From: cristy Date: Mon, 3 Oct 2011 14:00:35 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6911 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b817c3fdb805c4e9779bde89416297928a552fec;p=imagemagick --- diff --git a/MagickCore/fx.c b/MagickCore/fx.c index 20eef6582..114ac8410 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -742,8 +742,8 @@ MagickExport Image *ColorizeImage(const Image *image,const char *blend, /* Determine RGB values of the pen color. */ - flags=ParseGeometry(blend,&geometry_info); GetPixelInfo(image,&pixel); + flags=ParseGeometry(blend,&geometry_info); pixel.red=geometry_info.rho; pixel.green=geometry_info.rho; pixel.blue=geometry_info.rho; @@ -5097,21 +5097,21 @@ MagickExport Image *SwirlImage(const Image *image,double degrees, % % The format of the TintImage method is: % -% Image *TintImage(const Image *image,const char *opacity, +% Image *TintImage(const Image *image,const char *blend, % const PixelInfo *tint,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % -% o opacity: A color value used for tinting. +% o blend: A color value used for tinting. % % o tint: A color value used for tinting. % % o exception: return any errors or warnings in this structure. % */ -MagickExport Image *TintImage(const Image *image,const char *opacity, +MagickExport Image *TintImage(const Image *image,const char *blend, const PixelInfo *tint,ExceptionInfo *exception) { #define TintImageTag "Tint/Image" @@ -5168,26 +5168,25 @@ MagickExport Image *TintImage(const Image *image,const char *opacity, Determine RGB values of the color. */ GetPixelInfo(image,&pixel); - flags=ParseGeometry(opacity,&geometry_info); + flags=ParseGeometry(blend,&geometry_info); pixel.red=geometry_info.rho; pixel.green=geometry_info.rho; pixel.blue=geometry_info.rho; - pixel.black=geometry_info.rho; pixel.alpha=OpaqueAlpha; if ((flags & SigmaValue) != 0) pixel.green=geometry_info.sigma; if ((flags & XiValue) != 0) pixel.blue=geometry_info.xi; + if ((flags & PsiValue) != 0) + pixel.alpha=geometry_info.psi; if (image->colorspace == CMYKColorspace) { + pixel.black=geometry_info.rho; if ((flags & PsiValue) != 0) pixel.black=geometry_info.psi; if ((flags & ChiValue) != 0) pixel.alpha=geometry_info.chi; } - else - if ((flags & PsiValue) != 0) - pixel.alpha=geometry_info.psi; intensity=(MagickRealType) GetPixelInfoIntensity(tint); color_vector.red=(MagickRealType) (pixel.red*tint->red/100.0-intensity); color_vector.green=(MagickRealType) (pixel.green*tint->green/100.0-intensity); diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 9cfdd0b47..8050cc1ee 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -1457,9 +1457,6 @@ WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand, PixelInfo target; - Quantum - virtual_pixel[MaxPixelChannels]; - assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) @@ -1481,13 +1478,7 @@ WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand, PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale* PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale* PixelGetAlphaQuantum(blend))); - PixelGetQuantumPixel(wand->images,colorize,virtual_pixel); - GetPixelInfo(wand->images,&target); - target.red=virtual_pixel[RedPixelChannel]; - target.green=virtual_pixel[GreenPixelChannel]; - target.blue=virtual_pixel[BluePixelChannel]; - target.black=virtual_pixel[BlackPixelChannel]; - target.alpha=virtual_pixel[AlphaPixelChannel]; + target=PixelGetPixel(tint); colorize_image=ColorizeImage(wand->images,percent_blend,&target, wand->exception); if (colorize_image == (Image *) NULL) @@ -11281,7 +11272,7 @@ WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand, % The format of the MagickTintImage method is: % % MagickBooleanType MagickTintImage(MagickWand *wand, -% const PixelWand *tint,const PixelWand *alpha) +% const PixelWand *tint,const PixelWand *blend) % % A description of each parameter follows: % @@ -11293,10 +11284,10 @@ WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand, % */ WandExport MagickBooleanType MagickTintImage(MagickWand *wand, - const PixelWand *tint,const PixelWand *alpha) + const PixelWand *tint,const PixelWand *blend) { char - percent_opaque[MaxTextExtent]; + percent_blend[MaxTextExtent]; Image *tint_image; @@ -11311,22 +11302,22 @@ WandExport MagickBooleanType MagickTintImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); if (wand->images->colorspace != CMYKColorspace) - (void) FormatLocaleString(percent_opaque,MaxTextExtent, + (void) FormatLocaleString(percent_blend,MaxTextExtent, "%g,%g,%g,%g",(double) (100.0*QuantumScale* - PixelGetRedQuantum(alpha)),(double) (100.0*QuantumScale* - PixelGetGreenQuantum(alpha)),(double) (100.0*QuantumScale* - PixelGetBlueQuantum(alpha)),(double) (100.0*QuantumScale* - PixelGetAlphaQuantum(alpha))); + PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale* + PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale* + PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale* + PixelGetAlphaQuantum(blend))); else - (void) FormatLocaleString(percent_opaque,MaxTextExtent, + (void) FormatLocaleString(percent_blend,MaxTextExtent, "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale* - PixelGetCyanQuantum(alpha)),(double) (100.0*QuantumScale* - PixelGetMagentaQuantum(alpha)),(double) (100.0*QuantumScale* - PixelGetYellowQuantum(alpha)),(double) (100.0*QuantumScale* - PixelGetBlackQuantum(alpha)),(double) (100.0*QuantumScale* - PixelGetAlphaQuantum(alpha))); + PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale* + PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale* + PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale* + PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale* + PixelGetAlphaQuantum(blend))); target=PixelGetPixel(tint); - tint_image=TintImage(wand->images,percent_opaque,&target,wand->exception); + tint_image=TintImage(wand->images,percent_blend,&target,wand->exception); if (tint_image == (Image *) NULL) return(MagickFalse); ReplaceImageInList(&wand->images,tint_image); diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index 91b0400d1..c99ca4da4 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -428,7 +428,7 @@ static struct { "Thumbnail", { {"geometry", StringReference}, {"width", IntegerReference}, {"height", IntegerReference} } }, { "Strip", }, - { "Tint", { {"fill", StringReference}, {"opacity", StringReference} } }, + { "Tint", { {"fill", StringReference}, {"blend", StringReference} } }, { "Channel", { {"channel", MagickChannelOptions} } }, { "Splice", { {"geometry", StringReference}, {"width", IntegerReference}, {"height", IntegerReference}, {"x", IntegerReference},