File: ImageRef.cpp

package info (click to toggle)
imagemagick 8%3A6.9.11.60%2Bdfsg-1.6%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 76,816 kB
  • sloc: ansic: 349,503; cpp: 21,804; xml: 11,029; perl: 6,417; sh: 5,877; makefile: 3,042; tcl: 459
file content (70 lines) | stat: -rw-r--r-- 1,456 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
// Copyright Dirk Lemstra 2015
//
// Implementation of ImageRef
//
// This is an internal implementation class.
//

#define MAGICKCORE_IMPLEMENTATION  1
#define MAGICK_PLUSPLUS_IMPLEMENTATION 1

#include "Magick++/ImageRef.h"
#include "Magick++/Exception.h"
#include "Magick++/Options.h"

Magick::ImageRef::ImageRef(void)
  : _image(0),
    _options(new Options),
    _refCount(1),
    _mutexLock()
{
  _image=AcquireImage(_options->imageInfo());
  throwException(&_image->exception);
}

Magick::ImageRef::ImageRef(MagickCore::Image *image_)
  : _image(image_),
    _options(new Options),
    _refCount(1),
    _mutexLock()
{
}

Magick::ImageRef::ImageRef(MagickCore::Image *image_,const Options *options_)
  : _image(image_),
    _options(0),
    _refCount(1),
    _mutexLock()
{
  _options=new Options(*options_);
}

Magick::ImageRef::~ImageRef(void)
{
  // Deallocate image
  if (_image != (MagickCore::Image*) NULL)
    {
      DestroyImageList(_image);
      _image=(MagickCore::Image*) NULL;
    }

  // Deallocate image options
  delete _options;
  _options=(Options *) NULL;
}

void Magick::ImageRef::image(MagickCore::Image * image_)
{
  if (_image != (MagickCore::Image*) NULL)
    DestroyImageList(_image);
  _image=image_;
}

void  Magick::ImageRef::options(Magick::Options *options_)
{
  delete _options;
  _options=options_;
}