From acd0d4c147f40e88de332ff28d428a395628a9f4 Mon Sep 17 00:00:00 2001 From: cristy Date: Sat, 25 Jul 2015 16:12:33 +0000 Subject: [PATCH] --- Magick++/lib/Image.cpp | 5 +++-- Magick++/lib/Magick++/Include.h | 5 +++++ MagickCore/draw.c | 5 +++-- MagickCore/image.c | 38 ++++++++++++++++++++++++++------- MagickCore/image.h | 2 +- MagickWand/drawing-wand.c | 3 ++- MagickWand/magick-image.c | 8 ++++--- MagickWand/mogrify.c | 13 ++++++----- MagickWand/operation.c | 11 +++++----- coders/msl.c | 8 +++---- configure | 2 +- 11 files changed, 68 insertions(+), 32 deletions(-) diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 28bf6f083..4a257423b 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -1095,9 +1095,10 @@ void Magick::Image::mask(const Magick::Image &mask_) GetPPException; if (mask_.isValid()) - SetImageMask(image(),mask_.constImage(),exceptionInfo); + SetImageMask(image(),ReadPixelMask,mask_.constImage(),exceptionInfo); else - SetImageMask(image(),(MagickCore::Image *) NULL,exceptionInfo); + SetImageMask(image(),ReadPixelMask,(MagickCore::Image *) NULL, + exceptionInfo); ThrowImageException; } diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index 964d1f5e0..e6ff87824 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -968,6 +968,11 @@ namespace Magick using MagickCore::RGBAQuantum; using MagickCore::CMYKQuantum; + // Pixel mask types + using MagickCore::UndefinedPixelMask; + using MagickCore::ReadPixelMask; + using MagickCore::WritePixelMask; + // Rendering intents using MagickCore::RenderingIntent; using MagickCore::UndefinedIntent; diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 453fb3e45..f767820bd 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -1428,7 +1428,7 @@ MagickExport MagickBooleanType DrawClipPath(Image *image, exception); clone_info->clip_mask=(char *) NULL; status=NegateImage(clip_mask,MagickFalse,exception); - (void) SetImageMask(image,clip_mask,exception); + (void) SetImageMask(image,ReadPixelMask,clip_mask,exception); clip_mask=DestroyImage(clip_mask); status&=DrawImage(image,clone_info,exception); clone_info=DestroyDrawInfo(clone_info); @@ -2262,7 +2262,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (graphic_context[n]->clip_mask != (char *) NULL) if (LocaleCompare(graphic_context[n]->clip_mask, graphic_context[n-1]->clip_mask) != 0) - (void) SetImageMask(image,(Image *) NULL,exception); + (void) SetImageMask(image,ReadPixelMask,(Image *) NULL, + exception); graphic_context[n]=DestroyDrawInfo(graphic_context[n]); n--; break; diff --git a/MagickCore/image.c b/MagickCore/image.c index e5c4c40a8..8a205703e 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -747,7 +747,7 @@ MagickExport MagickBooleanType ClipImagePath(Image *image,const char *pathname, (void) NegateImage(clip_mask,MagickFalse,exception); (void) FormatLocaleString(clip_mask->magick_filename,MagickPathExtent, "8BIM:1999,2998:%s\nPS",pathname); - (void) SetImageMask(image,clip_mask,exception); + (void) SetImageMask(image,ReadPixelMask,clip_mask,exception); clip_mask=DestroyImage(clip_mask); return(MagickTrue); } @@ -2899,20 +2899,22 @@ MagickExport void SetImageInfoFile(ImageInfo *image_info,FILE *file) % % The format of the SetImageMask method is: % -% MagickBooleanType SetImageMask(Image *image,const Image *mask, -% ExceptionInfo *exception) +% MagickBooleanType SetImageMask(Image *image,const PixelMask type, +% const Image *mask,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % +% o type: the mask type, ReadPixelMask or WritePixelMask. +% % o mask: the image mask. % % o exception: return any errors or warnings in this structure. % */ -MagickExport MagickBooleanType SetImageMask(Image *image,const Image *mask, - ExceptionInfo *exception) +MagickExport MagickBooleanType SetImageMask(Image *image,const PixelMask type, + const Image *mask,ExceptionInfo *exception) { CacheView *mask_view, @@ -2933,10 +2935,18 @@ MagickExport MagickBooleanType SetImageMask(Image *image,const Image *mask, assert(image->signature == MagickCoreSignature); if (mask == (const Image *) NULL) { - image->read_mask=MagickFalse; + switch (type) + { + case WritePixelMask: image->write_mask=MagickFalse; break; + default: image->read_mask=MagickFalse; break; + } return(SyncImagePixelCache(image,exception)); } - image->read_mask=MagickTrue; + switch (type) + { + case WritePixelMask: image->write_mask=MagickTrue; break; + default: image->read_mask=MagickTrue; break; + } if (SyncImagePixelCache(image,exception) == MagickFalse) return(MagickFalse); status=MagickTrue; @@ -2968,7 +2978,19 @@ MagickExport MagickBooleanType SetImageMask(Image *image,const Image *mask, } for (x=0; x < (ssize_t) image->columns; x++) { - SetPixelReadMask(image,ClampToQuantum(GetPixelIntensity(mask,p)),q); + switch (type) + { + case WritePixelMask: + { + SetPixelWriteMask(image,ClampToQuantum(GetPixelIntensity(mask,p)),q); + break; + } + default: + { + SetPixelReadMask(image,ClampToQuantum(GetPixelIntensity(mask,p)),q); + break; + } + } p+=GetPixelChannels(mask); q+=GetPixelChannels(image); } diff --git a/MagickCore/image.h b/MagickCore/image.h index 6d13fc166..56b6f6851 100644 --- a/MagickCore/image.h +++ b/MagickCore/image.h @@ -546,7 +546,7 @@ extern MagickExport MagickBooleanType SetImageColor(Image *,const PixelInfo *,ExceptionInfo *), SetImageExtent(Image *,const size_t,const size_t,ExceptionInfo *), SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *), - SetImageMask(Image *,const Image *,ExceptionInfo *), + SetImageMask(Image *,const PixelMask type,const Image *,ExceptionInfo *), SetImageStorageClass(Image *,const ClassType,ExceptionInfo *), StripImage(Image *,ExceptionInfo *), SyncImage(Image *,ExceptionInfo *), diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c index b6d029a14..8becee05c 100644 --- a/MagickWand/drawing-wand.c +++ b/MagickWand/drawing-wand.c @@ -6822,7 +6822,8 @@ WandExport MagickBooleanType PopDrawingWand(DrawingWand *wand) if (CurrentContext->clip_mask != (char *) NULL) if (LocaleCompare(CurrentContext->clip_mask, wand->graphic_context[wand->index-1]->clip_mask) != 0) - (void) SetImageMask(wand->image,(Image *) NULL); + (void) SetImageMask(wand->image,ReadPixelMask,(Image *) NULL, + wand->exception); #endif CurrentContext=DestroyDrawInfo(CurrentContext); wand->index--; diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 10a0fb2cd..3480e4a69 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -9142,17 +9142,19 @@ WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand, % The format of the MagickSetImageMask method is: % % MagickBooleanType MagickSetImageMask(MagickWand *wand, -% const MagickWand *clip_mask) +% const PixelMask type,const MagickWand *clip_mask) % % A description of each parameter follows: % % o wand: the magick wand. % +% o type: type of mask, ReadPixelMask or WritePixelMask. +% % o clip_mask: the clip_mask wand. % */ WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand, - const MagickWand *clip_mask) + const PixelMask type,const MagickWand *clip_mask) { assert(wand != (MagickWand *) NULL); assert(wand->signature == MagickWandSignature); @@ -9164,7 +9166,7 @@ WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name); if (clip_mask->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",clip_mask->name); - return(SetImageMask(wand->images,clip_mask->images,wand->exception)); + return(SetImageMask(wand->images,type,clip_mask->images,wand->exception)); } /* diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 5a70a2cba..8003e154d 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -1057,7 +1057,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') { - (void) SetImageMask(*image,(Image *) NULL,exception); + (void) SetImageMask(*image,ReadPixelMask,(Image *) NULL, + exception); break; } (void) ClipImage(*image,exception); @@ -1086,7 +1087,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, /* Remove a mask. */ - (void) SetImageMask(*image,(Image *) NULL,exception); + (void) SetImageMask(*image,ReadPixelMask,(Image *) NULL, + exception); break; } /* @@ -1120,7 +1122,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, } mask_view=DestroyCacheView(mask_view); mask_image->alpha_trait=BlendPixelTrait; - (void) SetImageMask(*image,mask_image,exception); + (void) SetImageMask(*image,ReadPixelMask,mask_image,exception); break; } if (LocaleCompare("clip-path",option+1) == 0) @@ -2111,7 +2113,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, /* Remove a mask. */ - (void) SetImageMask(*image,(Image *) NULL,exception); + (void) SetImageMask(*image,ReadPixelMask,(Image *) NULL, + exception); break; } /* @@ -2120,7 +2123,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, mask=GetImageCache(mogrify_info,argv[i+1],exception); if (mask == (Image *) NULL) break; - (void) SetImageMask(*image,mask,exception); + (void) SetImageMask(*image,ReadPixelMask,mask,exception); mask=DestroyImage(mask); break; } diff --git a/MagickWand/operation.c b/MagickWand/operation.c index f2bfd74eb..76b3da60f 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -1986,7 +1986,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, if (IfNormalOp) (void) ClipImage(_image,_exception); else /* "+mask" remove the write mask */ - (void) SetImageMask(_image,(Image *) NULL,_exception); + (void) SetImageMask(_image,ReadPixelMask,(Image *) NULL,_exception); break; } if (LocaleCompare("clip-mask",option+1) == 0) @@ -2009,7 +2009,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, if (IfPlusOp) { /* use "+clip-mask" Remove the write mask for -clip-path */ - (void) SetImageMask(_image,(Image *) NULL,_exception); + (void) SetImageMask(_image,ReadPixelMask,(Image *) NULL,_exception); break; } mask_image=GetImageCache(_image_info,arg1,_exception); @@ -2041,7 +2041,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, mask_view=DestroyCacheView(mask_view); mask_image->alpha_trait=BlendPixelTrait; (void) SetImageColorspace(_image,GRAYColorspace,_exception); - (void) SetImageMask(_image,mask_image,_exception); + (void) SetImageMask(_image,ReadPixelMask,mask_image,_exception); mask_image=DestroyImage(mask_image); break; } @@ -2746,14 +2746,15 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, if (IfPlusOp) { /* Remove a mask. */ - (void) SetImageMask(_image,(Image *) NULL,_exception); + (void) SetImageMask(_image,ReadPixelMask,(Image *) NULL, + _exception); break; } /* Set the image mask. */ mask=GetImageCache(_image_info,arg1,_exception); if (mask == (Image *) NULL) break; - (void) SetImageMask(_image,mask,_exception); + (void) SetImageMask(_image,ReadPixelMask,mask,_exception); mask=DestroyImage(mask); break; } diff --git a/coders/msl.c b/coders/msl.c index a2fa2292b..6f024a52c 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -6021,8 +6021,8 @@ static void MSLStartElement(void *context,const xmlChar *tag, exception); if (LocaleCompare(property,value) == 0) { - SetImageMask(msl_info->image[n],msl_info->image[j], - exception); + SetImageMask(msl_info->image[n],ReadPixelMask, + msl_info->image[j],exception); break; } } @@ -6039,8 +6039,8 @@ static void MSLStartElement(void *context,const xmlChar *tag, exception); if (LocaleCompare(property,value) == 0) { - SetImageMask(msl_info->image[n],msl_info->image[j], - exception); + SetImageMask(msl_info->image[n],ReadPixelMask, + msl_info->image[j],exception); break; } } diff --git a/configure b/configure index 2c7af4043..de9474663 100755 --- a/configure +++ b/configure @@ -4379,7 +4379,7 @@ MAGICK_PATCHLEVEL_VERSION=0 MAGICK_VERSION=7.0.0-0 -MAGICK_SVN_REVISION=19161:19162 +MAGICK_SVN_REVISION=19272M # Substitute library versioning -- 2.50.0