|
Revision 1, 2.1 KB
(checked in by cristy, 7 months ago)
|
|
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | #define MAGICKCORE_IMPLEMENTATION 1 |
|---|
| 11 | #define MAGICK_PLUSPLUS_IMPLEMENTATION 1 |
|---|
| 12 | |
|---|
| 13 | #include "Magick++/ImageRef.h" |
|---|
| 14 | #include "Magick++/Exception.h" |
|---|
| 15 | #include "Magick++/Options.h" |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | Magick::ImageRef::ImageRef ( MagickCore::Image * image_ ) |
|---|
| 19 | : _image(image_), |
|---|
| 20 | _options(new Options), |
|---|
| 21 | _id(-1), |
|---|
| 22 | _refCount(1), |
|---|
| 23 | _mutexLock() |
|---|
| 24 | { |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | Magick::ImageRef::ImageRef ( MagickCore::Image * image_, |
|---|
| 30 | const Options * options_ ) |
|---|
| 31 | : _image(image_), |
|---|
| 32 | _options(0), |
|---|
| 33 | _id(-1), |
|---|
| 34 | _refCount(1), |
|---|
| 35 | _mutexLock() |
|---|
| 36 | { |
|---|
| 37 | _options = new Options( *options_ ); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | Magick::ImageRef::ImageRef ( void ) |
|---|
| 42 | : _image(0), |
|---|
| 43 | _options(new Options), |
|---|
| 44 | _id(-1), |
|---|
| 45 | _refCount(1), |
|---|
| 46 | _mutexLock() |
|---|
| 47 | { |
|---|
| 48 | |
|---|
| 49 | _image = AcquireImage( _options->imageInfo() ); |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | throwException(_image->exception); |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | Magick::ImageRef::~ImageRef( void ) |
|---|
| 57 | { |
|---|
| 58 | |
|---|
| 59 | if( _id > -1 ) |
|---|
| 60 | { |
|---|
| 61 | char id[MaxTextExtent]; |
|---|
| 62 | sprintf(id,"%ld",_id); |
|---|
| 63 | DeleteImageRegistry( id ); |
|---|
| 64 | _id=-1; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | if ( _image ) |
|---|
| 69 | { |
|---|
| 70 | DestroyImageList( _image ); |
|---|
| 71 | _image = 0; |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | delete _options; |
|---|
| 76 | _options = 0; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | void Magick::ImageRef::image ( MagickCore::Image * image_ ) |
|---|
| 81 | { |
|---|
| 82 | if(_image) |
|---|
| 83 | DestroyImageList( _image ); |
|---|
| 84 | _image = image_; |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | void Magick::ImageRef::options ( Magick::Options * options_ ) |
|---|
| 89 | { |
|---|
| 90 | delete _options; |
|---|
| 91 | _options = options_; |
|---|
| 92 | } |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | void Magick::ImageRef::id ( const long id_ ) |
|---|
| 96 | { |
|---|
| 97 | if( _id > -1 ) |
|---|
| 98 | { |
|---|
| 99 | char id[MaxTextExtent]; |
|---|
| 100 | sprintf(id,"%ld",_id); |
|---|
| 101 | DeleteImageRegistry( id ); |
|---|
| 102 | } |
|---|
| 103 | _id = id_; |
|---|
| 104 | } |
|---|