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_,
2059  InputIterator first_,
2060  InputIterator last_ ) {
2061  if (linkImages(first_,last_) == false)
2062  return;
2064  MagickCore::Image* images = MagickCore::CoalesceImages( first_->image(),
2065  exceptionInfo);
2066  // Unlink image list
2067  unlinkImages( first_, last_ );
2068 
2069  // Ensure container is empty
2070  coalescedImages_->clear();
2071 
2072  // Move images to container
2073  insertImages( coalescedImages_, images );
2074 
2075  // Report any error
2076  ThrowPPException(first_->quiet());
2077  }
2078 
2079  // Return format coders matching specified conditions.
2080  //
2081  // The default (if no match terms are supplied) is to return all
2082  // available format coders.
2083  //
2084  // For example, to return all readable formats:
2085  // list<CoderInfo> coderList;
2086  // coderInfoList( &coderList, CoderInfo::TrueMatch, CoderInfo::AnyMatch, CoderInfo::AnyMatch)
2087  //
2088  template <class Container >
2089  void coderInfoList( Container *container_,
2093  ) {
2094  // Obtain first entry in MagickInfo list
2095  size_t number_formats;
2097  char **coder_list =
2098  MagickCore::GetMagickList( "*", &number_formats, exceptionInfo );
2099  if( !coder_list )
2100  {
2101  throwException(exceptionInfo);
2102  throwExceptionExplicit(MagickCore::MissingDelegateError,
2103  "Coder array not returned!", 0 );
2104  }
2105 
2106  // Clear out container
2107  container_->clear();
2108 
2109  for ( ::ssize_t i=0; i < (::ssize_t) number_formats; i++)
2110  {
2111  const MagickCore::MagickInfo *magick_info =
2112  MagickCore::GetMagickInfo( coder_list[i], exceptionInfo );
2113  coder_list[i]=(char *)
2114  MagickCore::RelinquishMagickMemory( coder_list[i] );
2115 
2116  // Skip stealth coders
2117  if ( MagickCore::GetMagickStealth(magick_info) )
2118  continue;
2119 
2120  try {
2121  CoderInfo coderInfo( magick_info->name );
2122 
2123  // Test isReadable_
2124  if ( isReadable_ != CoderInfo::AnyMatch &&
2125  (( coderInfo.isReadable() && isReadable_ != CoderInfo::TrueMatch ) ||
2126  ( !coderInfo.isReadable() && isReadable_ != CoderInfo::FalseMatch )) )
2127  continue;
2128 
2129  // Test isWritable_
2130  if ( isWritable_ != CoderInfo::AnyMatch &&
2131  (( coderInfo.isWritable() && isWritable_ != CoderInfo::TrueMatch ) ||
2132  ( !coderInfo.isWritable() && isWritable_ != CoderInfo::FalseMatch )) )
2133  continue;
2134 
2135  // Test isMultiFrame_
2136  if ( isMultiFrame_ != CoderInfo::AnyMatch &&
2137  (( coderInfo.isMultiFrame() && isMultiFrame_ != CoderInfo::TrueMatch ) ||
2138  ( !coderInfo.isMultiFrame() && isMultiFrame_ != CoderInfo::FalseMatch )) )
2139  continue;
2140 
2141  // Append matches to container
2142  container_->push_back( coderInfo );
2143  }
2144  // Intentionally ignore missing module errors
2145  catch ( Magick::ErrorModule )
2146  {
2147  continue;
2148  }
2149  }
2150  coder_list=(char **) MagickCore::RelinquishMagickMemory( coder_list );
2151  ThrowPPException(false);
2152  }
2153 
2154  //
2155  // Fill container with color histogram.
2156  // Entries are of type "std::pair<Color,size_t>". Use the pair
2157  // "first" member to access the Color and the "second" member to access
2158  // the number of times the color occurs in the image.
2159  //
2160  // For example:
2161  //
2162  // Using <map>:
2163  //
2164  // Image image("image.miff");
2165  // map<Color,size_t> histogram;
2166  // colorHistogram( &histogram, image );
2167  // std::map<Color,size_t>::const_iterator p=histogram.begin();
2168  // while (p != histogram.end())
2169  // {
2170  // cout << setw(10) << (int)p->second << ": ("
2171  // << setw(quantum_width) << (int)p->first.redQuantum() << ","
2172  // << setw(quantum_width) << (int)p->first.greenQuantum() << ","
2173  // << setw(quantum_width) << (int)p->first.blueQuantum() << ")"
2174  // << endl;
2175  // p++;
2176  // }
2177  //
2178  // Using <vector>:
2179  //
2180  // Image image("image.miff");
2181  // std::vector<std::pair<Color,size_t> > histogram;
2182  // colorHistogram( &histogram, image );
2183  // std::vector<std::pair<Color,size_t> >::const_iterator p=histogram.begin();
2184  // while (p != histogram.end())
2185  // {
2186  // cout << setw(10) << (int)p->second << ": ("
2187  // << setw(quantum_width) << (int)p->first.redQuantum() << ","
2188  // << setw(quantum_width) << (int)p->first.greenQuantum() << ","
2189  // << setw(quantum_width) << (int)p->first.blueQuantum() << ")"
2190  // << endl;
2191  // p++;
2192  // }
2193 
2194  template <class Container >
2195  void colorHistogram( Container *histogram_, const Image image)
2196  {
2198 
2199  // Obtain histogram array
2200  size_t colors;
2201  MagickCore::PixelInfo *histogram_array =
2202  MagickCore::GetImageHistogram( image.constImage(), &colors, exceptionInfo );
2203  ThrowPPException(image.quiet());
2204 
2205  // Clear out container
2206  histogram_->clear();
2207 
2208  // Transfer histogram array to container
2209  for ( size_t i=0; i < colors; i++)
2210  {
2211  histogram_->insert( histogram_->end(), std::pair<const Color,size_t>
2212  ( Color(histogram_array[i]), (size_t) histogram_array[i].count) );
2213  }
2214 
2215  // Deallocate histogram array
2216  histogram_array=(MagickCore::PixelInfo *)
2217  MagickCore::RelinquishMagickMemory(histogram_array);
2218  }
2219 
2220  // Combines one or more images into a single image. The grayscale value of
2221  // the pixels of each image in the sequence is assigned in order to the
2222  // specified channels of the combined image. The typical ordering would be
2223  // image 1 => Red, 2 => Green, 3 => Blue, etc.
2224  template<class InputIterator >
2225  void combineImages(Image *combinedImage_,InputIterator first_,
2226  InputIterator last_,const ChannelType channel_,
2227  const ColorspaceType colorspace_)
2228  {
2230  *image;
2231 
2232  std::vector<ChannelType>
2233  channelMask;
2234 
2235  if (linkImages(first_,last_) == false)
2236  return;
2238  channelMaskImages(first_,last_,&channelMask,channel_);
2239  image=CombineImages(first_->image(),colorspace_,exceptionInfo);
2240  restoreChannelMaskImages(first_,last_,&channelMask);
2241  unlinkImages(first_,last_);
2242  combinedImage_->replaceImage(image);
2243  ThrowPPException(combinedImage_->quiet());
2244  }
2245 
2246  template <class Container>
2247  void cropToTiles(Container *tiledImages_,const Image image_,
2248  const Geometry &geometry_)
2249  {
2251  MagickCore::Image* images=CropImageToTiles(image_.constImage(),
2252  static_cast<std::string>(geometry_).c_str(),exceptionInfo);
2253  tiledImages_->clear();
2254  insertImages(tiledImages_,images);
2255  ThrowPPException(image_.quiet());
2256  }
2257 
2258  // Break down an image sequence into constituent parts. This is
2259  // useful for creating GIF or MNG animation sequences.
2260  template<class InputIterator,class Container>
2261  void deconstructImages(Container *deconstructedImages_,
2262  InputIterator first_,InputIterator last_)
2263  {
2265  *images;
2266 
2267  if (linkImages(first_,last_) == false)
2268  return;
2270  images=CompareImagesLayers(first_->image(),CompareAnyLayer,exceptionInfo);
2271  unlinkImages(first_,last_);
2272 
2273  deconstructedImages_->clear();
2274  insertImages(deconstructedImages_,images);
2275 
2276  ThrowPPException(first_->quiet());
2277  }
2278 
2279  //
2280  // Display an image sequence
2281  //
2282  template <class InputIterator>
2283  void displayImages(InputIterator first_,InputIterator last_)
2284  {
2285  if (linkImages(first_,last_) == false)
2286  return;
2288  MagickCore::DisplayImages(first_->imageInfo(),first_->image(),
2289  exceptionInfo);
2290  unlinkImages(first_,last_);
2291  ThrowPPException(first_->quiet());
2292  }
2293 
2294  // Applies a value to the image with an arithmetic, relational,
2295  // or logical operator to an image. Use these operations to lighten or darken
2296  // an image, to increase or decrease contrast in an image, or to produce the
2297  // "negative" of an image.
2298  template <class InputIterator >
2299  void evaluateImages( Image *evaluatedImage_,
2300  InputIterator first_,
2301  InputIterator last_,
2302  const MagickEvaluateOperator operator_ ) {
2303  if (linkImages(first_,last_) == false)
2304  return;
2306  MagickCore::Image* image = EvaluateImages( first_->image(), operator_, exceptionInfo );
2307  unlinkImages( first_, last_ );
2308  evaluatedImage_->replaceImage( image );
2309  ThrowPPException(evaluatedImage_->quiet());
2310  }
2311 
2312  // Merge a sequence of image frames which represent image layers.
2313  // This is useful for combining Photoshop layers into a single image.
2314  template <class InputIterator>
2315  void flattenImages( Image *flattendImage_,
2316  InputIterator first_,
2317  InputIterator last_ ) {
2318  if (linkImages(first_,last_) == false)
2319  return;
2321  MagickCore::Image* image = MagickCore::MergeImageLayers( first_->image(),
2322  FlattenLayer,exceptionInfo );
2323  unlinkImages( first_, last_ );
2324  flattendImage_->replaceImage( image );
2325  ThrowPPException(flattendImage_->quiet());
2326  }
2327 
2328  // Implements the discrete Fourier transform (DFT) of the image either as a
2329  // magnitude / phase or real / imaginary image pair.
2330  template <class Container >
2331  void forwardFourierTransformImage( Container *fourierImages_,
2332  const Image &image_ ) {
2334 
2335  // Build image list
2336  MagickCore::Image* images = ForwardFourierTransformImage(
2337  image_.constImage(), MagickTrue, exceptionInfo);
2338 
2339  // Ensure container is empty
2340  fourierImages_->clear();
2341 
2342  // Move images to container
2343  insertImages( fourierImages_, images );
2344 
2345  // Report any error
2346  ThrowPPException(image_.quiet());
2347  }
2348  template <class Container >
2349  void forwardFourierTransformImage( Container *fourierImages_,
2350  const Image &image_, const bool magnitude_ ) {
2352 
2353  // Build image list
2354  MagickCore::Image* images = ForwardFourierTransformImage(
2355  image_.constImage(), magnitude_ == true ? MagickTrue : MagickFalse,
2356  exceptionInfo);
2357 
2358  // Ensure container is empty
2359  fourierImages_->clear();
2360 
2361  // Move images to container
2362  insertImages( fourierImages_, images );
2363 
2364  // Report any error
2365  ThrowPPException(image_.quiet());
2366  }
2367 
2368  // Applies a mathematical expression to a sequence of images.
2369  template <class InputIterator>
2370  void fxImages(Image *fxImage_,InputIterator first_,InputIterator last_,
2371  const std::string expression)
2372  {
2374  *image;
2375 
2376  if (linkImages(first_,last_) == false)
2377  return;
2379  image=FxImage(first_->constImage(),expression.c_str(),exceptionInfo);
2380  unlinkImages(first_,last_);
2381  fxImage_->replaceImage(image);
2382  ThrowPPException(fxImage_->quiet());
2383  }
2384 
2385  // Replace the colors of a sequence of images with the closest color
2386  // from a reference image.
2387  // Set dither_ to true to enable dithering. Set measureError_ to
2388  // true in order to evaluate quantization error.
2389  template<class InputIterator>
2390  void mapImages(InputIterator first_,InputIterator last_,
2391  const Image& mapImage_,bool dither_=false,bool measureError_=false)
2392  {
2394  *image;
2395 
2396  MagickCore::QuantizeInfo
2397  quantizeInfo;
2398 
2399  if (linkImages(first_,last_) == false)
2400  return;
2402  MagickCore::GetQuantizeInfo(&quantizeInfo);
2403  quantizeInfo.dither_method = dither_ ? MagickCore::RiemersmaDitherMethod :
2404  MagickCore::NoDitherMethod;
2405  MagickCore::RemapImages(&quantizeInfo,first_->image(),
2406  (mapImage_.isValid() ? mapImage_.constImage() :
2407  (const MagickCore::Image*) NULL),exceptionInfo);
2408  unlinkImages(first_,last_);
2409  if (exceptionInfo->severity != MagickCore::UndefinedException)
2410  {
2411  unlinkImages(first_,last_);
2412  throwException(exceptionInfo,mapImage_.quiet());
2413  }
2414 
2415  image=first_->image();
2416  while(image != (MagickCore::Image *) NULL)
2417  {
2418  // Calculate quantization error
2419  if (measureError_)
2420  {
2421  MagickCore::GetImageQuantizeError(image,exceptionInfo);
2422  if (exceptionInfo->severity > MagickCore::UndefinedException)
2423  {
2424  unlinkImages(first_,last_);
2425  throwException(exceptionInfo,mapImage_.quiet());
2426  }
2427  }
2428 
2429  // Update DirectClass representation of pixels
2430  MagickCore::SyncImage(image,exceptionInfo);
2431  if (exceptionInfo->severity > MagickCore::UndefinedException)
2432  {
2433  unlinkImages(first_,last_);
2434  throwException(exceptionInfo,mapImage_.quiet());
2435  }
2436 
2437  // Next image
2438  image=image->next;
2439  }
2440 
2441  unlinkImages(first_,last_);
2442  (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
2443  }
2444 
2445  // Composes all the image layers from the current given
2446  // image onward to produce a single image of the merged layers.
2447  template <class InputIterator >
2448  void mergeImageLayers( Image *mergedImage_,
2449  InputIterator first_,
2450  InputIterator last_,
2451  const LayerMethod method_ ) {
2452  if (linkImages(first_,last_) == false)
2453  return;
2455  MagickCore::Image* image = MergeImageLayers( first_->image(), method_, exceptionInfo );
2456  unlinkImages( first_, last_ );
2457  mergedImage_->replaceImage( image );
2458  ThrowPPException(mergedImage_->quiet());
2459  }
2460 
2461  // Create a composite image by combining several separate images.
2462  template <class Container, class InputIterator>
2463  void montageImages(Container *montageImages_,InputIterator first_,
2464  InputIterator last_,const Montage &options_)
2465  {
2467  *images;
2468 
2469  MagickCore::MontageInfo
2470  *montageInfo;
2471 
2472  if (linkImages(first_,last_) == false)
2473  return;
2474 
2475  montageInfo=static_cast<MagickCore::MontageInfo*>(
2476  MagickCore::AcquireMagickMemory(sizeof(MagickCore::MontageInfo)));
2477 
2478  // Update montage options with those set in montageOpts_
2479  options_.updateMontageInfo(*montageInfo);
2480 
2481  // Update options which must transfer to image options
2482  if (options_.label().length() != 0)
2483  first_->label(options_.label());
2484 
2485  // Do montage
2487  images=MagickCore::MontageImages(first_->image(),montageInfo,
2488  exceptionInfo);
2489 
2490  // Unlink linked image list
2491  unlinkImages(first_,last_);
2492 
2493  // Reset output container to pristine state
2494  montageImages_->clear();
2495 
2496  if (images != (MagickCore::Image *) NULL)
2497  insertImages(montageImages_,images);
2498 
2499  // Clean up any allocated data in montageInfo
2500  MagickCore::DestroyMontageInfo(montageInfo);
2501 
2502  // Report any montage error
2503  ThrowPPException(first_->quiet());
2504 
2505  // Apply transparency to montage images
2506  if (montageImages_->size() > 0 && options_.transparentColor().isValid())
2507  for_each(montageImages_->begin(),montageImages_->end(),transparentImage(
2508  options_.transparentColor()));
2509  }
2510 
2511  // Morph a set of images
2512  template <class InputIterator, class Container >
2513  void morphImages( Container *morphedImages_,
2514  InputIterator first_,
2515  InputIterator last_,
2516  size_t frames_ ) {
2517  if (linkImages(first_,last_) == false)
2518  return;
2520 
2521  MagickCore::Image* images = MagickCore::MorphImages( first_->image(), frames_,
2522  exceptionInfo);
2523  // Unlink image list
2524  unlinkImages( first_, last_ );
2525 
2526  // Ensure container is empty
2527  morphedImages_->clear();
2528 
2529  // Move images to container
2530  insertImages( morphedImages_, images );
2531 
2532  // Report any error
2533  ThrowPPException(first_->quiet());
2534  }
2535 
2536  // Inlay a number of images to form a single coherent picture.
2537  template <class InputIterator>
2538  void mosaicImages( Image *mosaicImage_,
2539  InputIterator first_,
2540  InputIterator last_ ) {
2541  if (linkImages(first_,last_) == false)
2542  return;
2544  MagickCore::Image* image = MagickCore::MergeImageLayers( first_->image(),
2545  MosaicLayer,exceptionInfo );
2546  unlinkImages( first_, last_ );
2547  mosaicImage_->replaceImage( image );
2548  ThrowPPException(mosaicImage_->quiet());
2549  }
2550 
2551  // Compares each image the GIF disposed forms of the previous image in
2552  // the sequence. From this it attempts to select the smallest cropped
2553  // image to replace each frame, while preserving the results of the
2554  // GIF animation.
2555  template <class InputIterator, class Container >
2556  void optimizeImageLayers( Container *optimizedImages_,
2557  InputIterator first_,
2558  InputIterator last_ ) {
2559  if (linkImages(first_,last_) == false)
2560  return;
2562  MagickCore::Image* images = OptimizeImageLayers( first_->image(), exceptionInfo );
2563 
2564  unlinkImages( first_, last_ );
2565 
2566  optimizedImages_->clear();
2567 
2568  insertImages( optimizedImages_, images );
2569 
2570  ThrowPPException(first_->quiet());
2571  }
2572 
2573  // optimizeImagePlusLayers is exactly as optimizeImageLayers, but may
2574  // also add or even remove extra frames in the animation, if it improves
2575  // the total number of pixels in the resulting GIF animation.
2576  template <class InputIterator, class Container >
2577  void optimizePlusImageLayers( Container *optimizedImages_,
2578  InputIterator first_,
2579  InputIterator last_ ) {
2580  if (linkImages(first_,last_) == false)
2581  return;
2583  MagickCore::Image* images = OptimizePlusImageLayers( first_->image(), exceptionInfo );
2584 
2585  unlinkImages( first_, last_ );
2586 
2587  optimizedImages_->clear();
2588 
2589  insertImages( optimizedImages_, images );
2590 
2591  ThrowPPDrawException(first_->quiet());
2592  }
2593 
2594  // Compares each image the GIF disposed forms of the previous image in the
2595  // sequence. Any pixel that does not change the displayed result is replaced
2596  // with transparency.
2597  template<class InputIterator>
2598  void optimizeTransparency(InputIterator first_,InputIterator last_)
2599  {
2600  if (linkImages(first_,last_) == false)
2601  return;
2603  OptimizeImageTransparency(first_->image(),exceptionInfo);
2604  unlinkImages(first_,last_ );
2605 
2606  ThrowPPException(first_->quiet());
2607  }
2608 
2609  // Adds the names of the profiles of the image to the container.
2610  template <class Container>
2611  void profileNames(Container *names_,const Image* image_)
2612  {
2613  const char*
2614  name;
2615 
2616  names_->clear();
2617 
2618  MagickCore::ResetImageProfileIterator(image_->constImage());
2619  name=MagickCore::GetNextImageProfile(image_->constImage());
2620  while (name != (const char *) NULL)
2621  {
2622  names_->push_back(std::string(name));
2623  name=MagickCore::GetNextImageProfile(image_->constImage());
2624  }
2625  }
2626 
2627  // Quantize colors in images using current quantization settings
2628  // Set measureError_ to true in order to measure quantization error
2629  template <class InputIterator>
2630  void quantizeImages(InputIterator first_,InputIterator last_,
2631  bool measureError_ = false)
2632  {
2633  if (linkImages(first_,last_) == false)
2634  return;
2636  MagickCore::QuantizeImages(first_->quantizeInfo(),first_->image(),
2637  exceptionInfo);
2638  unlinkImages(first_,last_);
2639 
2640  MagickCore::Image *image=first_->image();
2641  while (image != (MagickCore::Image *) NULL)
2642  {
2643  // Calculate quantization error
2644  if (measureError_)
2645  MagickCore::GetImageQuantizeError(image,exceptionInfo);
2646 
2647  // Update DirectClass representation of pixels
2648  MagickCore::SyncImage(image,exceptionInfo);
2649 
2650  image=image->next;
2651  }
2652  unlinkImages(first_,last_);
2653  ThrowPPException(first_->quiet());
2654  }
2655 
2656  // Read images into existing container (appending to container)
2657  template<class Container>
2658  void readImages(Container *sequence_,const std::string &imageSpec_,
2659  ReadOptions &options)
2660  {
2662  *images;
2663 
2664  MagickCore::ImageInfo
2665  *imageInfo;
2666 
2667  imageInfo=options.imageInfo();
2668  imageSpec_.copy(imageInfo->filename,MagickPathExtent-1);
2669  imageInfo->filename[imageSpec_.length()] = 0;
2671  images=MagickCore::ReadImage(imageInfo,exceptionInfo);
2672  insertImages(sequence_,images);
2673  ThrowPPException(options.quiet());
2674  }
2675 
2676  template<class Container>
2677  void readImages(Container *sequence_,const std::string &imageSpec_)
2678  {
2679  ReadOptions options;
2680  readImages(sequence_,imageSpec_,options);
2681  }
2682 
2683  template<class Container>
2684  void readImages(Container *sequence_,const Blob &blob_,ReadOptions &options)
2685  {
2687  *images;
2688 
2690  images=MagickCore::BlobToImage(options.imageInfo(),blob_.data(),
2691  blob_.length(),exceptionInfo);
2692  insertImages(sequence_,images);
2693  ThrowPPException(options.quiet());
2694  }
2695 
2696  template<class Container>
2697  void readImages(Container *sequence_,const Blob &blob_)
2698  {
2699  ReadOptions options;
2700  readImages(sequence_,blob_,options);
2701  }
2702 
2703  // Returns a separate grayscale image for each channel specified.
2704  template<class Container>
2705  void separateImages(Container *separatedImages_,Image &image_,
2706  const ChannelType channel_)
2707  {
2708  MagickCore::ChannelType
2709  channel_mask;
2710 
2712  *images;
2713 
2715  channel_mask=MagickCore::SetImageChannelMask(image_.image(),channel_);
2716  images=SeparateImages(image_.constImage(),exceptionInfo);
2717  MagickCore::SetPixelChannelMask(image_.image(),channel_mask);
2718 
2719  separatedImages_->clear();
2720  insertImages(separatedImages_,images);
2721 
2722  ThrowPPException(image_.quiet());
2723  }
2724 
2725  // Smush images from list into single image in either horizontal or
2726  // vertical direction.
2727  template<class InputIterator>
2728  void smushImages(Image *smushedImage_,InputIterator first_,
2729  InputIterator last_,const ssize_t offset_,bool stack_=false)
2730  {
2732  *newImage;
2733 
2734  if (linkImages(first_,last_) == false)
2735  return;
2737  newImage=MagickCore::SmushImages(first_->constImage(),
2738  (MagickBooleanType) stack_,offset_,exceptionInfo);
2739  unlinkImages(first_,last_);
2740  smushedImage_->replaceImage(newImage);
2741  ThrowPPException(smushedImage_->quiet());
2742  }
2743 
2744  // Write Images
2745  template <class InputIterator>
2746  void writeImages( InputIterator first_,
2747  InputIterator last_,
2748  const std::string &imageSpec_,
2749  bool adjoin_ = true ) {
2750 
2751  if (linkImages(first_,last_) == false)
2752  return;
2753 
2754  first_->adjoin( adjoin_ );
2755 
2757  ::ssize_t errorStat = MagickCore::WriteImages( first_->constImageInfo(),
2758  first_->image(),
2759  imageSpec_.c_str(),
2760  exceptionInfo );
2761  unlinkImages( first_, last_ );
2762 
2763  if ( errorStat != false )
2764  {
2765  (void) MagickCore::DestroyExceptionInfo( exceptionInfo );
2766  return;
2767  }
2768 
2769  ThrowPPException(first_->quiet());
2770  }
2771  // Write images to BLOB
2772  template <class InputIterator>
2773  void writeImages( InputIterator first_,
2774  InputIterator last_,
2775  Blob *blob_,
2776  bool adjoin_ = true) {
2777  if (linkImages(first_,last_) == false)
2778  return;
2779 
2780  first_->adjoin( adjoin_ );
2781 
2783  size_t length = 2048; // Efficient size for small images
2784  void* data = MagickCore::ImagesToBlob( first_->imageInfo(),
2785  first_->image(),
2786  &length,
2787  exceptionInfo);
2788  blob_->updateNoCopy( data, length, Magick::Blob::MallocAllocator );
2789 
2790  unlinkImages( first_, last_ );
2791 
2792  ThrowPPException(first_->quiet());
2793  }
2794 
2795 } // namespace Magick
2796 
2797 #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:2728
class MagickPPExport Color
Definition: Color.h:16
void evaluateImages(Image *evaluatedImage_, InputIterator first_, InputIterator last_, const MagickEvaluateOperator operator_)
Definition: STL.h:2299
MagickPPExport const char * borderGeometryDefault
Definition: Image.cpp:32
void separateImages(Container *separatedImages_, Image &image_, const ChannelType channel_)
Definition: STL.h:2705
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:2089
void mosaicImages(Image *mosaicImage_, InputIterator first_, InputIterator last_)
Definition: STL.h:2538
void unlinkImages(InputIterator first_, InputIterator last_)
Definition: STL.h:1951
const MagickCore::Image * constImage(void) const
Definition: Image.cpp:4987
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:1308
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:2448
void forwardFourierTransformImage(Container *fourierImages_, const Image &image_)
Definition: STL.h:2331
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:2225
bool linkImages(InputIterator first_, InputIterator last_)
Definition: STL.h:1897
MagickCore::Image * replaceImage(MagickCore::Image *replacement_)
Definition: Image.cpp:5032
void optimizeImageLayers(Container *optimizedImages_, InputIterator first_, InputIterator last_)
Definition: STL.h:2556
void cropToTiles(Container *tiledImages_, const Image image_, const Geometry &geometry_)
Definition: STL.h:2247
void transparentColor(const Color &transparentColor_)
Definition: Montage.cpp:170
void flattenImages(Image *flattendImage_, InputIterator first_, InputIterator last_)
Definition: STL.h:2315
void colorHistogram(Container *histogram_, const Image image)
Definition: STL.h:2195
MagickPPExport void throwException(MagickCore::ExceptionInfo *exception_, const bool quiet_=false)
MagickCore::Image *& image(void)
Definition: Image.cpp:4982
void montageImages(Container *montageImages_, InputIterator first_, InputIterator last_, const Montage &options_)
Definition: STL.h:2463
void updateNoCopy(void *data_, const size_t length_, const Allocator allocator_=NewAllocator)
Definition: Blob.cpp:121
#define ThrowPPDrawException(quiet)
Definition: Include.h:1541
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:2746
void mapImages(InputIterator first_, InputIterator last_, const Image &mapImage_, bool dither_=false, bool measureError_=false)
Definition: STL.h:2390
void readImages(Container *sequence_, const std::string &imageSpec_, ReadOptions &options)
Definition: STL.h:2658
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:1544
void fxImages(Image *fxImage_, InputIterator first_, InputIterator last_, const std::string expression)
Definition: STL.h:2370
void isValid(const bool isValid_)
Definition: Image.cpp:1068
void deconstructImages(Container *deconstructedImages_, InputIterator first_, InputIterator last_)
Definition: STL.h:2261
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:2513
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:2283
void label(const std::string &label_)
Definition: Montage.cpp:100
#define GetPPException
Definition: Include.h:1525
void optimizePlusImageLayers(Container *optimizedImages_, InputIterator first_, InputIterator last_)
Definition: STL.h:2577
void optimizeTransparency(InputIterator first_, InputIterator last_)
Definition: STL.h:2598
void profileNames(Container *names_, const Image *image_)
Definition: STL.h:2611
virtual void updateMontageInfo(MagickCore::MontageInfo &montageInfo_) const
Definition: Montage.cpp:180
void quantizeImages(InputIterator first_, InputIterator last_, bool measureError_=false)
Definition: STL.h:2630