From: cristy Date: Sun, 2 Sep 2012 23:34:56 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5020 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a041706d555a780038f97211101cf8acb7f297d2;p=imagemagick --- diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 0e0b54e77..dde74bf73 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -1398,6 +1398,20 @@ void Magick::Image::medianFilter ( const double radius_ ) (void) DestroyExceptionInfo( &exceptionInfo ); } +// Merge layers +void Magick::Image::mergeLayers( const LayerMethod layerMethod_ ) +{ + ExceptionInfo exceptionInfo; + GetExceptionInfo( &exceptionInfo ); + MagickCore::Image* newImage = + MergeImageLayers ( image(), + layerMethod_, + &exceptionInfo ); + replaceImage( newImage ); + throwException( exceptionInfo ); + (void) DestroyExceptionInfo( &exceptionInfo ); +} + // Reduce image by integral size void Magick::Image::minify ( void ) { diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index f0ebfa7b6..34dedd4fb 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -1032,6 +1032,9 @@ typedef struct _ImageStatistics // Transparent color void matteColor ( const Color &matteColor_ ); Color matteColor ( void ) const; + + // Merge image layers + void mergeLayers ( const LayerMethod layerType_ ); // The mean error per pixel computed when an image is color reduced double meanErrorPerPixel ( void ) const; diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index 40aacb550..f5dde9b3f 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -364,8 +364,24 @@ namespace Magick using MagickCore::PartitionInterlace; // Layer method + using MagickCore::LayerMethod; + using MagickCore::UndefinedLayer; + using MagickCore::CoalesceLayer; + using MagickCore::CompareAnyLayer; + using MagickCore::CompareClearLayer; + using MagickCore::CompareOverlayLayer; + using MagickCore::DisposeLayer; + using MagickCore::OptimizeLayer; + using MagickCore::OptimizeImageLayer; + using MagickCore::OptimizePlusLayer; + using MagickCore::OptimizeTransLayer; + using MagickCore::RemoveDupsLayer; + using MagickCore::RemoveZeroLayer; + using MagickCore::CompositeLayer; + using MagickCore::MergeLayer; using MagickCore::FlattenLayer; using MagickCore::MosaicLayer; + using MagickCore::TrimBoundsLayer; // Line cap types using MagickCore::LineCap; diff --git a/Magick++/lib/Magick++/STL.h b/Magick++/lib/Magick++/STL.h index 56678bbc4..d4c30a183 100644 --- a/Magick++/lib/Magick++/STL.h +++ b/Magick++/lib/Magick++/STL.h @@ -725,6 +725,19 @@ namespace Magick private: double _radius; }; + + // Merge image layers + class MagickPPExport mergeLayersImage : public + std::unary_function + { + public: + mergeLayersImage ( LayerMethod layerMethod_ ); + + void operator()( Image &image_ ) const; + + private: + LayerMethod _layerMethod; + }; // Reduce image by integral size class MagickPPExport minifyImage : public std::unary_function diff --git a/Magick++/lib/STL.cpp b/Magick++/lib/STL.cpp index 0228c8b43..721163ce5 100644 --- a/Magick++/lib/STL.cpp +++ b/Magick++/lib/STL.cpp @@ -689,6 +689,17 @@ void Magick::medianConvolveImage::operator()( Magick::Image &image_ ) const image_.medianFilter( _radius ); } +// Merge image layers +Magick::mergeLayersImage::mergeLayersImage( + Magick::LayerMethod layerMethod_ ) + : _layerMethod( layerMethod_ ) +{ +} +void Magick::mergeLayersImage::operator()( Magick::Image &image_ ) const +{ + image_.mergeLayers( _layerMethod ); +} + // Reduce image by integral size Magick::minifyImage::minifyImage( void ) { diff --git a/MagickCore/layer.c b/MagickCore/layer.c index 472f1d6ab..7f7868cb7 100644 --- a/MagickCore/layer.c +++ b/MagickCore/layer.c @@ -507,7 +507,7 @@ MagickExport Image *DisposeImages(const Image *images,ExceptionInfo *exception) % % The format of the ComparePixels method is: % -% MagickBooleanType *ComparePixels(const ImageLayerMethod method, +% MagickBooleanType *ComparePixels(const LayerMethod method, % const PixelInfo *p,const PixelInfo *q) % % A description of each parameter follows: @@ -519,7 +519,7 @@ MagickExport Image *DisposeImages(const Image *images,ExceptionInfo *exception) % */ -static MagickBooleanType ComparePixels(const ImageLayerMethod method, +static MagickBooleanType ComparePixels(const LayerMethod method, const PixelInfo *p,const PixelInfo *q) { double @@ -575,7 +575,7 @@ static MagickBooleanType ComparePixels(const ImageLayerMethod method, % % The format of the CompareImagesBounds method is: % -% RectangleInfo *CompareImagesBounds(const ImageLayerMethod method, +% RectangleInfo *CompareImagesBounds(const LayerMethod method, % const Image *image1, const Image *image2, ExceptionInfo *exception) % % A description of each parameter follows: @@ -590,7 +590,7 @@ static MagickBooleanType ComparePixels(const ImageLayerMethod method, */ static RectangleInfo CompareImagesBounds(const Image *image1,const Image *image2, - const ImageLayerMethod method,ExceptionInfo *exception) + const LayerMethod method,ExceptionInfo *exception) { RectangleInfo bounds; @@ -721,7 +721,7 @@ static RectangleInfo CompareImagesBounds(const Image *image1,const Image *image2 % % CompareImagesLayers() compares each image with the next in a sequence and % returns the minimum bounding region of all the pixel differences (of the -% ImageLayerMethod specified) it discovers. +% LayerMethod specified) it discovers. % % Images do NOT have to be the same size, though it is best that all the % images are 'coalesced' (images are all the same size, on a flattened @@ -733,7 +733,7 @@ static RectangleInfo CompareImagesBounds(const Image *image1,const Image *image2 % The format of the CompareImagesLayers method is: % % Image *CompareImagesLayers(const Image *images, -% const ImageLayerMethod method,ExceptionInfo *exception) +% const LayerMethod method,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -747,7 +747,7 @@ static RectangleInfo CompareImagesBounds(const Image *image1,const Image *image2 */ MagickExport Image *CompareImagesLayers(const Image *image, - const ImageLayerMethod method, ExceptionInfo *exception) + const LayerMethod method, ExceptionInfo *exception) { Image *image_a, @@ -878,7 +878,7 @@ MagickExport Image *CompareImagesLayers(const Image *image, % The format of the OptimizeLayerFrames method is: % % Image *OptimizeLayerFrames(const Image *image, -% const ImageLayerMethod method, ExceptionInfo *exception) +% const LayerMethod method, ExceptionInfo *exception) % % A description of each parameter follows: % @@ -907,7 +907,7 @@ MagickExport Image *CompareImagesLayers(const Image *image, #define DEBUG_OPT_FRAME 0 static Image *OptimizeLayerFrames(const Image *image, - const ImageLayerMethod method, ExceptionInfo *exception) + const LayerMethod method, ExceptionInfo *exception) { ExceptionInfo *sans_exception; @@ -1852,7 +1852,7 @@ MagickExport void CompositeLayers(Image *destination, % MergeImageLayers() composes all the image layers from the current given % image onward to produce a single image of the merged layers. % -% The inital canvas's size depends on the given ImageLayerMethod, and is +% The inital canvas's size depends on the given LayerMethod, and is % initialized using the first images background color. The images % are then compositied onto that image in sequence using the given % composition that has been assigned to each individual image. @@ -1860,7 +1860,7 @@ MagickExport void CompositeLayers(Image *destination, % The format of the MergeImageLayers is: % % Image *MergeImageLayers(const Image *image, -% const ImageLayerMethod method, ExceptionInfo *exception) +% const LayerMethod method, ExceptionInfo *exception) % % A description of each parameter follows: % @@ -1891,7 +1891,7 @@ MagickExport void CompositeLayers(Image *destination, % o exception: return any errors or warnings in this structure. % */ -MagickExport Image *MergeImageLayers(Image *image,const ImageLayerMethod method, +MagickExport Image *MergeImageLayers(Image *image,const LayerMethod method, ExceptionInfo *exception) { #define MergeLayersTag "Merge/Layers" diff --git a/MagickCore/layer.h b/MagickCore/layer.h index 29413c88c..d19c74fac 100644 --- a/MagickCore/layer.h +++ b/MagickCore/layer.h @@ -52,13 +52,13 @@ typedef enum FlattenLayer, MosaicLayer, TrimBoundsLayer -} ImageLayerMethod; +} LayerMethod; extern MagickExport Image *CoalesceImages(const Image *,ExceptionInfo *), *DisposeImages(const Image *,ExceptionInfo *), - *CompareImagesLayers(const Image *,const ImageLayerMethod,ExceptionInfo *), - *MergeImageLayers(Image *,const ImageLayerMethod,ExceptionInfo *), + *CompareImagesLayers(const Image *,const LayerMethod,ExceptionInfo *), + *MergeImageLayers(Image *,const LayerMethod,ExceptionInfo *), *OptimizeImageLayers(const Image *,ExceptionInfo *), *OptimizePlusImageLayers(const Image *,ExceptionInfo *); diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 6f644a7ea..5b939b56c 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -1731,7 +1731,7 @@ WandExport MagickBooleanType MagickCommentImage(MagickWand *wand, % The format of the MagickCompareImagesLayers method is: % % MagickWand *MagickCompareImagesLayers(MagickWand *wand, -% const ImageLayerMethod method) +% const LayerMethod method) % % A description of each parameter follows: % @@ -1741,7 +1741,7 @@ WandExport MagickBooleanType MagickCommentImage(MagickWand *wand, % */ WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand, - const ImageLayerMethod method) + const LayerMethod method) { Image *layers_image; @@ -6562,7 +6562,7 @@ WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand) % MagickMergeImageLayers() composes all the image layers from the current % given image onward to produce a single image of the merged layers. % -% The inital canvas's size depends on the given ImageLayerMethod, and is +% The inital canvas's size depends on the given LayerMethod, and is % initialized using the first images background color. The images % are then compositied onto that image in sequence using the given % composition that has been assigned to each individual image. @@ -6570,7 +6570,7 @@ WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand) % The format of the MagickMergeImageLayers method is: % % MagickWand *MagickMergeImageLayers(MagickWand *wand, -% const ImageLayerMethod method) +% const LayerMethod method) % % A description of each parameter follows: % @@ -6592,7 +6592,7 @@ WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand) % */ WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand, - const ImageLayerMethod method) + const LayerMethod method) { Image *mosaic_image; diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h index fa4d79c7e..ab019002c 100644 --- a/MagickWand/magick-image.h +++ b/MagickWand/magick-image.h @@ -326,7 +326,7 @@ extern WandExport MagickWand *MagickCombineImages(MagickWand *,const ColorspaceType), *MagickCompareImages(MagickWand *,const MagickWand *,const MetricType, double *), - *MagickCompareImagesLayers(MagickWand *,const ImageLayerMethod), + *MagickCompareImagesLayers(MagickWand *,const LayerMethod), *MagickDeconstructImages(MagickWand *), *MagickEvaluateImages(MagickWand *,const MagickEvaluateOperator), *MagickFxImage(MagickWand *,const char *), @@ -334,7 +334,7 @@ extern WandExport MagickWand *MagickGetImageClipMask(MagickWand *), *MagickGetImageRegion(MagickWand *,const size_t,const size_t,const ssize_t, const ssize_t), - *MagickMergeImageLayers(MagickWand *,const ImageLayerMethod), + *MagickMergeImageLayers(MagickWand *,const LayerMethod), *MagickMorphImages(MagickWand *,const size_t), *MagickMontageImage(MagickWand *,const DrawingWand *,const char *, const char *,const MontageMode,const char *), diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 9eb8577c8..eafd86b86 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -7755,12 +7755,12 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info, Image *layers; - ImageLayerMethod + LayerMethod method; (void) SyncImagesSettings(mogrify_info,*images,exception); layers=(Image *) NULL; - method=(ImageLayerMethod) ParseCommandOption(MagickLayerOptions, + method=(LayerMethod) ParseCommandOption(MagickLayerOptions, MagickFalse,argv[i+1]); switch (method) { diff --git a/MagickWand/operation.c b/MagickWand/operation.c index d4ff50068..224cf486d 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -3906,7 +3906,7 @@ WandExport void CLIListOperatorImages(MagickCLI *cli_wand, if ( parse < 0 ) CLIWandExceptArgBreak(OptionError,"UnrecognizedLayerMethod", option,arg1); - switch ((ImageLayerMethod) parse) + switch ((LayerMethod) parse) { case CoalesceLayer: { @@ -3918,7 +3918,7 @@ WandExport void CLIListOperatorImages(MagickCLI *cli_wand, case CompareOverlayLayer: default: { - new_images=CompareImagesLayers(_images,(ImageLayerMethod) parse, + new_images=CompareImagesLayers(_images,(LayerMethod) parse, _exception); break; } @@ -3927,7 +3927,7 @@ WandExport void CLIListOperatorImages(MagickCLI *cli_wand, case MosaicLayer: case TrimBoundsLayer: { - new_images=MergeImageLayers(_images,(ImageLayerMethod) parse, + new_images=MergeImageLayers(_images,(LayerMethod) parse, _exception); break; } diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index b2a203b24..7f2935721 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -3444,7 +3444,7 @@ CompareLayers(ref) Image *image; - ImageLayerMethod + LayerMethod method; register ssize_t @@ -3505,7 +3505,7 @@ CompareLayers(ref) SvPV(ST(i),na)); break; } - method=(ImageLayerMethod) option; + method=(LayerMethod) option; break; } ThrowPerlException(exception,OptionError,"UnrecognizedAttribute", @@ -6786,7 +6786,7 @@ Layers(ref,...) *image, *layers; - ImageLayerMethod + LayerMethod method; register ssize_t @@ -6869,7 +6869,7 @@ Layers(ref,...) SvPV(ST(i),na)); break; } - method=(ImageLayerMethod) option; + method=(LayerMethod) option; break; } ThrowPerlException(exception,OptionError,"UnrecognizedAttribute", diff --git a/www/api/MagickCore/globals_0x69.html b/www/api/MagickCore/globals_0x69.html index 579cad698..07b4e1559 100644 --- a/www/api/MagickCore/globals_0x69.html +++ b/www/api/MagickCore/globals_0x69.html @@ -96,7 +96,7 @@ Here is a list of all functions, variables, defines, enums, and typedefs with li : magick-type.h
  • ImageInfoRegistryType : registry.h -
  • ImageLayerMethod +
  • LayerMethod : layer.h
  • ImageListToArray() : list.c diff --git a/www/api/MagickCore/globals_enum.html b/www/api/MagickCore/globals_enum.html index f9562a071..97999ebec 100644 --- a/www/api/MagickCore/globals_enum.html +++ b/www/api/MagickCore/globals_enum.html @@ -108,7 +108,7 @@ : geometry.h

    - i -