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