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