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