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