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