Image.h revision 2fcdcaf5f27967318e07808b67498cceac3b4125
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-2015
5//
6// Definition of Image, the representation of a single image in Magick++
7//
8
9#if !defined(Magick_Image_header)
10#define Magick_Image_header
11
12#include "Magick++/Include.h"
13#include <string>
14#include <list>
15#include "Magick++/Blob.h"
16#include "Magick++/Color.h"
17#include "Magick++/Drawable.h"
18#include "Magick++/Exception.h"
19#include "Magick++/Geometry.h"
20#include "Magick++/Statistic.h"
21#include "Magick++/TypeMetric.h"
22
23namespace Magick
24{
25  // Forward declarations
26  class Options;
27  class ImageRef;
28
29  extern MagickPPExport const char *borderGeometryDefault;
30  extern MagickPPExport const char *frameGeometryDefault;
31  extern MagickPPExport const char *raiseGeometryDefault;
32
33  // Compare two Image objects regardless of LHS/RHS
34  // Image sizes and signatures are used as basis of comparison
35  MagickPPExport int operator ==
36    (const Magick::Image &left_,const Magick::Image &right_);
37  MagickPPExport int operator !=
38    (const Magick::Image &left_,const Magick::Image &right_);
39  MagickPPExport int operator >
40    (const Magick::Image &left_,const Magick::Image &right_);
41  MagickPPExport int operator <
42    (const Magick::Image &left_,const Magick::Image &right_);
43  MagickPPExport int operator >=
44    (const Magick::Image &left_,const Magick::Image &right_);
45  MagickPPExport int operator <=
46    (const Magick::Image &left_,const Magick::Image &right_);
47
48  //
49  // Image is the representation of an image. In reality, it actually
50  // a handle object which contains a pointer to a shared reference
51  // object (ImageRef). As such, this object is extremely space efficient.
52  //
53  class MagickPPExport Image
54  {
55  public:
56
57    // Default constructor
58    Image(void);
59
60    // Construct Image from in-memory BLOB
61    Image(const Blob &blob_);
62
63    // Construct Image of specified size from in-memory BLOB
64    Image(const Blob &blob_,const Geometry &size_);
65
66    // Construct Image of specified size and depth from in-memory BLOB
67    Image(const Blob &blob_,const Geometry &size_,const size_t depth_);
68
69    // Construct Image of specified size, depth, and format from
70    // in-memory BLOB
71    Image(const Blob &blob_,const Geometry &size_,const size_t depth_,
72      const std::string &magick_);
73
74    // Construct Image of specified size, and format from in-memory BLOB
75    Image(const Blob &blob_,const Geometry &size_,const std::string &magick_);
76
77    // Construct a blank image canvas of specified size and color
78    Image(const Geometry &size_,const Color &color_);
79
80    // Copy constructor
81    Image(const Image &image_);
82
83    // Copy constructor to copy part of the image
84    Image(const Image &image_,const Geometry &geometry_);
85
86    // Construct an image based on an array of raw pixels, of
87    // specified type and mapping, in memory
88    Image(const size_t width_,const size_t height_,const std::string &map_,
89      const StorageType type_,const void *pixels_);
90
91    // Construct from image file or image specification
92    Image(const std::string &imageSpec_);
93
94    // Destructor
95    virtual ~Image();
96
97    // Assignment operator
98    Image& operator=(const Image &image_);
99
100    // Join images into a single multi-image file
101    void adjoin(const bool flag_);
102    bool adjoin(void) const;
103
104    // Image supports transparency (alpha channel)
105    void alpha(const bool alphaFlag_);
106    bool alpha(void) const;
107
108    // Transparent color
109    void alphaColor(const Color &alphaColor_);
110    Color alphaColor(void) const;
111
112    // Anti-alias Postscript and TrueType fonts (default true)
113    void antiAlias(const bool flag_);
114    bool antiAlias(void) const;
115
116    // Time in 1/100ths of a second which must expire before
117    // displaying the next image in an animated sequence.
118    void animationDelay(const size_t delay_);
119    size_t animationDelay(void) const;
120
121    // Lessen (or intensify) when adding noise to an image.
122    void attenuate(const double attenuate_);
123
124    // Number of iterations to loop an animation (e.g. Netscape loop
125    // extension) for.
126    void animationIterations(const size_t iterations_);
127    size_t animationIterations(void) const;
128
129    // Image background color
130    void backgroundColor(const Color &color_);
131    Color backgroundColor(void) const;
132
133    // Name of texture image to tile onto the image background
134    void backgroundTexture(const std::string &backgroundTexture_);
135    std::string backgroundTexture(void) const;
136
137    // Base image width (before transformations)
138    size_t baseColumns(void) const;
139
140    // Base image filename (before transformations)
141    std::string baseFilename(void) const;
142
143    // Base image height (before transformations)
144    size_t baseRows(void) const;
145
146    // Use black point compensation.
147    void blackPointCompensation(const bool flag_);
148    bool blackPointCompensation(void) const;
149
150    // Image border color
151    void borderColor(const Color &color_);
152    Color borderColor(void) const;
153
154    // Return smallest bounding box enclosing non-border pixels. The
155    // current fuzz value is used when discriminating between pixels.
156    // This is the crop bounding box used by crop(Geometry(0,0));
157    Geometry boundingBox(void) const;
158
159    // Text bounding-box base color (default none)
160    void boxColor(const Color &boxColor_);
161    Color boxColor(void) const;
162
163    // Set or obtain modulus channel depth
164    void channelDepth(const ChannelType channel_,const size_t depth_);
165    size_t channelDepth(const ChannelType channel_);
166
167    // Returns the number of channels in this image.
168    size_t channels() const;
169
170    // Image class (DirectClass or PseudoClass)
171    // NOTE: setting a DirectClass image to PseudoClass will result in
172    // the loss of color information if the number of colors in the
173    // image is greater than the maximum palette size (either 256 or
174    // 65536 entries depending on the value of MAGICKCORE_QUANTUM_DEPTH when
175    // ImageMagick was built).
176    void classType(const ClassType class_);
177    ClassType classType(void) const;
178
179    // Colors within this distance are considered equal
180    void colorFuzz(const double fuzz_);
181    double colorFuzz(void) const;
182
183    // Colormap size (number of colormap entries)
184    void colorMapSize(const size_t entries_);
185    size_t colorMapSize(void) const;
186
187    // Image Color Space
188    void colorSpace(const ColorspaceType colorSpace_);
189    ColorspaceType colorSpace(void) const;
190
191    void colorSpaceType(const ColorspaceType colorSpace_);
192    ColorspaceType colorSpaceType(void) const;
193
194    // Image width
195    size_t columns(void) const;
196
197    // Comment image (add comment string to image)
198    void comment(const std::string &comment_);
199    std::string comment(void) const;
200
201    // Composition operator to be used when composition is implicitly
202    // used (such as for image flattening).
203    void compose(const CompositeOperator compose_);
204    CompositeOperator compose(void) const;
205
206    // Compression type
207    void compressType(const CompressionType compressType_);
208    CompressionType compressType(void) const;
209
210    // Enable printing of debug messages from ImageMagick
211    void debug(const bool flag_);
212    bool debug(void) const;
213
214    // Vertical and horizontal resolution in pixels of the image
215    void density(const Point &density_);
216    Point density(void) const;
217
218    // Image depth (bits allocated to red/green/blue components)
219    void depth(const size_t depth_);
220    size_t depth(void) const;
221
222    // Tile names from within an image montage
223    std::string directory(void) const;
224
225    // Endianness (little like Intel or big like SPARC) for image
226    // formats which support endian-specific options.
227    void endian(const EndianType endian_);
228    EndianType endian(void) const;
229
230    // Exif profile (BLOB)
231    void exifProfile(const Blob &exifProfile_);
232    Blob exifProfile(void) const;
233
234    // Image file name
235    void fileName(const std::string &fileName_);
236    std::string fileName(void) const;
237
238    // Number of bytes of the image on disk
239    MagickSizeType fileSize(void) const;
240
241    // Color to use when filling drawn objects
242    void fillColor(const Color &fillColor_);
243    Color fillColor(void) const;
244
245    // Rule to use when filling drawn objects
246    void fillRule(const FillRule &fillRule_);
247    FillRule fillRule(void) const;
248
249    // Pattern to use while filling drawn objects.
250    void fillPattern(const Image &fillPattern_);
251    Image fillPattern(void) const;
252
253    // Filter to use when resizing image
254    void filterType(const FilterTypes filterType_);
255    FilterTypes filterType(void) const;
256
257    // Text rendering font
258    void font(const std::string &font_);
259    std::string font(void) const;
260
261    // Font family
262    void fontFamily(const std::string &family_);
263    std::string fontFamily(void) const;
264
265    // Font point size
266    void fontPointsize(const double pointSize_);
267    double fontPointsize(void) const;
268
269    // Font style
270    void fontStyle(const StyleType style_);
271    StyleType fontStyle(void) const;
272
273    // Font weight
274    void fontWeight(const size_t weight_);
275    size_t fontWeight(void) const;
276
277    // Long image format description
278    std::string format(void) const;
279
280    // Formats the specified expression
281    // More info here: http://www.imagemagick.org/script/escape.php
282    std::string formatExpression(const std::string expression);
283
284    // Gamma level of the image
285    double gamma(void) const;
286
287    // Preferred size of the image when encoding
288    Geometry geometry(void) const;
289
290    // GIF disposal method
291    void gifDisposeMethod(const DisposeType disposeMethod_);
292    DisposeType gifDisposeMethod(void) const;
293
294    bool hasChannel(const PixelChannel channel) const;
295
296    // When comparing images, emphasize pixel differences with this color.
297    void highlightColor(const Color color_);
298
299    // ICC color profile (BLOB)
300    void iccColorProfile(const Blob &colorProfile_);
301    Blob iccColorProfile(void) const;
302
303    // Type of interlacing to use
304    void interlaceType(const InterlaceType interlace_);
305    InterlaceType interlaceType(void) const;
306
307    // Pixel color interpolation method to use
308    void interpolate(const PixelInterpolateMethod interpolate_);
309    PixelInterpolateMethod interpolate(void) const;
310
311    // IPTC profile (BLOB)
312    void iptcProfile(const Blob &iptcProfile_);
313    Blob iptcProfile(void) const;
314
315    // Returns true if none of the pixels in the image have an alpha value
316    // other than OpaqueAlpha (QuantumRange).
317    bool isOpaque(void) const;
318
319    // Does object contain valid image?
320    void isValid(const bool isValid_);
321    bool isValid(void) const;
322
323    // Image label
324    void label(const std::string &label_);
325    std::string label(void) const;
326
327    // When comparing images, de-emphasize pixel differences with this color.
328    void lowlightColor(const Color color_);
329
330    // File type magick identifier (.e.g "GIF")
331    void magick(const std::string &magick_);
332    std::string magick(void) const;
333
334    // Associate a mask with the image. The mask must be the same dimensions
335    // as the image. Pass an invalid image to unset an existing mask.
336    void mask(const Image &mask_);
337    Image mask(void) const;
338
339    // The mean error per pixel computed when an image is color reduced
340    double meanErrorPerPixel(void) const;
341
342    // Image modulus depth (minimum number of bits required to support
343    // red/green/blue components without loss of accuracy)
344    void modulusDepth(const size_t modulusDepth_);
345    size_t modulusDepth(void) const;
346
347    // Transform image to black and white
348    void monochrome(const bool monochromeFlag_);
349    bool monochrome(void) const;
350
351    // Tile size and offset within an image montage
352    Geometry montageGeometry(void) const;
353
354    // The normalized max error per pixel computed when an image is
355    // color reduced.
356    double normalizedMaxError(void) const;
357
358    // The normalized mean error per pixel computed when an image is
359    // color reduced.
360    double normalizedMeanError(void) const;
361
362    // Image orientation
363    void orientation(const OrientationType orientation_);
364    OrientationType orientation(void) const;
365
366    // Preferred size and location of an image canvas.
367    void page(const Geometry &pageSize_);
368    Geometry page(void) const;
369
370    // JPEG/MIFF/PNG compression level (default 75).
371    void quality(const size_t quality_);
372    size_t quality(void) const;
373
374    // Maximum number of colors to quantize to
375    void quantizeColors(const size_t colors_);
376    size_t quantizeColors(void) const;
377
378    // Colorspace to quantize in.
379    void quantizeColorSpace(const ColorspaceType colorSpace_);
380    ColorspaceType quantizeColorSpace(void) const;
381
382    // Dither image during quantization (default true).
383    void quantizeDither(const bool ditherFlag_);
384    bool quantizeDither(void) const;
385
386    // Dither method
387    void quantizeDitherMethod(const DitherMethod ditherMethod_);
388    DitherMethod quantizeDitherMethod(void) const;
389
390    // Quantization tree-depth
391    void quantizeTreeDepth(const size_t treeDepth_);
392    size_t quantizeTreeDepth(void) const;
393
394    // Suppress all warning messages. Error messages are still reported.
395    void quiet(const bool quiet_);
396    bool quiet(void) const;
397
398    // The type of rendering intent
399    void renderingIntent(const RenderingIntent renderingIntent_);
400    RenderingIntent renderingIntent(void) const;
401
402    // Units of image resolution
403    void resolutionUnits(const ResolutionType resolutionUnits_);
404    ResolutionType resolutionUnits(void) const;
405
406    // The number of pixel rows in the image
407    size_t rows(void) const;
408
409    // Image scene number
410    void scene(const size_t scene_);
411    size_t scene(void) const;
412
413    // Width and height of a raw image
414    void size(const Geometry &geometry_);
415    Geometry size(void) const;
416
417    // enabled/disable stroke anti-aliasing
418    void strokeAntiAlias(const bool flag_);
419    bool strokeAntiAlias(void) const;
420
421    // Color to use when drawing object outlines
422    void strokeColor(const Color &strokeColor_);
423    Color strokeColor(void) const;
424
425    // Specify the pattern of dashes and gaps used to stroke
426    // paths. The strokeDashArray represents a zero-terminated array
427    // of numbers that specify the lengths of alternating dashes and
428    // gaps in pixels. If an odd number of values is provided, then
429    // the list of values is repeated to yield an even number of
430    // values.  A typical strokeDashArray_ array might contain the
431    // members 5 3 2 0, where the zero value indicates the end of the
432    // pattern array.
433    void strokeDashArray(const double *strokeDashArray_);
434    const double *strokeDashArray(void) const;
435
436    // While drawing using a dash pattern, specify distance into the
437    // dash pattern to start the dash (default 0).
438    void strokeDashOffset(const double strokeDashOffset_);
439    double strokeDashOffset(void) const;
440
441    // Specify the shape to be used at the end of open subpaths when
442    // they are stroked. Values of LineCap are UndefinedCap, ButtCap,
443    // RoundCap, and SquareCap.
444    void strokeLineCap(const LineCap lineCap_);
445    LineCap strokeLineCap(void) const;
446
447    // Specify the shape to be used at the corners of paths (or other
448    // vector shapes) when they are stroked. Values of LineJoin are
449    // UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
450    void strokeLineJoin(const LineJoin lineJoin_);
451    LineJoin strokeLineJoin(void) const;
452
453    // Specify miter limit. When two line segments meet at a sharp
454    // angle and miter joins have been specified for 'lineJoin', it is
455    // possible for the miter to extend far beyond the thickness of
456    // the line stroking the path. The miterLimit' imposes a limit on
457    // the ratio of the miter length to the 'lineWidth'. The default
458    // value of this parameter is 4.
459    void strokeMiterLimit(const size_t miterLimit_);
460    size_t strokeMiterLimit(void) const;
461
462    // Pattern image to use while stroking object outlines.
463    void strokePattern(const Image &strokePattern_);
464    Image strokePattern(void) const;
465
466    // Stroke width for drawing vector objects (default one)
467    void strokeWidth(const double strokeWidth_);
468    double strokeWidth(void) const;
469
470    // Subimage of an image sequence
471    void subImage(const size_t subImage_);
472    size_t subImage(void) const;
473
474    // Number of images relative to the base image
475    void subRange(const size_t subRange_);
476    size_t subRange(void) const;
477
478    // Render text right-to-left or left-to-right.
479    void textDirection(DirectionType direction_);
480    DirectionType textDirection() const;
481
482    // Annotation text encoding (e.g. "UTF-16")
483    void textEncoding(const std::string &encoding_);
484    std::string textEncoding(void) const;
485
486    // Text gravity.
487    void textGravity(GravityType gravity_);
488    GravityType textGravity() const;
489
490    // Text inter-line spacing
491    void textInterlineSpacing(double spacing_);
492    double textInterlineSpacing(void) const;
493
494    // Text inter-word spacing
495    void textInterwordSpacing(double spacing_);
496    double textInterwordSpacing(void) const;
497
498    // Text inter-character kerning
499    void textKerning(double kerning_);
500    double textKerning(void) const;
501
502    // Text undercolor box
503    void textUnderColor(const Color &underColor_);
504    Color textUnderColor(void) const;
505
506    // Number of colors in the image
507    size_t totalColors(void) const;
508
509    // Rotation to use when annotating with text or drawing
510    void transformRotation(const double angle_);
511
512    // Skew to use in X axis when annotating with text or drawing
513    void transformSkewX(const double skewx_);
514
515    // Skew to use in Y axis when annotating with text or drawing
516    void transformSkewY(const double skewy_);
517
518    // Image representation type (also see type operation)
519    //   Available types:
520    //    Bilevel        Grayscale       GrayscaleMatte
521    //    Palette        PaletteMatte    TrueColor
522    //    TrueColorMatte ColorSeparation ColorSeparationMatte
523    void type(const ImageType type_);
524    ImageType type(void) const;
525
526    // Print detailed information about the image
527    void verbose(const bool verboseFlag_);
528    bool verbose(void) const;
529
530    // FlashPix viewing parameters
531    void view(const std::string &view_);
532    std::string view(void) const;
533
534    // Virtual pixel method
535    void virtualPixelMethod(const VirtualPixelMethod virtualPixelMethod_);
536    VirtualPixelMethod virtualPixelMethod(void) const;
537
538    // X11 display to display to, obtain fonts from, or to capture
539    // image from
540    void x11Display(const std::string &display_);
541    std::string x11Display(void) const;
542
543    // x resolution of the image
544    double xResolution(void) const;
545
546    // y resolution of the image
547    double yResolution(void) const;
548
549    // Adaptive-blur image with specified blur factor
550    // The radius_ parameter specifies the radius of the Gaussian, in
551    // pixels, not counting the center pixel.  The sigma_ parameter
552    // specifies the standard deviation of the Laplacian, in pixels.
553    void adaptiveBlur(const double radius_=0.0,const double sigma_=1.0);
554
555    // This is shortcut function for a fast interpolative resize using mesh
556    // interpolation.  It works well for small resizes of less than +/- 50%
557    // of the original image size.  For larger resizing on images a full
558    // filtered and slower resize function should be used instead.
559    void adaptiveResize(const Geometry &geometry_);
560
561    // Adaptively sharpens the image by sharpening more intensely near image
562    // edges and less intensely far from edges. We sharpen the image with a
563    // Gaussian operator of the given radius and standard deviation (sigma).
564    // For reasonable results, radius should be larger than sigma.
565    void adaptiveSharpen(const double radius_=0.0,const double sigma_=1.0);
566    void adaptiveSharpenChannel(const ChannelType channel_,
567      const double radius_=0.0,const double sigma_=1.0);
568
569    // Local adaptive threshold image
570    // http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm
571    // Width x height define the size of the pixel neighborhood
572    // bias = constant to subtract from pixel neighborhood mean
573    void adaptiveThreshold(const size_t width_,const size_t height_,
574      const double bias_=0.0);
575
576    // Add noise to image with specified noise type
577    void addNoise(const NoiseType noiseType_);
578    void addNoiseChannel(const ChannelType channel_,
579      const NoiseType noiseType_);
580
581    // Transform image by specified affine (or free transform) matrix.
582    void affineTransform(const DrawableAffine &affine);
583
584    // Set or attenuate the alpha channel in the image. If the image
585    // pixels are opaque then they are set to the specified alpha
586    // value, otherwise they are blended with the supplied alpha
587    // value.  The value of alpha_ ranges from 0 (completely opaque)
588    // to QuantumRange. The defines OpaqueAlpha and TransparentAlpha are
589    // available to specify completely opaque or completely
590    // transparent, respectively.
591    void alpha(const unsigned int alpha_);
592
593    // AlphaChannel() activates, deactivates, resets, or sets the alpha
594    // channel.
595    void alphaChannel(AlphaChannelOption alphaOption_);
596
597    //
598    // Annotate image (draw text on image)
599    //
600    // Gravity effects text placement in bounding area according to rules:
601    //  NorthWestGravity  text bottom-left corner placed at top-left
602    //  NorthGravity      text bottom-center placed at top-center
603    //  NorthEastGravity  text bottom-right corner placed at top-right
604    //  WestGravity       text left-center placed at left-center
605    //  CenterGravity     text center placed at center
606    //  EastGravity       text right-center placed at right-center
607    //  SouthWestGravity  text top-left placed at bottom-left
608    //  SouthGravity      text top-center placed at bottom-center
609    //  SouthEastGravity  text top-right placed at bottom-right
610
611    // Annotate using specified text, and placement location
612    void annotate(const std::string &text_,const Geometry &location_);
613
614    // Annotate using specified text, bounding area, and placement
615    // gravity
616    void annotate(const std::string &text_,const Geometry &boundingArea_,
617      const GravityType gravity_);
618
619    // Annotate with text using specified text, bounding area,
620    // placement gravity, and rotation.
621    void annotate(const std::string &text_,const Geometry &boundingArea_,
622      const GravityType gravity_,const double degrees_);
623
624    // Annotate with text (bounding area is entire image) and placement
625    // gravity.
626    void annotate(const std::string &text_,const GravityType gravity_);
627
628    // Inserts the artifact with the specified name and value into
629    // the artifact tree of the image.
630    void artifact(const std::string &name_,const std::string &value_);
631
632    // Returns the value of the artifact with the specified name.
633    std::string artifact(const std::string &name_) const;
634
635    // Access/Update a named image attribute
636    void attribute(const std::string name_,const std::string value_);
637    std::string attribute(const std::string name_) const;
638
639    // Extracts the 'mean' from the image and adjust the image to try
640    // make set its gamma appropriatally.
641    void autoGamma(void);
642    void autoGammaChannel(const ChannelType channel_);
643
644    // Adjusts the levels of a particular image channel by scaling the
645    // minimum and maximum values to the full quantum range.
646    void autoLevel(void);
647    void autoLevelChannel(const ChannelType channel_);
648
649    // Adjusts an image so that its orientation is suitable for viewing.
650    void autoOrient(void);
651
652    // Forces all pixels below the threshold into black while leaving all
653    // pixels at or above the threshold unchanged.
654    void blackThreshold(const std::string &threshold_);
655    void blackThresholdChannel(const ChannelType channel_,
656      const std::string &threshold_);
657
658     // Simulate a scene at nighttime in the moonlight.
659    void blueShift(const double factor_=1.5);
660
661    // Blur image with specified blur factor
662    // The radius_ parameter specifies the radius of the Gaussian, in
663    // pixels, not counting the center pixel.  The sigma_ parameter
664    // specifies the standard deviation of the Laplacian, in pixels.
665    void blur(const double radius_=0.0,const double sigma_=1.0);
666    void blurChannel(const ChannelType channel_,const double radius_=0.0,
667      const double sigma_=1.0);
668
669    // Border image (add border to image)
670    void border(const Geometry &geometry_=borderGeometryDefault);
671
672    // Changes the brightness and/or contrast of an image. It converts the
673    // brightness and contrast parameters into slope and intercept and calls
674    // a polynomical function to apply to the image.
675    void brightnessContrast(const double brightness_=0.0,
676      const double contrast_=0.0);
677    void brightnessContrastChannel(const ChannelType channel_,
678      const double brightness_=0.0,const double contrast_=0.0);
679
680    // Uses a multi-stage algorithm to detect a wide range of edges in images.
681    void cannyEdge(const double radius_=0.0,const double sigma_=1.0,
682      const double lowerPercent_=0.1,const double upperPercent_=0.3);
683
684    // Accepts a lightweight Color Correction Collection
685    // (CCC) file which solely contains one or more color corrections and
686    // applies the correction to the image.
687    void cdl(const std::string &cdl_);
688
689    // Extract channel from image
690    void channel(const ChannelType channel_);
691
692    // Charcoal effect image (looks like charcoal sketch)
693    // The radius_ parameter specifies the radius of the Gaussian, in
694    // pixels, not counting the center pixel.  The sigma_ parameter
695    // specifies the standard deviation of the Laplacian, in pixels.
696    void charcoal(const double radius_=0.0,const double sigma_=1.0);
697
698    // Chop image (remove vertical or horizontal subregion of image)
699    // FIXME: describe how geometry argument is used to select either
700    // horizontal or vertical subregion of image.
701    void chop(const Geometry &geometry_);
702
703    // Chromaticity blue primary point (e.g. x=0.15, y=0.06)
704    void chromaBluePrimary(const double x_,const double y_);
705    void chromaBluePrimary(double *x_,double *y_) const;
706
707    // Chromaticity green primary point (e.g. x=0.3, y=0.6)
708    void chromaGreenPrimary(const double x_,const double y_);
709    void chromaGreenPrimary(double *x_,double *y_) const;
710
711    // Chromaticity red primary point (e.g. x=0.64, y=0.33)
712    void chromaRedPrimary(const double x_,const double y_);
713    void chromaRedPrimary(double *x_,double *y_) const;
714
715    // Chromaticity white point (e.g. x=0.3127, y=0.329)
716    void chromaWhitePoint(const double x_,const double y_);
717    void chromaWhitePoint(double *x_,double *y_) const;
718
719    // Set each pixel whose value is below zero to zero and any the
720    // pixel whose value is above the quantum range to the quantum range (e.g.
721    // 65535) otherwise the pixel value remains unchanged.
722    void clamp(void);
723    void clampChannel(const ChannelType channel_);
724
725    // Sets the image clip mask based on any clipping path information
726    // if it exists.
727    void clip(void);
728    void clipPath(const std::string pathname_,const bool inside_);
729
730    // Apply a color lookup table (CLUT) to the image.
731    void clut(const Image &clutImage_,const PixelInterpolateMethod method);
732    void clutChannel(const ChannelType channel_,const Image &clutImage_,
733      const PixelInterpolateMethod method);
734
735    // Colorize image with pen color, using specified percent alpha.
736    void colorize(const unsigned int alpha_,const Color &penColor_);
737
738    // Colorize image with pen color, using specified percent alpha
739    // for red, green, and blue quantums
740    void colorize(const unsigned int alphaRed_,const unsigned int alphaGreen_,
741       const unsigned int alphaBlue_,const Color &penColor_);
742
743     // Color at colormap position index_
744    void colorMap(const size_t index_,const Color &color_);
745    Color colorMap(const size_t index_) const;
746
747    // Apply a color matrix to the image channels. The user supplied
748    // matrix may be of order 1 to 5 (1x1 through 5x5).
749    void colorMatrix(const size_t order_,const double *color_matrix_);
750
751    // Compare current image with another image
752    // Sets meanErrorPerPixel, normalizedMaxError, and normalizedMeanError
753    // in the current image. False is returned if the images are identical.
754    bool compare(const Image &reference_);
755
756    // Compare current image with another image
757    // Returns the distortion based on the specified metric.
758    double compare(const Image &reference_,const MetricType metric_);
759    double compareChannel(const ChannelType channel_,
760                                     const Image &reference_,
761                                     const MetricType metric_ );
762
763    // Compare current image with another image
764    // Sets the distortion and returns the difference image.
765    Image compare(const Image &reference_,const MetricType metric_,
766      double *distortion);
767    Image compareChannel(const ChannelType channel_,const Image &reference_,
768      const MetricType metric_,double *distortion);
769
770    // Compose an image onto another at specified offset and using
771    // specified algorithm
772    void composite(const Image &compositeImage_,const Geometry &offset_,
773      const CompositeOperator compose_=InCompositeOp);
774    void composite(const Image &compositeImage_,const GravityType gravity_,
775      const CompositeOperator compose_=InCompositeOp);
776    void composite(const Image &compositeImage_,const ::ssize_t xOffset_,
777      const ::ssize_t yOffset_,const CompositeOperator compose_=InCompositeOp);
778
779    // Determines the connected-components of the image
780    void connectedComponents(const size_t connectivity_);
781
782    // Contrast image (enhance intensity differences in image)
783    void contrast(const bool sharpen_);
784
785    // A simple image enhancement technique that attempts to improve the
786    // contrast in an image by 'stretching' the range of intensity values
787    // it contains to span a desired range of values. It differs from the
788    // more sophisticated histogram equalization in that it can only apply a
789    // linear scaling function to the image pixel values. As a result the
790    // 'enhancement' is less harsh.
791    void contrastStretch(const double blackPoint_,const double whitePoint_);
792    void contrastStretchChannel(const ChannelType channel_,
793      const double blackPoint_,const double whitePoint_);
794
795    // Convolve image.  Applies a user-specified convolution to the image.
796    //  order_ represents the number of columns and rows in the filter kernel.
797    //  kernel_ is an array of doubles representing the convolution kernel.
798    void convolve(const size_t order_,const double *kernel_);
799
800    // Copies pixels from the source image as defined by the geometry the
801    // destination image at the specified offset.
802    void copyPixels(const Image &source_,const Geometry &geometry_,
803      const Offset &offset_);
804
805    // Crop image (subregion of original image)
806    void crop(const Geometry &geometry_);
807
808    // Cycle image colormap
809    void cycleColormap(const ::ssize_t amount_);
810
811    // Converts cipher pixels to plain pixels.
812    void decipher(const std::string &passphrase_);
813
814    // Tagged image format define. Similar to the defineValue() method
815    // except that passing the flag_ value 'true' creates a value-less
816    // define with that format and key. Passing the flag_ value 'false'
817    // removes any existing matching definition. The method returns 'true'
818    // if a matching key exists, and 'false' if no matching key exists.
819    void defineSet(const std::string &magick_,const std::string &key_,
820      bool flag_);
821    bool defineSet(const std::string &magick_,const std::string &key_) const;
822
823    // Tagged image format define (set/access coder-specific option) The
824    // magick_ option specifies the coder the define applies to.  The key_
825    // option provides the key specific to that coder.  The value_ option
826    // provides the value to set (if any). See the defineSet() method if the
827    // key must be removed entirely.
828    void defineValue(const std::string &magick_,const std::string &key_,
829      const std::string &value_);
830    std::string defineValue(const std::string &magick_,
831      const std::string &key_) const;
832
833    // Removes skew from the image. Skew is an artifact that occurs in scanned
834    // images because of the camera being misaligned, imperfections in the
835    // scanning or surface, or simply because the paper was not placed
836    // completely flat when scanned. The value of threshold_ ranges from 0
837    // to QuantumRange.
838    void deskew(const double threshold_);
839
840    // Despeckle image (reduce speckle noise)
841    void despeckle(void);
842
843    // Display image on screen
844    void display(void);
845
846    // Distort image.  distorts an image using various distortion methods, by
847    // mapping color lookups of the source image to a new destination image
848    // usally of the same size as the source image, unless 'bestfit' is set to
849    // true.
850    void distort(const DistortImageMethod method_,
851      const size_t numberArguments_,const double *arguments_,
852      const bool bestfit_=false);
853
854    // Draw on image using a single drawable
855    void draw(const Drawable &drawable_);
856
857    // Draw on image using a drawable list
858    void draw(const std::vector<Magick::Drawable> &drawable_);
859
860    // Edge image (hilight edges in image)
861    void edge(const double radius_=0.0);
862
863    // Emboss image (hilight edges with 3D effect)
864    // The radius_ parameter specifies the radius of the Gaussian, in
865    // pixels, not counting the center pixel.  The sigma_ parameter
866    // specifies the standard deviation of the Laplacian, in pixels.
867    void emboss(const double radius_=0.0,const double sigma_=1.0);
868
869    // Converts pixels to cipher-pixels.
870    void encipher(const std::string &passphrase_);
871
872    // Enhance image (minimize noise)
873    void enhance(void);
874
875    // Equalize image (histogram equalization)
876    void equalize(void);
877
878    // Erase image to current "background color"
879    void erase(void);
880
881    // Apply a value with an arithmetic, relational, or logical operator.
882    void evaluate(const ChannelType channel_,
883      const MagickEvaluateOperator operator_,double rvalue_);
884
885    // Apply a value with an arithmetic, relational, or logical operator.
886    void evaluate(const ChannelType channel_,const MagickFunction function_,
887      const size_t number_parameters_,const double *parameters_);
888
889    // Apply a value with an arithmetic, relational, or logical operator.
890    void evaluate(const ChannelType channel_,const ::ssize_t x_,
891      const ::ssize_t y_,const size_t columns_,const size_t rows_,
892      const MagickEvaluateOperator operator_,const double rvalue_);
893
894    // Extend the image as defined by the geometry.
895    void extent(const Geometry &geometry_);
896    void extent(const Geometry &geometry_,const Color &backgroundColor);
897    void extent(const Geometry &geometry_,const Color &backgroundColor,
898      const GravityType gravity_);
899    void extent(const Geometry &geometry_,const GravityType gravity_);
900
901    // Flip image (reflect each scanline in the vertical direction)
902    void flip(void);
903
904    // Floodfill pixels matching color (within fuzz factor) of target
905    // pixel(x,y) with replacement alpha value.
906    void floodFillAlpha(const ::ssize_t x_,const ::ssize_t y_,
907      const unsigned int alpha_,const bool invert_=false);
908
909    // Floodfill designated area with replacement alpha value
910    void floodFillAlpha(const ssize_t x_,const ssize_t y_,
911      const unsigned int alpha_,const Color &target_,const bool invert_=false);
912
913    // Flood-fill color across pixels that match the color of the
914    // target pixel and are neighbors of the target pixel.
915    // Uses current fuzz setting when determining color match.
916    void floodFillColor(const Geometry &point_,const Color &fillColor_,
917      const bool invert_=false);
918    void floodFillColor(const ::ssize_t x_,const ::ssize_t y_,
919      const Color &fillColor_,const bool invert_=false);
920
921    // Flood-fill color across pixels starting at target-pixel and
922    // stopping at pixels matching specified border color.
923    // Uses current fuzz setting when determining color match.
924    void floodFillColor(const Geometry &point_,const Color &fillColor_,
925      const Color &borderColor_,const bool invert_=false);
926    void floodFillColor(const ::ssize_t x_,const ::ssize_t y_,
927      const Color &fillColor_,const Color &borderColor_,
928      const bool invert_=false);
929
930    // Flood-fill texture across pixels that match the color of the
931    // target pixel and are neighbors of the target pixel.
932    // Uses current fuzz setting when determining color match.
933    void floodFillTexture(const Geometry &point_,const Image &texture_,
934      const bool invert_=false);
935    void floodFillTexture(const ::ssize_t x_,const ::ssize_t y_,
936      const Image &texture_,const bool invert_=false);
937
938    // Flood-fill texture across pixels starting at target-pixel and
939    // stopping at pixels matching specified border color.
940    // Uses current fuzz setting when determining color match.
941    void floodFillTexture(const Geometry &point_,const Image &texture_,
942      const Color &borderColor_,const bool invert_=false);
943    void floodFillTexture(const ::ssize_t x_,const ::ssize_t y_,
944      const Image &texture_,const Color &borderColor_,
945      const bool invert_=false);
946
947    // Flop image (reflect each scanline in the horizontal direction)
948    void flop(void);
949
950    // Obtain font metrics for text string given current font,
951    // pointsize, and density settings.
952    void fontTypeMetrics(const std::string &text_,TypeMetric *metrics);
953
954    // Obtain multi line font metrics for text string given current font,
955    // pointsize, and density settings.
956    void fontTypeMetricsMultiline(const std::string &text_,
957      TypeMetric *metrics);
958
959    // Frame image
960    void frame(const Geometry &geometry_=frameGeometryDefault);
961    void frame(const size_t width_,const size_t height_,
962      const ::ssize_t innerBevel_=6,const ::ssize_t outerBevel_=6);
963
964    // Applies a mathematical expression to the image.
965    void fx(const std::string expression_);
966    void fx(const std::string expression_,const Magick::ChannelType channel_);
967
968    // Gamma correct image
969    void gamma(const double gamma_);
970    void gamma(const double gammaRed_,const double gammaGreen_,
971      const double gammaBlue_);
972
973    // Gaussian blur image
974    // The number of neighbor pixels to be included in the convolution
975    // mask is specified by 'width_'. The standard deviation of the
976    // gaussian bell curve is specified by 'sigma_'.
977    void gaussianBlur(const double width_,const double sigma_);
978    void gaussianBlurChannel(const ChannelType channel_,const double width_,
979      const double sigma_);
980
981    // Transfers read-only pixels from the image to the pixel cache as
982    // defined by the specified region
983    const Quantum *getConstPixels(const ::ssize_t x_, const ::ssize_t y_,
984      const size_t columns_,const size_t rows_) const;
985
986    // Obtain immutable image pixel metacontent (valid for PseudoClass images)
987    const void *getConstMetacontent(void) const;
988
989    // Obtain mutable image pixel metacontent (valid for PseudoClass images)
990    void *getMetacontent(void);
991
992    // Transfers pixels from the image to the pixel cache as defined
993    // by the specified region. Modified pixels may be subsequently
994    // transferred back to the image via syncPixels.  This method is
995    // valid for DirectClass images.
996    Quantum *getPixels(const ::ssize_t x_,const ::ssize_t y_,
997      const size_t columns_,const size_t rows_);
998
999    // Converts the colors in the image to gray.
1000    void grayscale(const PixelIntensityMethod method_);
1001
1002    // Apply a color lookup table (Hald CLUT) to the image.
1003    void haldClut(const Image &clutImage_);
1004
1005    // Identifies lines in the image.
1006    void houghLine(const size_t width_,const size_t height_,
1007      const size_t threshold_=40);
1008
1009    // Identifies the potential color type of the image. This method can be
1010    // used to detect if the type can be changed to GrayScale.
1011    ImageType identifyType(void) const;
1012
1013    // Implode image (special effect)
1014    void implode(const double factor_);
1015
1016    // Implements the inverse discrete Fourier transform (DFT) of the image
1017    // either as a magnitude / phase or real / imaginary image pair.
1018    void inverseFourierTransform(const Image &phase_);
1019    void inverseFourierTransform(const Image &phase_,const bool magnitude_);
1020
1021    // An edge preserving noise reduction filter.
1022    void kuwahara(const double radius_=0.0,const double sigma_=1.0);
1023    void kuwaharaChannel(const ChannelType channel_,const double radius_=0.0,
1024      const double sigma_=1.0);
1025
1026    // Level image. Adjust the levels of the image by scaling the
1027    // colors falling between specified white and black points to the
1028    // full available quantum range. The parameters provided represent
1029    // the black, mid (gamma), and white points.  The black point
1030    // specifies the darkest color in the image. Colors darker than
1031    // the black point are set to zero. Mid point (gamma) specifies a
1032    // gamma correction to apply to the image. White point specifies
1033    // the lightest color in the image.  Colors brighter than the
1034    // white point are set to the maximum quantum value. The black and
1035    // white point have the valid range 0 to QuantumRange while mid (gamma)
1036    // has a useful range of 0 to ten.
1037    void level(const double blackPoint_,const double whitePoint_,
1038      const double gamma_=1.0);
1039    void levelChannel(const ChannelType channel_,const double blackPoint_,
1040      const double whitePoint_,const double gamma_=1.0);
1041
1042    // Maps the given color to "black" and "white" values, linearly spreading
1043    // out the colors, and level values on a channel by channel bases, as
1044    // per level(). The given colors allows you to specify different level
1045    // ranges for each of the color channels separately.
1046    void levelColors(const Color &blackColor_,const Color &whiteColor_,
1047      const bool invert_=true);
1048    void levelColorsChannel(const ChannelType channel_,
1049      const Color &blackColor_,const Color &whiteColor_,
1050      const bool invert_=true);
1051
1052    // Levelize applies the reversed level operation to just the specific
1053    // channels specified.It compresses the full range of color values, so
1054    // that they lie between the given black and white points. Gamma is
1055    // applied before the values are mapped.
1056    void levelize(const double blackPoint_,const double whitePoint_,
1057      const double gamma_=1.0);
1058    void levelizeChannel(const ChannelType channel_,const double blackPoint_,
1059      const double whitePoint_,const double gamma_=1.0);
1060
1061    // Discards any pixels below the black point and above the white point and
1062    // levels the remaining pixels.
1063    void linearStretch(const double blackPoint_,const double whitePoint_);
1064
1065    // Rescales image with seam carving.
1066    void liquidRescale(const Geometry &geometry_);
1067
1068    // Magnify image by integral size
1069    void magnify(void);
1070
1071    // Remap image colors with closest color from reference image
1072    void map(const Image &mapImage_,const bool dither_=false);
1073
1074    // Filter image by replacing each pixel component with the median
1075    // color in a circular neighborhood
1076    void medianFilter(const double radius_=0.0);
1077
1078    // Reduce image by integral size
1079    void minify(void);
1080
1081    // Modulate percent hue, saturation, and brightness of an image
1082    void modulate(const double brightness_,const double saturation_,
1083      const double hue_);
1084
1085    // Returns the normalized moments of one or more image channels.
1086    ImageMoments moments(void) const;
1087
1088    // Applies a kernel to the image according to the given mophology method.
1089    void morphology(const MorphologyMethod method_,const std::string kernel_,
1090      const ssize_t iterations_=1);
1091    void morphology(const MorphologyMethod method_,
1092      const KernelInfoType kernel_,const std::string arguments_,
1093      const ssize_t iterations_=1);
1094    void morphologyChannel(const ChannelType channel_,
1095      const MorphologyMethod method_,const std::string kernel_,
1096      const ssize_t iterations_=1);
1097    void morphologyChannel(const ChannelType channel_,
1098      const MorphologyMethod method_,const KernelInfoType kernel_,
1099      const std::string arguments_,const ssize_t iterations_=1);
1100
1101    // Motion blur image with specified blur factor
1102    // The radius_ parameter specifies the radius of the Gaussian, in
1103    // pixels, not counting the center pixel.  The sigma_ parameter
1104    // specifies the standard deviation of the Laplacian, in pixels.
1105    // The angle_ parameter specifies the angle the object appears
1106    // to be comming from (zero degrees is from the right).
1107    void motionBlur(const double radius_,const double sigma_,
1108      const double angle_);
1109
1110    // Negate colors in image.  Set grayscale to only negate grayscale
1111    // values in image.
1112    void negate(const bool grayscale_=false);
1113    void negateChannel(const ChannelType channel_,const bool grayscale_=false);
1114
1115    // Normalize image (increase contrast by normalizing the pixel
1116    // values to span the full range of color values)
1117    void normalize(void);
1118
1119    // Oilpaint image (image looks like oil painting)
1120    void oilPaint(const double radius_=0.0,const double sigma=1.0);
1121
1122    // Change color of opaque pixel to specified pen color.
1123    void opaque(const Color &opaqueColor_,const Color &penColor_,
1124      const bool invert_=false);
1125
1126    // Perform a ordered dither based on a number of pre-defined dithering
1127    // threshold maps, but over multiple intensity levels.
1128    void orderedDither(std::string thresholdMap_);
1129    void orderedDitherChannel(const ChannelType channel_,
1130      std::string thresholdMap_);
1131
1132    // Set each pixel whose value is less than epsilon to epsilon or
1133    // -epsilon (whichever is closer) otherwise the pixel value remains
1134    // unchanged.
1135    void perceptible(const double epsilon_);
1136    void perceptibleChannel(const ChannelType channel_,const double epsilon_);
1137
1138    // Returns the perceptual hash for this image.
1139    Magick::ImagePerceptualHash perceptualHash() const;
1140
1141    // Ping is similar to read except only enough of the image is read
1142    // to determine the image columns, rows, and filesize.  Access the
1143    // columns(), rows(), and fileSize() attributes after invoking
1144    // ping.  The image data is not valid after calling ping.
1145    void ping(const std::string &imageSpec_);
1146
1147    // Ping is similar to read except only enough of the image is read
1148    // to determine the image columns, rows, and filesize.  Access the
1149    // columns(), rows(), and fileSize() attributes after invoking
1150    // ping.  The image data is not valid after calling ping.
1151    void ping(const Blob &blob_);
1152
1153    // Get/set pixel color at location x & y.
1154    void pixelColor(const ::ssize_t x_,const ::ssize_t y_,const Color &color_);
1155    Color pixelColor(const ::ssize_t x_,const ::ssize_t y_ ) const;
1156
1157    // Simulates a Polaroid picture.
1158    void polaroid(const std::string &caption_,const double angle_,
1159      const PixelInterpolateMethod method_);
1160
1161    // Reduces the image to a limited number of colors for a "poster" effect.
1162    void posterize(const size_t levels_,const DitherMethod method_);
1163    void posterizeChannel(const ChannelType channel_,const size_t levels_,
1164      const DitherMethod method_);
1165
1166    // Execute a named process module using an argc/argv syntax similar to
1167    // that accepted by a C 'main' routine. An exception is thrown if the
1168    // requested process module doesn't exist, fails to load, or fails during
1169    // execution.
1170    void process(std::string name_,const ::ssize_t argc_,const char **argv_);
1171
1172    // Add or remove a named profile to/from the image. Remove the
1173    // profile by passing an empty Blob (e.g. Blob()). Valid names are
1174    // "*", "8BIM", "ICM", "IPTC", or a user/format-defined profile name.
1175    void profile(const std::string name_,const Blob &colorProfile_);
1176
1177    // Retrieve a named profile from the image. Valid names are:
1178    // "8BIM", "8BIMTEXT", "APP1", "APP1JPEG", "ICC", "ICM", & "IPTC"
1179    // or an existing user/format-defined profile name.
1180    Blob profile(const std::string name_) const;
1181
1182    // Quantize image (reduce number of colors)
1183    void quantize(const bool measureError_=false);
1184
1185    // Raise image (lighten or darken the edges of an image to give a
1186    // 3-D raised or lowered effect)
1187    void raise(const Geometry &geometry_=raiseGeometryDefault,
1188      const bool raisedFlag_=false);
1189
1190    // Random threshold image.
1191    //
1192    // Changes the value of individual pixels based on the intensity
1193    // of each pixel compared to a random threshold.  The result is a
1194    // low-contrast, two color image.  The thresholds_ argument is a
1195    // geometry containing LOWxHIGH thresholds.  If the string
1196    // contains 2x2, 3x3, or 4x4, then an ordered dither of order 2,
1197    // 3, or 4 will be performed instead.  If a channel_ argument is
1198    // specified then only the specified channel is altered.  This is
1199    // a very fast alternative to 'quantize' based dithering.
1200    void randomThreshold(const Geometry &thresholds_);
1201    void randomThresholdChannel(const ChannelType channel_,
1202      const Geometry &thresholds_);
1203
1204    // Read single image frame from in-memory BLOB
1205    void read(const Blob &blob_);
1206
1207    // Read single image frame of specified size from in-memory BLOB
1208    void read(const Blob &blob_,const Geometry &size_);
1209
1210    // Read single image frame of specified size and depth from
1211    // in-memory BLOB
1212    void read(const Blob &blob_,const Geometry &size_,const size_t depth_);
1213
1214    // Read single image frame of specified size, depth, and format
1215    // from in-memory BLOB
1216    void read(const Blob &blob_,const Geometry &size_,const size_t depth_,
1217      const std::string &magick_);
1218
1219    // Read single image frame of specified size, and format from
1220    // in-memory BLOB
1221    void read(const Blob &blob_,const Geometry &size_,
1222      const std::string &magick_);
1223
1224    // Read single image frame of specified size into current object
1225    void read(const Geometry &size_,const std::string &imageSpec_);
1226
1227    // Read single image frame from an array of raw pixels, with
1228    // specified storage type (ConstituteImage), e.g.
1229    // image.read( 640, 480, "RGB", 0, pixels );
1230    void read(const size_t width_,const size_t height_,const std::string &map_,
1231      const StorageType type_,const void *pixels_);
1232
1233    // Read single image frame into current object
1234    void read(const std::string &imageSpec_);
1235
1236    // Transfers one or more pixel components from a buffer or file
1237    // into the image pixel cache of an image.
1238    // Used to support image decoders.
1239    void readPixels(const QuantumType quantum_,const unsigned char *source_);
1240
1241    // Reduce noise in image using a noise peak elimination filter
1242    void reduceNoise(void);
1243    void reduceNoise(const size_t order_);
1244
1245    // Resets the image page canvas and position.
1246    void repage();
1247
1248    // Resize image in terms of its pixel size.
1249    void resample(const Point &density_);
1250
1251    // Resize image to specified size.
1252    void resize(const Geometry &geometry_);
1253
1254    // Roll image (rolls image vertically and horizontally) by specified
1255    // number of columnms and rows)
1256    void roll(const Geometry &roll_);
1257    void roll(const size_t columns_,const size_t rows_);
1258
1259    // Rotate image counter-clockwise by specified number of degrees.
1260    void rotate(const double degrees_);
1261
1262    // Rotational blur image.
1263    void rotationalBlur(const double angle_);
1264    void rotationalBlurChannel(const ChannelType channel_,const double angle_);
1265
1266    // Resize image by using pixel sampling algorithm
1267    void sample(const Geometry &geometry_);
1268
1269    // Resize image by using simple ratio algorithm
1270    void scale(const Geometry &geometry_);
1271
1272    // Segment (coalesce similar image components) by analyzing the
1273    // histograms of the color components and identifying units that
1274    // are homogeneous with the fuzzy c-means technique.  Also uses
1275    // QuantizeColorSpace and Verbose image attributes
1276    void segment(const double clusterThreshold_=1.0,
1277      const double smoothingThreshold_=1.5);
1278
1279    // Selectively blur pixels within a contrast threshold. It is similar to
1280    // the unsharpen mask that sharpens everything with contrast above a
1281    // certain threshold.
1282    void selectiveBlur(const double radius_,const double sigma_,
1283      const double threshold_);
1284    void selectiveBlurChannel(const ChannelType channel_,const double radius_,
1285      const double sigma_,const double threshold_);
1286
1287    // Separates a channel from the image and returns it as a grayscale image.
1288    Image separate(const ChannelType channel_) const;
1289
1290    // Applies a special effect to the image, similar to the effect achieved in
1291    // a photo darkroom by sepia toning.  Threshold ranges from 0 to
1292    // QuantumRange and is a measure of the extent of the sepia toning.
1293    // A threshold of 80% is a good starting point for a reasonable tone.
1294    void sepiaTone(const double threshold_);
1295
1296    // Allocates a pixel cache region to store image pixels as defined
1297    // by the region rectangle.  This area is subsequently transferred
1298    // from the pixel cache to the image via syncPixels.
1299    Quantum *setPixels(const ::ssize_t x_, const ::ssize_t y_,
1300      const size_t columns_,const size_t rows_);
1301
1302    // Shade image using distant light source
1303    void shade(const double azimuth_=30,const double elevation_=30,
1304      const bool colorShading_=false);
1305
1306    // Simulate an image shadow
1307    void shadow(const double percentAlpha_=80.0,const double sigma_=0.5,
1308      const ssize_t x_=5,const ssize_t y_=5);
1309
1310    // Sharpen pixels in image
1311    // The radius_ parameter specifies the radius of the Gaussian, in
1312    // pixels, not counting the center pixel.  The sigma_ parameter
1313    // specifies the standard deviation of the Laplacian, in pixels.
1314    void sharpen(const double radius_=0.0,const double sigma_=1.0);
1315    void sharpenChannel(const ChannelType channel_,const double radius_=0.0,
1316      const double sigma_=1.0);
1317
1318    // Shave pixels from image edges.
1319    void shave(const Geometry &geometry_);
1320
1321    // Shear image (create parallelogram by sliding image by X or Y axis)
1322    void shear(const double xShearAngle_,const double yShearAngle_);
1323
1324    // adjust the image contrast with a non-linear sigmoidal contrast algorithm
1325    void sigmoidalContrast(const bool sharpen_,const double contrast,
1326      const double midpoint=QuantumRange/2.0);
1327
1328    // Image signature. Set force_ to true in order to re-calculate
1329    // the signature regardless of whether the image data has been
1330    // modified.
1331    std::string signature(const bool force_=false) const;
1332
1333    // Simulates a pencil sketch. We convolve the image with a Gaussian
1334    // operator of the given radius and standard deviation (sigma). For
1335    // reasonable results, radius should be larger than sigma. Use a
1336    // radius of 0 and SketchImage() selects a suitable radius for you.
1337    void sketch(const double radius_=0.0,const double sigma_=1.0,
1338      const double angle_=0.0);
1339
1340    // Solarize image (similar to effect seen when exposing a
1341    // photographic film to light during the development process)
1342    void solarize(const double factor_=50.0);
1343
1344    // Sparse color image, given a set of coordinates, interpolates the colors
1345    // found at those coordinates, across the whole image, using various
1346    // methods.
1347    void sparseColor(const ChannelType channel_,
1348      const SparseColorMethod method_,const size_t numberArguments_,
1349      const double *arguments_);
1350
1351    // Splice the background color into the image.
1352    void splice(const Geometry &geometry_);
1353    void splice(const Geometry &geometry_,const Color &backgroundColor_);
1354    void splice(const Geometry &geometry_,const Color &backgroundColor_,
1355      const GravityType gravity_);
1356
1357    // Spread pixels randomly within image by specified ammount
1358    void spread(const size_t amount_=3);
1359
1360    // Returns the statistics for this image.
1361    Magick::ImageStatistics statistics() const;
1362
1363    // Add a digital watermark to the image (based on second image)
1364    void stegano(const Image &watermark_);
1365
1366    // Create an image which appears in stereo when viewed with
1367    // red-blue glasses (Red image on left, blue on right)
1368    void stereo(const Image &rightImage_);
1369
1370    // Strip strips an image of all profiles and comments.
1371    void strip(void);
1372
1373    // Search for the specified image at EVERY possible location in this image.
1374    // This is slow! very very slow.. It returns a similarity image such that
1375    // an exact match location is completely white and if none of the pixels
1376    // match, black, otherwise some gray level in-between.
1377    Image subImageSearch(const Image &reference_,const MetricType metric_,
1378      Geometry *offset_,double *similarityMetric_,
1379      const double similarityThreshold=(-1.0));
1380
1381    // Swirl image (image pixels are rotated by degrees)
1382    void swirl(const double degrees_);
1383
1384    // Transfers the image cache pixels to the image.
1385    void syncPixels(void);
1386
1387    // Channel a texture on image background
1388    void texture(const Image &texture_);
1389
1390    // Threshold image
1391    void threshold(const double threshold_);
1392
1393    // Resize image to thumbnail size
1394    void thumbnail(const Geometry &geometry_);
1395
1396    // Applies a color vector to each pixel in the image. The length of the
1397    // vector is 0 for black and white and at its maximum for the midtones.
1398    // The vector weighting function is f(x)=(1-(4.0*((x-0.5)*(x-0.5))))
1399    void tint(const std::string opacity_);
1400
1401    // Transform image based on image and crop geometries
1402    // Crop geometry is optional
1403    void transform(const Geometry &imageGeometry_);
1404    void transform(const Geometry &imageGeometry_,
1405      const Geometry &cropGeometry_);
1406
1407    // Origin of coordinate system to use when annotating with text or drawing
1408    void transformOrigin(const double x_,const double y_);
1409
1410    // Reset transformation parameters to default
1411    void transformReset(void);
1412
1413    // Scale to use when annotating with text or drawing
1414    void transformScale(const double sx_,const double sy_);
1415
1416    // Add matte image to image, setting pixels matching color to
1417    // transparent
1418    void transparent(const Color &color_,const bool inverse_=false);
1419
1420    // Add matte image to image, for all the pixels that lies in between
1421    // the given two color
1422    void transparentChroma(const Color &colorLow_,const Color &colorHigh_);
1423
1424    // Creates a horizontal mirror image by reflecting the pixels around the
1425    // central y-axis while rotating them by 90 degrees.
1426    void transpose(void);
1427
1428    // Creates a vertical mirror image by reflecting the pixels around the
1429    // central x-axis while rotating them by 270 degrees.
1430    void transverse(void);
1431
1432    // Trim edges that are the background color from the image
1433    void trim(void);
1434
1435    // Returns the unique colors of an image.
1436    Image uniqueColors(void) const;
1437
1438    // Replace image with a sharpened version of the original image
1439    // using the unsharp mask algorithm.
1440    //  radius_
1441    //    the radius of the Gaussian, in pixels, not counting the
1442    //    center pixel.
1443    //  sigma_
1444    //    the standard deviation of the Gaussian, in pixels.
1445    //  amount_
1446    //    the percentage of the difference between the original and
1447    //    the blur image that is added back into the original.
1448    // threshold_
1449    //   the threshold in pixels needed to apply the diffence amount.
1450    void unsharpmask(const double radius_,const double sigma_,
1451      const double amount_,const double threshold_);
1452    void unsharpmaskChannel(const ChannelType channel_,const double radius_,
1453      const double sigma_,const double amount_,const double threshold_);
1454
1455    // Softens the edges of the image in vignette style.
1456    void vignette(const double radius_=0.0,const double sigma_=1.0,
1457      const ssize_t x_=0,const ssize_t y_=0);
1458
1459    // Map image pixels to a sine wave
1460    void wave(const double amplitude_=25.0,const double wavelength_=150.0);
1461
1462    // Forces all pixels above the threshold into white while leaving all
1463    // pixels at or below the threshold unchanged.
1464    void whiteThreshold(const std::string &threshold_);
1465    void whiteThresholdChannel(const ChannelType channel_,
1466      const std::string &threshold_);
1467
1468    // Write single image frame to in-memory BLOB, with optional
1469    // format and adjoin parameters.
1470    void write(Blob *blob_);
1471    void write(Blob *blob_,const std::string &magick_);
1472    void write(Blob *blob_,const std::string &magick_,const size_t depth_);
1473
1474    // Write single image frame to an array of pixels with storage
1475    // type specified by user (DispatchImage), e.g.
1476    // image.write( 0, 0, 640, 1, "RGB", 0, pixels );
1477    void write(const ::ssize_t x_,const ::ssize_t y_,const size_t columns_,
1478      const size_t rows_,const std::string &map_,const StorageType type_,
1479      void *pixels_);
1480
1481    // Write single image frame to a file
1482    void write(const std::string &imageSpec_);
1483
1484    // Transfers one or more pixel components from the image pixel
1485    // cache to a buffer or file.
1486    // Used to support image encoders.
1487    void writePixels(const QuantumType quantum_,unsigned char *destination_);
1488
1489    // Zoom image to specified size.
1490    void zoom(const Geometry &geometry_);
1491
1492    //////////////////////////////////////////////////////////////////////
1493    //
1494    // No user-serviceable parts beyond this point
1495    //
1496    //////////////////////////////////////////////////////////////////////
1497
1498    // Construct with MagickCore::Image and default options
1499    Image(MagickCore::Image *image_);
1500
1501    // Retrieve Image*
1502    MagickCore::Image *&image(void);
1503    const MagickCore::Image *constImage(void) const;
1504
1505    // Retrieve ImageInfo*
1506    MagickCore::ImageInfo *imageInfo(void);
1507    const MagickCore::ImageInfo *constImageInfo(void) const;
1508
1509    // Retrieve Options*
1510    Options *options(void);
1511    const Options *constOptions(void) const;
1512
1513    // Retrieve QuantizeInfo*
1514    MagickCore::QuantizeInfo *quantizeInfo(void);
1515    const MagickCore::QuantizeInfo *constQuantizeInfo(void) const;
1516
1517    // Prepare to update image (copy if reference > 1)
1518    void modifyImage(void);
1519
1520    // Replace current image (reference counted)
1521    MagickCore::Image *replaceImage(MagickCore::Image *replacement_);
1522
1523  private:
1524
1525    void read(MagickCore::Image *image,
1526      MagickCore::ExceptionInfo *exceptionInfo);
1527
1528    void floodFill(const ssize_t x_,const ssize_t y_,
1529      const Magick::Image *fillPattern_,const Color &fill_,
1530      const PixelInfo *target,const bool invert_);
1531
1532    ImageRef *_imgRef;
1533  };
1534
1535} // end of namespace Magick
1536
1537#endif // Magick_Image_header
1538