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