Magick++  6.9.3
ImageRef.cpp
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
4 // Copyright Dirk Lemstra 2015
5 //
6 // Implementation of ImageRef
7 //
8 // This is an internal implementation class.
9 //
10 
11 #define MAGICKCORE_IMPLEMENTATION 1
12 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
13 
14 #include "Magick++/ImageRef.h"
15 #include "Magick++/Exception.h"
16 #include "Magick++/Options.h"
17 
18 Magick::ImageRef::ImageRef(void)
19  : _image(0),
20  _options(new Options),
21  _refCount(1),
22  _mutexLock()
23 {
24  _image=AcquireImage(_options->imageInfo());
25  throwException(&_image->exception);
26 }
27 
28 Magick::ImageRef::ImageRef(MagickCore::Image *image_)
29  : _image(image_),
30  _options(new Options),
31  _refCount(1),
32  _mutexLock()
33 {
34 }
35 
36 Magick::ImageRef::ImageRef(MagickCore::Image *image_,const Options *options_)
37  : _image(image_),
38  _options(0),
39  _refCount(1),
40  _mutexLock()
41 {
42  _options=new Options(*options_);
43 }
44 
45 Magick::ImageRef::~ImageRef(void)
46 {
47  // Deallocate image
48  if (_image != (MagickCore::Image*) NULL)
49  {
50  DestroyImageList(_image);
51  _image=(MagickCore::Image*) NULL;
52  }
53 
54  // Deallocate image options
55  delete _options;
56  _options=(Options *) NULL;
57 }
58 
59 void Magick::ImageRef::image(MagickCore::Image * image_)
60 {
61  if (_image != (MagickCore::Image*) NULL)
62  DestroyImageList(_image);
63  _image=image_;
64 }
65 
66 void Magick::ImageRef::options(Magick::Options *options_)
67 {
68  delete _options;
69  _options=options_;
70 }
MagickPPExport void throwException(MagickCore::ExceptionInfo *exception_, const bool quiet_=false)
class MagickPPExport Image
Definition: Drawable.h:647