Loading...
Searching...
No Matches
Magick::ImageRef Class Reference

## Public Member Functions

| ImageRef (MagickCore::Image *image_)
size_t | decrease ()
MagickCore::Image *& | image (void)
void | increase ()
bool | isShared ()
void | options (Options *options_)
Options * | options (void)
std::string | signature (const bool force_=false)

## Static Public Member Functions

static ImageRef * | replaceImage (ImageRef *imgRef, MagickCore::Image *replacement_)

## Private Member Functions

| ImageRef (MagickCore::Image *image_, const Options *options_)
| ImageRef (const ImageRef &)
ImageRef & | operator= (const ImageRef &)

## Private Attributes

MagickCore::Image * | _image
MutexLock | _mutexLock
Options * | _options
::ssize_t | _refCount

## Detailed Description

Definition at line 28 of file ImageRef.h.

## Constructor & Destructor Documentation

## ImageRef() [1/3]

Magick::ImageRef::ImageRef | ( | void |  | ) |

Definition at line 20 of file ImageRef.cpp.

: _image(0),
_mutexLock(),
_options(new Options),
_refCount(1)
{
GetPPException;
_image=AcquireImage(_options->imageInfo(),exceptionInfo);
ThrowPPException(false);
}

## ImageRef() [2/3]

Magick::ImageRef::ImageRef | ( | MagickCore::Image * | image_ | ) |

Definition at line 31 of file ImageRef.cpp.

: _image(image_),
_mutexLock(),
_options(new Options),
_refCount(1)
{
}

## ~ImageRef()

Magick::ImageRef::~ImageRef | ( | void |  | ) |

Definition at line 39 of file ImageRef.cpp.

{
// Deallocate image
if (_image != (MagickCore::Image*) NULL)
_image=DestroyImageList(_image);
// Deallocate image options
delete _options;
_options=(Options *) NULL;
}

## ImageRef() [3/3]

Magick::ImageRef::ImageRef | ( | MagickCore::Image * | image_,
|  | const Options * | options_
| ) |  |

private

Definition at line 150 of file ImageRef.cpp.

: _image(image_),
_mutexLock(),
_options(0),
_refCount(1)
{
_options=new Options(*options_);
}

## Member Function Documentation

## decrease()

size_t Magick::ImageRef::decrease | ( |  | ) |

Definition at line 50 of file ImageRef.cpp.

{
size_t
count;
_mutexLock.lock();
if (_refCount == 0)
{
_mutexLock.unlock();
throwExceptionExplicit(MagickCore::OptionError,
"Invalid call to decrease");
return(0);
}
count=(size_t) (--_refCount);
_mutexLock.unlock();
return(count);
}

## image()

MagickCore::Image *& Magick::ImageRef::image | ( | void |  | ) |

Definition at line 68 of file ImageRef.cpp.

{
return(_image);
}

## increase()

void Magick::ImageRef::increase | ( |  | ) |

Definition at line 73 of file ImageRef.cpp.

{
_mutexLock.lock();
_refCount++;
_mutexLock.unlock();
}

## isShared()

bool Magick::ImageRef::isShared | ( |  | ) |

Definition at line 80 of file ImageRef.cpp.

{
bool
isShared;
_mutexLock.lock();
isShared=(_refCount > 1);
_mutexLock.unlock();
return(isShared);
}

## options() [1/2]

void Magick::ImageRef::options | ( | Magick::Options * | options_ | ) |

Definition at line 91 of file ImageRef.cpp.

{
delete _options;
_options=options_;
}

## options() [2/2]

Magick::Options * Magick::ImageRef::options | ( | void |  | ) |

Definition at line 97 of file ImageRef.cpp.

{
return(_options);
}

## replaceImage()

Magick::ImageRef * Magick::ImageRef::replaceImage | ( | ImageRef * | imgRef,
|  | MagickCore::Image * | replacement_
| ) |  |

static

Definition at line 102 of file ImageRef.cpp.

{
Magick::ImageRef
*instance;
imgRef->_mutexLock.lock();
if (imgRef->_refCount == 1)
{
// We can replace the image if we own it.
instance=imgRef;
if (imgRef->_image != (MagickCore::Image*) NULL)
(void) DestroyImageList(imgRef->_image);
imgRef->_image=replacement_;
imgRef->_mutexLock.unlock();
}
else
{
// We don't own the image, create a new ImageRef instance.
instance=new ImageRef(replacement_,imgRef->_options);
imgRef->_refCount--;
imgRef->_mutexLock.unlock();
}
return(instance);
}
Magick::ImageRef
Definition ImageRef.h:29

## signature()

std::string Magick::ImageRef::signature | ( | const bool | force_ = `false` | ) |

Definition at line 128 of file ImageRef.cpp.

{
const char
*property;
// Re-calculate image signature if necessary
GetPPException;
_mutexLock.lock();
property=(const char *) NULL;
if (!force_ && (_image->taint == MagickFalse))
property=GetImageProperty(_image,"Signature",exceptionInfo);
if (property == (const char *) NULL)
{
(void) SignatureImage(_image,exceptionInfo);
property=GetImageProperty(_image,"Signature",exceptionInfo);
}
_mutexLock.unlock();
ThrowPPException(true);
return(std::string(property));
}

## Field Documentation

## _image

MagickCore::Image* Magick::ImageRef::_image

private

Definition at line 77 of file ImageRef.h.

## _mutexLock

MutexLock Magick::ImageRef::_mutexLock

private

Definition at line 78 of file ImageRef.h.

## _options

Options* Magick::ImageRef::_options

private

Definition at line 79 of file ImageRef.h.

## _refCount

::ssize_t Magick::ImageRef::_refCount

private

Definition at line 80 of file ImageRef.h.

The documentation for this class was generated from the following files:

- /build/imagemagick-icbe39/imagemagick-7.1.2.3+dfsg1/Magick++/lib/Magick++/ImageRef.h
- /build/imagemagick-icbe39/imagemagick-7.1.2.3+dfsg1/Magick++/lib/ImageRef.cpp