Coverage Report

Created: 2025-07-23 08:18

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