From: cristy Date: Sat, 30 Mar 2013 21:53:44 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~3979 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7f8906ff9acc25015aa4cc7eea1bd840ed3264b;p=imagemagick --- diff --git a/coders/clip.c b/coders/clip.c index 36ae9aa6c..918878297 100644 --- a/coders/clip.c +++ b/coders/clip.c @@ -46,6 +46,7 @@ #include "MagickCore/constitute.h" #include "MagickCore/exception.h" #include "MagickCore/exception-private.h" +#include "MagickCore/list.h" #include "MagickCore/magick.h" #include "MagickCore/memory_.h" #include "MagickCore/monitor.h" @@ -66,6 +67,66 @@ static MagickBooleanType % % % % % % +% R e a d C L I P I m a g e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ReadCLIPImage returns the rendered clip path associated with the image. +% +% The format of the ReadCLIPImage method is: +% +% Image *ReadCLIPImage(const ImageInfo *image_info, +% ExceptionInfo *exception) +% +% A description of each parameter follows: +% +% o image_info: the image info. +% +% o exception: return any errors or warnings in this structure. +% +*/ +static Image *ReadCLIPImage(const ImageInfo *image_info, + ExceptionInfo *exception) +{ + Image + *clip_image, + *image; + + ImageInfo + *read_info; + + /* + Initialize Image structure. + */ + assert(image_info != (const ImageInfo *) NULL); + assert(image_info->signature == MagickSignature); + if (image_info->debug != MagickFalse) + (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", + image_info->filename); + assert(exception != (ExceptionInfo *) NULL); + assert(exception->signature == MagickSignature); + read_info=CloneImageInfo(image_info); + SetImageInfoBlob(read_info,(void *) NULL,0); + *read_info->magick='\0'; + clip_image=ReadImage(read_info,exception); + read_info=DestroyImageInfo(read_info); + if (clip_image == (Image *) NULL) + return((Image *) NULL); + (void) ClipImage(clip_image,exception); + image=GetImageMask(clip_image,exception); + clip_image=DestroyImage(clip_image); + if (image == (Image *) NULL) + ThrowReaderException(CoderError,"ImageDoesNotHaveAClipMask"); + return(GetFirstImageInList(image)); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % R e g i s t e r C L I P I m a g e % % % % % @@ -90,6 +151,7 @@ ModuleExport size_t RegisterCLIPImage(void) *entry; entry=SetMagickInfo("CLIP"); + entry->decoder=(DecodeImageHandler *) ReadCLIPImage; entry->encoder=(EncodeImageHandler *) WriteCLIPImage; entry->description=ConstantString("Image Clip Mask"); entry->module=ConstantString("CLIP");