Powered by Pair ImageMagick logo
Image Magick
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

ImageMagick-6.1.1/Magick++/lib/Magick++/STL.h

Go to the documentation of this file.
00001 // This may look like C code, but it is really -*- C++ -*- 00002 // 00003 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 00004 // 00005 // Definition and implementation of template functions for using 00006 // Magick::Image with STL containers. 00007 // 00008 00009 #ifndef Magick_STL_header 00010 #define Magick_STL_header 00011 00012 #include "Magick++/Include.h" 00013 #include <algorithm> 00014 #include <functional> 00015 #include <iterator> 00016 #include <map> 00017 #include <utility> 00018 00019 #include "Magick++/CoderInfo.h" 00020 #include "Magick++/Drawable.h" 00021 #include "Magick++/Exception.h" 00022 #include "Magick++/Montage.h" 00023 00024 namespace Magick 00025 { 00026 // 00027 // STL function object declarations/definitions 00028 // 00029 00030 // Function objects provide the means to invoke an operation on one 00031 // or more image objects in an STL-compatable container. The 00032 // arguments to the function object constructor(s) are compatable 00033 // with the arguments to the equivalent Image class method and 00034 // provide the means to supply these options when the function 00035 // object is invoked. 00036 00037 // For example, to read a GIF animation, set the color red to 00038 // transparent for all frames, and write back out: 00039 // 00040 // list<image> images; 00041 // readImages( &images, "animation.gif" ); 00042 // for_each( images.begin(), images.end(), transparentImage( "red" ) ); 00043 // writeImages( images.begin(), images.end(), "animation.gif" ); 00044 00045 // Local adaptive threshold image 00046 // http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm 00047 // Width x height define the size of the pixel neighborhood 00048 // offset = constant to subtract from pixel neighborhood mean 00049 class MagickDLLDecl adaptiveThresholdImage : public std::unary_function<Image&,void> 00050 { 00051 public: 00052 adaptiveThresholdImage( const unsigned int width_, 00053 const unsigned int height_, 00054 const unsigned int offset_ = 0 ); 00055 00056 void operator()( Image &image_ ) const; 00057 00058 private: 00059 unsigned int _width; 00060 unsigned int _height; 00061 unsigned int _offset; 00062 }; 00063 00064 // Add noise to image with specified noise type 00065 class MagickDLLDecl addNoiseImage : public std::unary_function<Image&,void> 00066 { 00067 public: 00068 addNoiseImage ( NoiseType noiseType_ ); 00069 00070 void operator()( Image &image_ ) const; 00071 00072 private: 00073 NoiseType _noiseType; 00074 }; 00075 00076 // Transform image by specified affine (or free transform) matrix. 00077 class MagickDLLDecl affineTransformImage : public std::unary_function<Image&,void> 00078 { 00079 public: 00080 affineTransformImage( const DrawableAffine &affine_ ); 00081 00082 void operator()( Image &image_ ) const; 00083 00084 private: 00085 DrawableAffine _affine; 00086 }; 00087 00088 // Annotate image (draw text on image) 00089 class MagickDLLDecl annotateImage : public std::unary_function<Image&,void> 00090 { 00091 public: 00092 // Annotate using specified text, and placement location 00093 annotateImage ( const std::string &text_, 00094 const Geometry &geometry_ ); 00095 00096 // Annotate using specified text, bounding area, and placement 00097 // gravity 00098 annotateImage ( const std::string &text_, 00099 const Geometry &geometry_, 00100 const GravityType gravity_ ); 00101 00102 // Annotate with text using specified text, bounding area, 00103 // placement gravity, and rotation. 00104 annotateImage ( const std::string &text_, 00105 const Geometry &geometry_, 00106 const GravityType gravity_, 00107 const double degrees_ ); 00108 00109 // Annotate with text (bounding area is entire image) and 00110 // placement gravity. 00111 annotateImage ( const std::string &text_, 00112 const GravityType gravity_ ); 00113 00114 void operator()( Image &image_ ) const; 00115 00116 private: 00117 // Copy constructor and assignment are not supported 00118 annotateImage(const annotateImage&); 00119 annotateImage& operator=(const annotateImage&); 00120 00121 const std::string _text; 00122 const Geometry _geometry; 00123 const GravityType _gravity; 00124 const double _degrees; 00125 }; 00126 00127 // Blur image with specified blur factor 00128 class MagickDLLDecl blurImage : public std::unary_function<Image&,void> 00129 { 00130 public: 00131 blurImage( const double radius_ = 1, const double sigma_ = 0.5 ); 00132 00133 void operator()( Image &image_ ) const; 00134 00135 private: 00136 double _radius; 00137 double _sigma; 00138 }; 00139 00140 // Border image (add border to image) 00141 class MagickDLLDecl borderImage : public std::unary_function<Image&,void> 00142 { 00143 public: 00144 borderImage( const Geometry &geometry_ = borderGeometryDefault ); 00145 00146 void operator()( Image &image_ ) const; 00147 00148 private: 00149 Geometry _geometry; 00150 }; 00151 00152 // Charcoal effect image (looks like charcoal sketch) 00153 class MagickDLLDecl charcoalImage : public std::unary_function<Image&,void> 00154 { 00155 public: 00156 charcoalImage( const double radius_ = 1, const double sigma_ = 0.5 ); 00157 00158 void operator()( Image &image_ ) const; 00159 00160 private: 00161 double _radius; 00162 double _sigma; 00163 }; 00164 00165 // Chop image (remove vertical or horizontal subregion of image) 00166 class MagickDLLDecl chopImage : public std::unary_function<Image&,void> 00167 { 00168 public: 00169 chopImage( const Geometry &geometry_ ); 00170 00171 void operator()( Image &image_ ) const; 00172 00173 private: 00174 Geometry _geometry; 00175 }; 00176 00177 // Colorize image using pen color at specified percent opacity 00178 class MagickDLLDecl colorizeImage : public std::unary_function<Image&,void> 00179 { 00180 public: 00181 colorizeImage( const unsigned int opacityRed_, 00182 const unsigned int opacityGreen_, 00183 const unsigned int opacityBlue_, 00184 const Color &penColor_ ); 00185 00186 colorizeImage( const unsigned int opacity_, 00187 const Color &penColor_ ); 00188 00189 void operator()( Image &image_ ) const; 00190 00191 private: 00192 unsigned int _opacityRed; 00193 unsigned int _opacityGreen; 00194 unsigned int _opacityBlue; 00195 Color _penColor; 00196 }; 00197 00198 // Convert the image colorspace representation 00199 class MagickDLLDecl colorSpaceImage : public std::unary_function<Image&,void> 00200 { 00201 public: 00202 colorSpaceImage( ColorspaceType colorSpace_ ); 00203 00204 void operator()( Image &image_ ) const; 00205 00206 private: 00207 ColorspaceType _colorSpace; 00208 }; 00209 00210 // Comment image (add comment string to image) 00211 class MagickDLLDecl commentImage : public std::unary_function<Image&,void> 00212 { 00213 public: 00214 commentImage( const std::string &comment_ ); 00215 00216 void operator()( Image &image_ ) const; 00217 00218 private: 00219 std::string _comment; 00220 }; 00221 00222 // Compose an image onto another at specified offset and using 00223 // specified algorithm 00224 class MagickDLLDecl compositeImage : public std::unary_function<Image&,void> 00225 { 00226 public: 00227 compositeImage( const Image &compositeImage_, 00228 int xOffset_, 00229 int yOffset_, 00230 CompositeOperator compose_ = InCompositeOp ); 00231 00232 compositeImage( const Image &compositeImage_, 00233 const Geometry &offset_, 00234 CompositeOperator compose_ = InCompositeOp ); 00235 00236 void operator()( Image &image_ ) const; 00237 00238 private: 00239 Image _compositeImage; 00240 int _xOffset; 00241 int _yOffset; 00242 CompositeOperator _compose; 00243 }; 00244 00245 // Contrast image (enhance intensity differences in image) 00246 class MagickDLLDecl contrastImage : public std::unary_function<Image&,void> 00247 { 00248 public: 00249 contrastImage( const unsigned int sharpen_ ); 00250 00251 void operator()( Image &image_ ) const; 00252 00253 private: 00254 unsigned int _sharpen; 00255 }; 00256 00257 // Crop image (subregion of original image) 00258 class MagickDLLDecl cropImage : public std::unary_function<Image&,void> 00259 { 00260 public: 00261 cropImage( const Geometry &geometry_ ); 00262 00263 void operator()( Image &image_ ) const; 00264 00265 private: 00266 Geometry _geometry; 00267 }; 00268 00269 // Cycle image colormap 00270 class MagickDLLDecl cycleColormapImage : public std::unary_function<Image&,void> 00271 { 00272 public: 00273 cycleColormapImage( const int amount_ ); 00274 00275 void operator()( Image &image_ ) const; 00276 00277 private: 00278 int _amount; 00279 }; 00280 00281 // Despeckle image (reduce speckle noise) 00282 class MagickDLLDecl despeckleImage : public std::unary_function<Image&,void> 00283 { 00284 public: 00285 despeckleImage( void ); 00286 00287 void operator()( Image &image_ ) const; 00288 00289 private: 00290 }; 00291 00292 // Draw on image 00293 class MagickDLLDecl drawImage : public std::unary_function<Image&,void> 00294 { 00295 public: 00296 // Draw on image using a single drawable 00297 // Store in list to make implementation easier 00298 drawImage( const Drawable &drawable_ ); 00299 00300 // Draw on image using a drawable list 00301 drawImage( const DrawableList &drawable_ ); 00302 00303 void operator()( Image &image_ ) const; 00304 00305 private: 00306 DrawableList _drawableList; 00307 }; 00308 00309 // Edge image (hilight edges in image) 00310 class MagickDLLDecl edgeImage : public std::unary_function<Image&,void> 00311 { 00312 public: 00313 edgeImage( const double radius_ = 0.0 ); 00314 00315 void operator()( Image &image_ ) const; 00316 00317 private: 00318 double _radius; 00319 }; 00320 00321 // Emboss image (hilight edges with 3D effect) 00322 class MagickDLLDecl embossImage : public std::unary_function<Image&,void> 00323 { 00324 public: 00325 embossImage( void ); 00326 embossImage( const double radius_, const double sigma_ ); 00327 00328 void operator()( Image &image_ ) const; 00329 00330 private: 00331 double _radius; 00332 double _sigma; 00333 }; 00334 00335 // Enhance image (minimize noise) 00336 class MagickDLLDecl enhanceImage : public std::unary_function<Image&,void> 00337 { 00338 public: 00339 enhanceImage( void ); 00340 00341 void operator()( Image &image_ ) const; 00342 00343 private: 00344 }; 00345 00346 // Equalize image (histogram equalization) 00347 class MagickDLLDecl equalizeImage : public std::unary_function<Image&,void> 00348 { 00349 public: 00350 equalizeImage( void ); 00351 00352 void operator()( Image &image_ ) const; 00353 00354 private: 00355 }; 00356 00357 // Color to use when filling drawn objects 00358 class MagickDLLDecl fillColorImage : public std::unary_function<Image&,void> 00359 { 00360 public: 00361 fillColorImage( const Color &fillColor_ ); 00362 00363 void operator()( Image &image_ ) const; 00364 00365 private: 00366 Color _fillColor; 00367 }; 00368 00369 // Flip image (reflect each scanline in the vertical direction) 00370 class MagickDLLDecl flipImage : public std::unary_function<Image&,void> 00371 { 00372 public: 00373 flipImage( void ); 00374 00375 void operator()( Image &image_ ) const; 00376 00377 private: 00378 }; 00379 00380 // Flood-fill image with color 00381 class MagickDLLDecl floodFillColorImage : public std::unary_function<Image&,void> 00382 { 00383 public: 00384 // Flood-fill color across pixels starting at target-pixel and 00385 // stopping at pixels matching specified border color. 00386 // Uses current fuzz setting when determining color match. 00387 floodFillColorImage( const unsigned int x_, 00388 const unsigned int y_, 00389 const Color &fillColor_ ); 00390 00391 floodFillColorImage( const Geometry &point_, 00392 const Color &fillColor_ ); 00393 00394 // Flood-fill color across pixels starting at target-pixel and 00395 // stopping at pixels matching specified border color. 00396 // Uses current fuzz setting when determining color match. 00397 floodFillColorImage( const unsigned int x_, 00398 const unsigned int y_, 00399 const Color &fillColor_, 00400 const Color &borderColor_ ); 00401 00402 floodFillColorImage( const Geometry &point_, 00403 const Color &fillColor_, 00404 const Color &borderColor_ ); 00405 00406 void operator()( Image &image_ ) const; 00407 00408 private: 00409 unsigned int _x; 00410 unsigned int _y; 00411 Color _fillColor; 00412 Color _borderColor; 00413 }; 00414 00415 // Flood-fill image with texture 00416 class MagickDLLDecl floodFillTextureImage : public std::unary_function<Image&,void> 00417 { 00418 public: 00419 // Flood-fill texture across pixels that match the color of the 00420 // target pixel and are neighbors of the target pixel. 00421 // Uses current fuzz setting when determining color match. 00422 floodFillTextureImage( const unsigned int x_, 00423 const unsigned int y_, 00424 const Image &texture_ ); 00425 00426 floodFillTextureImage( const Geometry &point_, 00427 const Image &texture_ ); 00428 00429 // Flood-fill texture across pixels starting at target-pixel and 00430 // stopping at pixels matching specified border color. 00431 // Uses current fuzz setting when determining color match. 00432 floodFillTextureImage( const unsigned int x_, 00433 const unsigned int y_, 00434 const Image &texture_, 00435 const Color &borderColor_ ); 00436 00437 floodFillTextureImage( const Geometry &point_, 00438 const Image &texture_, 00439 const Color &borderColor_ ); 00440 00441 void operator()( Image &image_ ) const; 00442 00443 private: 00444 unsigned int _x; 00445 unsigned int _y; 00446 Image _texture; 00447 Color _borderColor; 00448 }; 00449 00450 // Flop image (reflect each scanline in the horizontal direction) 00451 class MagickDLLDecl flopImage : public std::unary_function<Image&,void> 00452 { 00453 public: 00454 flopImage( void ); 00455 00456 void operator()( Image &image_ ) const; 00457 00458 private: 00459 }; 00460 00461 // Frame image 00462 class MagickDLLDecl frameImage : public std::unary_function<Image&,void> 00463 { 00464 public: 00465 frameImage( const Geometry &geometry_ = frameGeometryDefault ); 00466 00467 frameImage( const unsigned int width_, const unsigned int height_, 00468 const int innerBevel_ = 6, const int outerBevel_ = 6 ); 00469 00470 void operator()( Image &image_ ) const; 00471 00472 private: 00473 unsigned int _width; 00474 unsigned int _height; 00475 int _outerBevel; 00476 int _innerBevel; 00477 }; 00478 00479 // Gamma correct image 00480 class MagickDLLDecl gammaImage : public std::unary_function<Image&,void> 00481 { 00482 public: 00483 gammaImage( const double gamma_ ); 00484 00485 gammaImage ( const double gammaRed_, 00486 const double gammaGreen_, 00487 const double gammaBlue_ ); 00488 00489 void operator()( Image &image_ ) const; 00490 00491 private: 00492 double _gammaRed; 00493 double _gammaGreen; 00494 double _gammaBlue; 00495 }; 00496 00497 // Gaussian blur image 00498 // The number of neighbor pixels to be included in the convolution 00499 // mask is specified by 'width_'. The standard deviation of the 00500 // gaussian bell curve is specified by 'sigma_'. 00501 class MagickDLLDecl gaussianBlurImage : public std::unary_function<Image&,void> 00502 { 00503 public: 00504 gaussianBlurImage( const double width_, const double sigma_ ); 00505 00506 void operator()( Image &image_ ) const; 00507 00508 private: 00509 double _width; 00510 double _sigma; 00511 }; 00512 00513 // Implode image (special effect) 00514 class MagickDLLDecl implodeImage : public std::unary_function<Image&,void> 00515 { 00516 public: 00517 implodeImage( const double factor_ = 50 ); 00518 00519 void operator()( Image &image_ ) const; 00520 00521 private: 00522 double _factor; 00523 }; 00524 00525 // Set image validity. Valid images become empty (inValid) if 00526 // argument is false. 00527 class MagickDLLDecl isValidImage : public std::unary_function<Image&,void> 00528 { 00529 public: 00530 isValidImage( const bool isValid_ ); 00531 00532 void operator()( Image &image_ ) const; 00533 00534 private: 00535 bool _isValid; 00536 }; 00537 00538 // Label image 00539 class MagickDLLDecl labelImage : public std::unary_function<Image&,void> 00540 { 00541 public: 00542 labelImage( const std::string &label_ ); 00543 00544 void operator()( Image &image_ ) const; 00545 00546 private: 00547 std::string _label; 00548 }; 00549 00550 // Extract channel from image 00551 class MagickDLLDecl channelImage : public std::unary_function<Image&,void> 00552 { 00553 public: 00554 channelImage( const ChannelType channel_ ); 00555 00556 void operator()( Image &image_ ) const; 00557 00558 private: 00559 ChannelType _channel; 00560 }; 00561 00562 // Magnify image by integral size 00563 class MagickDLLDecl magnifyImage : public std::unary_function<Image&,void> 00564 { 00565 public: 00566 magnifyImage( void ); 00567 00568 void operator()( Image &image_ ) const; 00569 00570 private: 00571 }; 00572 00573 // Remap image colors with closest color from reference image 00574 class MagickDLLDecl mapImage : public std::unary_function<Image&,void> 00575 { 00576 public: 00577 mapImage( const Image &mapImage_ , 00578 const bool dither_ = false ); 00579 00580 void operator()( Image &image_ ) const; 00581 00582 private: 00583 Image _mapImage; 00584 bool _dither; 00585 }; 00586 00587 // Floodfill designated area with a matte value 00588 class MagickDLLDecl matteFloodfillImage : public std::unary_function<Image&,void> 00589 { 00590 public: 00591 matteFloodfillImage( const Color &target_ , 00592 const unsigned int matte_, 00593 const int x_, const int y_, 00594 const PaintMethod method_ ); 00595 00596 void operator()( Image &image_ ) const; 00597 00598 private: 00599 Color _target; 00600 unsigned int _matte; 00601 int _x; 00602 int _y; 00603 PaintMethod _method; 00604 }; 00605 00606 // Filter image by replacing each pixel component with the median 00607 // color in a circular neighborhood 00608 class MagickDLLDecl medianFilterImage : public std::unary_function<Image&,void> 00609 { 00610 public: 00611 medianFilterImage( const double radius_ = 0.0 ); 00612 00613 void operator()( Image &image_ ) const; 00614 00615 private: 00616 double _radius; 00617 }; 00618 00619 // Reduce image by integral size 00620 class MagickDLLDecl minifyImage : public std::unary_function<Image&,void> 00621 { 00622 public: 00623 minifyImage( void ); 00624 00625 void operator()( Image &image_ ) const; 00626 00627 private: 00628 }; 00629 00630 // Modulate percent hue, saturation, and brightness of an image 00631 class MagickDLLDecl modulateImage : public std::unary_function<Image&,void> 00632 { 00633 public: 00634 modulateImage( const double brightness_, 00635 const double saturation_, 00636 const double hue_ ); 00637 00638 void operator()( Image &image_ ) const; 00639 00640 private: 00641 double _brightness; 00642 double _saturation; 00643 double _hue; 00644 }; 00645 00646 // Negate colors in image. Set grayscale to only negate grayscale 00647 // values in image. 00648 class MagickDLLDecl negateImage : public std::unary_function<Image&,void> 00649 { 00650 public: 00651 negateImage( const bool grayscale_ = false ); 00652 00653 void operator()( Image &image_ ) const; 00654 00655 private: 00656 bool _grayscale; 00657 }; 00658 00659 // Normalize image (increase contrast by normalizing the pixel 00660 // values to span the full range of color values) 00661 class MagickDLLDecl normalizeImage : public std::unary_function<Image&,void> 00662 { 00663 public: 00664 normalizeImage( void ); 00665 00666 void operator()( Image &image_ ) const; 00667 00668 private: 00669 }; 00670 00671 // Oilpaint image (image looks like oil painting) 00672 class MagickDLLDecl oilPaintImage : public std::unary_function<Image&,void> 00673 { 00674 public: 00675 oilPaintImage( const double radius_ = 3 ); 00676 00677 void operator()( Image &image_ ) const; 00678 00679 private: 00680 double _radius; 00681 }; 00682 00683 // Set or attenuate the image opacity channel. If the image pixels 00684 // are opaque then they are set to the specified opacity value, 00685 // otherwise they are blended with the supplied opacity value. The 00686 // value of opacity_ ranges from 0 (completely opaque) to 00687 // MaxRGB. The defines OpaqueOpacity and TransparentOpacity are 00688 // available to specify completely opaque or completely transparent, 00689 // respectively. 00690 class MagickDLLDecl opacityImage : public std::unary_function<Image&,void> 00691 { 00692 public: 00693 opacityImage( const unsigned int opacity_ ); 00694 00695 void operator()( Image &image_ ) const; 00696 00697 private: 00698 unsigned int _opacity; 00699 }; 00700 00701 // Change color of opaque pixel to specified pen color. 00702 class MagickDLLDecl opaqueImage : public std::unary_function<Image&,void> 00703 { 00704 public: 00705 opaqueImage( const Color &opaqueColor_, 00706 const Color &penColor_ ); 00707 00708 void operator()( Image &image_ ) const; 00709 00710 private: 00711 Color _opaqueColor; 00712 Color _penColor; 00713 }; 00714 00715 // Quantize image (reduce number of colors) 00716 class MagickDLLDecl quantizeImage : public std::unary_function<Image&,void> 00717 { 00718 public: 00719 quantizeImage( const bool measureError_ = false ); 00720 00721 void operator()( Image &image_ ) const; 00722 00723 private: 00724 bool _measureError; 00725 }; 00726 00727 // Raise image (lighten or darken the edges of an image to give a 00728 // 3-D raised or lowered effect) 00729 class MagickDLLDecl raiseImage : public std::unary_function<Image&,void> 00730 { 00731 public: 00732 raiseImage( const Geometry &geometry_ = raiseGeometryDefault, 00733 const bool raisedFlag_ = false ); 00734 00735 void operator()( Image &image_ ) const; 00736 00737 private: 00738 Geometry _geometry; 00739 bool _raisedFlag; 00740 }; 00741 00742 // Reduce noise in image using a noise peak elimination filter 00743 class MagickDLLDecl reduceNoiseImage : public std::unary_function<Image&,void> 00744 { 00745 public: 00746 reduceNoiseImage( void ); 00747 00748 reduceNoiseImage (const unsigned int order_ ); 00749 00750 void operator()( Image &image_ ) const; 00751 00752 private: 00753 unsigned int _order; 00754 }; 00755 00756 // Roll image (rolls image vertically and horizontally) by specified 00757 // number of columnms and rows) 00758 class MagickDLLDecl rollImage : public std::unary_function<Image&,void> 00759 { 00760 public: 00761 rollImage( const Geometry &roll_ ); 00762 00763 rollImage( const int columns_, const int rows_ ); 00764 00765 void operator()( Image &image_ ) const; 00766 00767 private: 00768 int _columns; 00769 int _rows; 00770 }; 00771 00772 // Rotate image counter-clockwise by specified number of degrees. 00773 class MagickDLLDecl rotateImage : public std::unary_function<Image&,void> 00774 { 00775 public: 00776 rotateImage( const double degrees_ ); 00777 00778 void operator()( Image &image_ ) const; 00779 00780 private: 00781 double _degrees; 00782 }; 00783 00784 // Resize image by using pixel sampling algorithm 00785 class MagickDLLDecl sampleImage : public std::unary_function<Image&,void> 00786 { 00787 public: 00788 sampleImage( const Geometry &geometry_ ); 00789 00790 void operator()( Image &image_ ) const; 00791 00792 private: 00793 Geometry _geometry; 00794 }; 00795 00796 // Resize image by using simple ratio algorithm 00797 class MagickDLLDecl scaleImage : public std::unary_function<Image&,void> 00798 { 00799 public: 00800 scaleImage( const Geometry &geometry_ ); 00801 00802 void operator()( Image &image_ ) const; 00803 00804 private: 00805 Geometry _geometry; 00806 }; 00807 00808 // Segment (coalesce similar image components) by analyzing the 00809 // histograms of the color components and identifying units that are 00810 // homogeneous with the fuzzy c-means technique. 00811 // Also uses QuantizeColorSpace and Verbose image attributes 00812 class MagickDLLDecl segmentImage : public std::unary_function<Image&,void> 00813 { 00814 public: 00815 segmentImage( const double clusterThreshold_ = 1.0, 00816 const double smoothingThreshold_ = 1.5 ); 00817 00818 void operator()( Image &image_ ) const; 00819 00820 private: 00821 double _clusterThreshold; 00822 double _smoothingThreshold; 00823 }; 00824 00825 // Shade image using distant light source 00826 class MagickDLLDecl shadeImage : public std::unary_function<Image&,void> 00827 { 00828 public: 00829 shadeImage( const double clusterThreshold_ = 1.0, 00830 const double smoothingThreshold_ = 1.5 ); 00831 00832 void operator()( Image &image_ ) const; 00833 00834 private: 00835 double _clusterThreshold; 00836 double _smoothingThreshold; 00837 }; 00838 00839 // Sharpen pixels in image 00840 class MagickDLLDecl sharpenImage : public std::unary_function<Image&,void> 00841 { 00842 public: 00843 sharpenImage( const double radius_ = 1, const double sigma_ = 0.5 ); 00844 00845 void operator()( Image &image_ ) const; 00846 00847 private: 00848 double _radius; 00849 double _sigma; 00850 }; 00851 00852 // Shave pixels from image edges. 00853 class MagickDLLDecl shaveImage : public std::unary_function<Image&,void> 00854 { 00855 public: 00856 shaveImage( const Geometry &geometry_ ); 00857 00858 void operator()( Image &image_ ) const; 00859 00860 private: 00861 Geometry _geometry; 00862 }; 00863 00864 00865 // Shear image (create parallelogram by sliding image by X or Y axis) 00866 class MagickDLLDecl shearImage : public std::unary_function<Image&,void> 00867 { 00868 public: 00869 shearImage( const double xShearAngle_, 00870 const double yShearAngle_ ); 00871 00872 void operator()( Image &image_ ) const; 00873 00874 private: 00875 double _xShearAngle; 00876 double _yShearAngle; 00877 }; 00878 00879 // Solarize image (similar to effect seen when exposing a 00880 // photographic film to light during the development process) 00881 class MagickDLLDecl solarizeImage : public std::unary_function<Image&,void> 00882 { 00883 public: 00884 solarizeImage( const double factor_ ); 00885 00886 void operator()( Image &image_ ) const; 00887 00888 private: 00889 double _factor; 00890 }; 00891 00892 // Spread pixels randomly within image by specified ammount 00893 class MagickDLLDecl spreadImage : public std::unary_function<Image&,void> 00894 { 00895 public: 00896 spreadImage( const unsigned int amount_ = 3 ); 00897 00898 void operator()( Image &image_ ) const; 00899 00900 private: 00901 unsigned int _amount; 00902 }; 00903 00904 // Add a digital watermark to the image (based on second image) 00905 class MagickDLLDecl steganoImage : public std::unary_function<Image&,void> 00906 { 00907 public: 00908 steganoImage( const Image &waterMark_ ); 00909 00910 void operator()( Image &image_ ) const; 00911 00912 private: 00913 Image _waterMark; 00914 }; 00915 00916 // Create an image which appears in stereo when viewed with red-blue glasses 00917 // (Red image on left, blue on right) 00918 class MagickDLLDecl stereoImage : public std::unary_function<Image&,void> 00919 { 00920 public: 00921 stereoImage( const Image &rightImage_ ); 00922 00923 void operator()( Image &image_ ) const; 00924 00925 private: 00926 Image _rightImage; 00927 }; 00928 00929 // Color to use when drawing object outlines 00930 class MagickDLLDecl strokeColorImage : public std::unary_function<Image&,void> 00931 { 00932 public: 00933 strokeColorImage( const Color &strokeColor_ ); 00934 00935 void operator()( Image &image_ ) const; 00936 00937 private: 00938 Color _strokeColor; 00939 }; 00940 00941 // Swirl image (image pixels are rotated by degrees) 00942 class MagickDLLDecl swirlImage : public std::unary_function<Image&,void> 00943 { 00944 public: 00945 swirlImage( const double degrees_ ); 00946 00947 void operator()( Image &image_ ) const; 00948 00949 private: 00950 double _degrees; 00951 }; 00952 00953 // Channel a texture on image background 00954 class MagickDLLDecl textureImage : public std::unary_function<Image&,void> 00955 { 00956 public: 00957 textureImage( const Image &texture_ ); 00958 00959 void operator()( Image &image_ ) const; 00960 00961 private: 00962 Image _texture; 00963 }; 00964 00965 // Threshold image 00966 class MagickDLLDecl thresholdImage : public std::unary_function<Image&,void> 00967 { 00968 public: 00969 thresholdImage( const double threshold_ ); 00970 00971 void operator()( Image &image_ ) const; 00972 00973 private: 00974 double _threshold; 00975 }; 00976 00977 // Transform image based on image and crop geometries 00978 class MagickDLLDecl transformImage : public std::unary_function<Image&,void> 00979 { 00980 public: 00981 transformImage( const Geometry &imageGeometry_ ); 00982 00983 transformImage( const Geometry &imageGeometry_, 00984 const Geometry &cropGeometry_ ); 00985 00986 void operator()( Image &image_ ) const; 00987 00988 private: 00989 Geometry _imageGeometry; 00990 Geometry _cropGeometry; 00991 }; 00992 00993 // Set image color to transparent 00994 class MagickDLLDecl transparentImage : public std::unary_function<Image&,void> 00995 { 00996 public: 00997 transparentImage( const Color& color_ ); 00998 00999 void operator()( Image &image_ ) const; 01000 01001 private: 01002 Color _color; 01003 }; 01004 01005 // Trim edges that are the background color from the image 01006 class MagickDLLDecl trimImage : public std::unary_function<Image&,void> 01007 { 01008 public: 01009 trimImage( void ); 01010 01011 void operator()( Image &image_ ) const; 01012 01013 private: 01014 }; 01015 01016 // Map image pixels to a sine wave 01017 class MagickDLLDecl waveImage : public std::unary_function<Image&,void> 01018 { 01019 public: 01020 waveImage( const double amplitude_ = 25.0, 01021 const double wavelength_ = 150.0 ); 01022 01023 void operator()( Image &image_ ) const; 01024 01025 private: 01026 double _amplitude; 01027 double _wavelength; 01028 }; 01029 01030 // Zoom image to specified size. 01031 class MagickDLLDecl zoomImage : public std::unary_function<Image&,void> 01032 { 01033 public: 01034 zoomImage( const Geometry &geometry_ ); 01035 01036 void operator()( Image &image_ ) const; 01037 01038 private: 01039 Geometry _geometry; 01040 }; 01041 01042 // 01043 // Function object image attribute accessors 01044 // 01045 01046 // Anti-alias Postscript and TrueType fonts (default true) 01047 class MagickDLLDecl antiAliasImage : public std::unary_function<Image&,void> 01048 { 01049 public: 01050 antiAliasImage( const bool flag_ ); 01051 01052 void operator()( Image &image_ ) const; 01053 01054 private: 01055 bool _flag; 01056 }; 01057 01058 // Join images into a single multi-image file 01059 class MagickDLLDecl adjoinImage : public std::unary_function<Image&,void> 01060 { 01061 public: 01062 adjoinImage( const bool flag_ ); 01063 01064 void operator()( Image &image_ ) const; 01065 01066 private: 01067 bool _flag; 01068 }; 01069 01070 // Time in 1/100ths of a second which must expire before displaying 01071 // the next image in an animated sequence. 01072 class MagickDLLDecl animationDelayImage : public std::unary_function<Image&,void> 01073 { 01074 public: 01075 animationDelayImage( const unsigned int delay_ ); 01076 01077 void operator()( Image &image_ ) const; 01078 01079 private: 01080 unsigned int _delay; 01081 }; 01082 01083 // Number of iterations to loop an animation (e.g. Netscape loop 01084 // extension) for. 01085 class MagickDLLDecl animationIterationsImage : public std::unary_function<Image&,void> 01086 { 01087 public: 01088 animationIterationsImage( const unsigned int iterations_ ); 01089 01090 void operator()( Image &image_ ) const; 01091 01092 private: 01093 unsigned int _iterations; 01094 }; 01095 01096 // Image background color 01097 class MagickDLLDecl backgroundColorImage : public std::unary_function<Image&,void> 01098 { 01099 public: 01100 backgroundColorImage( const Color &color_ ); 01101 01102 void operator()( Image &image_ ) const; 01103 01104 private: 01105 Color _color; 01106 }; 01107 01108 // Name of texture image to tile onto the image background 01109 class MagickDLLDecl backgroundTextureImage : public std::unary_function<Image&,void> 01110 { 01111 public: 01112 backgroundTextureImage( const std::string &backgroundTexture_ ); 01113 01114 void operator()( Image &image_ ) const; 01115 01116 private: 01117 std::string _backgroundTexture; 01118 }; 01119 01120 // Image border color 01121 class MagickDLLDecl borderColorImage : public std::unary_function<Image&,void> 01122 { 01123 public: 01124 borderColorImage( const Color &color_ ); 01125 01126 void operator()( Image &image_ ) const; 01127 01128 private: 01129 Color _color; 01130 }; 01131 01132 // Text bounding-box base color (default none) 01133 class MagickDLLDecl boxColorImage : public std::unary_function<Image&,void> 01134 { 01135 public: 01136 boxColorImage( const Color &boxColor_ ); 01137 01138 void operator()( Image &image_ ) const; 01139 01140 private: 01141 Color _boxColor; 01142 }; 01143 01144 // Chromaticity blue primary point (e.g. x=0.15, y=0.06) 01145 class MagickDLLDecl chromaBluePrimaryImage : public std::unary_function<Image&,void> 01146 { 01147 public: 01148 chromaBluePrimaryImage( const double x_, const double y_ ); 01149 01150 void operator()( Image &image_ ) const; 01151 01152 private: 01153 double _x; 01154 double _y; 01155 }; 01156 01157 // Chromaticity green primary point (e.g. x=0.3, y=0.6) 01158 class MagickDLLDecl chromaGreenPrimaryImage : public std::unary_function<Image&,void> 01159 { 01160 public: 01161 chromaGreenPrimaryImage( const double x_, const double y_ ); 01162 01163 void operator()( Image &image_ ) const; 01164 01165 private: 01166 double _x; 01167 double _y; 01168 }; 01169 01170 // Chromaticity red primary point (e.g. x=0.64, y=0.33) 01171 class MagickDLLDecl chromaRedPrimaryImage : public std::unary_function<Image&,void> 01172 { 01173 public: 01174 chromaRedPrimaryImage( const double x_, const double y_ ); 01175 01176 void operator()( Image &image_ ) const; 01177 01178 private: 01179 double _x; 01180 double _y; 01181 }; 01182 01183 // Chromaticity white point (e.g. x=0.3127, y=0.329) 01184 class MagickDLLDecl chromaWhitePointImage : public std::unary_function<Image&,void> 01185 { 01186 public: 01187 chromaWhitePointImage( const double x_, const double y_ ); 01188 01189 void operator()( Image &image_ ) const; 01190 01191 private: 01192 double _x; 01193 double _y; 01194 }; 01195 01196 // Colors within this distance are considered equal 01197 class MagickDLLDecl colorFuzzImage : public std::unary_function<Image&,void> 01198 { 01199 public: 01200 colorFuzzImage( const double fuzz_ ); 01201 01202 void operator()( Image &image_ ) const; 01203 01204 private: 01205 double _fuzz; 01206 }; 01207 01208 // Color at colormap position index_ 01209 class MagickDLLDecl colorMapImage : public std::unary_function<Image&,void> 01210 { 01211 public: 01212 colorMapImage( const unsigned int index_, const Color &color_ ); 01213 01214 void operator()( Image &image_ ) const; 01215 01216 private: 01217 unsigned int _index; 01218 Color _color; 01219 }; 01220 01221 // Composition operator to be used when composition is implicitly used 01222 // (such as for image flattening). 01223 class MagickDLLDecl composeImage : public std::unary_function<Image&,void> 01224 { 01225 public: 01226 composeImage( const CompositeOperator compose_ ); 01227 01228 void operator()( Image &image_ ) const; 01229 01230 private: 01231 CompositeOperator _compose; 01232 }; 01233 01234 // Compression type 01235 class MagickDLLDecl compressTypeImage : public std::unary_function<Image&,void> 01236 { 01237 public: 01238 compressTypeImage( const CompressionType compressType_ ); 01239 01240 void operator()( Image &image_ ) const; 01241 01242 private: 01243 CompressionType _compressType; 01244 }; 01245 01246 // Vertical and horizontal resolution in pixels of the image 01247 class MagickDLLDecl densityImage : public std::unary_function<Image&,void> 01248 { 01249 public: 01250 densityImage( const Geometry &geomery_ ); 01251 01252 void operator()( Image &image_ ) const; 01253 01254 private: 01255 Geometry _geomery; 01256 }; 01257 01258 // Image depth (bits allocated to red/green/blue components) 01259 class MagickDLLDecl depthImage : public std::unary_function<Image&,void> 01260 { 01261 public: 01262 depthImage( const unsigned int depth_ ); 01263 01264 void operator()( Image &image_ ) const; 01265 01266 private: 01267 unsigned int _depth; 01268 }; 01269 01270 // Endianness (LSBEndian like Intel or MSBEndian like SPARC) for image 01271 // formats which support endian-specific options. 01272 class MagickDLLDecl endianImage : public std::unary_function<Image&,void> 01273 { 01274 public: 01275 endianImage( const EndianType endian_ ); 01276 01277 void operator()( Image &image_ ) const; 01278 01279 private: 01280 EndianType _endian; 01281 }; 01282 01283 // Image file name 01284 class MagickDLLDecl fileNameImage : public std::unary_function<Image&,void> 01285 { 01286 public: 01287 fileNameImage( const std::string &fileName_ ); 01288 01289 void operator()( Image &image_ ) const; 01290 01291 private: 01292 std::string _fileName; 01293 }; 01294 01295 // Filter to use when resizing image 01296 class MagickDLLDecl filterTypeImage : public std::unary_function<Image&,void> 01297 { 01298 public: 01299 filterTypeImage( const FilterTypes filterType_ ); 01300 01301 void operator()( Image &image_ ) const; 01302 01303 private: 01304 FilterTypes _filterType; 01305 }; 01306 01307 // Text rendering font 01308 class MagickDLLDecl fontImage : public std::unary_function<Image&,void> 01309 { 01310 public: 01311 fontImage( const std::string &font_ ); 01312 01313 void operator()( Image &image_ ) const; 01314 01315 private: 01316 std::string _font; 01317 }; 01318 01319 // Font point size 01320 class MagickDLLDecl fontPointsizeImage : public std::unary_function<Image&,void> 01321 { 01322 public: 01323 fontPointsizeImage( const unsigned int pointsize_ ); 01324 01325 void operator()( Image &image_ ) const; 01326 01327 private: 01328 unsigned int _pointsize; 01329 }; 01330 01331 // GIF disposal method 01332 class MagickDLLDecl gifDisposeMethodImage : public std::unary_function<Image&,void> 01333 { 01334 public: 01335 gifDisposeMethodImage( const unsigned int disposeMethod_ ); 01336 01337 void operator()( Image &image_ ) const; 01338 01339 private: 01340 unsigned int _disposeMethod; 01341 }; 01342 01343 // Type of interlacing to use 01344 class MagickDLLDecl interlaceTypeImage : public std::unary_function<Image&,void> 01345 { 01346 public: 01347 interlaceTypeImage( const InterlaceType interlace_ ); 01348 01349 void operator()( Image &image_ ) const; 01350 01351 private: 01352 InterlaceType _interlace; 01353 }; 01354 01355 // Linewidth for drawing vector objects (default one) 01356 class MagickDLLDecl lineWidthImage : public std::unary_function<Image&,void> 01357 { 01358 public: 01359 lineWidthImage( const double lineWidth_ ); 01360 01361 void operator()( Image &image_ ) const; 01362 01363 private: 01364 double _lineWidth; 01365 }; 01366 01367 // File type magick identifier (.e.g "GIF") 01368 class MagickDLLDecl magickImage : public std::unary_function<Image&,void> 01369 { 01370 public: 01371 magickImage( const std::string &magick_ ); 01372 01373 void operator()( Image &image_ ) const; 01374 01375 private: 01376 std::string _magick; 01377 }; 01378 01379 // Image supports transparent color 01380 class MagickDLLDecl matteImage : public std::unary_function<Image&,void> 01381 { 01382 public: 01383 matteImage( const bool matteFlag_ ); 01384 01385 void operator()( Image &image_ ) const; 01386 01387 private: 01388 bool _matteFlag; 01389 }; 01390 01391 // Transparent color 01392 class MagickDLLDecl matteColorImage : public std::unary_function<Image&,void> 01393 { 01394 public: 01395 matteColorImage( const Color &matteColor_ ); 01396 01397 void operator()( Image &image_ ) const; 01398 01399 private: 01400 Color _matteColor; 01401 }; 01402 01403 // Indicate that image is black and white 01404 class MagickDLLDecl monochromeImage : public std::unary_function<Image&,void> 01405 { 01406 public: 01407 monochromeImage( const bool monochromeFlag_ ); 01408 01409 void operator()( Image &image_ ) const; 01410 01411 private: 01412 bool _monochromeFlag; 01413 }; 01414 01415 // Pen color 01416 class MagickDLLDecl penColorImage : public std::unary_function<Image&,void> 01417 { 01418 public: 01419 penColorImage( const Color &penColor_ ); 01420 01421 void operator()( Image &image_ ) const; 01422 01423 private: 01424 Color _penColor; 01425 }; 01426 01427 // Pen texture image. 01428 class MagickDLLDecl penTextureImage : public std::unary_function<Image&,void> 01429 { 01430 public: 01431 penTextureImage( const Image &penTexture_ ); 01432 01433 void operator()( Image &image_ ) const; 01434 01435 private: 01436 Image _penTexture; 01437 }; 01438 01439 // Set pixel color at location x & y. 01440 class MagickDLLDecl pixelColorImage : public std::unary_function<Image&,void> 01441 { 01442 public: 01443 pixelColorImage( const unsigned int x_, 01444 const unsigned int y_, 01445 const Color &color_); 01446 01447 void operator()( Image &image_ ) const; 01448 01449 private: 01450 unsigned int _x; 01451 unsigned int _y; 01452 Color _color; 01453 }; 01454 01455 // Postscript page size. 01456 class MagickDLLDecl pageImage : public std::unary_function<Image&,void> 01457 { 01458 public: 01459 pageImage( const Geometry &pageSize_ ); 01460 01461 void operator()( Image &image_ ) const; 01462 01463 private: 01464 Geometry _pageSize; 01465 }; 01466 01467 // JPEG/MIFF/PNG compression level (default 75). 01468 class MagickDLLDecl qualityImage : public std::unary_function<Image&,void> 01469 { 01470 public: 01471 qualityImage( const unsigned int quality_ ); 01472 01473 void operator()( Image &image_ ) const; 01474 01475 private: 01476 unsigned int _quality; 01477 }; 01478 01479 // Maximum number of colors to quantize to 01480 class MagickDLLDecl quantizeColorsImage : public std::unary_function<Image&,void> 01481 { 01482 public: 01483 quantizeColorsImage( const unsigned int colors_ ); 01484 01485 void operator()( Image &image_ ) const; 01486 01487 private: 01488 unsigned int _colors; 01489 }; 01490 01491 // Colorspace to quantize in. 01492 class MagickDLLDecl quantizeColorSpaceImage : public std::unary_function<Image&,void> 01493 { 01494 public: 01495 quantizeColorSpaceImage( const ColorspaceType colorSpace_ ); 01496 01497 void operator()( Image &image_ ) const; 01498 01499 private: 01500 ColorspaceType _colorSpace; 01501 }; 01502 01503 // Dither im