STL.cpp revision cf9e54702eac3e23864eec78b1f72fc0c41829e8
1d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// This may look like C code, but it is really -*- C++ -*-
2d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant//
3d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Copyright Bob Friesenhahn, 1999, 2002
4d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant//
5d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Implementation of STL classes and functions
6d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant//
7d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
8d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant#define MAGICKCORE_IMPLEMENTATION  1
9d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
10d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
11d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant#include <Magick++/Functions.h>
12d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant#include <Magick++/Image.h>
13d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant#include <Magick++/STL.h>
14d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
15d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Adaptive-blur image with specified blur factor
16d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::adaptiveBlurImage::adaptiveBlurImage( const double radius_,
17d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant      const double sigma_  )
18d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant      : _radius( radius_ ),
19d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _sigma( sigma_ )
20d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
214c2acbcfc928a7d4f18b2c9202288abdf0131219Marshall Clow}
224c2acbcfc928a7d4f18b2c9202288abdf0131219Marshall Clowvoid Magick::adaptiveBlurImage::operator()( Magick::Image &image_ ) const
23d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
24d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.adaptiveBlur( _radius, _sigma );
25d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
26d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
27d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Local adaptive threshold image
28d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::adaptiveThresholdImage::adaptiveThresholdImage( const size_t width_,
29d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                                        const size_t height_,
30d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                                        const ssize_t offset_ )
31d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant      : _width(width_),
32d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _height(height_),
33d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _offset(offset_)
34d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
35d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
36d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::adaptiveThresholdImage::operator()( Magick::Image &image_ ) const
37d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
38d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.adaptiveThreshold( _width, _height, _offset );
39d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
40d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
41d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Add noise to image with specified noise type
42d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::addNoiseImage::addNoiseImage( Magick::NoiseType noiseType_ )
43d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _noiseType( noiseType_ )
44d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
45d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
46d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::addNoiseImage::operator()( Magick::Image &image_ ) const
47d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
48d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.addNoise( _noiseType );
49d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
50d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
51d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Transform image by specified affine (or free transform) matrix.
524c2acbcfc928a7d4f18b2c9202288abdf0131219Marshall ClowMagick::affineTransformImage::affineTransformImage( const DrawableAffine &affine_  )
534c2acbcfc928a7d4f18b2c9202288abdf0131219Marshall Clow  : _affine( affine_ )
54d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
55d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
56d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::affineTransformImage::operator()( Magick::Image &image_ ) const
57d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
584c2acbcfc928a7d4f18b2c9202288abdf0131219Marshall Clow  image_.affineTransform( _affine );
59d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
6092827189cbb1e63dfebf0a46aac4372c3089ff11Howard Hinnant
614c2acbcfc928a7d4f18b2c9202288abdf0131219Marshall Clow// Annotate image (draw text on image)
6292827189cbb1e63dfebf0a46aac4372c3089ff11Howard Hinnant
63d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Annotate using specified text, and placement location
64d8cfd659b70bcf65a9c810ebe525632af38726f0Nick LewyckyMagick::annotateImage::annotateImage ( const std::string &text_,
65d8cfd659b70bcf65a9c810ebe525632af38726f0Nick Lewycky                                       const Magick::Geometry &geometry_ )
66d8cfd659b70bcf65a9c810ebe525632af38726f0Nick Lewycky      : _text( text_ ),
67d8cfd659b70bcf65a9c810ebe525632af38726f0Nick Lewycky	_geometry( geometry_ ),
68d8cfd659b70bcf65a9c810ebe525632af38726f0Nick Lewycky	_gravity( Magick::NorthWestGravity ),
69d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _degrees( 0 )
70d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
71d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
72d8cfd659b70bcf65a9c810ebe525632af38726f0Nick Lewycky// Annotate using specified text, bounding area, and placement gravity
73d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::annotateImage::annotateImage ( const std::string &text_,
74d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                       const Magick::Geometry &geometry_,
75d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                       const Magick::GravityType gravity_ )
76d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _text( text_ ),
77d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _geometry( geometry_ ),
78d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _gravity( gravity_ ),
79d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _degrees( 0 )
80d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
81d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
82d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Annotate with text using specified text, bounding area, placement
83d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// gravity, and rotation.
84d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::annotateImage::annotateImage ( const std::string &text_,
85d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                    const Magick::Geometry &geometry_,
86d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                    const Magick::GravityType gravity_,
87d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                    const double degrees_ )
88d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant      : _text( text_ ),
89d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _geometry( geometry_ ),
90d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _gravity( gravity_ ),
91d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _degrees( degrees_ )
92d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
93d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
94d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Annotate with text (bounding area is entire image) and placement
95d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// gravity.
96d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::annotateImage::annotateImage ( const std::string &text_,
97d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                       const Magick::GravityType gravity_ )
98d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _text( text_ ),
99d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _geometry( ),
100d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _gravity( gravity_ ),
101d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _degrees( 0 )
102d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
103d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
104d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::annotateImage::operator()( Magick::Image &image_ ) const
105d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
106d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.annotate( _text, _geometry, _gravity, _degrees );
107d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
108d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
109d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Blur image with specified blur factor
110d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::blurImage::blurImage( const double radius_, const double sigma_  )
111d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant      : _radius( radius_ ),
112d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _sigma( sigma_ )
113d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
114d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
115d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::blurImage::operator()( Magick::Image &image_ ) const
116d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
117d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.blur( _radius, _sigma );
118d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
119d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
120d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Border image (add border to image)
121d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::borderImage::borderImage( const Magick::Geometry &geometry_ )
122d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _geometry( geometry_ )
123d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
124d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
125d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::borderImage::operator()( Magick::Image &image_ ) const
126d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
127d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.border( _geometry );
128d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
129d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
130d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Extract channel from image
131d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::channelImage::channelImage( const Magick::ChannelType channel_ )
132d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _channel( channel_ )
133d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
134d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
135d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::channelImage::operator()( Magick::Image &image_ ) const
136d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
137d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.channel( _channel );
138d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
139d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
140d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Charcoal effect image (looks like charcoal sketch)
141d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::charcoalImage::charcoalImage( const double radius_, const double sigma_ )
142d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant      : _radius( radius_ ),
143d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant        _sigma( sigma_ )
144d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
145d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
146d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::charcoalImage::operator()( Magick::Image &image_ ) const
147d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
148d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.charcoal( _radius, _sigma );
149d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
150d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
151d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Chop image (remove vertical or horizontal subregion of image)
152d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::chopImage::chopImage( const Magick::Geometry &geometry_ )
153d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _geometry( geometry_ )
154d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
155d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
156d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::chopImage::operator()( Magick::Image &image_ ) const
157d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
158d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.chop( _geometry );
159d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
160d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
161d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// accepts a lightweight Color Correction Collection (CCC) file which solely
162d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// contains one or more color corrections and applies the correction to the
163d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// image.
164d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::cdlImage::cdlImage( const std::string &cdl_ )
165d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _cdl ( cdl_ )
166d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
167d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
168d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnantvoid Magick::cdlImage::operator()( Image &image_ ) const
169d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
170d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  image_.cdl( _cdl.c_str() );
171d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
172d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant
173d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant// Colorize image using pen color at specified percent alpha
174d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::colorizeImage::colorizeImage( const unsigned int alphaRed_,
175d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                      const unsigned int alphaGreen_,
176d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                      const unsigned int alphaBlue_,
177d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                      const Magick::Color &penColor_ )
178d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _alphaRed ( alphaRed_ ),
179d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _alphaGreen ( alphaGreen_ ),
180d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _alphaBlue ( alphaBlue_ ),
181d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _penColor( penColor_ )
182d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant{
183d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant}
184d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard HinnantMagick::colorizeImage::colorizeImage( const unsigned int alpha_,
185d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant                                      const Magick::Color &penColor_ )
186d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant  : _alphaRed ( alpha_ ),
187d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _alphaGreen ( alpha_ ),
188d213ffdf3befead3b8f5a0ba12ce1c2d9949525Howard Hinnant    _alphaBlue ( alpha_ ),
189    _penColor( penColor_ )
190{
191}
192void Magick::colorizeImage::operator()( Magick::Image &image_ ) const
193{
194  image_.colorize( _alphaRed, _alphaGreen, _alphaBlue, _penColor );
195}
196
197// Apply a color matrix to the image channels.  The user supplied
198// matrix may be of order 1 to 5 (1x1 through 5x5).
199Magick::colorMatrixImage::colorMatrixImage( const size_t order_,
200              const double *color_matrix_ )
201  : _order( order_ ),
202    _color_matrix( color_matrix_ )
203{
204}
205void Magick::colorMatrixImage::operator()( Image &image_ ) const
206{
207  image_.colorMatrix( _order, _color_matrix );
208}
209
210// Convert the image colorspace representation
211Magick::colorSpaceImage::colorSpaceImage( Magick::ColorspaceType colorSpace_ )
212  : _colorSpace( colorSpace_ )
213{
214}
215void Magick::colorSpaceImage::operator()( Magick::Image &image_ ) const
216{
217  image_.colorSpace( _colorSpace );
218}
219
220// Comment image (add comment string to image)
221Magick::commentImage::commentImage( const std::string &comment_ )
222  : _comment( comment_ )
223{
224}
225void Magick::commentImage::operator()( Magick::Image &image_ ) const
226{
227  image_.comment( _comment );
228}
229
230// Compose an image onto another at specified offset and using
231// specified algorithm
232Magick::compositeImage::compositeImage( const Magick::Image &compositeImage_,
233                                        ssize_t xOffset_,
234                                        ssize_t yOffset_,
235                                        Magick::CompositeOperator compose_  )
236  : _compositeImage( compositeImage_ ),
237    _xOffset ( xOffset_ ),
238    _yOffset ( yOffset_ ),
239    _compose ( compose_ )
240{
241}
242Magick::compositeImage::compositeImage( const Magick::Image &compositeImage_,
243                                        const Magick::Geometry &offset_,
244                                        Magick::CompositeOperator compose_  )
245  : _compositeImage( compositeImage_ ),
246    _xOffset ( offset_.xOff() ),
247    _yOffset ( offset_.yOff() ),
248    _compose ( compose_ )
249{
250}
251void Magick::compositeImage::operator()( Image &image_ ) const
252{
253  image_.composite( _compositeImage, _xOffset, _yOffset, _compose );
254}
255
256// Contrast image (enhance intensity differences in image)
257Magick::contrastImage::contrastImage( const size_t sharpen_ )
258  : _sharpen( sharpen_ )
259{
260}
261void Magick::contrastImage::operator()( Magick::Image &image_ ) const
262{
263  image_.contrast( _sharpen );
264}
265
266// Crop image (subregion of original image)
267Magick::cropImage::cropImage( const Magick::Geometry &geometry_ )
268  : _geometry( geometry_ )
269{
270}
271void Magick::cropImage::operator()( Magick::Image &image_ ) const
272{
273  image_.crop( _geometry );
274}
275
276// Cycle image colormap
277Magick::cycleColormapImage::cycleColormapImage( const ssize_t amount_ )
278  : _amount( amount_ )
279{
280}
281void Magick::cycleColormapImage::operator()( Magick::Image &image_ ) const
282{
283  image_.cycleColormap( _amount );
284}
285
286// Despeckle image (reduce speckle noise)
287Magick::despeckleImage::despeckleImage( void )
288{
289}
290void Magick::despeckleImage::operator()( Magick::Image &image_ ) const
291{
292  image_.despeckle( );
293}
294
295// Distort image.  distorts an image using various distortion methods, by
296// mapping color lookups of the source image to a new destination image
297// usally of the same size as the source image, unless 'bestfit' is set to
298// true.
299Magick::distortImage::distortImage( const Magick::DistortImageMethod method_,
300                                    const size_t number_arguments_,
301                                    const double *arguments_,
302                                    const bool bestfit_ )
303  : _method ( method_ ),
304    _number_arguments ( number_arguments_ ),
305    _arguments ( arguments_ ),
306    _bestfit( bestfit_ )
307{
308}
309Magick::distortImage::distortImage( const Magick::DistortImageMethod method_,
310                                    const size_t number_arguments_,
311                                    const double *arguments_ )
312  : _method ( method_ ),
313    _number_arguments ( number_arguments_ ),
314    _arguments ( arguments_ ),
315    _bestfit( false )
316{
317}
318void Magick::distortImage::operator()( Magick::Image &image_ ) const
319{
320  image_.distort( _method, _number_arguments, _arguments, _bestfit );
321}
322
323// Draw on image
324Magick::drawImage::drawImage( const Magick::Drawable &drawable_ )
325  : _drawableList()
326{
327  _drawableList.push_back( drawable_ );
328}
329Magick::drawImage::drawImage( const std::list<Magick::Drawable> &drawable_ )
330  : _drawableList( drawable_ )
331{
332}
333void Magick::drawImage::operator()( Magick::Image &image_ ) const
334{
335  image_.draw( _drawableList );
336}
337
338// Edge image (hilight edges in image)
339Magick::edgeImage::edgeImage( const double radius_ )
340  : _radius( radius_ )
341{
342}
343void Magick::edgeImage::operator()( Magick::Image &image_ ) const
344{
345  image_.edge( _radius );
346}
347
348// Emboss image (hilight edges with 3D effect)
349Magick::embossImage::embossImage( void )
350  : _radius( 1 ),
351    _sigma( 0.5 )
352{
353}
354Magick::embossImage::embossImage( const double radius_, const double sigma_ )
355  : _radius( radius_ ),
356    _sigma( sigma_ )
357{
358}
359void Magick::embossImage::operator()( Magick::Image &image_ ) const
360{
361  image_.emboss( _radius, _sigma );
362}
363
364// Enhance image (minimize noise)
365Magick::enhanceImage::enhanceImage( void )
366{
367}
368void Magick::enhanceImage::operator()( Magick::Image &image_ ) const
369{
370  image_.enhance( );
371}
372
373// Equalize image (histogram equalization)
374Magick::equalizeImage::equalizeImage( void )
375{
376}
377void Magick::equalizeImage::operator()( Magick::Image &image_ ) const
378{
379  image_.equalize( );
380}
381
382// Color to use when filling drawn objects
383Magick::fillColorImage::fillColorImage( const Magick::Color &fillColor_ )
384  : _fillColor( fillColor_ )
385{
386}
387void Magick::fillColorImage::operator()( Magick::Image &image_ ) const
388{
389  image_.fillColor( _fillColor );
390}
391
392// Flip image (reflect each scanline in the vertical direction)
393Magick::flipImage::flipImage( void )
394{
395}
396void Magick::flipImage::operator()( Magick::Image &image_ ) const
397{
398  image_.flip( );
399}
400
401Magick::floodFillAlphaImage::floodFillAlphaImage(const ssize_t x_,
402  const ssize_t y_,const unsigned int alpha_,const Color &target_,
403  const bool invert_)
404  : _target(target_),
405    _alpha(alpha_),
406    _x(x_),
407    _y(y_),
408    _invert(invert_)
409{
410}
411
412void Magick::floodFillAlphaImage::operator()(Magick::Image &image_) const
413{
414  image_.floodFillAlpha(_x,_y,_alpha,_target,_invert);
415}
416
417Magick::floodFillColorImage::floodFillColorImage(const ssize_t x_,
418  const ssize_t y_,const Magick::Color &fillColor_,const bool invert_)
419  : _x(x_),
420    _y(y_),
421    _fillColor(fillColor_),
422    _borderColor(),
423    _invert(invert_)
424{
425}
426
427Magick::floodFillColorImage::floodFillColorImage(
428  const Magick::Geometry &point_,const Magick::Color &fillColor_,
429  const bool invert_)
430  : _x(point_.xOff()),
431    _y(point_.yOff()),
432    _fillColor(fillColor_),
433    _borderColor(),
434    _invert(invert_)
435{
436}
437
438Magick::floodFillColorImage::floodFillColorImage(const ssize_t x_,
439  const ssize_t y_,const Magick::Color &fillColor_,
440  const Magick::Color &borderColor_,const bool invert_)
441  : _x(x_),
442    _y(y_),
443    _fillColor(fillColor_),
444    _borderColor(borderColor_),
445    _invert(invert_)
446{
447}
448
449Magick::floodFillColorImage::floodFillColorImage(const Geometry &point_,
450  const Color &fillColor_,const Color &borderColor_,const bool invert_)
451  : _x(point_.xOff()),
452    _y(point_.yOff()),
453    _fillColor(fillColor_),
454    _borderColor(borderColor_),
455    _invert(invert_)
456{
457}
458void Magick::floodFillColorImage::operator()(Magick::Image &image_) const
459{
460  if (_borderColor.isValid())
461    image_.floodFillColor(_x,_y,_fillColor,_borderColor,_invert);
462  else
463    image_.floodFillColor(_x,_y,_fillColor,_invert);
464}
465
466Magick::floodFillTextureImage::floodFillTextureImage(const ssize_t x_,
467  const ssize_t y_,const Magick::Image &texture_,const bool invert_)
468  : _x(x_),
469    _y(y_),
470    _texture(texture_),
471    _borderColor(),
472    _invert(invert_)
473{
474}
475
476Magick::floodFillTextureImage::floodFillTextureImage(
477  const Magick::Geometry &point_,const Magick::Image &texture_,
478  const bool invert_)
479  : _x(point_.xOff()),
480    _y(point_.yOff()),
481    _texture(texture_),
482    _borderColor(),
483    _invert(invert_)
484{
485}
486
487Magick::floodFillTextureImage::floodFillTextureImage(const ssize_t x_,
488  const ssize_t y_,const Magick::Image &texture_,
489  const Magick::Color &borderColor_,const bool invert_)
490  : _x(x_),
491    _y(y_),
492    _texture(texture_),
493    _borderColor(borderColor_),
494    _invert(invert_)
495{
496}
497
498Magick::floodFillTextureImage::floodFillTextureImage(
499  const Magick::Geometry &point_,const Magick::Image &texture_,
500  const Magick::Color &borderColor_,const bool invert_)
501  : _x(point_.xOff()),
502    _y(point_.yOff()),
503    _texture(texture_),
504    _borderColor(borderColor_),
505    _invert(invert_)
506{
507}
508
509void Magick::floodFillTextureImage::operator()(Magick::Image &image_) const
510{
511  if (_borderColor.isValid())
512    image_.floodFillTexture(_x,_y,_texture,_borderColor,_invert);
513  else
514    image_.floodFillTexture(_x,_y,_texture,_invert);
515}
516
517// Flop image (reflect each scanline in the horizontal direction)
518Magick::flopImage::flopImage( void )
519{
520}
521void Magick::flopImage::operator()( Magick::Image &image_ ) const
522{
523  image_.flop( );
524}
525
526// Frame image
527Magick::frameImage::frameImage( const Magick::Geometry &geometry_ )
528  : _width( geometry_.width() ),
529    _height( geometry_.height() ),
530    _outerBevel( geometry_.xOff() ),
531    _innerBevel( geometry_.yOff() )
532{
533}
534Magick::frameImage::frameImage( const size_t width_, const size_t height_,
535                                const ssize_t innerBevel_, const ssize_t outerBevel_ )
536  : _width( width_ ),
537    _height( height_ ),
538    _outerBevel( outerBevel_ ),
539    _innerBevel( innerBevel_ )
540{
541}
542void Magick::frameImage::operator()( Magick::Image &image_ ) const
543{
544  image_.frame( _width, _height, _innerBevel, _outerBevel );
545}
546
547// Gamma correct image
548Magick::gammaImage::gammaImage( const double gamma_ )
549  : _gammaRed( gamma_ ),
550    _gammaGreen( gamma_ ),
551    _gammaBlue( gamma_ )
552{
553}
554Magick::gammaImage::gammaImage ( const double gammaRed_,
555                                 const double gammaGreen_,
556                                 const double gammaBlue_ )
557  : _gammaRed( gammaRed_ ),
558    _gammaGreen( gammaGreen_ ),
559    _gammaBlue( gammaBlue_ )
560{
561}
562void Magick::gammaImage::operator()( Magick::Image &image_ ) const
563{
564  image_.gamma( _gammaRed, _gammaGreen, _gammaBlue );
565}
566
567// Gaussian blur image
568// The number of neighbor pixels to be included in the convolution
569// mask is specified by 'width_'. The standard deviation of the
570// gaussian bell curve is specified by 'sigma_'.
571Magick::gaussianBlurImage::gaussianBlurImage( const double width_,
572                                              const double sigma_ )
573  : _width( width_ ),
574    _sigma( sigma_ )
575{
576}
577void Magick::gaussianBlurImage::operator()( Magick::Image &image_ ) const
578{
579  image_.gaussianBlur( _width, _sigma );
580}
581
582// Apply a color lookup table (Hald CLUT) to the image.
583Magick::haldClutImage::haldClutImage( const Image &haldClutImage_ )
584  : _haldClutImage ( haldClutImage_ )
585{
586}
587void Magick::haldClutImage::operator()( Image &image_ ) const
588{
589  image_.haldClut( _haldClutImage );
590}
591
592// Implode image (special effect)
593Magick::implodeImage::implodeImage( const double factor_  )
594  : _factor( factor_ )
595{
596}
597void Magick::implodeImage::operator()( Magick::Image &image_ ) const
598{
599  image_.implode( _factor );
600}
601
602// Implements the inverse discrete Fourier transform (IFT) of the image
603// either as a magnitude / phase or real / imaginary image pair.
604Magick::inverseFourierTransformImage::inverseFourierTransformImage( const Magick::Image &phaseImage_ )
605  : _phaseImage( phaseImage_ )
606{
607}
608void Magick::inverseFourierTransformImage::operator()( Magick::Image &image_ ) const
609{
610  image_.inverseFourierTransform( _phaseImage );
611}
612
613// Set image validity. Valid images become empty (inValid) if argument
614// is false.
615Magick::isValidImage::isValidImage( const bool isValid_  )
616  : _isValid( isValid_ )
617{
618}
619void Magick::isValidImage::operator()( Magick::Image &image_ ) const
620{
621  image_.isValid( _isValid );
622}
623
624// Label image
625Magick::labelImage::labelImage( const std::string &label_ )
626  : _label( label_ )
627{
628}
629void Magick::labelImage::operator()( Magick::Image &image_ ) const
630{
631  image_.label( _label );
632}
633
634// Level image
635Magick::levelImage::levelImage( const double black_point,
636                                const double white_point,
637                                const double mid_point )
638  : _black_point(black_point),
639    _white_point(white_point),
640    _mid_point(mid_point)
641{
642}
643void Magick::levelImage::operator()( Magick::Image &image_ ) const
644{
645  image_.level( _black_point, _white_point, _mid_point );
646}
647
648// Magnify image by integral size
649Magick::magnifyImage::magnifyImage( void )
650{
651}
652void Magick::magnifyImage::operator()( Magick::Image &image_ ) const
653{
654  image_.magnify( );
655}
656
657// Remap image colors with closest color from reference image
658Magick::mapImage::mapImage( const Magick::Image &mapImage_ ,
659                            const bool dither_ )
660  : _mapImage( mapImage_ ),
661    _dither( dither_ )
662{
663}
664void Magick::mapImage::operator()( Magick::Image &image_ ) const
665{
666  image_.map( _mapImage, _dither );
667}
668
669// Filter image by replacing each pixel component with the median
670// color in a circular neighborhood
671Magick::medianConvolveImage::medianConvolveImage( const double radius_  )
672  : _radius( radius_ )
673{
674}
675void Magick::medianConvolveImage::operator()( Magick::Image &image_ ) const
676{
677  image_.medianFilter( _radius );
678}
679
680// Reduce image by integral size
681Magick::minifyImage::minifyImage( void )
682{
683}
684void Magick::minifyImage::operator()( Magick::Image &image_ ) const
685{
686  image_.minify( );
687}
688
689// Modulate percent hue, saturation, and brightness of an image
690Magick::modulateImage::modulateImage( const double brightness_,
691                                      const double saturation_,
692                                      const double hue_ )
693  : _brightness( brightness_ ),
694    _saturation( saturation_ ),
695    _hue( hue_ )
696{
697}
698void Magick::modulateImage::operator()( Magick::Image &image_ ) const
699{
700  image_.modulate( _brightness, _saturation, _hue );
701}
702
703// Negate colors in image.  Set grayscale to only negate grayscale
704// values in image.
705Magick::negateImage::negateImage( const bool grayscale_  )
706  : _grayscale( grayscale_ )
707{
708}
709void Magick::negateImage::operator()( Magick::Image &image_ ) const
710{
711  image_.negate( _grayscale );
712}
713
714// Normalize image (increase contrast by normalizing the pixel values
715// to span the full range of color values)
716Magick::normalizeImage::normalizeImage( void )
717{
718}
719void Magick::normalizeImage::operator()( Magick::Image &image_ ) const
720{
721  image_.normalize( );
722}
723
724// Oilpaint image (image looks like oil painting)
725Magick::oilPaintImage::oilPaintImage( const double radius_ )
726  : _radius( radius_ )
727{
728}
729void Magick::oilPaintImage::operator()( Magick::Image &image_ ) const
730{
731  image_.oilPaint( _radius );
732}
733
734// Set or attenuate the image alpha channel. If the image pixels are
735// opaque then they are set to the specified alpha value, otherwise
736// they are blended with the supplied alpha value.  The value of
737// alpha_ ranges from 0 (completely opaque) to QuantumRange. The defines
738// OpaqueAlpha and TransparentAlpha are available to specify
739// completely opaque or completely transparent, respectively.
740Magick::alphaImage::alphaImage( const unsigned int alpha_ )
741  : _alpha( alpha_ )
742{
743}
744void Magick::alphaImage::operator()( Magick::Image &image_ ) const
745{
746  image_.alpha( _alpha );
747}
748
749// Change color of opaque pixel to specified pen color.
750Magick::opaqueImage::opaqueImage( const Magick::Color &opaqueColor_,
751                                  const Magick::Color &penColor_ )
752  : _opaqueColor( opaqueColor_ ),
753    _penColor( penColor_ )
754{
755}
756void Magick::opaqueImage::operator()( Magick::Image &image_ ) const
757{
758  image_.opaque( _opaqueColor, _penColor );
759}
760
761// Quantize image (reduce number of colors)
762Magick::quantizeImage::quantizeImage( const bool measureError_  )
763  : _measureError( measureError_ )
764{
765}
766void Magick::quantizeImage::operator()( Image &image_ ) const
767{
768  image_.quantize( _measureError );
769}
770
771// Raise image (lighten or darken the edges of an image to give a 3-D
772// raised or lowered effect)
773Magick::raiseImage::raiseImage( const Magick::Geometry &geometry_ ,
774                                const bool raisedFlag_  )
775  : _geometry( geometry_ ),
776    _raisedFlag( raisedFlag_ )
777{
778}
779void Magick::raiseImage::operator()( Magick::Image &image_ ) const
780{
781  image_.raise( _geometry, _raisedFlag );
782}
783
784Magick::ReadOptions::ReadOptions(void)
785  : _imageInfo(static_cast<ImageInfo*>(AcquireMagickMemory(
786      sizeof(ImageInfo))))
787{
788  GetImageInfo(_imageInfo);
789}
790
791Magick::ReadOptions::ReadOptions(const Magick::ReadOptions& options_)
792  : _imageInfo(CloneImageInfo(options_._imageInfo))
793{
794}
795
796Magick::ReadOptions::~ReadOptions()
797{
798  _imageInfo=DestroyImageInfo(_imageInfo);
799}
800
801void Magick::ReadOptions::density(const Magick::Geometry &density_)
802{
803  if (!density_.isValid())
804    _imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density);
805  else
806    Magick::CloneString(&_imageInfo->density,density_);
807}
808
809Magick::Geometry Magick::ReadOptions::density(void) const
810{
811  if (_imageInfo->density)
812    return(Geometry(_imageInfo->density));
813
814  return(Geometry());
815}
816
817void Magick::ReadOptions::depth(size_t depth_)
818{
819  _imageInfo->depth=depth_;
820}
821
822size_t Magick::ReadOptions::depth(void) const
823{
824  return(_imageInfo->depth);
825}
826
827void Magick::ReadOptions::size(const Geometry &geometry_)
828{
829  _imageInfo->size=(char *) RelinquishMagickMemory(_imageInfo->size);
830
831  if ( geometry_.isValid() )
832    Magick::CloneString(&_imageInfo->size,geometry_);
833}
834
835Magick::Geometry Magick::ReadOptions::size(void) const
836{
837  if (_imageInfo->size)
838    return(Geometry(_imageInfo->size));
839
840  return(Geometry());
841}
842
843MagickCore::ImageInfo *Magick::ReadOptions::imageInfo(void)
844{
845  return(_imageInfo);
846}
847
848// Reduce noise in image using a noise peak elimination filter
849Magick::reduceNoiseImage::reduceNoiseImage( void )
850  : _order(3)
851{
852}
853Magick::reduceNoiseImage::reduceNoiseImage ( const size_t order_ )
854      : _order(order_)
855{
856}
857void Magick::reduceNoiseImage::operator()( Image &image_ ) const
858{
859  image_.reduceNoise( _order );
860}
861
862// Roll image (rolls image vertically and horizontally) by specified
863// number of columnms and rows)
864Magick::rollImage::rollImage( const Magick::Geometry &roll_ )
865  : _columns( roll_.width() ),
866    _rows( roll_.height() )
867{
868}
869Magick::rollImage::rollImage( const ssize_t columns_,
870                              const ssize_t rows_ )
871  : _columns( columns_ ),
872    _rows( rows_ )
873{
874}
875void Magick::rollImage::operator()( Magick::Image &image_ ) const
876{
877  image_.roll( _columns, _rows );
878}
879
880// Rotate image counter-clockwise by specified number of degrees.
881Magick::rotateImage::rotateImage( const double degrees_ )
882  : _degrees( degrees_ )
883{
884}
885void Magick::rotateImage::operator()( Magick::Image &image_ ) const
886{
887  image_.rotate( _degrees );
888}
889
890// Resize image by using pixel sampling algorithm
891Magick::sampleImage::sampleImage( const Magick::Geometry &geometry_ )
892  : _geometry( geometry_ )
893{
894}
895void Magick::sampleImage::operator()( Magick::Image &image_ ) const
896{
897  image_.sample( _geometry );
898}
899
900// Resize image by using simple ratio algorithm
901Magick::scaleImage::scaleImage( const Magick::Geometry &geometry_ )
902  : _geometry( geometry_ )
903{
904}
905void Magick::scaleImage::operator()( Magick::Image &image_ ) const
906{
907  image_.scale( _geometry );
908}
909
910// Segment (coalesce similar image components) by analyzing the
911// histograms of the color components and identifying units that are
912// homogeneous with the fuzzy c-means technique.  Also uses
913// QuantizeColorSpace and Verbose image attributes
914Magick::segmentImage::segmentImage( const double clusterThreshold_ ,
915                                    const double smoothingThreshold_ )
916  : _clusterThreshold( clusterThreshold_ ),
917    _smoothingThreshold( smoothingThreshold_ )
918{
919}
920void Magick::segmentImage::operator()( Magick::Image &image_ ) const
921{
922  image_.segment( _clusterThreshold, _smoothingThreshold );
923}
924
925// Shade image using distant light source
926Magick::shadeImage::shadeImage( const double azimuth_,
927                                const double elevation_,
928        const bool colorShading_)
929  : _azimuth( azimuth_ ),
930    _elevation( elevation_ ),
931    _colorShading (colorShading_)
932{
933}
934void Magick::shadeImage::operator()( Magick::Image &image_ ) const
935{
936  image_.shade( _azimuth, _elevation, _colorShading );
937}
938
939// Simulate an image shadow
940Magick::shadowImage::shadowImage( const double percent_opacity_,
941                                const double sigma_,
942        const ssize_t x_, const ssize_t y_ )
943  : _percent_opacity( percent_opacity_ ),
944    _sigma( sigma_ ),
945    _x ( x_ ),
946    _y ( y_ )
947{
948}
949void Magick::shadowImage::operator()( Magick::Image &image_ ) const
950{
951  image_.shadow( _percent_opacity, _sigma, _x, _y );
952}
953
954// Sharpen pixels in image
955Magick::sharpenImage::sharpenImage( const double radius_, const double sigma_ )
956  : _radius( radius_ ),
957    _sigma( sigma_ )
958{
959}
960void Magick::sharpenImage::operator()( Magick::Image &image_ ) const
961{
962  image_.sharpen( _radius, _sigma );
963}
964
965// Shave pixels from image edges.
966Magick::shaveImage::shaveImage( const Magick::Geometry &geometry_ )
967  : _geometry( geometry_ )
968{
969}
970void Magick::shaveImage::operator()( Magick::Image &image_ ) const
971{
972  image_.shave( _geometry );
973}
974
975// Shear image (create parallelogram by sliding image by X or Y axis)
976Magick::shearImage::shearImage( const double xShearAngle_,
977                                const double yShearAngle_ )
978  : _xShearAngle( xShearAngle_ ),
979    _yShearAngle( yShearAngle_ )
980{
981}
982void Magick::shearImage::operator()( Magick::Image &image_ ) const
983{
984  image_.shear( _xShearAngle, _yShearAngle );
985}
986
987// Solarize image (similar to effect seen when exposing a photographic
988// film to light during the development process)
989Magick::solarizeImage::solarizeImage( const double factor_ )
990  : _factor( factor_ )
991{
992}
993void Magick::solarizeImage::operator()( Magick::Image &image_ ) const
994{
995  image_.solarize( _factor );
996}
997
998// Spread pixels randomly within image by specified ammount
999Magick::spreadImage::spreadImage( const size_t amount_ )
1000  : _amount( amount_ )
1001{
1002}
1003void Magick::spreadImage::operator()( Magick::Image &image_ ) const
1004{
1005  image_.spread( _amount );
1006}
1007
1008// Add a digital watermark to the image (based on second image)
1009Magick::steganoImage::steganoImage( const Magick::Image &waterMark_ )
1010  : _waterMark( waterMark_ )
1011{
1012}
1013void Magick::steganoImage::operator()( Magick::Image &image_ ) const
1014{
1015  image_.stegano( _waterMark );
1016}
1017
1018// Create an image which appears in stereo when viewed with red-blue
1019// glasses (Red image on left, blue on right)
1020Magick::stereoImage::stereoImage( const Magick::Image &rightImage_ )
1021  : _rightImage( rightImage_ )
1022{
1023}
1024void Magick::stereoImage::operator()( Magick::Image &image_ ) const
1025{
1026  image_.stereo( _rightImage );
1027}
1028
1029// Color to use when drawing object outlines
1030Magick::strokeColorImage::strokeColorImage( const Magick::Color &strokeColor_ )
1031  : _strokeColor( strokeColor_ )
1032{
1033}
1034void Magick::strokeColorImage::operator()( Magick::Image &image_ ) const
1035{
1036  image_.strokeColor( _strokeColor );
1037}
1038
1039// Swirl image (image pixels are rotated by degrees)
1040Magick::swirlImage::swirlImage( const double degrees_ )
1041  : _degrees( degrees_ )
1042{
1043}
1044void Magick::swirlImage::operator()( Magick::Image &image_ ) const
1045{
1046  image_.swirl( _degrees );
1047}
1048
1049// Channel a texture on image background
1050Magick::textureImage::textureImage( const Magick::Image &texture_ )
1051  : _texture( texture_ )
1052{
1053}
1054void Magick::textureImage::operator()( Magick::Image &image_ ) const
1055{
1056  image_.texture( _texture );
1057}
1058
1059// Threshold image
1060Magick::thresholdImage::thresholdImage( const double threshold_ )
1061  : _threshold( threshold_ )
1062{
1063}
1064void Magick::thresholdImage::operator()( Magick::Image &image_ ) const
1065{
1066  image_.threshold( _threshold );
1067}
1068
1069// Transform image based on image and crop geometries
1070Magick::transformImage::transformImage( const Magick::Geometry &imageGeometry_ )
1071  : _imageGeometry( imageGeometry_ ),
1072    _cropGeometry( )
1073{
1074}
1075Magick::transformImage::transformImage( const Magick::Geometry &imageGeometry_,
1076                                        const Geometry &cropGeometry_  )
1077  : _imageGeometry( imageGeometry_ ),
1078    _cropGeometry( cropGeometry_ )
1079{
1080}
1081void Magick::transformImage::operator()( Magick::Image &image_ ) const
1082{
1083  if ( _cropGeometry.isValid() )
1084    image_.transform( _imageGeometry, _cropGeometry );
1085  else
1086    image_.transform( _imageGeometry );
1087}
1088
1089// Set image color to transparent
1090Magick::transparentImage::transparentImage( const Magick::Color& color_ )
1091  : _color( color_ )
1092{
1093}
1094void Magick::transparentImage::operator()( Magick::Image &image_ ) const
1095{
1096  image_.transparent( _color );
1097}
1098
1099// Trim edges that are the background color from the image
1100Magick::trimImage::trimImage( void )
1101{
1102}
1103void Magick::trimImage::operator()( Magick::Image &image_ ) const
1104{
1105  image_.trim( );
1106}
1107
1108// Map image pixels to a sine wave
1109Magick::waveImage::waveImage( const double amplitude_,
1110                              const double wavelength_ )
1111  : _amplitude( amplitude_ ),
1112    _wavelength( wavelength_ )
1113{
1114}
1115void Magick::waveImage::operator()( Magick::Image &image_ ) const
1116{
1117  image_.wave( _amplitude, _wavelength );
1118}
1119
1120// resize image to specified size.
1121Magick::resizeImage::resizeImage( const Magick::Geometry &geometry_ )
1122  : _geometry( geometry_ )
1123{
1124}
1125void Magick::resizeImage::operator()( Magick::Image &image_ ) const
1126{
1127  image_.resize( _geometry );
1128}
1129
1130// Zoom image to specified size.
1131Magick::zoomImage::zoomImage( const Magick::Geometry &geometry_ )
1132  : _geometry( geometry_ )
1133{
1134}
1135void Magick::zoomImage::operator()( Magick::Image &image_ ) const
1136{
1137  image_.zoom( _geometry );
1138}
1139
1140//
1141// Function object image attribute accessors
1142//
1143
1144// Anti-alias Postscript and TrueType fonts (default true)
1145Magick::antiAliasImage::antiAliasImage( const bool flag_ )
1146  : _flag( flag_ )
1147{
1148}
1149void Magick::antiAliasImage::operator()( Magick::Image &image_ ) const
1150{
1151  image_.antiAlias( _flag );
1152}
1153
1154// Join images into a single multi-image file
1155Magick::adjoinImage::adjoinImage( const bool flag_ )
1156  : _flag( flag_ )
1157{
1158}
1159void Magick::adjoinImage::operator()( Magick::Image &image_ ) const
1160{
1161  image_.adjoin( _flag );
1162}
1163
1164// Time in 1/100ths of a second which must expire before displaying
1165// the next image in an animated sequence.
1166Magick::animationDelayImage::animationDelayImage( const size_t delay_ )
1167  : _delay( delay_ )
1168{
1169}
1170void Magick::animationDelayImage::operator()( Magick::Image &image_ ) const
1171{
1172  image_.animationDelay( _delay );
1173}
1174
1175// Number of iterations to loop an animation (e.g. Netscape loop
1176// extension) for.
1177Magick::animationIterationsImage::animationIterationsImage( const size_t iterations_ )
1178  : _iterations( iterations_ )
1179{
1180}
1181void Magick::animationIterationsImage::operator()( Magick::Image &image_ ) const
1182{
1183  image_.animationIterations( _iterations );
1184}
1185
1186// Image background color
1187Magick::backgroundColorImage::backgroundColorImage( const Magick::Color &color_ )
1188  : _color( color_ )
1189{
1190}
1191void Magick::backgroundColorImage::operator()( Magick::Image &image_ ) const
1192{
1193  image_.backgroundColor( _color );
1194}
1195
1196// Name of texture image to tile onto the image background
1197Magick::backgroundTextureImage::backgroundTextureImage( const std::string &backgroundTexture_ )
1198  : _backgroundTexture( backgroundTexture_ )
1199{
1200}
1201void Magick::backgroundTextureImage::operator()( Magick::Image &image_ ) const
1202{
1203  image_.backgroundTexture( _backgroundTexture );
1204}
1205
1206// Image border color
1207Magick::borderColorImage::borderColorImage( const Magick::Color &color_ )
1208  : _color( color_ )
1209{
1210}
1211void Magick::borderColorImage::operator()( Magick::Image &image_ ) const
1212{
1213  image_.borderColor( _color );
1214}
1215
1216// Text bounding-box base color (default none)
1217Magick::boxColorImage::boxColorImage( const Magick::Color &boxColor_ )
1218  : _boxColor( boxColor_ ) { }
1219
1220void Magick::boxColorImage::operator()( Magick::Image &image_ ) const
1221{
1222  image_.boxColor( _boxColor );
1223}
1224
1225// Chromaticity blue primary point (e.g. x=0.15, y=0.06)
1226Magick::chromaBluePrimaryImage::chromaBluePrimaryImage( const double x_,
1227                                                        const double y_ )
1228  : _x( x_ ),
1229    _y( y_ )
1230{
1231}
1232void Magick::chromaBluePrimaryImage::operator()( Magick::Image &image_ ) const
1233{
1234  image_.chromaBluePrimary( _x, _y );
1235}
1236
1237// Chromaticity green primary point (e.g. x=0.3, y=0.6)
1238Magick::chromaGreenPrimaryImage::chromaGreenPrimaryImage( const double x_,
1239                                                          const double y_ )
1240  : _x( x_ ),
1241    _y( y_ )
1242{
1243}
1244void Magick::chromaGreenPrimaryImage::operator()( Magick::Image &image_ ) const
1245{
1246  image_.chromaGreenPrimary( _x, _y );
1247}
1248
1249// Chromaticity red primary point (e.g. x=0.64, y=0.33)
1250Magick::chromaRedPrimaryImage::chromaRedPrimaryImage( const double x_,
1251                                                      const double y_ )
1252  : _x( x_ ),
1253    _y( y_ )
1254{
1255}
1256void Magick::chromaRedPrimaryImage::operator()( Magick::Image &image_ ) const
1257{
1258  image_.chromaRedPrimary( _x, _y );
1259}
1260
1261// Chromaticity white point (e.g. x=0.3127, y=0.329)
1262Magick::chromaWhitePointImage::chromaWhitePointImage( const double x_,
1263                                                      const double y_ )
1264  : _x( x_ ),
1265    _y( y_ )
1266{
1267}
1268void Magick::chromaWhitePointImage::operator()( Magick::Image &image_ ) const
1269{
1270  image_.chromaWhitePoint( _x, _y );
1271}
1272
1273// Colors within this distance are considered equal
1274Magick::colorFuzzImage::colorFuzzImage( const double fuzz_ )
1275  : _fuzz( fuzz_ )
1276{
1277}
1278void Magick::colorFuzzImage::operator()( Magick::Image &image_ ) const
1279{
1280  image_.colorFuzz( _fuzz );
1281}
1282
1283// Color at colormap position index_
1284Magick::colorMapImage::colorMapImage( const size_t index_,
1285                                      const Color &color_ )
1286  : _index( index_ ),
1287    _color( color_ )
1288{
1289}
1290void Magick::colorMapImage::operator()( Magick::Image &image_ ) const
1291{
1292  image_.colorMap( _index, _color );
1293}
1294
1295// Composition operator to be used when composition is implicitly used
1296// (such as for image flattening).
1297Magick::composeImage::composeImage( const CompositeOperator compose_ )
1298  : _compose( compose_ )
1299{
1300}
1301void Magick::composeImage::operator()( Magick::Image &image_ ) const
1302{
1303  image_.compose( _compose );
1304}
1305
1306// Compression type
1307Magick::compressTypeImage::compressTypeImage( const CompressionType compressType_ )
1308  : _compressType( compressType_ )
1309{
1310}
1311void Magick::compressTypeImage::operator()( Magick::Image &image_ ) const
1312{
1313  image_.compressType( _compressType );
1314}
1315
1316// Vertical and horizontal resolution in pixels of the image
1317Magick::densityImage::densityImage( const Geometry &geomery_ )
1318  : _geomery( geomery_ )
1319{
1320}
1321void Magick::densityImage::operator()( Magick::Image &image_ ) const
1322{
1323  image_.density( _geomery );
1324}
1325
1326// Image depth (bits allocated to red/green/blue components)
1327Magick::depthImage::depthImage( const size_t depth_ )
1328  : _depth( depth_ )
1329{
1330}
1331void Magick::depthImage::operator()( Magick::Image &image_ ) const
1332{
1333  image_.depth( _depth );
1334}
1335
1336// Endianness (LSBEndian like Intel or MSBEndian like SPARC) for image
1337// formats which support endian-specific options.
1338Magick::endianImage::endianImage( const Magick::EndianType endian_ )
1339  : _endian( endian_ )
1340{
1341}
1342void Magick::endianImage::operator()( Magick::Image &image_ ) const
1343{
1344  image_.endian( _endian );
1345}
1346
1347// Image file name
1348Magick::fileNameImage::fileNameImage( const std::string &fileName_ )
1349  : _fileName( fileName_ )
1350{
1351}
1352void Magick::fileNameImage::operator()( Magick::Image &image_ ) const
1353{
1354  image_.fileName( _fileName );
1355}
1356
1357// Filter to use when resizing image
1358Magick::filterTypeImage::filterTypeImage( const FilterTypes filterType_ )
1359  : _filterType( filterType_ )
1360{
1361}
1362void Magick::filterTypeImage::operator()( Magick::Image &image_ ) const
1363{
1364  image_.filterType( _filterType );
1365}
1366
1367// Text rendering font
1368Magick::fontImage::fontImage( const std::string &font_ )
1369  : _font( font_ )
1370{
1371}
1372void Magick::fontImage::operator()( Magick::Image &image_ ) const
1373{
1374  image_.font( _font );
1375}
1376
1377// Font point size
1378Magick::fontPointsizeImage::fontPointsizeImage( const size_t pointsize_ )
1379  : _pointsize( pointsize_ )
1380{
1381}
1382void Magick::fontPointsizeImage::operator()( Magick::Image &image_ ) const
1383{
1384  image_.fontPointsize( _pointsize );
1385}
1386
1387// GIF disposal method
1388Magick::gifDisposeMethodImage::gifDisposeMethodImage( const DisposeType disposeMethod_ )
1389  : _disposeMethod( disposeMethod_ )
1390{
1391}
1392void Magick::gifDisposeMethodImage::operator()( Magick::Image &image_ ) const
1393{
1394  image_.gifDisposeMethod( _disposeMethod );
1395}
1396
1397// Type of interlacing to use
1398Magick::interlaceTypeImage::interlaceTypeImage( const InterlaceType interlace_ )
1399  : _interlace( interlace_ )
1400{
1401}
1402void Magick::interlaceTypeImage::operator()( Magick::Image &image_ ) const
1403{
1404  image_.interlaceType( _interlace );
1405}
1406
1407// File type magick identifier (.e.g "GIF")
1408Magick::magickImage::magickImage( const std::string &magick_ )
1409  : _magick( magick_ )
1410{
1411}
1412void Magick::magickImage::operator()( Magick::Image &image_ ) const
1413{
1414  image_.magick( _magick );
1415}
1416
1417// Image supports transparent color
1418Magick::alphaFlagImage::alphaFlagImage( const bool alphaFlag_ )
1419  : _alphaFlag( alphaFlag_ )
1420{
1421}
1422void Magick::alphaFlagImage::operator()( Magick::Image &image_ ) const
1423{
1424  image_.alpha( _alphaFlag );
1425}
1426
1427// Transparent color
1428Magick::alphaColorImage::alphaColorImage( const Color &alphaColor_ )
1429  : _alphaColor( alphaColor_ )
1430{
1431}
1432void Magick::alphaColorImage::operator()( Magick::Image &image_ ) const
1433{
1434  image_.alphaColor( _alphaColor );
1435}
1436
1437// Indicate that image is black and white
1438Magick::monochromeImage::monochromeImage( const bool monochromeFlag_ )
1439  : _monochromeFlag( monochromeFlag_ )
1440{
1441}
1442void Magick::monochromeImage::operator()( Magick::Image &image_ ) const
1443{
1444  image_.monochrome( _monochromeFlag );
1445}
1446
1447// Set pixel color at location x & y.
1448Magick::pixelColorImage::pixelColorImage( const ssize_t x_,
1449                                          const ssize_t y_,
1450                                          const Color &color_)
1451  : _x( x_ ),
1452    _y( y_ ),
1453    _color( color_ ) { }
1454
1455void Magick::pixelColorImage::operator()( Magick::Image &image_ ) const
1456{
1457  image_.pixelColor( _x, _y, _color );
1458}
1459
1460// Postscript page size.
1461Magick::pageImage::pageImage( const Geometry &pageSize_ )
1462  : _pageSize( pageSize_ )
1463{
1464}
1465void Magick::pageImage::operator()( Magick::Image &image_ ) const
1466{
1467  image_.page( _pageSize );
1468}
1469
1470// JPEG/MIFF/PNG compression level (default 75).
1471Magick::qualityImage::qualityImage( const size_t quality_ )
1472  : _quality( quality_ )
1473{
1474}
1475void Magick::qualityImage::operator()( Magick::Image &image_ ) const
1476{
1477  image_.quality( _quality );
1478}
1479
1480// Maximum number of colors to quantize to
1481Magick::quantizeColorsImage::quantizeColorsImage( const size_t colors_ )
1482  : _colors( colors_ )
1483{
1484}
1485void Magick::quantizeColorsImage::operator()( Magick::Image &image_ ) const
1486{
1487  image_.quantizeColors( _colors );
1488}
1489
1490// Colorspace to quantize in.
1491Magick::quantizeColorSpaceImage::quantizeColorSpaceImage( const ColorspaceType colorSpace_ )
1492  : _colorSpace( colorSpace_ )
1493{
1494}
1495void Magick::quantizeColorSpaceImage::operator()( Magick::Image &image_ ) const
1496{
1497  image_.quantizeColorSpace( _colorSpace );
1498}
1499
1500// Dither image during quantization (default true).
1501Magick::quantizeDitherImage::quantizeDitherImage( const bool ditherFlag_ )
1502  : _ditherFlag( ditherFlag_ )
1503{
1504}
1505void Magick::quantizeDitherImage::operator()( Magick::Image &image_ ) const
1506{
1507  image_.quantizeDither( _ditherFlag );
1508}
1509
1510// Quantization tree-depth
1511Magick::quantizeTreeDepthImage::quantizeTreeDepthImage( const size_t treeDepth_ )
1512  : _treeDepth( treeDepth_ ) { }
1513
1514void Magick::quantizeTreeDepthImage::operator()( Magick::Image &image_ ) const
1515{
1516  image_.quantizeTreeDepth( _treeDepth );
1517}
1518
1519// The type of rendering intent
1520Magick::renderingIntentImage::renderingIntentImage( const Magick::RenderingIntent renderingIntent_ )
1521  : _renderingIntent( renderingIntent_ )
1522{
1523}
1524void Magick::renderingIntentImage::operator()( Magick::Image &image_ ) const
1525{
1526  image_.renderingIntent( _renderingIntent );
1527}
1528
1529// Units of image resolution
1530Magick::resolutionUnitsImage::resolutionUnitsImage( const Magick::ResolutionType resolutionUnits_ )
1531  : _resolutionUnits( resolutionUnits_ )
1532{
1533}
1534void Magick::resolutionUnitsImage::operator()( Magick::Image &image_ ) const
1535{
1536  image_.resolutionUnits( _resolutionUnits );
1537}
1538
1539// Image scene number
1540Magick::sceneImage::sceneImage( const size_t scene_ )
1541  : _scene( scene_ )
1542{
1543}
1544void Magick::sceneImage::operator()( Magick::Image &image_ ) const
1545{
1546  image_.scene( _scene );
1547}
1548
1549// Width and height of a raw image
1550Magick::sizeImage::sizeImage( const Magick::Geometry &geometry_ )
1551  : _geometry( geometry_ )
1552{
1553}
1554void Magick::sizeImage::operator()( Magick::Image &image_ ) const
1555{
1556  image_.size( _geometry );
1557}
1558
1559// Splice the background color into the image.
1560Magick::spliceImage::spliceImage( const Magick::Geometry &geometry_ )
1561  : _geometry( geometry_ )
1562{
1563}
1564void Magick::spliceImage::operator()( Magick::Image &image_ ) const
1565{
1566  image_.splice( _geometry );
1567}
1568
1569// stripImage strips an image of all profiles and comments.
1570Magick::stripImage::stripImage( void )
1571{
1572}
1573void Magick::stripImage::operator()( Magick::Image &image_ ) const
1574{
1575  image_.strip( );
1576}
1577
1578// Subimage of an image sequence
1579Magick::subImageImage::subImageImage( const size_t subImage_ )
1580  : _subImage( subImage_ )
1581{
1582}
1583void Magick::subImageImage::operator()( Magick::Image &image_ ) const
1584{
1585  image_.subImage( _subImage );
1586}
1587
1588// Number of images relative to the base image
1589Magick::subRangeImage::subRangeImage( const size_t subRange_ )
1590  : _subRange( subRange_ )
1591{
1592}
1593void Magick::subRangeImage::operator()( Magick::Image &image_ ) const
1594{
1595  image_.subRange( _subRange );
1596}
1597
1598// Image storage type
1599Magick::typeImage::typeImage( const Magick::ImageType type_ )
1600  : _type( type_ )
1601{
1602}
1603void Magick::typeImage::operator()( Magick::Image &image_ ) const
1604{
1605  image_.type( _type );
1606}
1607
1608// Print detailed information about the image
1609Magick::verboseImage::verboseImage( const bool verbose_ )
1610  : _verbose( verbose_ )
1611{
1612}
1613void Magick::verboseImage::operator()( Magick::Image &image_ ) const
1614{
1615  image_.verbose( _verbose );
1616}
1617
1618// FlashPix viewing parameters
1619Magick::viewImage::viewImage( const std::string &view_ )
1620  : _view( view_ ) { }
1621
1622void Magick::viewImage::operator()( Magick::Image &image_ ) const
1623{
1624  image_.view( _view );
1625}
1626
1627// X11 display to display to, obtain fonts from, or to capture image
1628// from
1629Magick::x11DisplayImage::x11DisplayImage( const std::string &display_ )
1630  : _display( display_ )
1631{
1632}
1633void Magick::x11DisplayImage::operator()( Magick::Image &image_ ) const
1634{
1635  image_.x11Display( _display );
1636}
1637