STL.cpp revision 4c08aed51c5899665ade97263692328eea4af106
1de4a1d01951937632098a6cda45859afa587a06fsewardj// This may look like C code, but it is really -*- C++ -*- 2de4a1d01951937632098a6cda45859afa587a06fsewardj// 3de4a1d01951937632098a6cda45859afa587a06fsewardj// Copyright Bob Friesenhahn, 1999, 2002 4de4a1d01951937632098a6cda45859afa587a06fsewardj// 5de4a1d01951937632098a6cda45859afa587a06fsewardj// Implementation of STL classes and functions 6de4a1d01951937632098a6cda45859afa587a06fsewardj// 7de4a1d01951937632098a6cda45859afa587a06fsewardj 8de4a1d01951937632098a6cda45859afa587a06fsewardj#define MAGICKCORE_IMPLEMENTATION 1 9de4a1d01951937632098a6cda45859afa587a06fsewardj#define MAGICK_PLUSPLUS_IMPLEMENTATION 1 10de4a1d01951937632098a6cda45859afa587a06fsewardj 11de4a1d01951937632098a6cda45859afa587a06fsewardj#include <Magick++/Image.h> 12de4a1d01951937632098a6cda45859afa587a06fsewardj#include <Magick++/STL.h> 13de4a1d01951937632098a6cda45859afa587a06fsewardj 14de4a1d01951937632098a6cda45859afa587a06fsewardj// Adaptive-blur image with specified blur factor 15de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::adaptiveBlurImage::adaptiveBlurImage( const double radius_, 16de4a1d01951937632098a6cda45859afa587a06fsewardj const double sigma_ ) 17de4a1d01951937632098a6cda45859afa587a06fsewardj : _radius( radius_ ), 18de4a1d01951937632098a6cda45859afa587a06fsewardj _sigma( sigma_ ) 19de4a1d01951937632098a6cda45859afa587a06fsewardj{ 20de4a1d01951937632098a6cda45859afa587a06fsewardj} 21de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::adaptiveBlurImage::operator()( Magick::Image &image_ ) const 22de4a1d01951937632098a6cda45859afa587a06fsewardj{ 23de4a1d01951937632098a6cda45859afa587a06fsewardj image_.adaptiveBlur( _radius, _sigma ); 24de4a1d01951937632098a6cda45859afa587a06fsewardj} 25de4a1d01951937632098a6cda45859afa587a06fsewardj 26de4a1d01951937632098a6cda45859afa587a06fsewardj// Local adaptive threshold image 27de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::adaptiveThresholdImage::adaptiveThresholdImage( const size_t width_, 28de4a1d01951937632098a6cda45859afa587a06fsewardj const size_t height_, 29de4a1d01951937632098a6cda45859afa587a06fsewardj const ssize_t offset_ ) 30de4a1d01951937632098a6cda45859afa587a06fsewardj : _width(width_), 31de4a1d01951937632098a6cda45859afa587a06fsewardj _height(height_), 32de4a1d01951937632098a6cda45859afa587a06fsewardj _offset(offset_) 33de4a1d01951937632098a6cda45859afa587a06fsewardj{ 34de4a1d01951937632098a6cda45859afa587a06fsewardj} 35de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::adaptiveThresholdImage::operator()( Magick::Image &image_ ) const 36de4a1d01951937632098a6cda45859afa587a06fsewardj{ 37de4a1d01951937632098a6cda45859afa587a06fsewardj image_.adaptiveThreshold( _width, _height, _offset ); 38de4a1d01951937632098a6cda45859afa587a06fsewardj} 39de4a1d01951937632098a6cda45859afa587a06fsewardj 40de4a1d01951937632098a6cda45859afa587a06fsewardj// Add noise to image with specified noise type 41de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::addNoiseImage::addNoiseImage( Magick::NoiseType noiseType_ ) 42de4a1d01951937632098a6cda45859afa587a06fsewardj : _noiseType( noiseType_ ) 43de4a1d01951937632098a6cda45859afa587a06fsewardj{ 44de4a1d01951937632098a6cda45859afa587a06fsewardj} 45de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::addNoiseImage::operator()( Magick::Image &image_ ) const 46de4a1d01951937632098a6cda45859afa587a06fsewardj{ 47de4a1d01951937632098a6cda45859afa587a06fsewardj image_.addNoise( _noiseType ); 48de4a1d01951937632098a6cda45859afa587a06fsewardj} 49de4a1d01951937632098a6cda45859afa587a06fsewardj 50de4a1d01951937632098a6cda45859afa587a06fsewardj// Transform image by specified affine (or free transform) matrix. 512e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::affineTransformImage::affineTransformImage( const DrawableAffine &affine_ ) 522e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _affine( affine_ ) 532e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 542e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 552e93c50dc50235189661b70e3f27a4098d5cccccsewardjvoid Magick::affineTransformImage::operator()( Magick::Image &image_ ) const 562e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 57de4a1d01951937632098a6cda45859afa587a06fsewardj image_.affineTransform( _affine ); 582e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 592e93c50dc50235189661b70e3f27a4098d5cccccsewardj 602e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Annotate image (draw text on image) 612e93c50dc50235189661b70e3f27a4098d5cccccsewardj 622e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Annotate using specified text, and placement location 632e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::annotateImage::annotateImage ( const std::string &text_, 642e93c50dc50235189661b70e3f27a4098d5cccccsewardj const Magick::Geometry &geometry_ ) 652e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _text( text_ ), 662e93c50dc50235189661b70e3f27a4098d5cccccsewardj _geometry( geometry_ ), 672e93c50dc50235189661b70e3f27a4098d5cccccsewardj _gravity( Magick::NorthWestGravity ), 682e93c50dc50235189661b70e3f27a4098d5cccccsewardj _degrees( 0 ) 692e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 702e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 712e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Annotate using specified text, bounding area, and placement gravity 722e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::annotateImage::annotateImage ( const std::string &text_, 732e93c50dc50235189661b70e3f27a4098d5cccccsewardj const Magick::Geometry &geometry_, 742e93c50dc50235189661b70e3f27a4098d5cccccsewardj const Magick::GravityType gravity_ ) 752e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _text( text_ ), 762e93c50dc50235189661b70e3f27a4098d5cccccsewardj _geometry( geometry_ ), 772e93c50dc50235189661b70e3f27a4098d5cccccsewardj _gravity( gravity_ ), 782e93c50dc50235189661b70e3f27a4098d5cccccsewardj _degrees( 0 ) 792e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 802e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 812e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Annotate with text using specified text, bounding area, placement 822e93c50dc50235189661b70e3f27a4098d5cccccsewardj// gravity, and rotation. 832e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::annotateImage::annotateImage ( const std::string &text_, 842e93c50dc50235189661b70e3f27a4098d5cccccsewardj const Magick::Geometry &geometry_, 852e93c50dc50235189661b70e3f27a4098d5cccccsewardj const Magick::GravityType gravity_, 862e93c50dc50235189661b70e3f27a4098d5cccccsewardj const double degrees_ ) 872e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _text( text_ ), 882e93c50dc50235189661b70e3f27a4098d5cccccsewardj _geometry( geometry_ ), 892e93c50dc50235189661b70e3f27a4098d5cccccsewardj _gravity( gravity_ ), 902e93c50dc50235189661b70e3f27a4098d5cccccsewardj _degrees( degrees_ ) 912e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 922e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 932e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Annotate with text (bounding area is entire image) and placement 942e93c50dc50235189661b70e3f27a4098d5cccccsewardj// gravity. 952e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::annotateImage::annotateImage ( const std::string &text_, 962e93c50dc50235189661b70e3f27a4098d5cccccsewardj const Magick::GravityType gravity_ ) 972e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _text( text_ ), 982e93c50dc50235189661b70e3f27a4098d5cccccsewardj _geometry( ), 992e93c50dc50235189661b70e3f27a4098d5cccccsewardj _gravity( gravity_ ), 100de4a1d01951937632098a6cda45859afa587a06fsewardj _degrees( 0 ) 101de4a1d01951937632098a6cda45859afa587a06fsewardj{ 102de4a1d01951937632098a6cda45859afa587a06fsewardj} 103de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::annotateImage::operator()( Magick::Image &image_ ) const 104de4a1d01951937632098a6cda45859afa587a06fsewardj{ 105de4a1d01951937632098a6cda45859afa587a06fsewardj image_.annotate( _text, _geometry, _gravity, _degrees ); 106de4a1d01951937632098a6cda45859afa587a06fsewardj} 107de4a1d01951937632098a6cda45859afa587a06fsewardj 108de4a1d01951937632098a6cda45859afa587a06fsewardj// Blur image with specified blur factor 109de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::blurImage::blurImage( const double radius_, const double sigma_ ) 1102e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _radius( radius_ ), 1112e93c50dc50235189661b70e3f27a4098d5cccccsewardj _sigma( sigma_ ) 1122e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 113de4a1d01951937632098a6cda45859afa587a06fsewardj} 114de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::blurImage::operator()( Magick::Image &image_ ) const 115de4a1d01951937632098a6cda45859afa587a06fsewardj{ 116de4a1d01951937632098a6cda45859afa587a06fsewardj image_.blur( _radius, _sigma ); 117de4a1d01951937632098a6cda45859afa587a06fsewardj} 118de4a1d01951937632098a6cda45859afa587a06fsewardj 119de4a1d01951937632098a6cda45859afa587a06fsewardj// Border image (add border to image) 1202e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::borderImage::borderImage( const Magick::Geometry &geometry_ ) 1212e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _geometry( geometry_ ) 1222e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 123de4a1d01951937632098a6cda45859afa587a06fsewardj} 124de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::borderImage::operator()( Magick::Image &image_ ) const 125de4a1d01951937632098a6cda45859afa587a06fsewardj{ 126de4a1d01951937632098a6cda45859afa587a06fsewardj image_.border( _geometry ); 127de4a1d01951937632098a6cda45859afa587a06fsewardj} 128de4a1d01951937632098a6cda45859afa587a06fsewardj 129de4a1d01951937632098a6cda45859afa587a06fsewardj// Extract channel from image 1302e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::channelImage::channelImage( const Magick::ChannelType channel_ ) 1312e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _channel( channel_ ) 1322e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 133de4a1d01951937632098a6cda45859afa587a06fsewardj} 134de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::channelImage::operator()( Magick::Image &image_ ) const 135de4a1d01951937632098a6cda45859afa587a06fsewardj{ 136de4a1d01951937632098a6cda45859afa587a06fsewardj image_.channel( _channel ); 137de4a1d01951937632098a6cda45859afa587a06fsewardj} 138de4a1d01951937632098a6cda45859afa587a06fsewardj 139de4a1d01951937632098a6cda45859afa587a06fsewardj// Charcoal effect image (looks like charcoal sketch) 140de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::charcoalImage::charcoalImage( const double radius_, const double sigma_ ) 141de4a1d01951937632098a6cda45859afa587a06fsewardj : _radius( radius_ ), 142de4a1d01951937632098a6cda45859afa587a06fsewardj _sigma( sigma_ ) 143de4a1d01951937632098a6cda45859afa587a06fsewardj{ 1442e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 1452e93c50dc50235189661b70e3f27a4098d5cccccsewardjvoid Magick::charcoalImage::operator()( Magick::Image &image_ ) const 1462e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 147de4a1d01951937632098a6cda45859afa587a06fsewardj image_.charcoal( _radius, _sigma ); 148de4a1d01951937632098a6cda45859afa587a06fsewardj} 149de4a1d01951937632098a6cda45859afa587a06fsewardj 150de4a1d01951937632098a6cda45859afa587a06fsewardj// Chop image (remove vertical or horizontal subregion of image) 151de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::chopImage::chopImage( const Magick::Geometry &geometry_ ) 152de4a1d01951937632098a6cda45859afa587a06fsewardj : _geometry( geometry_ ) 153de4a1d01951937632098a6cda45859afa587a06fsewardj{ 154de4a1d01951937632098a6cda45859afa587a06fsewardj} 155de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::chopImage::operator()( Magick::Image &image_ ) const 156de4a1d01951937632098a6cda45859afa587a06fsewardj{ 157de4a1d01951937632098a6cda45859afa587a06fsewardj image_.chop( _geometry ); 1582e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 1592e93c50dc50235189661b70e3f27a4098d5cccccsewardj 1602e93c50dc50235189661b70e3f27a4098d5cccccsewardj// accepts a lightweight Color Correction Collection (CCC) file which solely 1612e93c50dc50235189661b70e3f27a4098d5cccccsewardj// contains one or more color corrections and applies the correction to the 1622e93c50dc50235189661b70e3f27a4098d5cccccsewardj// image. 1632e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::cdlImage::cdlImage( const std::string &cdl_ ) 164de4a1d01951937632098a6cda45859afa587a06fsewardj : _cdl ( cdl_ ) 165de4a1d01951937632098a6cda45859afa587a06fsewardj{ 166de4a1d01951937632098a6cda45859afa587a06fsewardj} 167de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::cdlImage::operator()( Image &image_ ) const 168de4a1d01951937632098a6cda45859afa587a06fsewardj{ 169de4a1d01951937632098a6cda45859afa587a06fsewardj image_.cdl( _cdl.c_str() ); 1702e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 1712e93c50dc50235189661b70e3f27a4098d5cccccsewardj 1722e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Colorize image using pen color at specified percent alpha 1732e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::colorizeImage::colorizeImage( const unsigned int alphaRed_, 1742e93c50dc50235189661b70e3f27a4098d5cccccsewardj const unsigned int alphaGreen_, 1752e93c50dc50235189661b70e3f27a4098d5cccccsewardj const unsigned int alphaBlue_, 176de4a1d01951937632098a6cda45859afa587a06fsewardj const Magick::Color &penColor_ ) 177de4a1d01951937632098a6cda45859afa587a06fsewardj : _alphaRed ( alphaRed_ ), 178de4a1d01951937632098a6cda45859afa587a06fsewardj _alphaGreen ( alphaGreen_ ), 179de4a1d01951937632098a6cda45859afa587a06fsewardj _alphaBlue ( alphaBlue_ ), 180de4a1d01951937632098a6cda45859afa587a06fsewardj _penColor( penColor_ ) 181de4a1d01951937632098a6cda45859afa587a06fsewardj{ 182de4a1d01951937632098a6cda45859afa587a06fsewardj} 183de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::colorizeImage::colorizeImage( const unsigned int alpha_, 1842e93c50dc50235189661b70e3f27a4098d5cccccsewardj const Magick::Color &penColor_ ) 1852e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _alphaRed ( alpha_ ), 1862e93c50dc50235189661b70e3f27a4098d5cccccsewardj _alphaGreen ( alpha_ ), 1872e93c50dc50235189661b70e3f27a4098d5cccccsewardj _alphaBlue ( alpha_ ), 188de4a1d01951937632098a6cda45859afa587a06fsewardj _penColor( penColor_ ) 189de4a1d01951937632098a6cda45859afa587a06fsewardj{ 190de4a1d01951937632098a6cda45859afa587a06fsewardj} 191de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::colorizeImage::operator()( Magick::Image &image_ ) const 192de4a1d01951937632098a6cda45859afa587a06fsewardj{ 193de4a1d01951937632098a6cda45859afa587a06fsewardj image_.colorize( _alphaRed, _alphaGreen, _alphaBlue, _penColor ); 194de4a1d01951937632098a6cda45859afa587a06fsewardj} 195de4a1d01951937632098a6cda45859afa587a06fsewardj 196de4a1d01951937632098a6cda45859afa587a06fsewardj// Apply a color matrix to the image channels. The user supplied 1972e93c50dc50235189661b70e3f27a4098d5cccccsewardj// matrix may be of order 1 to 5 (1x1 through 5x5). 1982e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::colorMatrixImage::colorMatrixImage( const size_t order_, 1992e93c50dc50235189661b70e3f27a4098d5cccccsewardj const double *color_matrix_ ) 2002e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _order( order_ ), 2012e93c50dc50235189661b70e3f27a4098d5cccccsewardj _color_matrix( color_matrix_ ) 2022e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 2032e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 2042e93c50dc50235189661b70e3f27a4098d5cccccsewardjvoid Magick::colorMatrixImage::operator()( Image &image_ ) const 2052e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 2062e93c50dc50235189661b70e3f27a4098d5cccccsewardj image_.colorMatrix( _order, _color_matrix ); 2072e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 2082e93c50dc50235189661b70e3f27a4098d5cccccsewardj 2092e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Convert the image colorspace representation 2102e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::colorSpaceImage::colorSpaceImage( Magick::ColorspaceType colorSpace_ ) 2112e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _colorSpace( colorSpace_ ) 2122e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 213de4a1d01951937632098a6cda45859afa587a06fsewardj} 214de4a1d01951937632098a6cda45859afa587a06fsewardjvoid Magick::colorSpaceImage::operator()( Magick::Image &image_ ) const 215de4a1d01951937632098a6cda45859afa587a06fsewardj{ 2162e93c50dc50235189661b70e3f27a4098d5cccccsewardj image_.colorSpace( _colorSpace ); 2172e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 2182e93c50dc50235189661b70e3f27a4098d5cccccsewardj 2192e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Comment image (add comment string to image) 2202e93c50dc50235189661b70e3f27a4098d5cccccsewardjMagick::commentImage::commentImage( const std::string &comment_ ) 2212e93c50dc50235189661b70e3f27a4098d5cccccsewardj : _comment( comment_ ) 2222e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 2232e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 2242e93c50dc50235189661b70e3f27a4098d5cccccsewardjvoid Magick::commentImage::operator()( Magick::Image &image_ ) const 2252e93c50dc50235189661b70e3f27a4098d5cccccsewardj{ 2262e93c50dc50235189661b70e3f27a4098d5cccccsewardj image_.comment( _comment ); 2272e93c50dc50235189661b70e3f27a4098d5cccccsewardj} 2282e93c50dc50235189661b70e3f27a4098d5cccccsewardj 2292e93c50dc50235189661b70e3f27a4098d5cccccsewardj// Compose an image onto another at specified offset and using 2302e93c50dc50235189661b70e3f27a4098d5cccccsewardj// specified algorithm 231de4a1d01951937632098a6cda45859afa587a06fsewardjMagick::compositeImage::compositeImage( const Magick::Image &compositeImage_, 232 ssize_t xOffset_, 233 ssize_t yOffset_, 234 Magick::CompositeOperator compose_ ) 235 : _compositeImage( compositeImage_ ), 236 _xOffset ( xOffset_ ), 237 _yOffset ( yOffset_ ), 238 _compose ( compose_ ) 239{ 240} 241Magick::compositeImage::compositeImage( const Magick::Image &compositeImage_, 242 const Magick::Geometry &offset_, 243 Magick::CompositeOperator compose_ ) 244 : _compositeImage( compositeImage_ ), 245 _xOffset ( offset_.xOff() ), 246 _yOffset ( offset_.yOff() ), 247 _compose ( compose_ ) 248{ 249} 250void Magick::compositeImage::operator()( Image &image_ ) const 251{ 252 image_.composite( _compositeImage, _xOffset, _yOffset, _compose ); 253} 254 255// Contrast image (enhance intensity differences in image) 256Magick::contrastImage::contrastImage( const size_t sharpen_ ) 257 : _sharpen( sharpen_ ) 258{ 259} 260void Magick::contrastImage::operator()( Magick::Image &image_ ) const 261{ 262 image_.contrast( _sharpen ); 263} 264 265// Crop image (subregion of original image) 266Magick::cropImage::cropImage( const Magick::Geometry &geometry_ ) 267 : _geometry( geometry_ ) 268{ 269} 270void Magick::cropImage::operator()( Magick::Image &image_ ) const 271{ 272 image_.crop( _geometry ); 273} 274 275// Cycle image colormap 276Magick::cycleColormapImage::cycleColormapImage( const ssize_t amount_ ) 277 : _amount( amount_ ) 278{ 279} 280void Magick::cycleColormapImage::operator()( Magick::Image &image_ ) const 281{ 282 image_.cycleColormap( _amount ); 283} 284 285// Despeckle image (reduce speckle noise) 286Magick::despeckleImage::despeckleImage( void ) 287{ 288} 289void Magick::despeckleImage::operator()( Magick::Image &image_ ) const 290{ 291 image_.despeckle( ); 292} 293 294// Distort image. distorts an image using various distortion methods, by 295// mapping color lookups of the source image to a new destination image 296// usally of the same size as the source image, unless 'bestfit' is set to 297// true. 298Magick::distortImage::distortImage( const Magick::DistortImageMethod method_, 299 const size_t number_arguments_, 300 const double *arguments_, 301 const bool bestfit_ ) 302 : _method ( method_ ), 303 _number_arguments ( number_arguments_ ), 304 _arguments ( arguments_ ), 305 _bestfit( bestfit_ ) 306{ 307} 308Magick::distortImage::distortImage( const Magick::DistortImageMethod method_, 309 const size_t number_arguments_, 310 const double *arguments_ ) 311 : _method ( method_ ), 312 _number_arguments ( number_arguments_ ), 313 _arguments ( arguments_ ), 314 _bestfit( false ) 315{ 316} 317void Magick::distortImage::operator()( Magick::Image &image_ ) const 318{ 319 image_.distort( _method, _number_arguments, _arguments, _bestfit ); 320} 321 322// Draw on image 323Magick::drawImage::drawImage( const Magick::Drawable &drawable_ ) 324 : _drawableList() 325{ 326 _drawableList.push_back( drawable_ ); 327} 328Magick::drawImage::drawImage( const std::list<Magick::Drawable> &drawable_ ) 329 : _drawableList( drawable_ ) 330{ 331} 332void Magick::drawImage::operator()( Magick::Image &image_ ) const 333{ 334 image_.draw( _drawableList ); 335} 336 337// Edge image (hilight edges in image) 338Magick::edgeImage::edgeImage( const double radius_ ) 339 : _radius( radius_ ) 340{ 341} 342void Magick::edgeImage::operator()( Magick::Image &image_ ) const 343{ 344 image_.edge( _radius ); 345} 346 347// Emboss image (hilight edges with 3D effect) 348Magick::embossImage::embossImage( void ) 349 : _radius( 1 ), 350 _sigma( 0.5 ) 351{ 352} 353Magick::embossImage::embossImage( const double radius_, const double sigma_ ) 354 : _radius( radius_ ), 355 _sigma( sigma_ ) 356{ 357} 358void Magick::embossImage::operator()( Magick::Image &image_ ) const 359{ 360 image_.emboss( _radius, _sigma ); 361} 362 363// Enhance image (minimize noise) 364Magick::enhanceImage::enhanceImage( void ) 365{ 366} 367void Magick::enhanceImage::operator()( Magick::Image &image_ ) const 368{ 369 image_.enhance( ); 370} 371 372// Equalize image (histogram equalization) 373Magick::equalizeImage::equalizeImage( void ) 374{ 375} 376void Magick::equalizeImage::operator()( Magick::Image &image_ ) const 377{ 378 image_.equalize( ); 379} 380 381// Color to use when filling drawn objects 382Magick::fillColorImage::fillColorImage( const Magick::Color &fillColor_ ) 383 : _fillColor( fillColor_ ) 384{ 385} 386void Magick::fillColorImage::operator()( Magick::Image &image_ ) const 387{ 388 image_.fillColor( _fillColor ); 389} 390 391// Flip image (reflect each scanline in the vertical direction) 392Magick::flipImage::flipImage( void ) 393{ 394} 395void Magick::flipImage::operator()( Magick::Image &image_ ) const 396{ 397 image_.flip( ); 398} 399 400// Flood-fill image with color 401// Flood-fill color across pixels starting at target-pixel and 402// stopping at pixels matching specified border color. Uses current 403// fuzz setting when determining color match. 404Magick::floodFillColorImage::floodFillColorImage( const ssize_t x_, 405 const ssize_t y_, 406 const Magick::Color &fillColor_ ) 407 : _x(x_), 408 _y(y_), 409 _fillColor(fillColor_), 410 _borderColor() 411{ 412} 413Magick::floodFillColorImage::floodFillColorImage( const Magick::Geometry &point_, 414 const Magick::Color &fillColor_ ) 415 : _x(point_.xOff()), 416 _y(point_.yOff()), 417 _fillColor(fillColor_), 418 _borderColor() 419{ 420} 421// Flood-fill color across pixels starting at target-pixel and 422// stopping at pixels matching specified border color. Uses current 423// fuzz setting when determining color match. 424Magick::floodFillColorImage::floodFillColorImage( const ssize_t x_, 425 const ssize_t y_, 426 const Magick::Color &fillColor_, 427 const Magick::Color &borderColor_ ) 428 : _x(x_), 429 _y(y_), 430 _fillColor(fillColor_), 431 _borderColor(borderColor_) 432{ 433} 434Magick::floodFillColorImage::floodFillColorImage( const Geometry &point_, 435 const Color &fillColor_, 436 const Color &borderColor_ ) 437 : _x(point_.xOff()), 438 _y(point_.yOff()), 439 _fillColor(fillColor_), 440 _borderColor(borderColor_) 441{ 442} 443void Magick::floodFillColorImage::operator()( Magick::Image &image_ ) const 444{ 445 if ( _borderColor.isValid() ) 446 { 447 image_.floodFillColor( _x, _y, _fillColor, _borderColor ); 448 } 449 else 450 { 451 image_.floodFillColor( _x, _y, _fillColor ); 452 } 453} 454 455// Flood-fill image with texture 456 457// Flood-fill texture across pixels that match the color of the target 458// pixel and are neighbors of the target pixel. Uses current fuzz 459// setting when determining color match. 460Magick::floodFillTextureImage::floodFillTextureImage( const ssize_t x_, 461 const ssize_t y_, 462 const Magick::Image &texture_ ) 463 : _x(x_), 464 _y(y_), 465 _texture(texture_), 466 _borderColor() 467{ 468} 469Magick::floodFillTextureImage::floodFillTextureImage( const Magick::Geometry &point_, 470 const Magick::Image &texture_ ) 471 : _x(point_.xOff()), 472 _y(point_.yOff()), 473 _texture(texture_), 474 _borderColor() 475{ 476} 477// Flood-fill texture across pixels starting at target-pixel and 478// stopping at pixels matching specified border color. Uses current 479// fuzz setting when determining color match. 480Magick::floodFillTextureImage::floodFillTextureImage( const ssize_t x_, 481 const ssize_t y_, 482 const Magick::Image &texture_, 483 const Magick::Color &borderColor_ ) 484 : _x(x_), 485 _y(y_), 486 _texture(texture_), 487 _borderColor(borderColor_) 488{ 489} 490Magick::floodFillTextureImage::floodFillTextureImage( const Magick::Geometry &point_, 491 const Magick::Image &texture_, 492 const Magick::Color &borderColor_ ) 493 : _x(point_.xOff()), 494 _y(point_.yOff()), 495 _texture(texture_), 496 _borderColor(borderColor_) 497{ 498} 499void Magick::floodFillTextureImage::operator()( Magick::Image &image_ ) const 500{ 501 if ( _borderColor.isValid() ) 502 { 503 image_.floodFillTexture( _x, _y, _texture, _borderColor ); 504 } 505 else 506 { 507 image_.floodFillTexture( _x, _y, _texture ); 508 } 509} 510 511// Flop image (reflect each scanline in the horizontal direction) 512Magick::flopImage::flopImage( void ) 513{ 514} 515void Magick::flopImage::operator()( Magick::Image &image_ ) const 516{ 517 image_.flop( ); 518} 519 520// Frame image 521Magick::frameImage::frameImage( const Magick::Geometry &geometry_ ) 522 : _width( geometry_.width() ), 523 _height( geometry_.height() ), 524 _outerBevel( geometry_.xOff() ), 525 _innerBevel( geometry_.yOff() ) 526{ 527} 528Magick::frameImage::frameImage( const size_t width_, const size_t height_, 529 const ssize_t innerBevel_, const ssize_t outerBevel_ ) 530 : _width( width_ ), 531 _height( height_ ), 532 _outerBevel( outerBevel_ ), 533 _innerBevel( innerBevel_ ) 534{ 535} 536void Magick::frameImage::operator()( Magick::Image &image_ ) const 537{ 538 image_.frame( _width, _height, _innerBevel, _outerBevel ); 539} 540 541// Gamma correct image 542Magick::gammaImage::gammaImage( const double gamma_ ) 543 : _gammaRed( gamma_ ), 544 _gammaGreen( gamma_ ), 545 _gammaBlue( gamma_ ) 546{ 547} 548Magick::gammaImage::gammaImage ( const double gammaRed_, 549 const double gammaGreen_, 550 const double gammaBlue_ ) 551 : _gammaRed( gammaRed_ ), 552 _gammaGreen( gammaGreen_ ), 553 _gammaBlue( gammaBlue_ ) 554{ 555} 556void Magick::gammaImage::operator()( Magick::Image &image_ ) const 557{ 558 image_.gamma( _gammaRed, _gammaGreen, _gammaBlue ); 559} 560 561// Gaussian blur image 562// The number of neighbor pixels to be included in the convolution 563// mask is specified by 'width_'. The standard deviation of the 564// gaussian bell curve is specified by 'sigma_'. 565Magick::gaussianBlurImage::gaussianBlurImage( const double width_, 566 const double sigma_ ) 567 : _width( width_ ), 568 _sigma( sigma_ ) 569{ 570} 571void Magick::gaussianBlurImage::operator()( Magick::Image &image_ ) const 572{ 573 image_.gaussianBlur( _width, _sigma ); 574} 575 576// Apply a color lookup table (Hald CLUT) to the image. 577Magick::haldClutImage::haldClutImage( const Image &haldClutImage_ ) 578 : _haldClutImage ( haldClutImage_ ) 579{ 580} 581void Magick::haldClutImage::operator()( Image &image_ ) const 582{ 583 image_.haldClut( _haldClutImage ); 584} 585 586// Implode image (special effect) 587Magick::implodeImage::implodeImage( const double factor_ ) 588 : _factor( factor_ ) 589{ 590} 591void Magick::implodeImage::operator()( Magick::Image &image_ ) const 592{ 593 image_.implode( _factor ); 594} 595 596// Implements the inverse discrete Fourier transform (IFT) of the image 597// either as a magnitude / phase or real / imaginary image pair. 598Magick::inverseFourierTransformImage::inverseFourierTransformImage( const Magick::Image &phaseImage_ ) 599 : _phaseImage( phaseImage_ ) 600{ 601} 602void Magick::inverseFourierTransformImage::operator()( Magick::Image &image_ ) const 603{ 604 image_.inverseFourierTransform( _phaseImage ); 605} 606 607// Set image validity. Valid images become empty (inValid) if argument 608// is false. 609Magick::isValidImage::isValidImage( const bool isValid_ ) 610 : _isValid( isValid_ ) 611{ 612} 613void Magick::isValidImage::operator()( Magick::Image &image_ ) const 614{ 615 image_.isValid( _isValid ); 616} 617 618// Label image 619Magick::labelImage::labelImage( const std::string &label_ ) 620 : _label( label_ ) 621{ 622} 623void Magick::labelImage::operator()( Magick::Image &image_ ) const 624{ 625 image_.label( _label ); 626} 627 628// Level image 629Magick::levelImage::levelImage( const double black_point, 630 const double white_point, 631 const double mid_point ) 632 : _black_point(black_point), 633 _white_point(white_point), 634 _mid_point(mid_point) 635{ 636} 637void Magick::levelImage::operator()( Magick::Image &image_ ) const 638{ 639 image_.level( _black_point, _white_point, _mid_point ); 640} 641 642// Level image channel 643Magick::levelChannelImage::levelChannelImage( const Magick::ChannelType channel, const double black_point, 644 const double white_point, 645 const double mid_point ) 646 : _channel(channel), 647 _black_point(black_point), 648 _white_point(white_point), 649 _mid_point(mid_point) 650{ 651} 652 653void Magick::levelChannelImage::operator()( Magick::Image &image_ ) const 654{ 655 image_.levelChannel( _channel, _black_point, _white_point, _mid_point ); 656} 657 658// Magnify image by integral size 659Magick::magnifyImage::magnifyImage( void ) 660{ 661} 662void Magick::magnifyImage::operator()( Magick::Image &image_ ) const 663{ 664 image_.magnify( ); 665} 666 667// Remap image colors with closest color from reference image 668Magick::mapImage::mapImage( const Magick::Image &mapImage_ , 669 const bool dither_ ) 670 : _mapImage( mapImage_ ), 671 _dither( dither_ ) 672{ 673} 674void Magick::mapImage::operator()( Magick::Image &image_ ) const 675{ 676 image_.map( _mapImage, _dither ); 677} 678 679// Floodfill designated area with a matte value 680Magick::matteFloodfillImage::matteFloodfillImage( const Color &target_ , 681 const unsigned int matte_, 682 const ssize_t x_, const ssize_t y_, 683 const PaintMethod method_ ) 684 : _target( target_ ), 685 _matte( matte_ ), 686 _x( x_ ), 687 _y( y_ ), 688 _method( method_ ) 689{ 690} 691void Magick::matteFloodfillImage::operator()( Magick::Image &image_ ) const 692{ 693 image_.matteFloodfill( _target, _matte, _x, _y, _method ); 694} 695 696// Filter image by replacing each pixel component with the median 697// color in a circular neighborhood 698Magick::medianFilterImage::medianFilterImage( const double radius_ ) 699 : _radius( radius_ ) 700{ 701} 702void Magick::medianFilterImage::operator()( Magick::Image &image_ ) const 703{ 704 image_.medianFilter( _radius ); 705} 706 707// Reduce image by integral size 708Magick::minifyImage::minifyImage( void ) 709{ 710} 711void Magick::minifyImage::operator()( Magick::Image &image_ ) const 712{ 713 image_.minify( ); 714} 715 716// Modulate percent hue, saturation, and brightness of an image 717Magick::modulateImage::modulateImage( const double brightness_, 718 const double saturation_, 719 const double hue_ ) 720 : _brightness( brightness_ ), 721 _saturation( saturation_ ), 722 _hue( hue_ ) 723{ 724} 725void Magick::modulateImage::operator()( Magick::Image &image_ ) const 726{ 727 image_.modulate( _brightness, _saturation, _hue ); 728} 729 730// Negate colors in image. Set grayscale to only negate grayscale 731// values in image. 732Magick::negateImage::negateImage( const bool grayscale_ ) 733 : _grayscale( grayscale_ ) 734{ 735} 736void Magick::negateImage::operator()( Magick::Image &image_ ) const 737{ 738 image_.negate( _grayscale ); 739} 740 741// Normalize image (increase contrast by normalizing the pixel values 742// to span the full range of color values) 743Magick::normalizeImage::normalizeImage( void ) 744{ 745} 746void Magick::normalizeImage::operator()( Magick::Image &image_ ) const 747{ 748 image_.normalize( ); 749} 750 751// Oilpaint image (image looks like oil painting) 752Magick::oilPaintImage::oilPaintImage( const double radius_ ) 753 : _radius( radius_ ) 754{ 755} 756void Magick::oilPaintImage::operator()( Magick::Image &image_ ) const 757{ 758 image_.oilPaint( _radius ); 759} 760 761// Set or attenuate the image alpha channel. If the image pixels are 762// opaque then they are set to the specified alpha value, otherwise 763// they are blended with the supplied alpha value. The value of 764// alpha_ ranges from 0 (completely opaque) to QuantumRange. The defines 765// OpaqueAlpha and TransparentAlpha are available to specify 766// completely opaque or completely transparent, respectively. 767Magick::alphaImage::alphaImage( const unsigned int alpha_ ) 768 : _alpha( alpha_ ) 769{ 770} 771void Magick::alphaImage::operator()( Magick::Image &image_ ) const 772{ 773 image_.alpha( _alpha ); 774} 775 776// Change color of opaque pixel to specified pen color. 777Magick::opaqueImage::opaqueImage( const Magick::Color &opaqueColor_, 778 const Magick::Color &penColor_ ) 779 : _opaqueColor( opaqueColor_ ), 780 _penColor( penColor_ ) 781{ 782} 783void Magick::opaqueImage::operator()( Magick::Image &image_ ) const 784{ 785 image_.opaque( _opaqueColor, _penColor ); 786} 787 788// Quantize image (reduce number of colors) 789Magick::quantizeImage::quantizeImage( const bool measureError_ ) 790 : _measureError( measureError_ ) 791{ 792} 793void Magick::quantizeImage::operator()( Image &image_ ) const 794{ 795 image_.quantize( _measureError ); 796} 797 798// Raise image (lighten or darken the edges of an image to give a 3-D 799// raised or lowered effect) 800Magick::raiseImage::raiseImage( const Magick::Geometry &geometry_ , 801 const bool raisedFlag_ ) 802 : _geometry( geometry_ ), 803 _raisedFlag( raisedFlag_ ) 804{ 805} 806void Magick::raiseImage::operator()( Magick::Image &image_ ) const 807{ 808 image_.raise( _geometry, _raisedFlag ); 809} 810 811// Reduce noise in image using a noise peak elimination filter 812Magick::reduceNoiseImage::reduceNoiseImage( void ) 813 : _order(3) 814{ 815} 816Magick::reduceNoiseImage::reduceNoiseImage ( const size_t order_ ) 817 : _order(order_) 818{ 819} 820void Magick::reduceNoiseImage::operator()( Image &image_ ) const 821{ 822 image_.reduceNoise( _order ); 823} 824 825// Roll image (rolls image vertically and horizontally) by specified 826// number of columnms and rows) 827Magick::rollImage::rollImage( const Magick::Geometry &roll_ ) 828 : _columns( roll_.width() ), 829 _rows( roll_.height() ) 830{ 831} 832Magick::rollImage::rollImage( const ssize_t columns_, 833 const ssize_t rows_ ) 834 : _columns( columns_ ), 835 _rows( rows_ ) 836{ 837} 838void Magick::rollImage::operator()( Magick::Image &image_ ) const 839{ 840 image_.roll( _columns, _rows ); 841} 842 843// Rotate image counter-clockwise by specified number of degrees. 844Magick::rotateImage::rotateImage( const double degrees_ ) 845 : _degrees( degrees_ ) 846{ 847} 848void Magick::rotateImage::operator()( Magick::Image &image_ ) const 849{ 850 image_.rotate( _degrees ); 851} 852 853// Resize image by using pixel sampling algorithm 854Magick::sampleImage::sampleImage( const Magick::Geometry &geometry_ ) 855 : _geometry( geometry_ ) 856{ 857} 858void Magick::sampleImage::operator()( Magick::Image &image_ ) const 859{ 860 image_.sample( _geometry ); 861} 862 863// Resize image by using simple ratio algorithm 864Magick::scaleImage::scaleImage( const Magick::Geometry &geometry_ ) 865 : _geometry( geometry_ ) 866{ 867} 868void Magick::scaleImage::operator()( Magick::Image &image_ ) const 869{ 870 image_.scale( _geometry ); 871} 872 873// Segment (coalesce similar image components) by analyzing the 874// histograms of the color components and identifying units that are 875// homogeneous with the fuzzy c-means technique. Also uses 876// QuantizeColorSpace and Verbose image attributes 877Magick::segmentImage::segmentImage( const double clusterThreshold_ , 878 const double smoothingThreshold_ ) 879 : _clusterThreshold( clusterThreshold_ ), 880 _smoothingThreshold( smoothingThreshold_ ) 881{ 882} 883void Magick::segmentImage::operator()( Magick::Image &image_ ) const 884{ 885 image_.segment( _clusterThreshold, _smoothingThreshold ); 886} 887 888// Shade image using distant light source 889Magick::shadeImage::shadeImage( const double azimuth_, 890 const double elevation_, 891 const bool colorShading_) 892 : _azimuth( azimuth_ ), 893 _elevation( elevation_ ), 894 _colorShading (colorShading_) 895{ 896} 897void Magick::shadeImage::operator()( Magick::Image &image_ ) const 898{ 899 image_.shade( _azimuth, _elevation, _colorShading ); 900} 901 902// Sharpen pixels in image 903Magick::sharpenImage::sharpenImage( const double radius_, const double sigma_ ) 904 : _radius( radius_ ), 905 _sigma( sigma_ ) 906{ 907} 908void Magick::sharpenImage::operator()( Magick::Image &image_ ) const 909{ 910 image_.sharpen( _radius, _sigma ); 911} 912 913// Shave pixels from image edges. 914Magick::shaveImage::shaveImage( const Magick::Geometry &geometry_ ) 915 : _geometry( geometry_ ) 916{ 917} 918void Magick::shaveImage::operator()( Magick::Image &image_ ) const 919{ 920 image_.shave( _geometry ); 921} 922 923// Shear image (create parallelogram by sliding image by X or Y axis) 924Magick::shearImage::shearImage( const double xShearAngle_, 925 const double yShearAngle_ ) 926 : _xShearAngle( xShearAngle_ ), 927 _yShearAngle( yShearAngle_ ) 928{ 929} 930void Magick::shearImage::operator()( Magick::Image &image_ ) const 931{ 932 image_.shear( _xShearAngle, _yShearAngle ); 933} 934 935// Solarize image (similar to effect seen when exposing a photographic 936// film to light during the development process) 937Magick::solarizeImage::solarizeImage( const double factor_ ) 938 : _factor( factor_ ) 939{ 940} 941void Magick::solarizeImage::operator()( Magick::Image &image_ ) const 942{ 943 image_.solarize( _factor ); 944} 945 946// Spread pixels randomly within image by specified ammount 947Magick::spreadImage::spreadImage( const size_t amount_ ) 948 : _amount( amount_ ) 949{ 950} 951void Magick::spreadImage::operator()( Magick::Image &image_ ) const 952{ 953 image_.spread( _amount ); 954} 955 956// Add a digital watermark to the image (based on second image) 957Magick::steganoImage::steganoImage( const Magick::Image &waterMark_ ) 958 : _waterMark( waterMark_ ) 959{ 960} 961void Magick::steganoImage::operator()( Magick::Image &image_ ) const 962{ 963 image_.stegano( _waterMark ); 964} 965 966// Create an image which appears in stereo when viewed with red-blue 967// glasses (Red image on left, blue on right) 968Magick::stereoImage::stereoImage( const Magick::Image &rightImage_ ) 969 : _rightImage( rightImage_ ) 970{ 971} 972void Magick::stereoImage::operator()( Magick::Image &image_ ) const 973{ 974 image_.stereo( _rightImage ); 975} 976 977// Color to use when drawing object outlines 978Magick::strokeColorImage::strokeColorImage( const Magick::Color &strokeColor_ ) 979 : _strokeColor( strokeColor_ ) 980{ 981} 982void Magick::strokeColorImage::operator()( Magick::Image &image_ ) const 983{ 984 image_.strokeColor( _strokeColor ); 985} 986 987// Swirl image (image pixels are rotated by degrees) 988Magick::swirlImage::swirlImage( const double degrees_ ) 989 : _degrees( degrees_ ) 990{ 991} 992void Magick::swirlImage::operator()( Magick::Image &image_ ) const 993{ 994 image_.swirl( _degrees ); 995} 996 997// Channel a texture on image background 998Magick::textureImage::textureImage( const Magick::Image &texture_ ) 999 : _texture( texture_ ) 1000{ 1001} 1002void Magick::textureImage::operator()( Magick::Image &image_ ) const 1003{ 1004 image_.texture( _texture ); 1005} 1006 1007// Threshold image 1008Magick::thresholdImage::thresholdImage( const double threshold_ ) 1009 : _threshold( threshold_ ) 1010{ 1011} 1012void Magick::thresholdImage::operator()( Magick::Image &image_ ) const 1013{ 1014 image_.threshold( _threshold ); 1015} 1016 1017// Transform image based on image and crop geometries 1018Magick::transformImage::transformImage( const Magick::Geometry &imageGeometry_ ) 1019 : _imageGeometry( imageGeometry_ ), 1020 _cropGeometry( ) 1021{ 1022} 1023Magick::transformImage::transformImage( const Magick::Geometry &imageGeometry_, 1024 const Geometry &cropGeometry_ ) 1025 : _imageGeometry( imageGeometry_ ), 1026 _cropGeometry( cropGeometry_ ) 1027{ 1028} 1029void Magick::transformImage::operator()( Magick::Image &image_ ) const 1030{ 1031 if ( _cropGeometry.isValid() ) 1032 image_.transform( _imageGeometry, _cropGeometry ); 1033 else 1034 image_.transform( _imageGeometry ); 1035} 1036 1037// Set image color to transparent 1038Magick::transparentImage::transparentImage( const Magick::Color& color_ ) 1039 : _color( color_ ) 1040{ 1041} 1042void Magick::transparentImage::operator()( Magick::Image &image_ ) const 1043{ 1044 image_.transparent( _color ); 1045} 1046 1047// Trim edges that are the background color from the image 1048Magick::trimImage::trimImage( void ) 1049{ 1050} 1051void Magick::trimImage::operator()( Magick::Image &image_ ) const 1052{ 1053 image_.trim( ); 1054} 1055 1056// Map image pixels to a sine wave 1057Magick::waveImage::waveImage( const double amplitude_, 1058 const double wavelength_ ) 1059 : _amplitude( amplitude_ ), 1060 _wavelength( wavelength_ ) 1061{ 1062} 1063void Magick::waveImage::operator()( Magick::Image &image_ ) const 1064{ 1065 image_.wave( _amplitude, _wavelength ); 1066} 1067 1068// resize image to specified size. 1069Magick::resizeImage::resizeImage( const Magick::Geometry &geometry_ ) 1070 : _geometry( geometry_ ) 1071{ 1072} 1073void Magick::resizeImage::operator()( Magick::Image &image_ ) const 1074{ 1075 image_.resize( _geometry ); 1076} 1077 1078// Zoom image to specified size. 1079Magick::zoomImage::zoomImage( const Magick::Geometry &geometry_ ) 1080 : _geometry( geometry_ ) 1081{ 1082} 1083void Magick::zoomImage::operator()( Magick::Image &image_ ) const 1084{ 1085 image_.zoom( _geometry ); 1086} 1087 1088// 1089// Function object image attribute accessors 1090// 1091 1092// Anti-alias Postscript and TrueType fonts (default true) 1093Magick::antiAliasImage::antiAliasImage( const bool flag_ ) 1094 : _flag( flag_ ) 1095{ 1096} 1097void Magick::antiAliasImage::operator()( Magick::Image &image_ ) const 1098{ 1099 image_.antiAlias( _flag ); 1100} 1101 1102// Join images into a single multi-image file 1103Magick::adjoinImage::adjoinImage( const bool flag_ ) 1104 : _flag( flag_ ) 1105{ 1106} 1107void Magick::adjoinImage::operator()( Magick::Image &image_ ) const 1108{ 1109 image_.adjoin( _flag ); 1110} 1111 1112// Time in 1/100ths of a second which must expire before displaying 1113// the next image in an animated sequence. 1114Magick::animationDelayImage::animationDelayImage( const size_t delay_ ) 1115 : _delay( delay_ ) 1116{ 1117} 1118void Magick::animationDelayImage::operator()( Magick::Image &image_ ) const 1119{ 1120 image_.animationDelay( _delay ); 1121} 1122 1123// Number of iterations to loop an animation (e.g. Netscape loop 1124// extension) for. 1125Magick::animationIterationsImage::animationIterationsImage( const size_t iterations_ ) 1126 : _iterations( iterations_ ) 1127{ 1128} 1129void Magick::animationIterationsImage::operator()( Magick::Image &image_ ) const 1130{ 1131 image_.animationIterations( _iterations ); 1132} 1133 1134// Image background color 1135Magick::backgroundColorImage::backgroundColorImage( const Magick::Color &color_ ) 1136 : _color( color_ ) 1137{ 1138} 1139void Magick::backgroundColorImage::operator()( Magick::Image &image_ ) const 1140{ 1141 image_.backgroundColor( _color ); 1142} 1143 1144// Name of texture image to tile onto the image background 1145Magick::backgroundTextureImage::backgroundTextureImage( const std::string &backgroundTexture_ ) 1146 : _backgroundTexture( backgroundTexture_ ) 1147{ 1148} 1149void Magick::backgroundTextureImage::operator()( Magick::Image &image_ ) const 1150{ 1151 image_.backgroundTexture( _backgroundTexture ); 1152} 1153 1154// Image border color 1155Magick::borderColorImage::borderColorImage( const Magick::Color &color_ ) 1156 : _color( color_ ) 1157{ 1158} 1159void Magick::borderColorImage::operator()( Magick::Image &image_ ) const 1160{ 1161 image_.borderColor( _color ); 1162} 1163 1164// Text bounding-box base color (default none) 1165Magick::boxColorImage::boxColorImage( const Magick::Color &boxColor_ ) 1166 : _boxColor( boxColor_ ) { } 1167 1168void Magick::boxColorImage::operator()( Magick::Image &image_ ) const 1169{ 1170 image_.boxColor( _boxColor ); 1171} 1172 1173// Chromaticity blue primary point (e.g. x=0.15, y=0.06) 1174Magick::chromaBluePrimaryImage::chromaBluePrimaryImage( const double x_, 1175 const double y_ ) 1176 : _x( x_ ), 1177 _y( y_ ) 1178{ 1179} 1180void Magick::chromaBluePrimaryImage::operator()( Magick::Image &image_ ) const 1181{ 1182 image_.chromaBluePrimary( _x, _y ); 1183} 1184 1185// Chromaticity green primary point (e.g. x=0.3, y=0.6) 1186Magick::chromaGreenPrimaryImage::chromaGreenPrimaryImage( const double x_, 1187 const double y_ ) 1188 : _x( x_ ), 1189 _y( y_ ) 1190{ 1191} 1192void Magick::chromaGreenPrimaryImage::operator()( Magick::Image &image_ ) const 1193{ 1194 image_.chromaGreenPrimary( _x, _y ); 1195} 1196 1197// Chromaticity red primary point (e.g. x=0.64, y=0.33) 1198Magick::chromaRedPrimaryImage::chromaRedPrimaryImage( const double x_, 1199 const double y_ ) 1200 : _x( x_ ), 1201 _y( y_ ) 1202{ 1203} 1204void Magick::chromaRedPrimaryImage::operator()( Magick::Image &image_ ) const 1205{ 1206 image_.chromaRedPrimary( _x, _y ); 1207} 1208 1209// Chromaticity white point (e.g. x=0.3127, y=0.329) 1210Magick::chromaWhitePointImage::chromaWhitePointImage( const double x_, 1211 const double y_ ) 1212 : _x( x_ ), 1213 _y( y_ ) 1214{ 1215} 1216void Magick::chromaWhitePointImage::operator()( Magick::Image &image_ ) const 1217{ 1218 image_.chromaWhitePoint( _x, _y ); 1219} 1220 1221// Colors within this distance are considered equal 1222Magick::colorFuzzImage::colorFuzzImage( const double fuzz_ ) 1223 : _fuzz( fuzz_ ) 1224{ 1225} 1226void Magick::colorFuzzImage::operator()( Magick::Image &image_ ) const 1227{ 1228 image_.colorFuzz( _fuzz ); 1229} 1230 1231// Color at colormap position index_ 1232Magick::colorMapImage::colorMapImage( const size_t index_, 1233 const Color &color_ ) 1234 : _index( index_ ), 1235 _color( color_ ) 1236{ 1237} 1238void Magick::colorMapImage::operator()( Magick::Image &image_ ) const 1239{ 1240 image_.colorMap( _index, _color ); 1241} 1242 1243// Composition operator to be used when composition is implicitly used 1244// (such as for image flattening). 1245Magick::composeImage::composeImage( const CompositeOperator compose_ ) 1246 : _compose( compose_ ) 1247{ 1248} 1249void Magick::composeImage::operator()( Magick::Image &image_ ) const 1250{ 1251 image_.compose( _compose ); 1252} 1253 1254// Compression type 1255Magick::compressTypeImage::compressTypeImage( const CompressionType compressType_ ) 1256 : _compressType( compressType_ ) 1257{ 1258} 1259void Magick::compressTypeImage::operator()( Magick::Image &image_ ) const 1260{ 1261 image_.compressType( _compressType ); 1262} 1263 1264// Vertical and horizontal resolution in pixels of the image 1265Magick::densityImage::densityImage( const Geometry &geomery_ ) 1266 : _geomery( geomery_ ) 1267{ 1268} 1269void Magick::densityImage::operator()( Magick::Image &image_ ) const 1270{ 1271 image_.density( _geomery ); 1272} 1273 1274// Image depth (bits allocated to red/green/blue components) 1275Magick::depthImage::depthImage( const size_t depth_ ) 1276 : _depth( depth_ ) 1277{ 1278} 1279void Magick::depthImage::operator()( Magick::Image &image_ ) const 1280{ 1281 image_.depth( _depth ); 1282} 1283 1284// Endianness (LSBEndian like Intel or MSBEndian like SPARC) for image 1285// formats which support endian-specific options. 1286Magick::endianImage::endianImage( const Magick::EndianType endian_ ) 1287 : _endian( endian_ ) 1288{ 1289} 1290void Magick::endianImage::operator()( Magick::Image &image_ ) const 1291{ 1292 image_.endian( _endian ); 1293} 1294 1295// Image file name 1296Magick::fileNameImage::fileNameImage( const std::string &fileName_ ) 1297 : _fileName( fileName_ ) 1298{ 1299} 1300void Magick::fileNameImage::operator()( Magick::Image &image_ ) const 1301{ 1302 image_.fileName( _fileName ); 1303} 1304 1305// Filter to use when resizing image 1306Magick::filterTypeImage::filterTypeImage( const FilterTypes filterType_ ) 1307 : _filterType( filterType_ ) 1308{ 1309} 1310void Magick::filterTypeImage::operator()( Magick::Image &image_ ) const 1311{ 1312 image_.filterType( _filterType ); 1313} 1314 1315// Text rendering font 1316Magick::fontImage::fontImage( const std::string &font_ ) 1317 : _font( font_ ) 1318{ 1319} 1320void Magick::fontImage::operator()( Magick::Image &image_ ) const 1321{ 1322 image_.font( _font ); 1323} 1324 1325// Font point size 1326Magick::fontPointsizeImage::fontPointsizeImage( const size_t pointsize_ ) 1327 : _pointsize( pointsize_ ) 1328{ 1329} 1330void Magick::fontPointsizeImage::operator()( Magick::Image &image_ ) const 1331{ 1332 image_.fontPointsize( _pointsize ); 1333} 1334 1335// GIF disposal method 1336Magick::gifDisposeMethodImage::gifDisposeMethodImage( const size_t disposeMethod_ ) 1337 : _disposeMethod( disposeMethod_ ) 1338{ 1339} 1340void Magick::gifDisposeMethodImage::operator()( Magick::Image &image_ ) const 1341{ 1342 image_.gifDisposeMethod( _disposeMethod ); 1343} 1344 1345// Type of interlacing to use 1346Magick::interlaceTypeImage::interlaceTypeImage( const InterlaceType interlace_ ) 1347 : _interlace( interlace_ ) 1348{ 1349} 1350void Magick::interlaceTypeImage::operator()( Magick::Image &image_ ) const 1351{ 1352 image_.interlaceType( _interlace ); 1353} 1354 1355// Linewidth for drawing vector objects (default one) 1356Magick::lineWidthImage::lineWidthImage( const double lineWidth_ ) 1357 : _lineWidth( lineWidth_ ) 1358{ 1359} 1360void Magick::lineWidthImage::operator()( Magick::Image &image_ ) const 1361{ 1362 image_.lineWidth( _lineWidth ); 1363} 1364 1365// File type magick identifier (.e.g "GIF") 1366Magick::magickImage::magickImage( const std::string &magick_ ) 1367 : _magick( magick_ ) 1368{ 1369} 1370void Magick::magickImage::operator()( Magick::Image &image_ ) const 1371{ 1372 image_.magick( _magick ); 1373} 1374 1375// Image supports transparent color 1376Magick::matteImage::matteImage( const bool matteFlag_ ) 1377 : _matteFlag( matteFlag_ ) 1378{ 1379} 1380void Magick::matteImage::operator()( Magick::Image &image_ ) const 1381{ 1382 image_.matte( _matteFlag ); 1383} 1384 1385// Transparent color 1386Magick::matteColorImage::matteColorImage( const Color &matteColor_ ) 1387 : _matteColor( matteColor_ ) 1388{ 1389} 1390void Magick::matteColorImage::operator()( Magick::Image &image_ ) const 1391{ 1392 image_.matteColor( _matteColor ); 1393} 1394 1395// Indicate that image is black and white 1396Magick::monochromeImage::monochromeImage( const bool monochromeFlag_ ) 1397 : _monochromeFlag( monochromeFlag_ ) 1398{ 1399} 1400void Magick::monochromeImage::operator()( Magick::Image &image_ ) const 1401{ 1402 image_.monochrome( _monochromeFlag ); 1403} 1404 1405// Pen color 1406Magick::penColorImage::penColorImage( const Color &penColor_ ) 1407 : _penColor( penColor_ ) 1408{ 1409} 1410void Magick::penColorImage::operator()( Magick::Image &image_ ) const 1411{ 1412 image_.penColor( _penColor ); 1413} 1414 1415// Pen texture image. 1416Magick::penTextureImage::penTextureImage( const Image &penTexture_ ) 1417 : _penTexture( penTexture_ ) 1418{ 1419} 1420void Magick::penTextureImage::operator()( Magick::Image &image_ ) const 1421{ 1422 image_.penTexture( _penTexture ); 1423} 1424 1425// Set pixel color at location x & y. 1426Magick::pixelColorImage::pixelColorImage( const ssize_t x_, 1427 const ssize_t y_, 1428 const Color &color_) 1429 : _x( x_ ), 1430 _y( y_ ), 1431 _color( color_ ) { } 1432 1433void Magick::pixelColorImage::operator()( Magick::Image &image_ ) const 1434{ 1435 image_.pixelColor( _x, _y, _color ); 1436} 1437 1438// Postscript page size. 1439Magick::pageImage::pageImage( const Geometry &pageSize_ ) 1440 : _pageSize( pageSize_ ) 1441{ 1442} 1443void Magick::pageImage::operator()( Magick::Image &image_ ) const 1444{ 1445 image_.page( _pageSize ); 1446} 1447 1448// JPEG/MIFF/PNG compression level (default 75). 1449Magick::qualityImage::qualityImage( const size_t quality_ ) 1450 : _quality( quality_ ) 1451{ 1452} 1453void Magick::qualityImage::operator()( Magick::Image &image_ ) const 1454{ 1455 image_.quality( _quality ); 1456} 1457 1458// Maximum number of colors to quantize to 1459Magick::quantizeColorsImage::quantizeColorsImage( const size_t colors_ ) 1460 : _colors( colors_ ) 1461{ 1462} 1463void Magick::quantizeColorsImage::operator()( Magick::Image &image_ ) const 1464{ 1465 image_.quantizeColors( _colors ); 1466} 1467 1468// Colorspace to quantize in. 1469Magick::quantizeColorSpaceImage::quantizeColorSpaceImage( const ColorspaceType colorSpace_ ) 1470 : _colorSpace( colorSpace_ ) 1471{ 1472} 1473void Magick::quantizeColorSpaceImage::operator()( Magick::Image &image_ ) const 1474{ 1475 image_.quantizeColorSpace( _colorSpace ); 1476} 1477 1478// Dither image during quantization (default true). 1479Magick::quantizeDitherImage::quantizeDitherImage( const bool ditherFlag_ ) 1480 : _ditherFlag( ditherFlag_ ) 1481{ 1482} 1483void Magick::quantizeDitherImage::operator()( Magick::Image &image_ ) const 1484{ 1485 image_.quantizeDither( _ditherFlag ); 1486} 1487 1488// Quantization tree-depth 1489Magick::quantizeTreeDepthImage::quantizeTreeDepthImage( const size_t treeDepth_ ) 1490 : _treeDepth( treeDepth_ ) { } 1491 1492void Magick::quantizeTreeDepthImage::operator()( Magick::Image &image_ ) const 1493{ 1494 image_.quantizeTreeDepth( _treeDepth ); 1495} 1496 1497// The type of rendering intent 1498Magick::renderingIntentImage::renderingIntentImage( const Magick::RenderingIntent renderingIntent_ ) 1499 : _renderingIntent( renderingIntent_ ) 1500{ 1501} 1502void Magick::renderingIntentImage::operator()( Magick::Image &image_ ) const 1503{ 1504 image_.renderingIntent( _renderingIntent ); 1505} 1506 1507// Units of image resolution 1508Magick::resolutionUnitsImage::resolutionUnitsImage( const Magick::ResolutionType resolutionUnits_ ) 1509 : _resolutionUnits( resolutionUnits_ ) 1510{ 1511} 1512void Magick::resolutionUnitsImage::operator()( Magick::Image &image_ ) const 1513{ 1514 image_.resolutionUnits( _resolutionUnits ); 1515} 1516 1517// Image scene number 1518Magick::sceneImage::sceneImage( const size_t scene_ ) 1519 : _scene( scene_ ) 1520{ 1521} 1522void Magick::sceneImage::operator()( Magick::Image &image_ ) const 1523{ 1524 image_.scene( _scene ); 1525} 1526 1527// Width and height of a raw image 1528Magick::sizeImage::sizeImage( const Magick::Geometry &geometry_ ) 1529 : _geometry( geometry_ ) 1530{ 1531} 1532void Magick::sizeImage::operator()( Magick::Image &image_ ) const 1533{ 1534 image_.size( _geometry ); 1535} 1536 1537// Splice the background color into the image. 1538Magick::spliceImage::spliceImage( const Magick::Geometry &geometry_ ) 1539 : _geometry( geometry_ ) 1540{ 1541} 1542void Magick::spliceImage::operator()( Magick::Image &image_ ) const 1543{ 1544 image_.splice( _geometry ); 1545} 1546 1547// stripImage strips an image of all profiles and comments. 1548Magick::stripImage::stripImage( void ) 1549{ 1550} 1551void Magick::stripImage::operator()( Magick::Image &image_ ) const 1552{ 1553 image_.strip( ); 1554} 1555 1556// Subimage of an image sequence 1557Magick::subImageImage::subImageImage( const size_t subImage_ ) 1558 : _subImage( subImage_ ) 1559{ 1560} 1561void Magick::subImageImage::operator()( Magick::Image &image_ ) const 1562{ 1563 image_.subImage( _subImage ); 1564} 1565 1566// Number of images relative to the base image 1567Magick::subRangeImage::subRangeImage( const size_t subRange_ ) 1568 : _subRange( subRange_ ) 1569{ 1570} 1571void Magick::subRangeImage::operator()( Magick::Image &image_ ) const 1572{ 1573 image_.subRange( _subRange ); 1574} 1575 1576// Image storage type 1577Magick::typeImage::typeImage( const Magick::ImageType type_ ) 1578 : _type( type_ ) 1579{ 1580} 1581void Magick::typeImage::operator()( Magick::Image &image_ ) const 1582{ 1583 image_.type( _type ); 1584} 1585 1586// Print detailed information about the image 1587Magick::verboseImage::verboseImage( const bool verbose_ ) 1588 : _verbose( verbose_ ) 1589{ 1590} 1591void Magick::verboseImage::operator()( Magick::Image &image_ ) const 1592{ 1593 image_.verbose( _verbose ); 1594} 1595 1596// FlashPix viewing parameters 1597Magick::viewImage::viewImage( const std::string &view_ ) 1598 : _view( view_ ) { } 1599 1600void Magick::viewImage::operator()( Magick::Image &image_ ) const 1601{ 1602 image_.view( _view ); 1603} 1604 1605// X11 display to display to, obtain fonts from, or to capture image 1606// from 1607Magick::x11DisplayImage::x11DisplayImage( const std::string &display_ ) 1608 : _display( display_ ) 1609{ 1610} 1611void Magick::x11DisplayImage::operator()( Magick::Image &image_ ) const 1612{ 1613 image_.x11Display( _display ); 1614} 1615