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