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