Magick++  7.0.7
Convert, Edit, Or Compose Bitmap Images
STL.h
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
4 // Copyright Dirk Lemstra 2013-2017
5 //
6 // Definition and implementation of template functions for using
7 // Magick::Image with STL containers.
8 //
9 
10 #ifndef Magick_STL_header
11 #define Magick_STL_header
12 
13 #include "Magick++/Include.h"
14 #include <algorithm>
15 #include <functional>
16 #include <iterator>
17 #include <map>
18 #include <utility>
19 
20 #include "Magick++/CoderInfo.h"
21 #include "Magick++/Drawable.h"
22 #include "Magick++/Exception.h"
23 #include "Magick++/Montage.h"
24 
25 namespace Magick
26 {
27  //
28  // STL function object declarations/definitions
29  //
30 
31  // Function objects provide the means to invoke an operation on one
32  // or more image objects in an STL-compatable container. The
33  // arguments to the function object constructor(s) are compatable
34  // with the arguments to the equivalent Image class method and
35  // provide the means to supply these options when the function
36  // object is invoked.
37 
38  // For example, to read a GIF animation, set the color red to
39  // transparent for all frames, and write back out:
40  //
41  // list<image> images;
42  // readImages( &images, "animation.gif" );
43  // for_each( images.begin(), images.end(), transparentImage( "red" ) );
44  // writeImages( images.begin(), images.end(), "animation.gif" );
45 
46  // Adaptive-blur image with specified blur factor
48  {
49  public:
50  adaptiveBlurImage( const double radius_ = 1, const double sigma_ = 0.5 );
51 
52  void operator()( Image &image_ ) const;
53 
54  private:
55  double _radius;
56  double _sigma;
57  };
58 
59  // Local adaptive threshold image
60  // http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm
61  // Width x height define the size of the pixel neighborhood
62  // offset = constant to subtract from pixel neighborhood mean
64  {
65  public:
66  adaptiveThresholdImage( const size_t width_,
67  const size_t height_,
68  const ::ssize_t offset_ = 0 );
69 
70  void operator()( Image &image_ ) const;
71 
72  private:
73  size_t _width;
74  size_t _height;
75  ::ssize_t _offset;
76  };
77 
78  // Add noise to image with specified noise type
80  {
81  public:
82  addNoiseImage(const NoiseType noiseType_,const double attenuate_ = 1.0);
83 
84  void operator()(Image &image_) const;
85 
86  private:
87  NoiseType _noiseType;
88  double _attenuate;
89  };
90 
91  // Transform image by specified affine (or free transform) matrix.
93  {
94  public:
95  affineTransformImage( const DrawableAffine &affine_ );
96 
97  void operator()( Image &image_ ) const;
98 
99  private:
100  DrawableAffine _affine;
101  };
102 
103  // Annotate image (draw text on image)
105  {
106  public:
107  // Annotate using specified text, and placement location
108  annotateImage ( const std::string &text_,
109  const Geometry &geometry_ );
110 
111  // Annotate using specified text, bounding area, and placement
112  // gravity
113  annotateImage ( const std::string &text_,
114  const Geometry &geometry_,
115  const GravityType gravity_ );
116 
117  // Annotate with text using specified text, bounding area,
118  // placement gravity, and rotation.
119  annotateImage ( const std::string &text_,
120  const Geometry &geometry_,
121  const GravityType gravity_,
122  const double degrees_ );
123 
124  // Annotate with text (bounding area is entire image) and
125  // placement gravity.
126  annotateImage ( const std::string &text_,
127  const GravityType gravity_ );
128 
129  void operator()( Image &image_ ) const;
130 
131  private:
132  const std::string _text;
133  const Geometry _geometry;
134  const GravityType _gravity;
135  const double _degrees;
136  };
137 
138  // Blur image with specified blur factor
140  {
141  public:
142  blurImage( const double radius_ = 1, const double sigma_ = 0.5 );
143 
144  void operator()( Image &image_ ) const;
145 
146  private:
147  double _radius;
148  double _sigma;
149  };
150 
151  // Border image (add border to image)
153  {
154  public:
155  borderImage( const Geometry &geometry_ = borderGeometryDefault );
156 
157  void operator()( Image &image_ ) const;
158 
159  private:
160  Geometry _geometry;
161  };
162 
163  // Extract channel from image
165  {
166  public:
167  channelImage( const ChannelType channel_ );
168 
169  void operator()( Image &image_ ) const;
170 
171  private:
172  ChannelType _channel;
173  };
174 
175  // Charcoal effect image (looks like charcoal sketch)
177  {
178  public:
179  charcoalImage( const double radius_ = 1, const double sigma_ = 0.5 );
180 
181  void operator()( Image &image_ ) const;
182 
183  private:
184  double _radius;
185  double _sigma;
186  };
187 
188  // Chop image (remove vertical or horizontal subregion of image)
190  {
191  public:
192  chopImage( const Geometry &geometry_ );
193 
194  void operator()( Image &image_ ) const;
195 
196  private:
197  Geometry _geometry;
198  };
199 
200  // Accepts a lightweight Color Correction Collection (CCC) file which solely
201  // contains one or more color corrections and applies the correction to the
202  // image.
204  {
205  public:
206  cdlImage( const std::string &cdl_ );
207 
208  void operator()( Image &image_ ) const;
209 
210  private:
211  std::string _cdl;
212  };
213 
214  // Colorize image using pen color at specified percent alpha
216  {
217  public:
218  colorizeImage( const unsigned int alphaRed_,
219  const unsigned int alphaGreen_,
220  const unsigned int alphaBlue_,
221  const Color &penColor_ );
222 
223  colorizeImage( const unsigned int alpha_,
224  const Color &penColor_ );
225 
226  void operator()( Image &image_ ) const;
227 
228  private:
229  unsigned int _alphaRed;
230  unsigned int _alphaGreen;
231  unsigned int _alphaBlue;
232  Color _penColor;
233  };
234 
235  // Apply a color matrix to the image channels. The user supplied
236  // matrix may be of order 1 to 5 (1x1 through 5x5).
238  {
239  public:
240  colorMatrixImage( const size_t order_,
241  const double *color_matrix_ );
242 
243  void operator()( Image &image_ ) const;
244 
245  private:
246  size_t _order;
247  const double *_color_matrix;
248  };
249 
250  // Convert the image colorspace representation
252  {
253  public:
254  colorSpaceImage( ColorspaceType colorSpace_ );
255 
256  void operator()( Image &image_ ) const;
257 
258  private:
259  ColorspaceType _colorSpace;
260  };
261 
262  // Comment image (add comment string to image)
264  {
265  public:
266  commentImage( const std::string &comment_ );
267 
268  void operator()( Image &image_ ) const;
269 
270  private:
271  std::string _comment;
272  };
273 
274  // Compose an image onto another at specified offset and using
275  // specified algorithm
277  {
278  public:
279  compositeImage( const Image &compositeImage_,
280  ::ssize_t xOffset_,
281  ::ssize_t yOffset_,
282  CompositeOperator compose_ = InCompositeOp );
283 
284  compositeImage( const Image &compositeImage_,
285  const Geometry &offset_,
286  CompositeOperator compose_ = InCompositeOp );
287 
288  void operator()( Image &image_ ) const;
289 
290  private:
291  Image _compositeImage;
292  ::ssize_t _xOffset;
293  ::ssize_t _yOffset;
294  CompositeOperator _compose;
295  };
296 
297  // Contrast image (enhance intensity differences in image)
299  {
300  public:
301  contrastImage( const size_t sharpen_ );
302 
303  void operator()( Image &image_ ) const;
304 
305  private:
306  size_t _sharpen;
307  };
308 
309  // Crop image (subregion of original image)
311  {
312  public:
313  cropImage( const Geometry &geometry_ );
314 
315  void operator()( Image &image_ ) const;
316 
317  private:
318  Geometry _geometry;
319  };
320 
321  // Cycle image colormap
323  {
324  public:
325  cycleColormapImage( const ::ssize_t amount_ );
326 
327  void operator()( Image &image_ ) const;
328 
329  private:
330  ::ssize_t _amount;
331  };
332 
333  // Despeckle image (reduce speckle noise)
335  {
336  public:
337  despeckleImage( void );
338 
339  void operator()( Image &image_ ) const;
340 
341  private:
342  };
343 
344  // Distort image. distorts an image using various distortion methods, by
345  // mapping color lookups of the source image to a new destination image
346  // usally of the same size as the source image, unless 'bestfit' is set to
347  // true.
349  {
350  public:
351  distortImage( const Magick::DistortMethod method_,
352  const size_t number_arguments_,
353  const double *arguments_,
354  const bool bestfit_ );
355 
356  distortImage( const Magick::DistortMethod method_,
357  const size_t number_arguments_,
358  const double *arguments_ );
359 
360  void operator()( Image &image_ ) const;
361 
362  private:
363  DistortMethod _method;
364  size_t _number_arguments;
365  const double *_arguments;
366  bool _bestfit;
367  };
368 
369  // Draw on image
371  {
372  public:
373  // Draw on image using a single drawable
374  // Store in list to make implementation easier
375  drawImage( const Drawable &drawable_ );
376 
377  // Draw on image using a drawable list
378  drawImage( const DrawableList &drawable_ );
379 
380  void operator()( Image &image_ ) const;
381 
382  private:
383  DrawableList _drawableList;
384  };
385 
386  // Edge image (hilight edges in image)
388  {
389  public:
390  edgeImage( const double radius_ = 0.0 );
391 
392  void operator()( Image &image_ ) const;
393 
394  private:
395  double _radius;
396  };
397 
398  // Emboss image (hilight edges with 3D effect)
400  {
401  public:
402  embossImage( void );
403  embossImage( const double radius_, const double sigma_ );
404 
405  void operator()( Image &image_ ) const;
406 
407  private:
408  double _radius;
409  double _sigma;
410  };
411 
412  // Enhance image (minimize noise)
414  {
415  public:
416  enhanceImage( void );
417 
418  void operator()( Image &image_ ) const;
419 
420  private:
421  };
422 
423  // Equalize image (histogram equalization)
425  {
426  public:
427  equalizeImage( void );
428 
429  void operator()( Image &image_ ) const;
430 
431  private:
432  };
433 
434  // Color to use when filling drawn objects
436  {
437  public:
438  fillColorImage( const Color &fillColor_ );
439 
440  void operator()( Image &image_ ) const;
441 
442  private:
443  Color _fillColor;
444  };
445 
446  // Flip image (reflect each scanline in the vertical direction)
448  {
449  public:
450  flipImage( void );
451 
452  void operator()( Image &image_ ) const;
453 
454  private:
455  };
456 
457  // Floodfill designated area with a matte value
459 
460  {
461  public:
462  floodFillAlphaImage(const ::ssize_t x_,const ::ssize_t y_,
463  const unsigned int alpha_,const Color &target_,const bool invert_=false);
464 
465  void operator()(Image &image_) const;
466 
467  private:
468  Color _target;
469  unsigned int _alpha;
470  ::ssize_t _x;
471  ::ssize_t _y;
472  bool _invert;
473  };
474 
475  // Flood-fill image with color
477 
478  {
479  public:
480  // Flood-fill color across pixels starting at target-pixel and
481  // stopping at pixels matching specified border color.
482  // Uses current fuzz setting when determining color match.
483  floodFillColorImage(const Geometry &point_,const Color &fillColor_,
484  const bool invert_=false);
485  floodFillColorImage(const ::ssize_t x_,const ::ssize_t y_,
486  const Color &fillColor_,const bool invert_=false);
487 
488  // Flood-fill color across pixels starting at target-pixel and
489  // stopping at pixels matching specified border color.
490  // Uses current fuzz setting when determining color match.
491  floodFillColorImage(const Geometry &point_,const Color &fillColor_,
492  const Color &borderColor_,const bool invert_=false);
493  floodFillColorImage(const ::ssize_t x_,const ::ssize_t y_,
494  const Color &fillColor_,const Color &borderColor_,
495  const bool invert_=false);
496 
497  void operator()(Image &image_) const;
498 
499  private:
500  ::ssize_t _x;
501  ::ssize_t _y;
502  Color _fillColor;
503  Color _borderColor;
504  bool _invert;
505  };
506 
507  // Flood-fill image with texture
509 
510  {
511  public:
512  // Flood-fill texture across pixels that match the color of the
513  // target pixel and are neighbors of the target pixel.
514  // Uses current fuzz setting when determining color match.
515  floodFillTextureImage(const ::ssize_t x_,const ::ssize_t y_,
516  const Image &texture_,const bool invert_=false);
517  floodFillTextureImage(const Geometry &point_,const Image &texture_,
518  const bool invert_=false);
519 
520  // Flood-fill texture across pixels starting at target-pixel and
521  // stopping at pixels matching specified border color.
522  // Uses current fuzz setting when determining color match.
523  floodFillTextureImage(const ::ssize_t x_,const ::ssize_t y_,
524  const Image &texture_,const Color &borderColor_,
525  const bool invert_=false);
526 
527  floodFillTextureImage(const Geometry &point_,const Image &texture_,
528  const Color &borderColor_,const bool invert_=false);
529 
530  void operator()(Image &image_) const;
531 
532  private:
533  ::ssize_t _x;
534  ::ssize_t _y;
535  Image _texture;
536  Color _borderColor;
537  bool _invert;
538  };
539 
540  // Flop image (reflect each scanline in the horizontal direction)
542  {
543  public:
544  flopImage( void );
545 
546  void operator()( Image &image_ ) const;
547 
548  private:
549  };
550 
551  // Frame image
553  {
554  public:
555  frameImage( const Geometry &geometry_ = frameGeometryDefault );
556 
557  frameImage( const size_t width_, const size_t height_,
558  const ::ssize_t innerBevel_ = 6, const ::ssize_t outerBevel_ = 6 );
559 
560  void operator()( Image &image_ ) const;
561 
562  private:
563  size_t _width;
564  size_t _height;
565  ::ssize_t _outerBevel;
566  ::ssize_t _innerBevel;
567  };
568 
569  // Gamma correct image
571  {
572  public:
573  gammaImage( const double gamma_ );
574 
575  gammaImage ( const double gammaRed_,
576  const double gammaGreen_,
577  const double gammaBlue_ );
578 
579  void operator()( Image &image_ ) const;
580 
581  private:
582  double _gammaRed;
583  double _gammaGreen;
584  double _gammaBlue;
585  };
586 
587  // Gaussian blur image
588  // The number of neighbor pixels to be included in the convolution
589  // mask is specified by 'width_'. The standard deviation of the
590  // gaussian bell curve is specified by 'sigma_'.
592  {
593  public:
594  gaussianBlurImage( const double width_, const double sigma_ );
595 
596  void operator()( Image &image_ ) const;
597 
598  private:
599  double _width;
600  double _sigma;
601  };
602 
603  // Apply a color lookup table (Hald CLUT) to the image.
605  {
606  public:
607  haldClutImage( const Image &haldClutImage_ );
608 
609  void operator()( Image &image_ ) const;
610 
611  private:
612  Image _haldClutImage;
613  };
614 
615  // Implode image (special effect)
617  {
618  public:
619  implodeImage( const double factor_ = 50 );
620 
621  void operator()( Image &image_ ) const;
622 
623  private:
624  double _factor;
625  };
626 
627  // implements the inverse discrete Fourier transform (IFT) of the image
628  // either as a magnitude / phase or real / imaginary image pair.
630  {
631  public:
632  inverseFourierTransformImage( const Image &phaseImage_ );
633 
634  void operator()( Image &image_ ) const;
635 
636  private:
637  Image _phaseImage;
638  };
639 
640  // Set image validity. Valid images become empty (inValid) if
641  // argument is false.
643  {
644  public:
645  isValidImage( const bool isValid_ );
646 
647  void operator()( Image &image_ ) const;
648 
649  private:
650  bool _isValid;
651  };
652 
653  // Label image
655  {
656  public:
657  labelImage( const std::string &label_ );
658 
659  void operator()( Image &image_ ) const;
660 
661  private:
662  std::string _label;
663  };
664 
665 
666  // Level image
668  {
669  public:
670  levelImage( const double black_point,
671  const double white_point,
672  const double mid_point=1.0 );
673 
674  void operator()( Image &image_ ) const;
675 
676  private:
677  double _black_point;
678  double _white_point;
679  double _mid_point;
680  };
681 
682  // Magnify image by integral size
684  {
685  public:
686  magnifyImage( void );
687 
688  void operator()( Image &image_ ) const;
689 
690  private:
691  };
692 
693  // Remap image colors with closest color from reference image
695  {
696  public:
697  mapImage( const Image &mapImage_ ,
698  const bool dither_ = false );
699 
700  void operator()( Image &image_ ) const;
701 
702  private:
703  Image _mapImage;
704  bool _dither;
705  };
706 
707  // Filter image by replacing each pixel component with the median
708  // color in a circular neighborhood
710  {
711  public:
712  medianConvolveImage( const double radius_ = 0.0 );
713 
714  void operator()( Image &image_ ) const;
715 
716  private:
717  double _radius;
718  };
719 
720  // Merge image layers
722  {
723  public:
724  mergeLayersImage ( LayerMethod layerMethod_ );
725 
726  void operator()( Image &image_ ) const;
727 
728  private:
729  LayerMethod _layerMethod;
730  };
731 
732  // Reduce image by integral size
734  {
735  public:
736  minifyImage( void );
737 
738  void operator()( Image &image_ ) const;
739 
740  private:
741  };
742 
743  // Modulate percent hue, saturation, and brightness of an image
745  {
746  public:
747  modulateImage( const double brightness_,
748  const double saturation_,
749  const double hue_ );
750 
751  void operator()( Image &image_ ) const;
752 
753  private:
754  double _brightness;
755  double _saturation;
756  double _hue;
757  };
758 
759  // Negate colors in image. Set grayscale to only negate grayscale
760  // values in image.
762  {
763  public:
764  negateImage( const bool grayscale_ = false );
765 
766  void operator()( Image &image_ ) const;
767 
768  private:
769  bool _grayscale;
770  };
771 
772  // Normalize image (increase contrast by normalizing the pixel
773  // values to span the full range of color values)
775  {
776  public:
777  normalizeImage( void );
778 
779  void operator()( Image &image_ ) const;
780 
781  private:
782  };
783 
784  // Oilpaint image (image looks like oil painting)
786  {
787  public:
788  oilPaintImage( const double radius_ = 3 );
789 
790  void operator()( Image &image_ ) const;
791 
792  private:
793  double _radius;
794  };
795 
796  // Set or attenuate the image alpha channel. If the image pixels
797  // are opaque then they are set to the specified alpha value,
798  // otherwise they are blended with the supplied alpha value. The
799  // value of alpha_ ranges from 0 (completely opaque) to
800  // QuantumRange. The defines OpaqueAlpha and TransparentAlpha are
801  // available to specify completely opaque or completely transparent,
802  // respectively.
804  {
805  public:
806  alphaImage( const unsigned int alpha_ );
807 
808  void operator()( Image &image_ ) const;
809 
810  private:
811  unsigned int _alpha;
812  };
813 
814  // Change color of opaque pixel to specified pen color.
816  {
817  public:
818  opaqueImage( const Color &opaqueColor_,
819  const Color &penColor_ );
820 
821  void operator()( Image &image_ ) const;
822 
823  private:
824  Color _opaqueColor;
825  Color _penColor;
826  };
827 
828  // Quantize image (reduce number of colors)
830  {
831  public:
832  quantizeImage( const bool measureError_ = false );
833 
834  void operator()( Image &image_ ) const;
835 
836  private:
837  bool _measureError;
838  };
839 
840  // Raise image (lighten or darken the edges of an image to give a
841  // 3-D raised or lowered effect)
843  {
844  public:
845  raiseImage( const Geometry &geometry_ = raiseGeometryDefault,
846  const bool raisedFlag_ = false );
847 
848  void operator()( Image &image_ ) const;
849 
850  private:
851  Geometry _geometry;
852  bool _raisedFlag;
853  };
854 
856  {
857  public:
858 
859  // Default constructor
860  ReadOptions(void);
861 
862  // Copy constructor
863  ReadOptions(const ReadOptions& options_);
864 
865  // Destructor
866  ~ReadOptions();
867 
868  // Vertical and horizontal resolution in pixels of the image
869  void density(const Geometry &geomery_);
870  Geometry density(void) const;
871 
872  // Image depth (8 or 16)
873  void depth(size_t depth_);
874  size_t depth(void) const;
875 
876  // Suppress all warning messages. Error messages are still reported.
877  void quiet(const bool quiet_);
878  bool quiet(void) const;
879 
880  // Image size (required for raw formats)
881  void size(const Geometry &geometry_);
882  Geometry size(void) const;
883 
884  //
885  // Internal implementation methods. Please do not use.
886  //
887 
888  MagickCore::ImageInfo *imageInfo(void);
889 
890  private:
891 
892  // Assignment not supported
893  ReadOptions& operator=(const ReadOptions&);
894 
895  MagickCore::ImageInfo *_imageInfo;
896  bool _quiet;
897  };
898 
899  // Reduce noise in image using a noise peak elimination filter
901  {
902  public:
903  reduceNoiseImage( void );
904 
905  reduceNoiseImage (const size_t order_ );
906 
907  void operator()( Image &image_ ) const;
908 
909  private:
910  size_t _order;
911  };
912 
913  // Resize image to specified size.
915  {
916  public:
917  resizeImage( const Geometry &geometry_ );
918 
919  void operator()( Image &image_ ) const;
920 
921  private:
922  Geometry _geometry;
923  };
924 
925  // Roll image (rolls image vertically and horizontally) by specified
926  // number of columnms and rows)
928  {
929  public:
930  rollImage( const Geometry &roll_ );
931 
932  rollImage( const ::ssize_t columns_, const ::ssize_t rows_ );
933 
934  void operator()( Image &image_ ) const;
935 
936  private:
937  size_t _columns;
938  size_t _rows;
939  };
940 
941  // Rotate image counter-clockwise by specified number of degrees.
943  {
944  public:
945  rotateImage( const double degrees_ );
946 
947  void operator()( Image &image_ ) const;
948 
949  private:
950  double _degrees;
951  };
952 
953  // Resize image by using pixel sampling algorithm
955  {
956  public:
957  sampleImage( const Geometry &geometry_ );
958 
959  void operator()( Image &image_ ) const;
960 
961  private:
962  Geometry _geometry;
963  };
964 
965  // Resize image by using simple ratio algorithm
967  {
968  public:
969  scaleImage( const Geometry &geometry_ );
970 
971  void operator()( Image &image_ ) const;
972 
973  private:
974  Geometry _geometry;
975  };
976 
977  // Segment (coalesce similar image components) by analyzing the
978  // histograms of the color components and identifying units that are
979  // homogeneous with the fuzzy c-means technique.
980  // Also uses QuantizeColorSpace and Verbose image attributes
982  {
983  public:
984  segmentImage( const double clusterThreshold_ = 1.0,
985  const double smoothingThreshold_ = 1.5 );
986 
987  void operator()( Image &image_ ) const;
988 
989  private:
990  double _clusterThreshold;
991  double _smoothingThreshold;
992  };
993 
994  // Shade image using distant light source
996  {
997  public:
998  shadeImage( const double azimuth_ = 30,
999  const double elevation_ = 30,
1000  const bool colorShading_ = false );
1001 
1002  void operator()( Image &image_ ) const;
1003 
1004  private:
1005  double _azimuth;
1006  double _elevation;
1007  bool _colorShading;
1008  };
1009 
1010  // Shadow effect image (simulate an image shadow)
1012  {
1013  public:
1014  shadowImage( const double percent_opacity_ = 80, const double sigma_ = 0.5,
1015  const ssize_t x_ = 5, const ssize_t y_ = 5 );
1016 
1017  void operator()( Image &image_ ) const;
1018 
1019  private:
1020  double _percent_opacity;
1021  double _sigma;
1022  ssize_t _x;
1023  ssize_t _y;
1024  };
1025 
1026  // Sharpen pixels in image
1028  {
1029  public:
1030  sharpenImage( const double radius_ = 1, const double sigma_ = 0.5 );
1031 
1032  void operator()( Image &image_ ) const;
1033 
1034  private:
1035  double _radius;
1036  double _sigma;
1037  };
1038 
1039  // Shave pixels from image edges.
1041  {
1042  public:
1043  shaveImage( const Geometry &geometry_ );
1044 
1045  void operator()( Image &image_ ) const;
1046 
1047  private:
1048  Geometry _geometry;
1049  };
1050 
1051 
1052  // Shear image (create parallelogram by sliding image by X or Y axis)
1054  {
1055  public:
1056  shearImage( const double xShearAngle_,
1057  const double yShearAngle_ );
1058 
1059  void operator()( Image &image_ ) const;
1060 
1061  private:
1062  double _xShearAngle;
1063  double _yShearAngle;
1064  };
1065 
1066  // Solarize image (similar to effect seen when exposing a
1067  // photographic film to light during the development process)
1069  {
1070  public:
1071  solarizeImage( const double factor_ );
1072 
1073  void operator()( Image &image_ ) const;
1074 
1075  private:
1076  double _factor;
1077  };
1078 
1079  // Splice the background color into the image.
1081  {
1082  public:
1083  spliceImage( const Geometry &geometry_ );
1084 
1085  void operator()( Image &image_ ) const;
1086 
1087  private:
1088  Geometry _geometry;
1089  };
1090 
1091  // Spread pixels randomly within image by specified ammount
1093  {
1094  public:
1095  spreadImage( const size_t amount_ = 3 );
1096 
1097  void operator()( Image &image_ ) const;
1098 
1099  private:
1100  size_t _amount;
1101  };
1102 
1103  // Add a digital watermark to the image (based on second image)
1105  {
1106  public:
1107  steganoImage( const Image &waterMark_ );
1108 
1109  void operator()( Image &image_ ) const;
1110 
1111  private:
1112  Image _waterMark;
1113  };
1114 
1115  // Create an image which appears in stereo when viewed with red-blue glasses
1116  // (Red image on left, blue on right)
1118  {
1119  public:
1120  stereoImage( const Image &rightImage_ );
1121 
1122  void operator()( Image &image_ ) const;
1123 
1124  private:
1125  Image _rightImage;
1126  };
1127 
1128  // Color to use when drawing object outlines
1130  {
1131  public:
1132  strokeColorImage( const Color &strokeColor_ );
1133 
1134  void operator()( Image &image_ ) const;
1135 
1136  private:
1137  Color _strokeColor;
1138  };
1139 
1140  // Swirl image (image pixels are rotated by degrees)
1142  {
1143  public:
1144  swirlImage( const double degrees_ );
1145 
1146  void operator()( Image &image_ ) const;
1147 
1148  private:
1149  double _degrees;
1150  };
1151 
1152  // Channel a texture on image background
1154  {
1155  public:
1156  textureImage( const Image &texture_ );
1157 
1158  void operator()( Image &image_ ) const;
1159 
1160  private:
1161  Image _texture;
1162  };
1163 
1164  // Threshold image
1166  {
1167  public:
1168  thresholdImage( const double threshold_ );
1169 
1170  void operator()( Image &image_ ) const;
1171 
1172  private:
1173  double _threshold;
1174  };
1175 
1176  // Set image color to transparent
1178  {
1179  public:
1180  transparentImage( const Color& color_ );
1181 
1182  void operator()( Image &image_ ) const;
1183 
1184  private:
1185  Color _color;
1186  };
1187 
1188  // Trim edges that are the background color from the image
1190  {
1191  public:
1192  trimImage( void );
1193 
1194  void operator()( Image &image_ ) const;
1195 
1196  private:
1197  };
1198 
1199  // Map image pixels to a sine wave
1201  {
1202  public:
1203  waveImage( const double amplitude_ = 25.0,
1204  const double wavelength_ = 150.0 );
1205 
1206  void operator()( Image &image_ ) const;
1207 
1208  private:
1209  double _amplitude;
1210  double _wavelength;
1211  };
1212 
1213  // Zoom image to specified size.
1215  {
1216  public:
1217  zoomImage( const Geometry &geometry_ );
1218 
1219  void operator()( Image &image_ ) const;
1220 
1221  private:
1222  Geometry _geometry;
1223  };
1224 
1225  //
1226  // Function object image attribute accessors
1227  //
1228 
1229  // Join images into a single multi-image file
1231  {
1232  public:
1233  adjoinImage( const bool flag_ );
1234 
1235  void operator()( Image &image_ ) const;
1236 
1237  private:
1238  bool _flag;
1239  };
1240 
1241  // Time in 1/100ths of a second which must expire before displaying
1242  // the next image in an animated sequence.
1244  {
1245  public:
1246  animationDelayImage( const size_t delay_ );
1247 
1248  void operator()( Image &image_ ) const;
1249 
1250  private:
1251  size_t _delay;
1252  };
1253 
1254  // Number of iterations to loop an animation (e.g. Netscape loop
1255  // extension) for.
1257  {
1258  public:
1259  animationIterationsImage( const size_t iterations_ );
1260 
1261  void operator()( Image &image_ ) const;
1262 
1263  private:
1264  size_t _iterations;
1265  };
1266 
1267  // Image background color
1269  {
1270  public:
1271  backgroundColorImage( const Color &color_ );
1272 
1273  void operator()( Image &image_ ) const;
1274 
1275  private:
1276  Color _color;
1277  };
1278 
1279  // Name of texture image to tile onto the image background
1281  {
1282  public:
1283  backgroundTextureImage( const std::string &backgroundTexture_ );
1284 
1285  void operator()( Image &image_ ) const;
1286 
1287  private:
1288  std::string _backgroundTexture;
1289  };
1290 
1291  // Image border color
1293  {
1294  public:
1295  borderColorImage( const Color &color_ );
1296 
1297  void operator()( Image &image_ ) const;
1298 
1299  private:
1300  Color _color;
1301  };
1302 
1303  // Text bounding-box base color (default none)
1305  {
1306  public:
1307  boxColorImage( const Color &boxColor_ );
1308 
1309  void operator()( Image &image_ ) const;
1310 
1311  private:
1312  Color _boxColor;
1313  };
1314 
1315  // Chromaticity blue primary point.
1317  {
1318  public:
1319  chromaBluePrimaryImage(const double x_,const double y_,const double z_);
1320 
1321  void operator()(Image &image_) const;
1322 
1323  private:
1324  double _x;
1325  double _y;
1326  double _z;
1327  };
1328 
1329  // Chromaticity green primary point.
1331  {
1332  public:
1333  chromaGreenPrimaryImage(const double x_,const double y_,const double z_);
1334 
1335  void operator()(Image &image_) const;
1336 
1337  private:
1338  double _x;
1339  double _y;
1340  double _z;
1341  };
1342 
1343  // Chromaticity red primary point.
1345  {
1346  public:
1347  chromaRedPrimaryImage(const double x_,const double y_,const double z_);
1348 
1349  void operator()(Image &image_) const;
1350 
1351  private:
1352  double _x;
1353  double _y;
1354  double _z;
1355  };
1356 
1357  // Chromaticity white point.
1359  {
1360  public:
1361  chromaWhitePointImage(const double x_,const double y_,const double z_);
1362 
1363  void operator()(Image &image_) const;
1364 
1365  private:
1366  double _x;
1367  double _y;
1368  double _z;
1369  };
1370 
1371  // Colors within this distance are considered equal
1373  {
1374  public:
1375  colorFuzzImage( const double fuzz_ );
1376 
1377  void operator()( Image &image_ ) const;
1378 
1379  private:
1380  double _fuzz;
1381  };
1382 
1383  // Color at colormap position index_
1385  {
1386  public:
1387  colorMapImage( const size_t index_, const Color &color_ );
1388 
1389  void operator()( Image &image_ ) const;
1390 
1391  private:
1392  size_t _index;
1393  Color _color;
1394  };
1395 
1396  // Composition operator to be used when composition is implicitly used
1397  // (such as for image flattening).
1399  {
1400  public:
1401  composeImage( const CompositeOperator compose_ );
1402 
1403  void operator()( Image &image_ ) const;
1404 
1405  private:
1406  CompositeOperator _compose;
1407  };
1408 
1409  // Compression type
1411  {
1412  public:
1413  compressTypeImage( const CompressionType compressType_ );
1414 
1415  void operator()( Image &image_ ) const;
1416 
1417  private:
1418  CompressionType _compressType;
1419  };
1420 
1421  // Vertical and horizontal resolution in pixels of the image
1423  {
1424  public:
1425  densityImage( const Point &point_ );
1426 
1427  void operator()( Image &image_ ) const;
1428 
1429  private:
1430  Point _point;
1431  };
1432 
1433  // Image depth (bits allocated to red/green/blue components)
1435  {
1436  public:
1437  depthImage( const size_t depth_ );
1438 
1439  void operator()( Image &image_ ) const;
1440 
1441  private:
1442  size_t _depth;
1443  };
1444 
1445  // Endianness (LSBEndian like Intel or MSBEndian like SPARC) for image
1446  // formats which support endian-specific options.
1448  {
1449  public:
1450  endianImage( const EndianType endian_ );
1451 
1452  void operator()( Image &image_ ) const;
1453 
1454  private:
1455  EndianType _endian;
1456  };
1457 
1458  // Image file name
1460  {
1461  public:
1462  fileNameImage( const std::string &fileName_ );
1463 
1464  void operator()( Image &image_ ) const;
1465 
1466  private:
1467  std::string _fileName;
1468  };
1469 
1470  // Filter to use when resizing image
1472  {
1473  public:
1474  filterTypeImage( const FilterType filterType_ );
1475 
1476  void operator()( Image &image_ ) const;
1477 
1478  private:
1479  FilterType _filterType;
1480  };
1481 
1482  // Text rendering font
1484  {
1485  public:
1486  fontImage( const std::string &font_ );
1487 
1488  void operator()( Image &image_ ) const;
1489 
1490  private:
1491  std::string _font;
1492  };
1493 
1494  // Font point size
1496  {
1497  public:
1498  fontPointsizeImage( const size_t pointsize_ );
1499 
1500  void operator()( Image &image_ ) const;
1501 
1502  private:
1503  size_t _pointsize;
1504  };
1505 
1506  // GIF disposal method
1508  {
1509  public:
1510  gifDisposeMethodImage( const DisposeType disposeMethod_ );
1511 
1512  void operator()( Image &image_ ) const;
1513 
1514  private:
1515  DisposeType _disposeMethod;
1516  };
1517 
1518  // Type of interlacing to use
1520  {
1521  public:
1522  interlaceTypeImage( const InterlaceType interlace_ );
1523 
1524  void operator()( Image &image_ ) const;
1525 
1526  private:
1527  InterlaceType _interlace;
1528  };
1529 
1530  // File type magick identifier (.e.g "GIF")
1532  {
1533  public:
1534  magickImage( const std::string &magick_ );
1535 
1536  void operator()( Image &image_ ) const;
1537 
1538  private:
1539  std::string _magick;
1540  };
1541 
1542  // Image supports transparent color
1544  {
1545  public:
1546  alphaFlagImage( const bool alphaFlag_ );
1547 
1548  void operator()( Image &image_ ) const;
1549 
1550  private:
1551  bool _alphaFlag;
1552  };
1553 
1554  // Transparent color
1556  {
1557  public:
1558  matteColorImage( const Color &matteColor_ );
1559 
1560  void operator()( Image &image_ ) const;
1561 
1562  private:
1563  Color _matteColor;
1564  };
1565 
1566  // Indicate that image is black and white
1568  {
1569  public:
1570  monochromeImage( const bool monochromeFlag_ );
1571 
1572  void operator()( Image &image_ ) const;
1573 
1574  private:
1575  bool _monochromeFlag;
1576  };
1577 
1578  // Pen color
1580  {
1581  public:
1582  penColorImage( const Color &penColor_ );
1583 
1584  void operator()( Image &image_ ) const;
1585 
1586  private:
1587  Color _penColor;
1588  };
1589 
1590  // Pen texture image.
1592  {
1593  public:
1594  penTextureImage( const Image &penTexture_ );
1595 
1596  void operator()( Image &image_ ) const;
1597 
1598  private:
1599  Image _penTexture;
1600  };
1601 
1602  // Set pixel color at location x & y.
1604  {
1605  public:
1606  pixelColorImage( const ::ssize_t x_,
1607  const ::ssize_t y_,
1608  const Color &color_);
1609 
1610  void operator()( Image &image_ ) const;
1611 
1612  private:
1613  ::ssize_t _x;
1614  ::ssize_t _y;
1615  Color _color;
1616  };
1617 
1618  // Postscript page size.
1620  {
1621  public:
1622  pageImage( const Geometry &pageSize_ );
1623 
1624  void operator()( Image &image_ ) const;
1625 
1626  private:
1627  Geometry _pageSize;
1628  };
1629 
1630  // JPEG/MIFF/PNG compression level (default 75).
1632  {
1633  public:
1634  qualityImage( const size_t quality_ );
1635 
1636  void operator()( Image &image_ ) const;
1637 
1638  private:
1639  size_t _quality;
1640  };
1641 
1642  // Maximum number of colors to quantize to
1644  {
1645  public:
1646  quantizeColorsImage( const size_t colors_ );
1647 
1648  void operator()( Image &image_ ) const;
1649 
1650  private:
1651  size_t _colors;
1652  };
1653 
1654  // Colorspace to quantize in.
1656  {
1657  public:
1658  quantizeColorSpaceImage( const ColorspaceType colorSpace_ );
1659 
1660  void operator()( Image &image_ ) const;
1661 
1662  private:
1663  ColorspaceType _colorSpace;
1664  };
1665 
1666  // Dither image during quantization (default true).
1668  {
1669  public:
1670  quantizeDitherImage( const bool ditherFlag_ );
1671 
1672  void operator()( Image &image_ ) const;
1673 
1674  private:
1675  bool _ditherFlag;
1676  };
1677 
1678  // Quantization tree-depth
1680  {
1681  public:
1682  quantizeTreeDepthImage( const size_t treeDepth_ );
1683 
1684  void operator()( Image &image_ ) const;
1685 
1686  private:
1687  size_t _treeDepth;
1688  };
1689 
1690  // The type of rendering intent
1692  {
1693  public:
1694  renderingIntentImage( const RenderingIntent renderingIntent_ );
1695 
1696  void operator()( Image &image_ ) const;
1697 
1698  private:
1699  RenderingIntent _renderingIntent;
1700  };
1701 
1702  // Units of image resolution
1704  {
1705  public:
1706  resolutionUnitsImage( const ResolutionType resolutionUnits_ );
1707 
1708  void operator()( Image &image_ ) const;
1709 
1710  private:
1711  ResolutionType _resolutionUnits;
1712  };
1713 
1714  // Image scene number
1716  {
1717  public:
1718  sceneImage( const size_t scene_ );
1719 
1720  void operator()( Image &image_ ) const;
1721 
1722  private:
1723  size_t _scene;
1724  };
1725 
1726  // adjust the image contrast with a non-linear sigmoidal contrast algorithm
1728  {
1729  public:
1730  sigmoidalContrastImage( const size_t sharpen_,
1731  const double contrast,
1732  const double midpoint = QuantumRange / 2.0 );
1733 
1734  void operator()( Image &image_ ) const;
1735 
1736  private:
1737  size_t _sharpen;
1738  double contrast;
1739  double midpoint;
1740  };
1741 
1742  // Width and height of a raw image
1744  {
1745  public:
1746  sizeImage( const Geometry &geometry_ );
1747 
1748  void operator()( Image &image_ ) const;
1749 
1750  private:
1751  Geometry _geometry;
1752  };
1753 
1754  // stripImage strips an image of all profiles and comments.
1756  {
1757  public:
1758  stripImage( void );
1759 
1760  void operator()( Image &image_ ) const;
1761 
1762  private:
1763  };
1764 
1765  // Subimage of an image sequence
1767  {
1768  public:
1769  subImageImage( const size_t subImage_ );
1770 
1771  void operator()( Image &image_ ) const;
1772 
1773  private:
1774  size_t _subImage;
1775  };
1776 
1777  // Number of images relative to the base image
1779  {
1780  public:
1781  subRangeImage( const size_t subRange_ );
1782 
1783  void operator()( Image &image_ ) const;
1784 
1785  private:
1786  size_t _subRange;
1787  };
1788 
1789  // Anti-alias Postscript and TrueType fonts (default true)
1791  {
1792  public:
1793  textAntiAliasImage( const bool flag_ );
1794 
1795  void operator()( Image &image_ ) const;
1796 
1797  private:
1798  bool _flag;
1799  };
1800 
1801  // Image storage type
1803  {
1804  public:
1805  typeImage( const ImageType type_ );
1806 
1807  void operator()( Image &image_ ) const;
1808 
1809  private:
1810  Magick::ImageType _type;
1811  };
1812 
1813 
1814  // Print detailed information about the image
1816  {
1817  public:
1818  verboseImage( const bool verbose_ );
1819 
1820  void operator()( Image &image_ ) const;
1821 
1822  private:
1823  bool _verbose;
1824  };
1825 
1826  // X11 display to display to, obtain fonts from, or to capture
1827  // image from
1829  {
1830  public:
1831  x11DisplayImage( const std::string &display_ );
1832 
1833  void operator()( Image &image_ ) const;
1834 
1835  private:
1836  std::string _display;
1837  };
1838 
1840  //
1841  // Implementation template definitions. Not for end-use.
1842  //
1844 
1845  // Changes the channel mask of the images and places the old
1846  // values in the container.
1847  template<class InputIterator, class Container>
1848  void channelMaskImages(InputIterator first_,InputIterator last_,
1849  Container *container_,const ChannelType channel_)
1850  {
1851  MagickCore::ChannelType
1852  channel_mask;
1853 
1854  container_->clear();
1855  for (InputIterator iter = first_; iter != last_; ++iter)
1856  {
1857  iter->modifyImage();
1858  channel_mask=MagickCore::SetImageChannelMask(iter->image(),channel_);
1859  container_->push_back(channel_mask);
1860  }
1861  }
1862 
1863  // Insert images in image list into existing container (appending to container)
1864  // The images should not be deleted since only the image ownership is passed.
1865  // The options are copied into the object.
1866  template<class Container>
1867  void insertImages(Container *sequence_,MagickCore::Image* images_)
1868  {
1870  *image,
1871  *next;
1872 
1873  image=images_;
1874  while (image != (MagickCore::Image *) NULL)
1875  {
1876  next=image->next;
1877  image->next=(MagickCore::Image *) NULL;
1878 
1879  if (next != (MagickCore::Image *) NULL)
1880  next->previous=(MagickCore::Image *) NULL;
1881 
1882  sequence_->push_back(Magick::Image(image));
1883 
1884  image=next;
1885  }
1886  }
1887 
1888  // Link images together into an image list based on the ordering of
1889  // the container implied by the iterator. This step is done in
1890  // preparation for use with ImageMagick functions which operate on
1891  // lists of images.
1892  // Images are selected by range, first_ to last_ so that a subset of
1893  // the container may be selected. Specify first_ via the
1894  // container's begin() method and last_ via the container's end()
1895  // method in order to specify the entire container.
1896  template<class InputIterator>
1897  bool linkImages(InputIterator first_,InputIterator last_)
1898  {
1900  *current,
1901  *previous;
1902 
1903  ::ssize_t
1904  scene;
1905 
1906  scene=0;
1907  previous=(MagickCore::Image *) NULL;
1908  for (InputIterator iter = first_; iter != last_; ++iter)
1909  {
1910  // Unless we reduce the reference count to one, the same image
1911  // structure may occur more than once in the container, causing
1912  // the linked list to fail.
1913  iter->modifyImage();
1914 
1915  current=iter->image();
1916 
1917  current->previous=previous;
1918  current->next=(MagickCore::Image *) NULL;
1919  current->scene=scene++;
1920 
1921  if (previous != (MagickCore::Image *) NULL)
1922  previous->next=current;
1923 
1924  previous=current;
1925  }
1926  return(scene > 0 ? true : false);
1927  }
1928 
1929  // Restores the channel mask of the images.
1930  template<class InputIterator, class Container>
1931  void restoreChannelMaskImages(InputIterator first_,InputIterator last_,
1932  Container *container_)
1933  {
1934  typename Container::iterator
1935  channel_mask;
1936 
1937  channel_mask=container_->begin();
1938  for (InputIterator iter = first_; iter != last_; ++iter)
1939  {
1940  iter->modifyImage();
1941  (void) MagickCore::SetImageChannelMask(iter->image(),
1942  (const MagickCore::ChannelType) *channel_mask);
1943  channel_mask++;
1944  }
1945  }
1946 
1947  // Remove links added by linkImages. This should be called after the
1948  // ImageMagick function call has completed to reset the image list
1949  // back to its pristine un-linked state.
1950  template<class InputIterator>
1951  void unlinkImages(InputIterator first_,InputIterator last_)
1952  {
1954  *image;
1955 
1956  for (InputIterator iter = first_; iter != last_; ++iter)
1957  {
1958  image=iter->image();
1959  image->previous=(MagickCore::Image *) NULL;
1960  image->next=(MagickCore::Image *) NULL;
1961  }
1962  }
1963 
1965  //
1966  // Template definitions for documented API
1967  //
1969 
1970  template <class InputIterator>
1971  void animateImages( InputIterator first_,InputIterator last_)
1972  {
1973  if (linkImages(first_,last_) == false)
1974  return;
1976  MagickCore::AnimateImages(first_->imageInfo(),first_->image(),
1977  exceptionInfo);
1978  unlinkImages(first_,last_);
1979  ThrowPPException(first_->quiet());
1980  }
1981 
1982  // Append images from list into single image in either horizontal or
1983  // vertical direction.
1984  template <class InputIterator>
1985  void appendImages( Image *appendedImage_,
1986  InputIterator first_,
1987  InputIterator last_,
1988  bool stack_ = false) {
1989  if (linkImages(first_,last_) == false)
1990  return;
1992  MagickCore::Image* image = MagickCore::AppendImages( first_->image(),
1993  (MagickBooleanType) stack_,
1994  exceptionInfo );
1995  unlinkImages( first_, last_ );
1996  appendedImage_->replaceImage( image );
1997  ThrowPPException(appendedImage_->quiet());
1998  }
1999 
2000  // Adds the names of the artifacts of the image to the container.
2001  template <class Container>
2002  void artifactNames(Container *names_,const Image* image_)
2003  {
2004  const char*
2005  name;
2006 
2007  names_->clear();
2008 
2009  MagickCore::ResetImageArtifactIterator(image_->constImage());
2010  name=MagickCore::GetNextImageArtifact(image_->constImage());
2011  while (name != (const char *) NULL)
2012  {
2013  names_->push_back(std::string(name));
2014  name=MagickCore::GetNextImageArtifact(image_->constImage());
2015  }
2016  }
2017 
2018  // Adds the names of the attributes of the image to the container.
2019  template <class Container>
2020  void attributeNames(Container *names_,const Image* image_)
2021  {
2022  const char*
2023  name;
2024 
2025  names_->clear();
2026 
2027  MagickCore::ResetImagePropertyIterator(image_->constImage());
2028  name=MagickCore::GetNextImageProperty(image_->constImage());
2029  while (name != (const char *) NULL)
2030  {
2031  names_->push_back(std::string(name));
2032  name=MagickCore::GetNextImageProperty(image_->constImage());
2033  }
2034  }
2035 
2036  // Average a set of images.
2037  // All the input images must be the same size in pixels.
2038  template <class InputIterator>
2039  void averageImages( Image *averagedImage_,
2040  InputIterator first_,
2041  InputIterator last_ ) {
2042  if (linkImages(first_,last_) == false)
2043  return;
2045  MagickCore::Image* image = MagickCore::EvaluateImages( first_->image(),
2046  MagickCore::MeanEvaluateOperator, exceptionInfo );
2047  unlinkImages( first_, last_ );
2048  averagedImage_->replaceImage( image );
2049  ThrowPPException(averagedImage_->quiet());
2050  }
2051 
2052  // Merge a sequence of images.
2053  // This is useful for GIF animation sequences that have page
2054  // offsets and disposal methods. A container to contain
2055  // the updated image sequence is passed via the coalescedImages_
2056  // option.
2057  template <class InputIterator, class Container >
2058  void coalesceImages(Container *coalescedImages_,InputIterator first_,
2059  InputIterator last_)
2060  {
2061  bool
2062  quiet;
2063 
2065  *images;
2066 
2067  if (linkImages(first_,last_) == false)
2068  return;
2069 
2071  quiet=first_->quiet();
2072  images=MagickCore::CoalesceImages(first_->image(),exceptionInfo);
2073 
2074  // Unlink image list
2075  unlinkImages(first_,last_);
2076 
2077  // Ensure container is empty
2078  coalescedImages_->clear();
2079 
2080  // Move images to container
2081  insertImages(coalescedImages_,images);
2082 
2083  // Report any error
2084  ThrowPPException(quiet);
2085  }
2086 
2087  // Return format coders matching specified conditions.
2088  //
2089  // The default (if no match terms are supplied) is to return all
2090  // available format coders.
2091  //
2092  // For example, to return all readable formats:
2093  // list<CoderInfo> coderList;
2094  // coderInfoList( &coderList, CoderInfo::TrueMatch, CoderInfo::AnyMatch, CoderInfo::AnyMatch)
2095  //
2096  template <class Container >
2097  void coderInfoList( Container *container_,
2101  ) {
2102  // Obtain first entry in MagickInfo list
2103  size_t number_formats;
2105  char **coder_list =
2106  MagickCore::GetMagickList( "*", &number_formats, exceptionInfo );
2107  if( !coder_list )
2108  {
2109  throwException(exceptionInfo);
2110  throwExceptionExplicit(MagickCore::MissingDelegateError,
2111  "Coder array not returned!", 0 );
2112  }
2113 
2114  // Clear out container
2115  container_->clear();
2116 
2117  for ( ::ssize_t i=0; i < (::ssize_t) number_formats; i++)
2118  {
2119  const MagickCore::MagickInfo *magick_info =
2120  MagickCore::GetMagickInfo( coder_list[i], exceptionInfo );
2121  coder_list[i]=(char *)
2122  MagickCore::RelinquishMagickMemory( coder_list[i] );
2123 
2124  // Skip stealth coders
2125  if ( MagickCore::GetMagickStealth(magick_info) )
2126  continue;
2127 
2128  try {
2129  CoderInfo coderInfo( magick_info->name );
2130 
2131  // Test isReadable_
2132  if ( isReadable_ != CoderInfo::AnyMatch &&
2133  (( coderInfo.isReadable() && isReadable_ != CoderInfo::TrueMatch ) ||
2134  ( !coderInfo.isReadable() && isReadable_ != CoderInfo::FalseMatch )) )
2135  continue;
2136 
2137  // Test isWritable_
2138  if ( isWritable_ != CoderInfo::AnyMatch &&
2139  (( coderInfo.isWritable() && isWritable_ != CoderInfo::TrueMatch ) ||
2140  ( !coderInfo.isWritable() && isWritable_ != CoderInfo::FalseMatch )) )
2141  continue;
2142 
2143  // Test isMultiFrame_
2144  if ( isMultiFrame_ != CoderInfo::AnyMatch &&
2145  (( coderInfo.isMultiFrame() && isMultiFrame_ != CoderInfo::TrueMatch ) ||
2146  ( !coderInfo.isMultiFrame() && isMultiFrame_ != CoderInfo::FalseMatch )) )
2147  continue;
2148 
2149  // Append matches to container
2150  container_->push_back( coderInfo );
2151  }
2152  // Intentionally ignore missing module errors
2153  catch ( Magick::ErrorModule& )
2154  {
2155  continue;
2156  }
2157  }
2158  coder_list=(char **) MagickCore::RelinquishMagickMemory( coder_list );
2159  ThrowPPException(false);
2160  }
2161 
2162  //
2163  // Fill container with color histogram.
2164  // Entries are of type "std::pair<Color,size_t>". Use the pair
2165  // "first" member to access the Color and the "second" member to access
2166  // the number of times the color occurs in the image.
2167  //
2168  // For example:
2169  //
2170  // Using <map>:
2171  //
2172  // Image image("image.miff");
2173  // map<Color,size_t> histogram;
2174  // colorHistogram( &histogram, image );
2175  // std::map<Color,size_t>::const_iterator p=histogram.begin();
2176  // while (p != histogram.end())
2177  // {
2178  // cout << setw(10) << (int)p->second << ": ("
2179  // << setw(quantum_width) << (int)p->first.redQuantum() << ","
2180  // << setw(quantum_width) << (int)p->first.greenQuantum() << ","
2181  // << setw(quantum_width) << (int)p->first.blueQuantum() << ")"
2182  // << endl;
2183  // p++;
2184  // }
2185  //
2186  // Using <vector>:
2187  //
2188  // Image image("image.miff");
2189  // std::vector<std::pair<Color,size_t> > histogram;
2190  // colorHistogram( &histogram, image );
2191  // std::vector<std::pair<Color,size_t> >::const_iterator p=histogram.begin();
2192  // while (p != histogram.end())
2193  // {
2194  // cout << setw(10) << (int)p->second << ": ("
2195  // << setw(quantum_width) << (int)p->first.redQuantum() << ","
2196  // << setw(quantum_width) << (int)p->first.greenQuantum() << ","
2197  // << setw(quantum_width) << (int)p->first.blueQuantum() << ")"
2198  // << endl;
2199  // p++;
2200  // }
2201 
2202  template <class Container >
2203  void colorHistogram( Container *histogram_, const Image image)
2204  {
2206 
2207  // Obtain histogram array
2208  size_t colors;
2209  MagickCore::PixelInfo *histogram_array =
2210  MagickCore::GetImageHistogram( image.constImage(), &colors, exceptionInfo );
2211  ThrowPPException(image.quiet());
2212 
2213  // Clear out container
2214  histogram_->clear();
2215 
2216  // Transfer histogram array to container
2217  for ( size_t i=0; i < colors; i++)
2218  {
2219  histogram_->insert( histogram_->end(), std::pair<const Color,size_t>
2220  ( Color(histogram_array[i]), (size_t) histogram_array[i].count) );
2221  }
2222 
2223  // Deallocate histogram array
2224  histogram_array=(MagickCore::PixelInfo *)
2225  MagickCore::RelinquishMagickMemory(histogram_array);
2226  }
2227 
2228  // Combines one or more images into a single image. The grayscale value of
2229  // the pixels of each image in the sequence is assigned in order to the
2230  // specified channels of the combined image. The typical ordering would be
2231  // image 1 => Red, 2 => Green, 3 => Blue, etc.
2232  template<class InputIterator >
2233  void combineImages(Image *combinedImage_,InputIterator first_,
2234  InputIterator last_,const ChannelType channel_,
2235  const ColorspaceType colorspace_)
2236  {
2238  *image;
2239 
2240  std::vector<ChannelType>
2241  channelMask;
2242 
2243  if (linkImages(first_,last_) == false)
2244  return;
2246  channelMaskImages(first_,last_,&channelMask,channel_);
2247  image=CombineImages(first_->image(),colorspace_,exceptionInfo);
2248  restoreChannelMaskImages(first_,last_,&channelMask);
2249  unlinkImages(first_,last_);
2250  combinedImage_->replaceImage(image);
2251  ThrowPPException(combinedImage_->quiet());
2252  }
2253 
2254  template <class Container>
2255  void cropToTiles(Container *tiledImages_,const Image image_,
2256  const Geometry &geometry_)
2257  {
2259  MagickCore::Image* images=CropImageToTiles(image_.constImage(),
2260  static_cast<std::string>(geometry_).c_str(),exceptionInfo);
2261  tiledImages_->clear();
2262  insertImages(tiledImages_,images);
2263  ThrowPPException(image_.quiet());
2264  }
2265 
2266  // Break down an image sequence into constituent parts. This is
2267  // useful for creating GIF or MNG animation sequences.
2268  template<class InputIterator,class Container>
2269  void deconstructImages(Container *deconstructedImages_,
2270  InputIterator first_,InputIterator last_)
2271  {
2272  bool
2273  quiet;
2274 
2276  *images;
2277 
2278  if (linkImages(first_,last_) == false)
2279  return;
2281  quiet=first_->quiet();
2282  images=CompareImagesLayers(first_->image(),CompareAnyLayer,exceptionInfo);
2283  unlinkImages(first_,last_);
2284 
2285  deconstructedImages_->clear();
2286  insertImages(deconstructedImages_,images);
2287 
2288  ThrowPPException(quiet);
2289  }
2290 
2291  //
2292  // Display an image sequence
2293  //
2294  template <class InputIterator>
2295  void displayImages(InputIterator first_,InputIterator last_)
2296  {
2297  if (linkImages(first_,last_) == false)
2298  return;
2300  MagickCore::DisplayImages(first_->imageInfo(),first_->image(),
2301  exceptionInfo);
2302  unlinkImages(first_,last_);
2303  ThrowPPException(first_->quiet());
2304  }
2305 
2306  // Applies a value to the image with an arithmetic, relational,
2307  // or logical operator to an image. Use these operations to lighten or darken
2308  // an image, to increase or decrease contrast in an image, or to produce the
2309  // "negative" of an image.
2310  template <class InputIterator >
2311  void evaluateImages( Image *evaluatedImage_,
2312  InputIterator first_,
2313  InputIterator last_,
2314  const MagickEvaluateOperator operator_ ) {
2315  if (linkImages(first_,last_) == false)
2316  return;
2318  MagickCore::Image* image = EvaluateImages( first_->image(), operator_, exceptionInfo );
2319  unlinkImages( first_, last_ );
2320  evaluatedImage_->replaceImage( image );
2321  ThrowPPException(evaluatedImage_->quiet());
2322  }
2323 
2324  // Merge a sequence of image frames which represent image layers.
2325  // This is useful for combining Photoshop layers into a single image.
2326  template <class InputIterator>
2327  void flattenImages( Image *flattendImage_,
2328  InputIterator first_,
2329  InputIterator last_ ) {
2330  if (linkImages(first_,last_) == false)
2331  return;
2333  MagickCore::Image* image = MagickCore::MergeImageLayers( first_->image(),
2334  FlattenLayer,exceptionInfo );
2335  unlinkImages( first_, last_ );
2336  flattendImage_->replaceImage( image );
2337  ThrowPPException(flattendImage_->quiet());
2338  }
2339 
2340  // Implements the discrete Fourier transform (DFT) of the image either as a
2341  // magnitude / phase or real / imaginary image pair.
2342  template <class Container >
2343  void forwardFourierTransformImage( Container *fourierImages_,
2344  const Image &image_ ) {
2346 
2347  // Build image list
2348  MagickCore::Image* images = ForwardFourierTransformImage(
2349  image_.constImage(), MagickTrue, exceptionInfo);
2350 
2351  // Ensure container is empty
2352  fourierImages_->clear();
2353 
2354  // Move images to container
2355  insertImages( fourierImages_, images );
2356 
2357  // Report any error
2358  ThrowPPException(image_.quiet());
2359  }
2360  template <class Container >
2361  void forwardFourierTransformImage( Container *fourierImages_,
2362  const Image &image_, const bool magnitude_ ) {
2364 
2365  // Build image list
2366  MagickCore::Image* images = ForwardFourierTransformImage(
2367  image_.constImage(), magnitude_ == true ? MagickTrue : MagickFalse,
2368  exceptionInfo);
2369 
2370  // Ensure container is empty
2371  fourierImages_->clear();
2372 
2373  // Move images to container
2374  insertImages( fourierImages_, images );
2375 
2376  // Report any error
2377  ThrowPPException(image_.quiet());
2378  }
2379 
2380  // Applies a mathematical expression to a sequence of images.
2381  template <class InputIterator>
2382  void fxImages(Image *fxImage_,InputIterator first_,InputIterator last_,
2383  const std::string expression)
2384  {
2386  *image;
2387 
2388  if (linkImages(first_,last_) == false)
2389  return;
2391  image=FxImage(first_->constImage(),expression.c_str(),exceptionInfo);
2392  unlinkImages(first_,last_);
2393  fxImage_->replaceImage(image);
2394  ThrowPPException(fxImage_->quiet());
2395  }
2396 
2397  // Replace the colors of a sequence of images with the closest color
2398  // from a reference image.
2399  // Set dither_ to true to enable dithering. Set measureError_ to
2400  // true in order to evaluate quantization error.
2401  template<class InputIterator>
2402  void mapImages(InputIterator first_,InputIterator last_,
2403  const Image& mapImage_,bool dither_=false,bool measureError_=false)
2404  {
2406  *image;
2407 
2408  MagickCore::QuantizeInfo
2409  quantizeInfo;
2410 
2411  if (linkImages(first_,last_) == false)
2412  return;
2414  MagickCore::GetQuantizeInfo(&quantizeInfo);
2415  quantizeInfo.dither_method = dither_ ? MagickCore::RiemersmaDitherMethod :
2416  MagickCore::NoDitherMethod;
2417  MagickCore::RemapImages(&quantizeInfo,first_->image(),
2418  (mapImage_.isValid() ? mapImage_.constImage() :
2419  (const MagickCore::Image*) NULL),exceptionInfo);
2420  unlinkImages(first_,last_);
2421  if (exceptionInfo->severity != MagickCore::UndefinedException)
2422  {
2423  unlinkImages(first_,last_);
2424  throwException(exceptionInfo,mapImage_.quiet());
2425  }
2426 
2427  image=first_->image();
2428  while(image != (MagickCore::Image *) NULL)
2429  {
2430  // Calculate quantization error
2431  if (measureError_)
2432  {
2433  MagickCore::GetImageQuantizeError(image,exceptionInfo);
2434  if (exceptionInfo->severity > MagickCore::UndefinedException)
2435  {
2436  unlinkImages(first_,last_);
2437  throwException(exceptionInfo,mapImage_.quiet());
2438  }
2439  }
2440 
2441  // Update DirectClass representation of pixels
2442  MagickCore::SyncImage(image,exceptionInfo);
2443  if (exceptionInfo->severity > MagickCore::UndefinedException)
2444  {
2445  unlinkImages(first_,last_);
2446  throwException(exceptionInfo,mapImage_.quiet());
2447  }
2448 
2449  // Next image
2450  image=image->next;
2451  }
2452 
2453  unlinkImages(first_,last_);
2454  (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
2455  }
2456 
2457  // Composes all the image layers from the current given
2458  // image onward to produce a single image of the merged layers.
2459  template <class InputIterator >
2460  void mergeImageLayers( Image *mergedImage_,
2461  InputIterator first_,
2462  InputIterator last_,
2463  const LayerMethod method_ ) {
2464  if (linkImages(first_,last_) == false)
2465  return;
2467  MagickCore::Image* image = MergeImageLayers( first_->image(), method_, exceptionInfo );
2468  unlinkImages( first_, last_ );
2469  mergedImage_->replaceImage( image );
2470  ThrowPPException(mergedImage_->quiet());
2471  }
2472 
2473  // Create a composite image by combining several separate images.
2474  template <class Container, class InputIterator>
2475  void montageImages(Container *montageImages_,InputIterator first_,
2476  InputIterator last_,const Montage &options_)
2477  {
2478  bool
2479  quiet;
2480 
2482  *images;
2483 
2484  MagickCore::MontageInfo
2485  *montageInfo;
2486 
2487  if (linkImages(first_,last_) == false)
2488  return;
2489 
2490  montageInfo=static_cast<MagickCore::MontageInfo*>(
2491  MagickCore::AcquireMagickMemory(sizeof(MagickCore::MontageInfo)));
2492 
2493  // Update montage options with those set in montageOpts_
2494  options_.updateMontageInfo(*montageInfo);
2495 
2496  // Update options which must transfer to image options
2497  if (options_.label().length() != 0)
2498  first_->label(options_.label());
2499 
2500  // Do montage
2502  quiet=first_->quiet();
2503  images=MagickCore::MontageImages(first_->image(),montageInfo,
2504  exceptionInfo);
2505 
2506  // Unlink linked image list
2507  unlinkImages(first_,last_);
2508 
2509  // Reset output container to pristine state
2510  montageImages_->clear();
2511 
2512  if (images != (MagickCore::Image *) NULL)
2513  insertImages(montageImages_,images);
2514 
2515  // Clean up any allocated data in montageInfo
2516  MagickCore::DestroyMontageInfo(montageInfo);
2517 
2518  // Report any montage error
2519  ThrowPPException(quiet);
2520 
2521  // Apply transparency to montage images
2522  if (montageImages_->size() > 0 && options_.transparentColor().isValid())
2523  for_each(montageImages_->begin(),montageImages_->end(),transparentImage(
2524  options_.transparentColor()));
2525  }
2526 
2527  // Morph a set of images
2528  template <class InputIterator, class Container >
2529  void morphImages(Container *morphedImages_,InputIterator first_,
2530  InputIterator last_,size_t frames_)
2531  {
2532  bool
2533  quiet;
2534 
2536  *images;
2537 
2538  if (linkImages(first_,last_) == false)
2539  return;
2540 
2542  quiet=first_->quiet();
2543  images=MagickCore::MorphImages(first_->image(),frames_,exceptionInfo);
2544 
2545  // Unlink image list
2546  unlinkImages(first_,last_);
2547 
2548  // Ensure container is empty
2549  morphedImages_->clear();
2550 
2551  // Move images to container
2552  insertImages(morphedImages_,images);
2553 
2554  // Report any error
2555  ThrowPPException(quiet);
2556  }
2557 
2558  // Inlay a number of images to form a single coherent picture.
2559  template <class InputIterator>
2560  void mosaicImages( Image *mosaicImage_,
2561  InputIterator first_,
2562  InputIterator last_ ) {
2563  if (linkImages(first_,last_) == false)
2564  return;
2566  MagickCore::Image* image = MagickCore::MergeImageLayers( first_->image(),
2567  MosaicLayer,exceptionInfo );
2568  unlinkImages( first_, last_ );
2569  mosaicImage_->replaceImage( image );
2570  ThrowPPException(mosaicImage_->quiet());
2571  }
2572 
2573  // Compares each image the GIF disposed forms of the previous image in
2574  // the sequence. From this it attempts to select the smallest cropped
2575  // image to replace each frame, while preserving the results of the
2576  // GIF animation.
2577  template <class InputIterator, class Container >
2578  void optimizeImageLayers(Container *optimizedImages_,InputIterator first_,
2579  InputIterator last_)
2580  {
2581  bool
2582  quiet;
2583 
2585  *images;
2586 
2587  if (linkImages(first_,last_) == false)
2588  return;
2589 
2591  quiet=first_->quiet();
2592  images=OptimizeImageLayers(first_->image(),exceptionInfo);
2593 
2594  unlinkImages(first_,last_);
2595 
2596  optimizedImages_->clear();
2597 
2598  insertImages(optimizedImages_,images);
2599 
2600  ThrowPPException(quiet);
2601  }
2602 
2603  // optimizeImagePlusLayers is exactly as optimizeImageLayers, but may
2604  // also add or even remove extra frames in the animation, if it improves
2605  // the total number of pixels in the resulting GIF animation.
2606  template <class InputIterator, class Container >
2607  void optimizePlusImageLayers(Container *optimizedImages_,
2608  InputIterator first_,InputIterator last_ )
2609  {
2610  bool
2611  quiet;
2612 
2614  *images;
2615 
2616  if (linkImages(first_,last_) == false)
2617  return;
2618 
2620  quiet=first_->quiet();
2621  images=OptimizePlusImageLayers(first_->image(),exceptionInfo);
2622 
2623  unlinkImages(first_,last_);
2624 
2625  optimizedImages_->clear();
2626 
2627  insertImages(optimizedImages_,images);
2628 
2629  ThrowPPException(quiet);
2630  }
2631 
2632  // Compares each image the GIF disposed forms of the previous image in the
2633  // sequence. Any pixel that does not change the displayed result is replaced
2634  // with transparency.
2635  template<class InputIterator>
2636  void optimizeTransparency(InputIterator first_,InputIterator last_)
2637  {
2638  if (linkImages(first_,last_) == false)
2639  return;
2641  OptimizeImageTransparency(first_->image(),exceptionInfo);
2642  unlinkImages(first_,last_ );
2643 
2644  ThrowPPException(first_->quiet());
2645  }
2646 
2647  // Adds the names of the profiles of the image to the container.
2648  template <class Container>
2649  void profileNames(Container *names_,const Image* image_)
2650  {
2651  const char*
2652  name;
2653 
2654  names_->clear();
2655 
2656  MagickCore::ResetImageProfileIterator(image_->constImage());
2657  name=MagickCore::GetNextImageProfile(image_->constImage());
2658  while (name != (const char *) NULL)
2659  {
2660  names_->push_back(std::string(name));
2661  name=MagickCore::GetNextImageProfile(image_->constImage());
2662  }
2663  }
2664 
2665  // Quantize colors in images using current quantization settings
2666  // Set measureError_ to true in order to measure quantization error
2667  template <class InputIterator>
2668  void quantizeImages(InputIterator first_,InputIterator last_,
2669  bool measureError_ = false)
2670  {
2671  if (linkImages(first_,last_) == false)
2672  return;
2674  MagickCore::QuantizeImages(first_->quantizeInfo(),first_->image(),
2675  exceptionInfo);
2676  unlinkImages(first_,last_);
2677 
2678  MagickCore::Image *image=first_->image();
2679  while (image != (MagickCore::Image *) NULL)
2680  {
2681  // Calculate quantization error
2682  if (measureError_)
2683  MagickCore::GetImageQuantizeError(image,exceptionInfo);
2684 
2685  // Update DirectClass representation of pixels
2686  MagickCore::SyncImage(image,exceptionInfo);
2687 
2688  image=image->next;
2689  }
2690  unlinkImages(first_,last_);
2691  ThrowPPException(first_->quiet());
2692  }
2693 
2694  // Read images into existing container (appending to container)
2695  template<class Container>
2696  void readImages(Container *sequence_,const std::string &imageSpec_,
2697  ReadOptions &options)
2698  {
2700  *images;
2701 
2702  MagickCore::ImageInfo
2703  *imageInfo;
2704 
2705  imageInfo=options.imageInfo();
2706  imageSpec_.copy(imageInfo->filename,MagickPathExtent-1);
2707  imageInfo->filename[imageSpec_.length()] = 0;
2709  images=MagickCore::ReadImage(imageInfo,exceptionInfo);
2710  insertImages(sequence_,images);
2711  ThrowPPException(options.quiet());
2712  }
2713 
2714  template<class Container>
2715  void readImages(Container *sequence_,const std::string &imageSpec_)
2716  {
2717  ReadOptions options;
2718  readImages(sequence_,imageSpec_,options);
2719  }
2720 
2721  template<class Container>
2722  void readImages(Container *sequence_,const Blob &blob_,ReadOptions &options)
2723  {
2725  *images;
2726 
2728  images=MagickCore::BlobToImage(options.imageInfo(),blob_.data(),
2729  blob_.length(),exceptionInfo);
2730  insertImages(sequence_,images);
2731  ThrowPPException(options.quiet());
2732  }
2733 
2734  template<class Container>
2735  void readImages(Container *sequence_,const Blob &blob_)
2736  {
2737  ReadOptions options;
2738  readImages(sequence_,blob_,options);
2739  }
2740 
2741  // Returns a separate grayscale image for each channel specified.
2742  template<class Container>
2743  void separateImages(Container *separatedImages_,Image &image_,
2744  const ChannelType channel_)
2745  {
2746  MagickCore::ChannelType
2747  channel_mask;
2748 
2750  *images;
2751 
2753  channel_mask=MagickCore::SetImageChannelMask(image_.image(),channel_);
2754  images=SeparateImages(image_.constImage(),exceptionInfo);
2755  MagickCore::SetPixelChannelMask(image_.image(),channel_mask);
2756 
2757  separatedImages_->clear();
2758  insertImages(separatedImages_,images);
2759 
2760  ThrowPPException(image_.quiet());
2761  }
2762 
2763  // Smush images from list into single image in either horizontal or
2764  // vertical direction.
2765  template<class InputIterator>
2766  void smushImages(Image *smushedImage_,InputIterator first_,
2767  InputIterator last_,const ssize_t offset_,bool stack_=false)
2768  {
2770  *newImage;
2771 
2772  if (linkImages(first_,last_) == false)
2773  return;
2775  newImage=MagickCore::SmushImages(first_->constImage(),
2776  (MagickBooleanType) stack_,offset_,exceptionInfo);
2777  unlinkImages(first_,last_);
2778  smushedImage_->replaceImage(newImage);
2779  ThrowPPException(smushedImage_->quiet());
2780  }
2781 
2782  // Write Images
2783  template <class InputIterator>
2784  void writeImages( InputIterator first_,
2785  InputIterator last_,
2786  const std::string &imageSpec_,
2787  bool adjoin_ = true ) {
2788 
2789  if (linkImages(first_,last_) == false)
2790  return;
2791 
2792  first_->adjoin( adjoin_ );
2793 
2795  ::ssize_t errorStat = MagickCore::WriteImages( first_->constImageInfo(),
2796  first_->image(),
2797  imageSpec_.c_str(),
2798  exceptionInfo );
2799  unlinkImages( first_, last_ );
2800 
2801  if ( errorStat != false )
2802  {
2803  (void) MagickCore::DestroyExceptionInfo( exceptionInfo );
2804  return;
2805  }
2806 
2807  ThrowPPException(first_->quiet());
2808  }
2809  // Write images to BLOB
2810  template <class InputIterator>
2811  void writeImages( InputIterator first_,
2812  InputIterator last_,
2813  Blob *blob_,
2814  bool adjoin_ = true) {
2815  if (linkImages(first_,last_) == false)
2816  return;
2817 
2818  first_->adjoin( adjoin_ );
2819 
2821  size_t length = 2048; // Efficient size for small images
2822  void* data = MagickCore::ImagesToBlob( first_->imageInfo(),
2823  first_->image(),
2824  &length,
2825  exceptionInfo);
2826  blob_->updateNoCopy( data, length, Magick::Blob::MallocAllocator );
2827 
2828  unlinkImages( first_, last_ );
2829 
2830  ThrowPPException(first_->quiet());
2831  }
2832 
2833 } // namespace Magick
2834 
2835 #endif // Magick_STL_header
void attributeNames(Container *names_, const Image *image_)
Definition: STL.h:2020
void smushImages(Image *smushedImage_, InputIterator first_, InputIterator last_, const ssize_t offset_, bool stack_=false)
Definition: STL.h:2766
class MagickPPExport Color
Definition: Color.h:16
void evaluateImages(Image *evaluatedImage_, InputIterator first_, InputIterator last_, const MagickEvaluateOperator operator_)
Definition: STL.h:2311
MagickPPExport const char * borderGeometryDefault
Definition: Image.cpp:32
void separateImages(Container *separatedImages_, Image &image_, const ChannelType channel_)
Definition: STL.h:2743
void averageImages(Image *averagedImage_, InputIterator first_, InputIterator last_)
Definition: STL.h:2039
void coderInfoList(Container *container_, CoderInfo::MatchType isReadable_=CoderInfo::AnyMatch, CoderInfo::MatchType isWritable_=CoderInfo::AnyMatch, CoderInfo::MatchType isMultiFrame_=CoderInfo::AnyMatch)
Definition: STL.h:2097
void mosaicImages(Image *mosaicImage_, InputIterator first_, InputIterator last_)
Definition: STL.h:2560
void unlinkImages(InputIterator first_, InputIterator last_)
Definition: STL.h:1951
const MagickCore::Image * constImage(void) const
Definition: Image.cpp:5000
void animateImages(InputIterator first_, InputIterator last_)
Definition: STL.h:1971
MagickPPExport const char * raiseGeometryDefault
Definition: Image.cpp:34
bool isReadable(void) const
Definition: CoderInfo.cpp:120
void coalesceImages(Container *coalescedImages_, InputIterator first_, InputIterator last_)
Definition: STL.h:2058
void restoreChannelMaskImages(InputIterator first_, InputIterator last_, Container *container_)
Definition: STL.h:1931
void quiet(const bool quiet_)
Definition: Image.cpp:1315
void appendImages(Image *appendedImage_, InputIterator first_, InputIterator last_, bool stack_=false)
Definition: STL.h:1985
void mergeImageLayers(Image *mergedImage_, InputIterator first_, InputIterator last_, const LayerMethod method_)
Definition: STL.h:2460
void forwardFourierTransformImage(Container *fourierImages_, const Image &image_)
Definition: STL.h:2343
void insertImages(Container *sequence_, MagickCore::Image *images_)
Definition: STL.h:1867
void combineImages(Image *combinedImage_, InputIterator first_, InputIterator last_, const ChannelType channel_, const ColorspaceType colorspace_)
Definition: STL.h:2233
bool linkImages(InputIterator first_, InputIterator last_)
Definition: STL.h:1897
MagickCore::Image * replaceImage(MagickCore::Image *replacement_)
Definition: Image.cpp:5045
void optimizeImageLayers(Container *optimizedImages_, InputIterator first_, InputIterator last_)
Definition: STL.h:2578
void cropToTiles(Container *tiledImages_, const Image image_, const Geometry &geometry_)
Definition: STL.h:2255
void transparentColor(const Color &transparentColor_)
Definition: Montage.cpp:170
void flattenImages(Image *flattendImage_, InputIterator first_, InputIterator last_)
Definition: STL.h:2327
void colorHistogram(Container *histogram_, const Image image)
Definition: STL.h:2203
MagickPPExport void throwException(MagickCore::ExceptionInfo *exception_, const bool quiet_=false)
MagickCore::Image *& image(void)
Definition: Image.cpp:4995
void montageImages(Container *montageImages_, InputIterator first_, InputIterator last_, const Montage &options_)
Definition: STL.h:2475
void updateNoCopy(void *data_, const size_t length_, const Allocator allocator_=NewAllocator)
Definition: Blob.cpp:121
void quiet(const bool quiet_)
Definition: STL.cpp:849
#define MagickPPExport
Definition: Include.h:268
bool isMultiFrame(void) const
Definition: CoderInfo.cpp:130
std::vector< Magick::Drawable > DrawableList
Definition: Drawable.h:144
void writeImages(InputIterator first_, InputIterator last_, const std::string &imageSpec_, bool adjoin_=true)
Definition: STL.h:2784
void mapImages(InputIterator first_, InputIterator last_, const Image &mapImage_, bool dither_=false, bool measureError_=false)
Definition: STL.h:2402
void readImages(Container *sequence_, const std::string &imageSpec_, ReadOptions &options)
Definition: STL.h:2696
MagickPPExport const char * frameGeometryDefault
Definition: Image.cpp:33
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:807
#define ThrowPPException(quiet)
Definition: Include.h:1545
void fxImages(Image *fxImage_, InputIterator first_, InputIterator last_, const std::string expression)
Definition: STL.h:2382
void isValid(const bool isValid_)
Definition: Image.cpp:1075
void deconstructImages(Container *deconstructedImages_, InputIterator first_, InputIterator last_)
Definition: STL.h:2269
const void * data(void) const
Definition: Blob.cpp:103
bool isWritable(void) const
Definition: CoderInfo.cpp:125
void channelMaskImages(InputIterator first_, InputIterator last_, Container *container_, const ChannelType channel_)
Definition: STL.h:1848
void morphImages(Container *morphedImages_, InputIterator first_, InputIterator last_, size_t frames_)
Definition: STL.h:2529
void artifactNames(Container *names_, const Image *image_)
Definition: STL.h:2002
class MagickPPExport Image
Definition: Drawable.h:720
MagickCore::ImageInfo * imageInfo(void)
Definition: STL.cpp:859
Definition: Blob.h:15
size_t length(void) const
Definition: Blob.cpp:108
void displayImages(InputIterator first_, InputIterator last_)
Definition: STL.h:2295
void label(const std::string &label_)
Definition: Montage.cpp:100
#define GetPPException
Definition: Include.h:1526
void optimizePlusImageLayers(Container *optimizedImages_, InputIterator first_, InputIterator last_)
Definition: STL.h:2607
void optimizeTransparency(InputIterator first_, InputIterator last_)
Definition: STL.h:2636
void profileNames(Container *names_, const Image *image_)
Definition: STL.h:2649
virtual void updateMontageInfo(MagickCore::MontageInfo &montageInfo_) const
Definition: Montage.cpp:180
void quantizeImages(InputIterator first_, InputIterator last_, bool measureError_=false)
Definition: STL.h:2668