12#ifndef Magick_STL_header
13#define Magick_STL_header
15#include "Magick++/Include.h"
22#include "Magick++/CoderInfo.h"
23#include "Magick++/Drawable.h"
24#include "Magick++/Exception.h"
25#include "Magick++/Montage.h"
54 void operator()(
Image &image_ )
const;
70 const ::ssize_t offset_ = 0 );
72 void operator()(
Image &image_ )
const;
84 addNoiseImage(
const NoiseType noiseType_,
const double attenuate_ = 1.0);
86 void operator()(
Image &image_)
const;
99 void operator()(
Image &image_ )
const;
117 const GravityType gravity_ );
123 const GravityType gravity_,
124 const double degrees_ );
129 const GravityType gravity_ );
131 void operator()(
Image &image_ )
const;
134 const std::string _text;
136 const GravityType _gravity;
137 const double _degrees;
144 blurImage(
const double radius_ = 1,
const double sigma_ = 0.5 );
146 void operator()(
Image &image_ )
const;
159 void operator()(
Image &image_ )
const;
171 void operator()(
Image &image_ )
const;
174 ChannelType _channel;
181 charcoalImage(
const double radius_ = 1,
const double sigma_ = 0.5 );
183 void operator()(
Image &image_ )
const;
196 void operator()(
Image &image_ )
const;
208 cdlImage(
const std::string &cdl_ );
210 void operator()(
Image &image_ )
const;
221 const unsigned int alphaGreen_,
222 const unsigned int alphaBlue_,
223 const Color &penColor_ );
226 const Color &penColor_ );
228 void operator()(
Image &image_ )
const;
231 unsigned int _alphaRed;
232 unsigned int _alphaGreen;
233 unsigned int _alphaBlue;
243 const double *color_matrix_ );
245 void operator()(
Image &image_ )
const;
249 const double *_color_matrix;
258 void operator()(
Image &image_ )
const;
261 ColorspaceType _colorSpace;
270 void operator()(
Image &image_ )
const;
273 std::string _comment;
284 CompositeOperator compose_ = InCompositeOp );
288 CompositeOperator compose_ = InCompositeOp );
290 void operator()(
Image &image_ )
const;
293 Image _compositeImage;
296 CompositeOperator _compose;
305 void operator()(
Image &image_ )
const;
317 void operator()(
Image &image_ )
const;
329 void operator()(
Image &image_ )
const;
341 void operator()(
Image &image_ )
const;
354 const size_t number_arguments_,
355 const double *arguments_,
356 const bool bestfit_ );
359 const size_t number_arguments_,
360 const double *arguments_ );
362 void operator()(
Image &image_ )
const;
365 DistortMethod _method;
366 size_t _number_arguments;
367 const double *_arguments;
380 drawImage(
const DrawableList &drawable_ );
382 void operator()(
Image &image_ )
const;
385 DrawableList _drawableList;
394 void operator()(
Image &image_ )
const;
405 embossImage(
const double radius_,
const double sigma_ );
407 void operator()(
Image &image_ )
const;
420 void operator()(
Image &image_ )
const;
431 void operator()(
Image &image_ )
const;
442 void operator()(
Image &image_ )
const;
454 void operator()(
Image &image_ )
const;
465 const unsigned int alpha_,
const Color &target_,
const bool invert_=
false);
467 void operator()(
Image &image_)
const;
486 const bool invert_=
false);
488 const Color &fillColor_,
const bool invert_=
false);
494 const Color &borderColor_,
const bool invert_=
false);
496 const Color &fillColor_,
const Color &borderColor_,
497 const bool invert_=
false);
499 void operator()(
Image &image_)
const;
518 const Image &texture_,
const bool invert_=
false);
520 const bool invert_=
false);
526 const Image &texture_,
const Color &borderColor_,
527 const bool invert_=
false);
530 const Color &borderColor_,
const bool invert_=
false);
532 void operator()(
Image &image_)
const;
548 void operator()(
Image &image_ )
const;
559 frameImage(
const size_t width_,
const size_t height_,
560 const ::ssize_t innerBevel_ = 6, const ::ssize_t outerBevel_ = 6 );
562 void operator()(
Image &image_ )
const;
567 ::ssize_t _outerBevel;
568 ::ssize_t _innerBevel;
578 const double gammaGreen_,
579 const double gammaBlue_ );
581 void operator()(
Image &image_ )
const;
598 void operator()(
Image &image_ )
const;
611 void operator()(
Image &image_ )
const;
614 Image _haldClutImage;
623 void operator()(
Image &image_ )
const;
636 void operator()(
Image &image_ )
const;
649 void operator()(
Image &image_ )
const;
661 void operator()(
Image &image_ )
const;
673 const double white_point,
674 const double mid_point=1.0 );
676 void operator()(
Image &image_ )
const;
690 void operator()(
Image &image_ )
const;
700 const bool dither_ =
false );
702 void operator()(
Image &image_ )
const;
716 void operator()(
Image &image_ )
const;
728 void operator()(
Image &image_ )
const;
731 LayerMethod _layerMethod;
740 void operator()(
Image &image_ )
const;
750 const double saturation_,
753 void operator()(
Image &image_ )
const;
768 void operator()(
Image &image_ )
const;
781 void operator()(
Image &image_ )
const;
792 void operator()(
Image &image_ )
const;
810 void operator()(
Image &image_ )
const;
821 const Color &penColor_ );
823 void operator()(
Image &image_ )
const;
836 void operator()(
Image &image_ )
const;
848 const bool raisedFlag_ =
false );
850 void operator()(
Image &image_ )
const;
871 void density(
const Geometry &geometry_);
875 void depth(
size_t depth_);
876 size_t depth(
void)
const;
879 void ping(
const bool flag_);
880 bool ping(
void)
const;
883 void quiet(
const bool quiet_);
884 bool quiet(
void)
const;
887 void size(
const Geometry &geometry_);
894 MagickCore::ImageInfo *imageInfo(
void);
901 MagickCore::ImageInfo *_imageInfo;
913 void operator()(
Image &image_ )
const;
925 void operator()(
Image &image_ )
const;
938 rollImage( const ::ssize_t columns_, const ::ssize_t rows_ );
940 void operator()(
Image &image_ )
const;
953 void operator()(
Image &image_ )
const;
965 void operator()(
Image &image_ )
const;
977 void operator()(
Image &image_ )
const;
991 const double smoothingThreshold_ = 1.5 );
993 void operator()(
Image &image_ )
const;
996 double _clusterThreshold;
997 double _smoothingThreshold;
1005 const double elevation_ = 30,
1006 const bool colorShading_ =
false );
1008 void operator()(
Image &image_ )
const;
1020 shadowImage(
const double percent_opacity_ = 80,
const double sigma_ = 0.5,
1021 const ssize_t x_ = 5,
const ssize_t y_ = 5 );
1023 void operator()(
Image &image_ )
const;
1026 double _percent_opacity;
1036 sharpenImage(
const double radius_ = 1,
const double sigma_ = 0.5 );
1038 void operator()(
Image &image_ )
const;
1051 void operator()(
Image &image_ )
const;
1063 const double yShearAngle_ );
1065 void operator()(
Image &image_ )
const;
1068 double _xShearAngle;
1069 double _yShearAngle;
1079 void operator()(
Image &image_ )
const;
1091 void operator()(
Image &image_ )
const;
1103 void operator()(
Image &image_ )
const;
1115 void operator()(
Image &image_ )
const;
1128 void operator()(
Image &image_ )
const;
1140 void operator()(
Image &image_ )
const;
1152 void operator()(
Image &image_ )
const;
1164 void operator()(
Image &image_ )
const;
1176 void operator()(
Image &image_ )
const;
1188 void operator()(
Image &image_ )
const;
1200 void operator()(
Image &image_ )
const;
1209 waveImage(
const double amplitude_ = 25.0,
1210 const double wavelength_ = 150.0 );
1212 void operator()(
Image &image_ )
const;
1225 void operator()(
Image &image_ )
const;
1241 void operator()(
Image &image_ )
const;
1254 void operator()(
Image &image_ )
const;
1267 void operator()(
Image &image_ )
const;
1279 void operator()(
Image &image_ )
const;
1291 void operator()(
Image &image_ )
const;
1294 std::string _backgroundTexture;
1303 void operator()(
Image &image_ )
const;
1315 void operator()(
Image &image_ )
const;
1327 void operator()(
Image &image_)
const;
1341 void operator()(
Image &image_)
const;
1355 void operator()(
Image &image_)
const;
1369 void operator()(
Image &image_)
const;
1383 void operator()(
Image &image_ )
const;
1395 void operator()(
Image &image_ )
const;
1409 void operator()(
Image &image_ )
const;
1412 CompositeOperator _compose;
1421 void operator()(
Image &image_ )
const;
1424 CompressionType _compressType;
1433 void operator()(
Image &image_ )
const;
1445 void operator()(
Image &image_ )
const;
1458 void operator()(
Image &image_ )
const;
1470 void operator()(
Image &image_ )
const;
1473 std::string _fileName;
1482 void operator()(
Image &image_ )
const;
1485 FilterType _filterType;
1494 void operator()(
Image &image_ )
const;
1506 void operator()(
Image &image_ )
const;
1518 void operator()(
Image &image_ )
const;
1521 DisposeType _disposeMethod;
1530 void operator()(
Image &image_ )
const;
1533 InterlaceType _interlace;
1542 void operator()(
Image &image_ )
const;
1545 std::string _magick;
1554 void operator()(
Image &image_ )
const;
1566 void operator()(
Image &image_ )
const;
1578 void operator()(
Image &image_ )
const;
1581 bool _monochromeFlag;
1590 void operator()(
Image &image_ )
const;
1602 void operator()(
Image &image_ )
const;
1614 const Color &color_);
1616 void operator()(
Image &image_ )
const;
1630 void operator()(
Image &image_ )
const;
1642 void operator()(
Image &image_ )
const;
1654 void operator()(
Image &image_ )
const;
1666 void operator()(
Image &image_ )
const;
1669 ColorspaceType _colorSpace;
1678 void operator()(
Image &image_ )
const;
1690 void operator()(
Image &image_ )
const;
1702 void operator()(
Image &image_ )
const;
1705 RenderingIntent _renderingIntent;
1714 void operator()(
Image &image_ )
const;
1717 ResolutionType _resolutionUnits;
1726 void operator()(
Image &image_ )
const;
1737 const double contrast,
1738 const double midpoint = (
double) QuantumRange / 2.0 );
1740 void operator()(
Image &image_ )
const;
1754 void operator()(
Image &image_ )
const;
1766 void operator()(
Image &image_ )
const;
1777 void operator()(
Image &image_ )
const;
1789 void operator()(
Image &image_ )
const;
1801 void operator()(
Image &image_ )
const;
1813 void operator()(
Image &image_ )
const;
1816 Magick::ImageType _type;
1826 void operator()(
Image &image_ )
const;
1839 void operator()(
Image &image_ )
const;
1842 std::string _display;
1853 template<
class InputIterator,
class Container>
1854 void channelMaskImages(InputIterator first_,InputIterator last_,
1855 Container *container_,
const ChannelType channel_)
1857 MagickCore::ChannelType
1860 container_->clear();
1861 for (InputIterator iter = first_; iter != last_; ++iter)
1863 iter->modifyImage();
1864 channel_mask=MagickCore::SetImageChannelMask(iter->image(),channel_);
1865 container_->push_back(channel_mask);
1872 template<
class Container>
1873 void insertImages(Container *sequence_,MagickCore::Image* images_)
1880 while (image != (MagickCore::Image *) NULL)
1883 image->next=(MagickCore::Image *) NULL;
1885 if (next != (MagickCore::Image *) NULL)
1886 next->previous=(MagickCore::Image *) NULL;
1902 template<
class InputIterator>
1903 bool linkImages(InputIterator first_,InputIterator last_)
1913 previous=(MagickCore::Image *) NULL;
1914 for (InputIterator iter = first_; iter != last_; ++iter)
1919 iter->modifyImage();
1921 current=iter->image();
1923 current->previous=previous;
1924 current->next=(MagickCore::Image *) NULL;
1925 current->scene=(size_t) scene++;
1927 if (previous != (MagickCore::Image *) NULL)
1928 previous->next=current;
1932 return(scene > 0 ?
true :
false);
1936 template<
class InputIterator,
class Container>
1937 void restoreChannelMaskImages(InputIterator first_,InputIterator last_,
1938 Container *container_)
1940 typename Container::iterator
1943 channel_mask=container_->begin();
1944 for (InputIterator iter = first_; iter != last_; ++iter)
1946 iter->modifyImage();
1947 (void) MagickCore::SetImageChannelMask(iter->image(),
1948 (
const MagickCore::ChannelType) *channel_mask);
1956 template<
class InputIterator>
1957 void unlinkImages(InputIterator first_,InputIterator last_)
1962 for (InputIterator iter = first_; iter != last_; ++iter)
1964 image=iter->image();
1965 image->previous=(MagickCore::Image *) NULL;
1966 image->next=(MagickCore::Image *) NULL;
1976 template <
class InputIterator>
1977 void animateImages( InputIterator first_,InputIterator last_)
1979 if (linkImages(first_,last_) ==
false)
1982 MagickCore::AnimateImages(first_->imageInfo(),first_->image(),
1984 unlinkImages(first_,last_);
1985 ThrowPPException(first_->quiet());
1990 template <
class InputIterator>
1991 void appendImages( Image *appendedImage_,
1992 InputIterator first_,
1993 InputIterator last_,
1994 bool stack_ =
false) {
1995 if (linkImages(first_,last_) ==
false)
1998 MagickCore::Image* image = MagickCore::AppendImages( first_->image(),
1999 (MagickBooleanType) stack_,
2001 unlinkImages( first_, last_ );
2002 appendedImage_->replaceImage( image );
2003 ThrowPPException(appendedImage_->quiet());
2007 template <
class Container>
2008 void artifactNames(Container *names_,
const Image* image_)
2015 MagickCore::ResetImageArtifactIterator(image_->constImage());
2016 name=MagickCore::GetNextImageArtifact(image_->constImage());
2017 while (name != (
const char *) NULL)
2019 names_->push_back(std::string(name));
2020 name=MagickCore::GetNextImageArtifact(image_->constImage());
2025 template <
class Container>
2026 void attributeNames(Container *names_,
const Image* image_)
2033 MagickCore::ResetImagePropertyIterator(image_->constImage());
2034 name=MagickCore::GetNextImageProperty(image_->constImage());
2035 while (name != (
const char *) NULL)
2037 names_->push_back(std::string(name));
2038 name=MagickCore::GetNextImageProperty(image_->constImage());
2044 template <
class InputIterator>
2045 void averageImages( Image *averagedImage_,
2046 InputIterator first_,
2047 InputIterator last_ ) {
2048 if (linkImages(first_,last_) ==
false)
2051 MagickCore::Image* image = MagickCore::EvaluateImages( first_->image(),
2052 MagickCore::MeanEvaluateOperator, exceptionInfo );
2053 unlinkImages( first_, last_ );
2054 averagedImage_->replaceImage( image );
2055 ThrowPPException(averagedImage_->quiet());
2063 template <
class InputIterator,
class Container >
2064 void coalesceImages(Container *coalescedImages_,InputIterator first_,
2065 InputIterator last_)
2073 if (linkImages(first_,last_) ==
false)
2077 quiet=first_->quiet();
2078 images=MagickCore::CoalesceImages(first_->image(),exceptionInfo);
2081 unlinkImages(first_,last_);
2084 coalescedImages_->clear();
2087 insertImages(coalescedImages_,images);
2090 ThrowPPException(quiet);
2102 template <
class Container >
2103 void coderInfoList( Container *container_,
2104 CoderInfo::MatchType isReadable_ = CoderInfo::AnyMatch,
2105 CoderInfo::MatchType isWritable_ = CoderInfo::AnyMatch,
2106 CoderInfo::MatchType isMultiFrame_ = CoderInfo::AnyMatch
2109 size_t number_formats;
2112 MagickCore::GetMagickList(
"*", &number_formats, exceptionInfo );
2115 throwException(exceptionInfo);
2116 throwExceptionExplicit(MagickCore::MissingDelegateError,
2117 "Coder array not returned!", 0 );
2121 container_->clear();
2123 for ( ::ssize_t i=0; i < (::ssize_t) number_formats; i++)
2125 const MagickCore::MagickInfo *magick_info =
2126 MagickCore::GetMagickInfo( coder_list[i], exceptionInfo );
2130 coder_list[i]=(
char *)
2131 MagickCore::RelinquishMagickMemory( coder_list[i] );
2134 if ( MagickCore::GetMagickStealth(magick_info) )
2138 CoderInfo coderInfo( magick_info->name );
2141 if ( isReadable_ != CoderInfo::AnyMatch &&
2142 (( coderInfo.isReadable() && isReadable_ != CoderInfo::TrueMatch ) ||
2143 ( !coderInfo.isReadable() && isReadable_ != CoderInfo::FalseMatch )) )
2147 if ( isWritable_ != CoderInfo::AnyMatch &&
2148 (( coderInfo.isWritable() && isWritable_ != CoderInfo::TrueMatch ) ||
2149 ( !coderInfo.isWritable() && isWritable_ != CoderInfo::FalseMatch )) )
2153 if ( isMultiFrame_ != CoderInfo::AnyMatch &&
2154 (( coderInfo.isMultiFrame() && isMultiFrame_ != CoderInfo::TrueMatch ) ||
2155 ( !coderInfo.isMultiFrame() && isMultiFrame_ != CoderInfo::FalseMatch )) )
2159 container_->push_back( coderInfo );
2167 coder_list=(
char **) MagickCore::RelinquishMagickMemory( coder_list );
2168 ThrowPPException(
false);
2211 template <
class Container >
2212 void colorHistogram( Container *histogram_,
const Image image)
2218 MagickCore::PixelInfo *histogram_array =
2219 MagickCore::GetImageHistogram( image.constImage(), &colors, exceptionInfo );
2220 ThrowPPException(image.quiet());
2223 histogram_->clear();
2226 for (
size_t i=0; i < colors; i++)
2228 histogram_->insert( histogram_->end(), std::pair<const Color,size_t>
2229 ( Color(histogram_array[i]), (
size_t) histogram_array[i].count) );
2233 histogram_array=(MagickCore::PixelInfo *)
2234 MagickCore::RelinquishMagickMemory(histogram_array);
2241 template<
class InputIterator >
2242 void combineImages(Image *combinedImage_,InputIterator first_,
2243 InputIterator last_,
const ChannelType channel_,
2244 const ColorspaceType colorspace_ = MagickCore::sRGBColorspace)
2249 std::vector<ChannelType>
2252 if (linkImages(first_,last_) ==
false)
2255 channelMaskImages(first_,last_,&channelMask,channel_);
2256 image=CombineImages(first_->image(),colorspace_,exceptionInfo);
2257 restoreChannelMaskImages(first_,last_,&channelMask);
2258 unlinkImages(first_,last_);
2259 combinedImage_->replaceImage(image);
2260 ThrowPPException(combinedImage_->quiet());
2263 template <
class Container>
2264 void cropToTiles(Container *tiledImages_,
const Image image_,
2265 const Geometry &geometry_)
2268 MagickCore::Image* images=CropImageToTiles(image_.constImage(),
2269 static_cast<std::string
>(geometry_).c_str(),exceptionInfo);
2270 tiledImages_->clear();
2271 insertImages(tiledImages_,images);
2272 ThrowPPException(image_.quiet());
2277 template<
class InputIterator,
class Container>
2278 void deconstructImages(Container *deconstructedImages_,
2279 InputIterator first_,InputIterator last_)
2287 if (linkImages(first_,last_) ==
false)
2290 quiet=first_->quiet();
2291 images=CompareImagesLayers(first_->image(),CompareAnyLayer,exceptionInfo);
2292 unlinkImages(first_,last_);
2294 deconstructedImages_->clear();
2295 insertImages(deconstructedImages_,images);
2297 ThrowPPException(quiet);
2303 template <
class InputIterator>
2304 void displayImages(InputIterator first_,InputIterator last_)
2306 if (linkImages(first_,last_) ==
false)
2309 MagickCore::DisplayImages(first_->imageInfo(),first_->image(),
2311 unlinkImages(first_,last_);
2312 ThrowPPException(first_->quiet());
2319 template <
class InputIterator >
2320 void evaluateImages( Image *evaluatedImage_,
2321 InputIterator first_,
2322 InputIterator last_,
2323 const MagickEvaluateOperator operator_ ) {
2324 if (linkImages(first_,last_) ==
false)
2327 MagickCore::Image* image = EvaluateImages( first_->image(), operator_, exceptionInfo );
2328 unlinkImages( first_, last_ );
2329 evaluatedImage_->replaceImage( image );
2330 ThrowPPException(evaluatedImage_->quiet());
2335 template <
class InputIterator>
2336 void flattenImages( Image *flattenedImage_,
2337 InputIterator first_,
2338 InputIterator last_ ) {
2339 if (linkImages(first_,last_) ==
false)
2342 MagickCore::Image* image = MagickCore::MergeImageLayers( first_->image(),
2343 FlattenLayer,exceptionInfo );
2344 unlinkImages( first_, last_ );
2345 flattenedImage_->replaceImage( image );
2346 ThrowPPException(flattenedImage_->quiet());
2351 template <
class Container >
2352 void forwardFourierTransformImage( Container *fourierImages_,
2353 const Image &image_ ) {
2357 MagickCore::Image* images = ForwardFourierTransformImage(
2358 image_.constImage(), MagickTrue, exceptionInfo);
2361 fourierImages_->clear();
2364 insertImages( fourierImages_, images );
2367 ThrowPPException(image_.quiet());
2369 template <
class Container >
2370 void forwardFourierTransformImage( Container *fourierImages_,
2371 const Image &image_,
const bool magnitude_ ) {
2375 MagickCore::Image* images = ForwardFourierTransformImage(
2376 image_.constImage(), magnitude_ ==
true ? MagickTrue : MagickFalse,
2380 fourierImages_->clear();
2383 insertImages( fourierImages_, images );
2386 ThrowPPException(image_.quiet());
2390 template <
class InputIterator>
2391 void fxImages(Image *fxImage_,InputIterator first_,InputIterator last_,
2392 const std::string expression)
2397 if (linkImages(first_,last_) ==
false)
2400 image=FxImage(first_->constImage(),expression.c_str(),exceptionInfo);
2401 unlinkImages(first_,last_);
2402 fxImage_->replaceImage(image);
2403 ThrowPPException(fxImage_->quiet());
2410 template<
class InputIterator>
2411 void mapImages(InputIterator first_,InputIterator last_,
2412 const Image& mapImage_,
bool dither_=
false,
bool measureError_=
false)
2417 MagickCore::QuantizeInfo
2420 if (linkImages(first_,last_) ==
false)
2423 MagickCore::GetQuantizeInfo(&quantizeInfo);
2424 quantizeInfo.dither_method = dither_ ? MagickCore::RiemersmaDitherMethod :
2425 MagickCore::NoDitherMethod;
2426 MagickCore::RemapImages(&quantizeInfo,first_->image(),
2427 (mapImage_.isValid() ? mapImage_.constImage() :
2428 (
const MagickCore::Image*) NULL),exceptionInfo);
2429 unlinkImages(first_,last_);
2430 if (exceptionInfo->severity != MagickCore::UndefinedException)
2432 unlinkImages(first_,last_);
2433 throwException(exceptionInfo,mapImage_.quiet());
2436 image=first_->image();
2437 while(image != (MagickCore::Image *) NULL)
2442 MagickCore::GetImageQuantizeError(image,exceptionInfo);
2443 if (exceptionInfo->severity > MagickCore::UndefinedException)
2445 unlinkImages(first_,last_);
2446 throwException(exceptionInfo,mapImage_.quiet());
2451 MagickCore::SyncImage(image,exceptionInfo);
2452 if (exceptionInfo->severity > MagickCore::UndefinedException)
2454 unlinkImages(first_,last_);
2455 throwException(exceptionInfo,mapImage_.quiet());
2462 unlinkImages(first_,last_);
2463 (void) MagickCore::DestroyExceptionInfo(exceptionInfo);
2468 template <
class InputIterator >
2469 void mergeImageLayers( Image *mergedImage_,
2470 InputIterator first_,
2471 InputIterator last_,
2472 const LayerMethod method_ ) {
2473 if (linkImages(first_,last_) ==
false)
2476 MagickCore::Image* image = MergeImageLayers( first_->image(), method_, exceptionInfo );
2477 unlinkImages( first_, last_ );
2478 mergedImage_->replaceImage( image );
2479 ThrowPPException(mergedImage_->quiet());
2483 template <
class Container,
class InputIterator>
2484 void montageImages(Container *montageImages_,InputIterator first_,
2485 InputIterator last_,
const Montage &options_)
2493 MagickCore::MontageInfo
2496 if (linkImages(first_,last_) ==
false)
2499 montageInfo=
static_cast<MagickCore::MontageInfo*
>(
2500 MagickCore::AcquireMagickMemory(
sizeof(MagickCore::MontageInfo)));
2503 options_.updateMontageInfo(*montageInfo);
2506 if (options_.label().length() != 0)
2507 first_->label(options_.label());
2511 quiet=first_->quiet();
2512 images=MagickCore::MontageImages(first_->image(),montageInfo,
2516 unlinkImages(first_,last_);
2519 montageImages_->clear();
2521 if (images != (MagickCore::Image *) NULL)
2522 insertImages(montageImages_,images);
2525 MagickCore::DestroyMontageInfo(montageInfo);
2528 ThrowPPException(quiet);
2531 if (montageImages_->size() > 0 && options_.transparentColor().isValid())
2532 for_each(montageImages_->begin(),montageImages_->end(),transparentImage(
2533 options_.transparentColor()));
2537 template <
class InputIterator,
class Container >
2538 void morphImages(Container *morphedImages_,InputIterator first_,
2539 InputIterator last_,
size_t frames_)
2547 if (linkImages(first_,last_) ==
false)
2551 quiet=first_->quiet();
2552 images=MagickCore::MorphImages(first_->image(),frames_,exceptionInfo);
2555 unlinkImages(first_,last_);
2558 morphedImages_->clear();
2561 insertImages(morphedImages_,images);
2564 ThrowPPException(quiet);
2568 template <
class InputIterator>
2569 void mosaicImages( Image *mosaicImage_,
2570 InputIterator first_,
2571 InputIterator last_ ) {
2572 if (linkImages(first_,last_) ==
false)
2575 MagickCore::Image* image = MagickCore::MergeImageLayers( first_->image(),
2576 MosaicLayer,exceptionInfo );
2577 unlinkImages( first_, last_ );
2578 mosaicImage_->replaceImage( image );
2579 ThrowPPException(mosaicImage_->quiet());
2586 template <
class InputIterator,
class Container >
2587 void optimizeImageLayers(Container *optimizedImages_,InputIterator first_,
2588 InputIterator last_)
2596 if (linkImages(first_,last_) ==
false)
2600 quiet=first_->quiet();
2601 images=OptimizeImageLayers(first_->image(),exceptionInfo);
2603 unlinkImages(first_,last_);
2605 optimizedImages_->clear();
2607 insertImages(optimizedImages_,images);
2609 ThrowPPException(quiet);
2615 template <
class InputIterator,
class Container >
2616 void optimizePlusImageLayers(Container *optimizedImages_,
2617 InputIterator first_,InputIterator last_ )
2625 if (linkImages(first_,last_) ==
false)
2629 quiet=first_->quiet();
2630 images=OptimizePlusImageLayers(first_->image(),exceptionInfo);
2632 unlinkImages(first_,last_);
2634 optimizedImages_->clear();
2636 insertImages(optimizedImages_,images);
2638 ThrowPPException(quiet);
2644 template<
class InputIterator>
2645 void optimizeTransparency(InputIterator first_,InputIterator last_)
2647 if (linkImages(first_,last_) ==
false)
2650 OptimizeImageTransparency(first_->image(),exceptionInfo);
2651 unlinkImages(first_,last_ );
2653 ThrowPPException(first_->quiet());
2657 template<
class Container>
2658 void pingImages(Container *sequence_,
const std::string &imageSpec_,
2659 ReadOptions &options)
2662 readImages(sequence_,imageSpec_,options);
2665 template<
class Container>
2666 void pingImages(Container *sequence_,
const std::string &imageSpec_)
2668 ReadOptions options;
2669 pingImages(sequence_,imageSpec_,options);
2672 template<
class Container>
2673 void pingImages(Container *sequence_,
const Blob &blob_,ReadOptions &options)
2676 readImages(sequence_,blob_,options);
2679 template<
class Container>
2680 void pingImages(Container *sequence_,
const Blob &blob_)
2682 ReadOptions options;
2683 pingImages(sequence_,blob_,options);
2687 template <
class Container>
2688 void profileNames(Container *names_,
const Image* image_)
2695 MagickCore::ResetImageProfileIterator(image_->constImage());
2696 name=MagickCore::GetNextImageProfile(image_->constImage());
2697 while (name != (
const char *) NULL)
2699 names_->push_back(std::string(name));
2700 name=MagickCore::GetNextImageProfile(image_->constImage());
2706 template <
class InputIterator>
2707 void quantizeImages(InputIterator first_,InputIterator last_,
2708 bool measureError_ =
false)
2710 if (linkImages(first_,last_) ==
false)
2713 MagickCore::QuantizeImages(first_->quantizeInfo(),first_->image(),
2715 unlinkImages(first_,last_);
2717 MagickCore::Image *image=first_->image();
2718 while (image != (MagickCore::Image *) NULL)
2722 MagickCore::GetImageQuantizeError(image,exceptionInfo);
2725 MagickCore::SyncImage(image,exceptionInfo);
2729 unlinkImages(first_,last_);
2730 ThrowPPException(first_->quiet());
2734 template<
class Container>
2735 void readImages(Container *sequence_,
const std::string &imageSpec_,
2736 ReadOptions &options)
2741 MagickCore::ImageInfo
2744 imageInfo=options.imageInfo();
2745 imageSpec_.copy(imageInfo->filename,MagickPathExtent-1);
2746 imageInfo->filename[imageSpec_.length()] = 0;
2748 images=MagickCore::ReadImage(imageInfo,exceptionInfo);
2749 insertImages(sequence_,images);
2750 ThrowPPException(options.quiet());
2753 template<
class Container>
2754 void readImages(Container *sequence_,
const std::string &imageSpec_)
2756 ReadOptions options;
2757 readImages(sequence_,imageSpec_,options);
2760 template<
class Container>
2761 void readImages(Container *sequence_,
const Blob &blob_,ReadOptions &options)
2767 images=MagickCore::BlobToImage(options.imageInfo(),blob_.data(),
2768 blob_.length(),exceptionInfo);
2769 insertImages(sequence_,images);
2770 ThrowPPException(options.quiet());
2773 template<
class Container>
2774 void readImages(Container *sequence_,
const Blob &blob_)
2776 ReadOptions options;
2777 readImages(sequence_,blob_,options);
2781 template<
class Container>
2782 void separateImages(Container *separatedImages_,Image &image_,
2783 const ChannelType channel_)
2785 MagickCore::ChannelType
2792 channel_mask=MagickCore::SetImageChannelMask(image_.image(),channel_);
2793 images=SeparateImages(image_.constImage(),exceptionInfo);
2794 MagickCore::SetPixelChannelMask(image_.image(),channel_mask);
2796 separatedImages_->clear();
2797 insertImages(separatedImages_,images);
2799 ThrowPPException(image_.quiet());
2804 template<
class InputIterator>
2805 void smushImages(Image *smushedImage_,InputIterator first_,
2806 InputIterator last_,
const ssize_t offset_,
bool stack_=
false)
2811 if (linkImages(first_,last_) ==
false)
2814 newImage=MagickCore::SmushImages(first_->constImage(),
2815 (MagickBooleanType) stack_,offset_,exceptionInfo);
2816 unlinkImages(first_,last_);
2817 smushedImage_->replaceImage(newImage);
2818 ThrowPPException(smushedImage_->quiet());
2822 template <
class InputIterator>
2823 void writeImages( InputIterator first_,
2824 InputIterator last_,
2825 const std::string &imageSpec_,
2826 bool adjoin_ =
true ) {
2828 if (linkImages(first_,last_) ==
false)
2831 first_->adjoin( adjoin_ );
2834 ::ssize_t errorStat = MagickCore::WriteImages( first_->constImageInfo(),
2838 unlinkImages( first_, last_ );
2840 if ( errorStat !=
false )
2842 (void) MagickCore::DestroyExceptionInfo( exceptionInfo );
2846 ThrowPPException(first_->quiet());
2849 template <
class InputIterator>
2850 void writeImages( InputIterator first_,
2851 InputIterator last_,
2853 bool adjoin_ =
true) {
2854 if (linkImages(first_,last_) ==
false)
2857 first_->adjoin( adjoin_ );
2860 size_t length = 2048;
2861 void* data = MagickCore::ImagesToBlob( first_->imageInfo(),
2865 blob_->updateNoCopy( data, length, Magick::Blob::MallocAllocator );
2867 unlinkImages( first_, last_ );
2869 ThrowPPException(first_->quiet());