From 6a97fda8543a0e225b7fe937f3a4151a1bf5dcc0 Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 11 Oct 2009 20:42:55 +0000 Subject: [PATCH] --- wand/ChangeLog | 6 ++ wand/magick-property.c | 223 +++++++++++++++++++++++++++++++++++++++++ wand/magick-property.h | 6 +- 3 files changed, 234 insertions(+), 1 deletion(-) diff --git a/wand/ChangeLog b/wand/ChangeLog index f1c98dc77..dab8f2b60 100644 --- a/wand/ChangeLog +++ b/wand/ChangeLog @@ -1,3 +1,9 @@ +2009-10-10 6.5.6-10 Cristy + * Add MagickSetImageArtifact(), etc. Wand artifacts are like properties + except they are not exported. They are needed for some method such + as setting compose:args for the composite DisplaceCompositeOp compose + operator. + 2009-08-27 6.5.5-3 Cristy * Added MagickSetOpacity/MagickGetOpacity. diff --git a/wand/magick-property.c b/wand/magick-property.c index 720cbb217..e7601aa54 100644 --- a/wand/magick-property.c +++ b/wand/magick-property.c @@ -66,6 +66,47 @@ % % % % % % +% M a g i c k D e l e t e I m a g e A r t i f a c t % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickDeleteImageArtifact() deletes a wand artifact. +% +% The format of the MagickDeleteImageArtifact method is: +% +% MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand, +% const char *artifact) +% +% A description of each parameter follows: +% +% o image: the image. +% +% o artifact: the image artifact. +% +*/ +WandExport MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand, + const char *artifact) +{ + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + { + (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, + "ContainsNoImages","`%s'",wand->name); + return(MagickFalse); + } + return(DeleteImageArtifact(wand->images,artifact)); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k D e l e t e I m a g e P r o p e r t y % % % % % @@ -486,6 +527,143 @@ WandExport char *MagickGetHomeURL(void) % % % % % % +% M a g i c k G e t I m a g e A r t i f a c t % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickGetImageArtifact() returns a value associated with the specified +% artifact. Use MagickRelinquishMemory() to free the value when you are +% finished with it. +% +% The format of the MagickGetImageArtifact method is: +% +% char *MagickGetImageArtifact(MagickWand *wand,const char *artifact) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o artifact: the artifact. +% +*/ +WandExport char *MagickGetImageArtifact(MagickWand *wand,const char *artifact) +{ + const char + *value; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + { + (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, + "ContainsNoImages","`%s'",wand->name); + return((char *) NULL); + } + value=GetImageArtifact(wand->images,artifact); + if (value == (const char *) NULL) + return((char *) NULL); + return(ConstantString(value)); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% M a g i c k G e t I m a g e P r o p e r t i e s % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickGetImageArtifacts() returns all the artifact names that match the +% specified pattern associated with a wand. Use MagickGetImageProperty() to +% return the value of a particular artifact. Use MagickRelinquishMemory() to +% free the value when you are finished with it. +% +% The format of the MagickGetImageArtifacts method is: +% +% char *MagickGetImageArtifacts(MagickWand *wand, +% const char *pattern,unsigned long *number_artifacts) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o pattern: Specifies a pointer to a text string containing a pattern. +% +% o number_artifacts: the number artifacts associated with this wand. +% +*/ +WandExport char **MagickGetImageArtifacts(MagickWand *wand, + const char *pattern,unsigned long *number_artifacts) +{ + char + **artifacts; + + const char + *artifact; + + register long + i; + + size_t + length; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + { + (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, + "ContainsNoImages","`%s'",wand->name); + return((char **) NULL); + } + (void) GetImageProperty(wand->images,"exif:*"); + length=1024; + artifacts=(char **) AcquireQuantumMemory(length,sizeof(*artifacts)); + if (artifacts == (char **) NULL) + return((char **) NULL); + ResetImagePropertyIterator(wand->images); + artifact=GetNextImageProperty(wand->images); + for (i=0; artifact != (const char *) NULL; ) + { + if ((*artifact != '[') && + (GlobExpression(artifact,pattern,MagickFalse) != MagickFalse)) + { + if ((i+1) >= (long) length) + { + length<<=1; + artifacts=(char **) ResizeQuantumMemory(artifacts,length, + sizeof(*artifacts)); + if (artifacts == (char **) NULL) + { + (void) ThrowMagickException(wand->exception,GetMagickModule(), + ResourceLimitError,"MemoryAllocationFailed","`%s'", + wand->name); + return((char **) NULL); + } + } + artifacts[i]=ConstantString(artifact); + i++; + } + artifact=GetNextImageProperty(wand->images); + } + artifacts[i]=(char *) NULL; + *number_artifacts=(unsigned long) i; + return(artifacts); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k G e t I m a g e P r o f i l e % % % % % @@ -1989,6 +2167,51 @@ WandExport MagickBooleanType MagickSetGravity(MagickWand *wand, % % % % % % +% M a g i c k S e t I m a g e A r t i f r c t % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickSetImageArtifact() associates a artifact with an image. +% +% The format of the MagickSetImageArtifact method is: +% +% MagickBooleanType MagickSetImageArtifact(MagickWand *wand, +% const char *artifact,const char *value) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o artifact: the artifact. +% +% o value: the value. +% +*/ +WandExport MagickBooleanType MagickSetImageArtifact(MagickWand *wand, + const char *artifact,const char *value) +{ + MagickBooleanType + status; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + ThrowWandException(WandError,"ContainsNoImages",wand->name); + status=SetImageArtifact(wand->images,artifact,value); + if (status == MagickFalse) + InheritException(wand->exception,&wand->images->exception); + return(status); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k S e t P r o f i l e I m a g e % % % % % diff --git a/wand/magick-property.h b/wand/magick-property.h index 7d1ef4920..e626b5a3e 100644 --- a/wand/magick-property.h +++ b/wand/magick-property.h @@ -28,6 +28,8 @@ extern WandExport char *MagickGetFormat(MagickWand *), *MagickGetFont(MagickWand *), *MagickGetHomeURL(void), + *MagickGetImageArtifact(MagickWand *,const char *), + **MagickGetImageArtifacts(MagickWand *,const char *,unsigned long *), **MagickGetImageProfiles(MagickWand *,const char *,unsigned long *), *MagickGetImageProperty(MagickWand *,const char *), **MagickGetImageProperties(MagickWand *,const char *,unsigned long *), @@ -75,8 +77,9 @@ extern WandExport OrientationType MagickGetOrientation(MagickWand *); extern WandExport MagickBooleanType - MagickDeleteOption(MagickWand *,const char *), + MagickDeleteImageArtifact(MagickWand *,const char *), MagickDeleteImageProperty(MagickWand *,const char *), + MagickDeleteOption(MagickWand *,const char *), MagickGetAntialias(const MagickWand *), MagickGetPage(const MagickWand *,unsigned long *,unsigned long *,long *, long *), @@ -94,6 +97,7 @@ extern WandExport MagickBooleanType MagickSetFormat(MagickWand *,const char *), MagickSetFont(MagickWand *,const char *), MagickSetGravity(MagickWand *,const GravityType), + MagickSetImageArtifact(MagickWand *,const char *,const char *), MagickSetImageProfile(MagickWand *,const char *,const void *,const size_t), MagickSetImageProperty(MagickWand *,const char *,const char *), MagickSetInterlaceScheme(MagickWand *,const InterlaceType), -- 2.40.0