"Pen color argument is invalid");
}
- char alpha[MaxTextExtent];
- FormatLocaleString(alpha,MaxTextExtent,"%u/%u/%u",alphaRed_,alphaGreen_,alphaBlue_);
+ char blend[MaxTextExtent];
+ FormatLocaleString(blend,MaxTextExtent,"%u/%u/%u",alphaRed_,alphaGreen_,alphaBlue_);
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
+ PixelInfo target;
+ GetPixelInfo(image(),&target);
+ PixelPacket pixel=static_cast<PixelPacket>(penColor_);
+ target.red=pixel.red;
+ target.green=pixel.green;
+ target.blue=pixel.blue;
+ target.alpha=pixel.alpha;
MagickCore::Image* newImage =
- ColorizeImage ( image(), alpha,
- penColor_, &exceptionInfo );
+ ColorizeImage ( image(), blend, &target, &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
%
*/
MagickExport MagickBooleanType QueryMagickColorCompliance(const char *name,
- const ComplianceType compliance,PixelInfo *color,
- ExceptionInfo *exception)
+ const ComplianceType compliance,PixelInfo *color,ExceptionInfo *exception)
{
GeometryInfo
geometry_info;
%
% The format of the ColorizeImage method is:
%
-% Image *ColorizeImage(const Image *image,const char *opacity,
-% const PixelPacket colorize,ExceptionInfo *exception)
+% Image *ColorizeImage(const Image *image,const char *blend,
+% const PixelInfo *colorize,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
-% o opacity: A character string indicating the level of opacity as a
+% o blend: A character string indicating the level of blending as a
% percentage.
%
% o colorize: A color value.
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *ColorizeImage(const Image *image,const char *opacity,
- const PixelPacket colorize,ExceptionInfo *exception)
+MagickExport Image *ColorizeImage(const Image *image,const char *blend,
+ const PixelInfo *colorize,ExceptionInfo *exception)
{
#define ColorizeImageTag "Colorize/Image"
MagickOffsetType
progress;
- PixelInfo
- pixel;
-
MagickStatusType
flags;
+ PixelInfo
+ pixel;
+
ssize_t
y;
colorize_image=DestroyImage(colorize_image);
return((Image *) NULL);
}
- if (opacity == (const char *) NULL)
+ if (blend == (const char *) NULL)
return(colorize_image);
/*
Determine RGB values of the pen color.
*/
- flags=ParseGeometry(opacity,&geometry_info);
+ flags=ParseGeometry(blend,&geometry_info);
+ GetPixelInfo(image,&pixel);
pixel.red=geometry_info.rho;
pixel.green=geometry_info.rho;
pixel.blue=geometry_info.rho;
- pixel.alpha=(MagickRealType) OpaqueAlpha;
+ pixel.alpha=100.0;
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 (pixel.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;
+ }
/*
Colorize DirectClass image.
*/
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- SetPixelRed(colorize_image,ClampToQuantum((GetPixelRed(image,p)*
- (100.0-pixel.red)+colorize.red*pixel.red)/100.0),q);
- SetPixelGreen(colorize_image,ClampToQuantum((GetPixelGreen(image,p)*
- (100.0-pixel.green)+colorize.green*pixel.green)/100.0),q);
- SetPixelBlue(colorize_image,ClampToQuantum((GetPixelBlue(image,p)*
- (100.0-pixel.blue)+colorize.blue*pixel.blue)/100.0),q);
- SetPixelAlpha(colorize_image,ClampToQuantum((GetPixelAlpha(image,p)*
- (100.0-pixel.alpha)+colorize.alpha*pixel.alpha)/100.0),q);
+ register ssize_t
+ i;
+
+ for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+ {
+ PixelChannel
+ channel;
+
+ PixelTrait
+ colorize_traits,
+ traits;
+
+ traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+ colorize_traits=GetPixelChannelMapTraits(colorize_image,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (colorize_traits == UndefinedPixelTrait))
+ continue;
+ if ((colorize_traits & CopyPixelTrait) != 0)
+ {
+ SetPixelChannel(colorize_image,channel,p[i],q);
+ continue;
+ }
+ switch (channel)
+ {
+ case RedPixelChannel:
+ {
+ SetPixelChannel(colorize_image,channel,ClampToQuantum((p[i]*
+ (100.0-pixel.red)+colorize->red*pixel.red)/100.0),q);
+ break;
+ }
+ case GreenPixelChannel:
+ {
+ SetPixelChannel(colorize_image,channel,ClampToQuantum((p[i]*
+ (100.0-pixel.green)+colorize->green*pixel.green)/100.0),q);
+ break;
+ }
+ case BluePixelChannel:
+ {
+ SetPixelChannel(colorize_image,channel,ClampToQuantum((p[i]*
+ (100.0-pixel.blue)+colorize->blue*pixel.blue)/100.0),q);
+ break;
+ }
+ case BlackPixelChannel:
+ {
+ SetPixelChannel(colorize_image,channel,ClampToQuantum((p[i]*
+ (100.0-pixel.black)+colorize->black*pixel.black)/100.0),q);
+ break;
+ }
+ case AlphaPixelChannel:
+ {
+ SetPixelChannel(colorize_image,channel,ClampToQuantum((p[i]*
+ (100.0-pixel.alpha)+colorize->alpha*pixel.alpha)/100.0),q);
+ break;
+ }
+ default:
+ {
+ SetPixelChannel(colorize_image,channel,p[i],q);
+ break;
+ }
+ }
+ }
p+=GetPixelChannels(image);
q+=GetPixelChannels(colorize_image);
}
*BlueShiftImage(const Image *,const double,ExceptionInfo *),
*CharcoalImage(const Image *,const double,const double,const double,
ExceptionInfo *),
- *ColorizeImage(const Image *,const char *,const PixelPacket,ExceptionInfo *),
+ *ColorizeImage(const Image *,const char *,const PixelInfo *,ExceptionInfo *),
*ColorMatrixImage(const Image *,const KernelInfo *kernel,ExceptionInfo *),
*FxImage(const Image *,const char *,ExceptionInfo *),
*ImplodeImage(const Image *,const double,const PixelInterpolateMethod,
#endif
/* Define if you have the <lcms2.h> header file. */
-/* #undef HAVE_LCMS2_H */
+#ifndef MAGICKCORE_HAVE_LCMS2_H
+#define MAGICKCORE_HAVE_LCMS2_H 1
+#endif
/* Define if you have the <lcms2/lcms2.h> header file. */
/* #undef HAVE_LCMS2_LCMS2_H */
/* Define if you have the <lcms.h> header file. */
-#ifndef MAGICKCORE_HAVE_LCMS_H
-#define MAGICKCORE_HAVE_LCMS_H 1
-#endif
+/* #undef HAVE_LCMS_H */
/* Define if you have the <lcms/lcms.h> header file. */
/* #undef HAVE_LCMS_LCMS_H */
#endif
/* Define if you have JBIG library */
-#ifndef MAGICKCORE_JBIG_DELEGATE
-#define MAGICKCORE_JBIG_DELEGATE 1
-#endif
+/* #undef JBIG_DELEGATE */
/* Define if you have JPEG version 2 "Jasper" library */
#ifndef MAGICKCORE_JP2_DELEGATE
#endif
/* Define if you have LQR library */
-#ifndef MAGICKCORE_LQR_DELEGATE
-#define MAGICKCORE_LQR_DELEGATE 1
-#endif
+/* #undef LQR_DELEGATE */
/* Define if using libltdl to support dynamically loadable modules */
#ifndef MAGICKCORE_LTDL_DELEGATE
/* Define to the system default library search path. */
#ifndef MAGICKCORE_LT_DLSEARCH_PATH
-#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/R/lib:/usr/lib64/atlas:/opt/modules/pkg/intel/f77/10.0.025/lib:/opt/intel/lib/intel64:/usr/lib64/llvm:/usr/local/lib:/usr/lib64/mysql:/usr/lib64/nvidia:/usr/lib64/qt-3.3/lib:/usr/lib64/xulrunner-2"
+#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/R/lib:/usr/lib64/alliance/lib:/usr/lib64/atlas:/opt/modules/pkg/intel/f77/10.0.025/lib:/usr/lib64/kicad:/usr/lib/llvm:/usr/lib64/llvm:/usr/local/lib:/usr/lib64/mpich2/lib/:/usr/lib64/mysql:/usr/lib64/nvidia:/usr/lib64/octave/3.4.2:/usr/lib64/openmotif:/usr/lib64/qt-3.3/lib:/usr/lib64/tcl8.5/tclx8.4:/usr/lib/wine/:/usr/lib64/wine/:/usr/lib64/xulrunner-2"
#endif
/* The archive extension */
/* Define if you have WEBP library */
-#ifndef MAGICKCORE_WEBP_DELEGATE
-#define MAGICKCORE_WEBP_DELEGATE 1
-#endif
+/* #undef WEBP_DELEGATE */
/* Define to use the Windows GDI32 library */
/* #undef WINGDI32_DELEGATE */
#define MagickLibAddendum "-0"
#define MagickLibInterface 7
#define MagickLibMinInterface 7
-#define MagickReleaseDate "2011-10-02"
+#define MagickReleaseDate "2011-10-03"
#define MagickChangeDate "20110801"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
#if defined(MAGICKCORE_OPENMP_SUPPORT)
% The format of the MagickColorizeImage method is:
%
% MagickBooleanType MagickColorizeImage(MagickWand *wand,
-% const PixelWand *colorize,const PixelWand *alpha)
+% const PixelWand *colorize,const PixelWand *blend)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
- const PixelWand *colorize,const PixelWand *alpha)
+ const PixelWand *colorize,const PixelWand *blend)
{
char
- percent_opaque[MaxTextExtent];
+ percent_blend[MaxTextExtent];
Image
*colorize_image;
- PixelPacket
+ PixelInfo
target;
+ Quantum
+ virtual_pixel[MaxPixelChannels];
+
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);
- (void) FormatLocaleString(percent_opaque,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)));
- PixelGetQuantumPacket(colorize,&target);
- colorize_image=ColorizeImage(wand->images,percent_opaque,target,
+ if (target.colorspace != CMYKColorspace)
+ (void) FormatLocaleString(percent_blend,MaxTextExtent,
+ "%g,%g,%g,%g",(double) (100.0*QuantumScale*
+ PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
+ PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
+ PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
+ PixelGetAlphaQuantum(blend)));
+ else
+ (void) FormatLocaleString(percent_blend,MaxTextExtent,
+ "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
+ PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
+ PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
+ 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];
+ colorize_image=ColorizeImage(wand->images,percent_blend,&target,
wand->exception);
if (colorize_image == (Image *) NULL)
return(MagickFalse);
Colorize the image.
*/
(void) SyncImageSettings(mogrify_info,*image);
- mogrify_image=ColorizeImage(*image,argv[i+1],draw_info->fill,
- exception);
+ mogrify_image=ColorizeImage(*image,argv[i+1],&fill,exception);
break;
}
if (LocaleCompare("color-matrix",option+1) == 0)
{ "Label", { {"label", StringReference} } },
{ "AddNoise", { {"noise", MagickNoiseOptions},
{"channel", MagickChannelOptions} } },
- { "Colorize", { {"fill", StringReference}, {"opacity", StringReference} } },
+ { "Colorize", { {"fill", StringReference}, {"blend", StringReference} } },
{ "Border", { {"geometry", StringReference}, {"width", IntegerReference},
{"height", IntegerReference}, {"fill", StringReference},
{"bordercolor", StringReference}, {"color", StringReference},
}
case 4: /* Colorize */
{
- PixelPacket
+ PixelInfo
target;
Quantum
virtual_pixel[MaxPixelChannels];
+ GetPixelInfo(image,&target);
(void) GetOneVirtualPixel(image,0,0,virtual_pixel,exception);
target.red=virtual_pixel[RedPixelChannel];
target.green=virtual_pixel[GreenPixelChannel];
AllCompliance,&target,exception);
if (attribute_flag[1] == 0)
argument_list[1].string_reference="100%";
- image=ColorizeImage(image,argument_list[1].string_reference,target,
+ image=ColorizeImage(image,argument_list[1].string_reference,&target,
exception);
break;
}
if (LocaleCompare((const char *) tag,"colorize") == 0)
{
char
- opacity[MaxTextExtent];
+ blend[MaxTextExtent];
Image
*colorize_image;
- PixelPacket
+ PixelInfo
target;
/*
(const char *) tag);
break;
}
- target=msl_info->image[n]->background_color;
- (void) CopyMagickString(opacity,"100",MaxTextExtent);
+ GetPixelInfo(msl_info->image[n],&target);
+ (void) CopyMagickString(blend,"100",MaxTextExtent);
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
{
CloneString(&value,attribute);
switch (*keyword)
{
- case 'F':
- case 'f':
+ case 'B':
+ case 'b':
{
- if (LocaleCompare(keyword,"fill") == 0)
+ if (LocaleCompare(keyword,"blend") == 0)
{
- (void) QueryColorCompliance(value,AllCompliance,&target,
- &msl_info->image[n]->exception);
+ (void) CopyMagickString(blend,value,MaxTextExtent);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
keyword);
break;
}
- case 'O':
- case 'o':
+ case 'F':
+ case 'f':
{
- if (LocaleCompare(keyword,"opacity") == 0)
+ if (LocaleCompare(keyword,"fill") == 0)
{
- (void) CopyMagickString(opacity,value,MaxTextExtent);
+ (void) QueryMagickColorCompliance(value,AllCompliance,
+ &target,&msl_info->image[n]->exception);
break;
}
ThrowMSLException(OptionError,"UnrecognizedAttribute",
}
}
}
- colorize_image=ColorizeImage(msl_info->image[n],opacity,target,
+ colorize_image=ColorizeImage(msl_info->image[n],blend,&target,
&msl_info->image[n]->exception);
if (colorize_image == (Image *) NULL)
break;