13#define MAGICKCORE_IMPLEMENTATION 1
14#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
16#include "Magick++/ImageRef.h"
17#include "Magick++/Exception.h"
18#include "Magick++/Options.h"
20Magick::ImageRef::ImageRef(
void)
23 _options(new Options),
27 _image=AcquireImage(_options->imageInfo(),exceptionInfo);
28 ThrowPPException(
false);
31Magick::ImageRef::ImageRef(MagickCore::Image *image_)
34 _options(new Options),
39Magick::ImageRef::~ImageRef(
void)
42 if (_image != (MagickCore::Image*) NULL)
43 _image=DestroyImageList(_image);
47 _options=(Options *) NULL;
50size_t Magick::ImageRef::decrease()
59 throwExceptionExplicit(MagickCore::OptionError,
60 "Invalid call to decrease");
63 count=(size_t) (--_refCount);
68MagickCore::Image *&Magick::ImageRef::image(
void)
73void Magick::ImageRef::increase()
80bool Magick::ImageRef::isShared()
86 isShared=(_refCount > 1);
103 MagickCore::Image *replacement_)
108 imgRef->_mutexLock.lock();
109 if (imgRef->_refCount == 1)
113 if (imgRef->_image != (MagickCore::Image*) NULL)
114 (void) DestroyImageList(imgRef->_image);
115 imgRef->_image=replacement_;
116 imgRef->_mutexLock.unlock();
121 instance=
new ImageRef(replacement_,imgRef->_options);
123 imgRef->_mutexLock.unlock();
128std::string Magick::ImageRef::signature(
const bool force_)
136 property=(
const char *) NULL;
137 if (!force_ && (_image->taint == MagickFalse))
138 property=GetImageProperty(_image,
"Signature",exceptionInfo);
139 if (property == (
const char *) NULL)
141 (void) SignatureImage(_image,exceptionInfo);
142 property=GetImageProperty(_image,
"Signature",exceptionInfo);
145 ThrowPPException(
true);
147 return(std::string(property));
150Magick::ImageRef::ImageRef(MagickCore::Image *image_,
const Options *options_)
156 _options=
new Options(*options_);