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