Anthony).
* Register / unregister CALS format in static.c (reference
http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=16103).
+ * Add SetImageColor() method.
2010-04-17 6.6.1-5 Cristy <quetzlzacatenango@image...>
* Only write one ICC profile to PSD image.
{"channel", MagickChannelOptions}, {"method", MagickMorphologyOptions},
{"iterations", IntegerReference} } },
{ "ColorMatrix", { {"matrix", ArrayReference} } },
+ { "Color", { {"color", StringReference} } }
};
static SplayTreeInfo
MorphologyImage = 266
ColorMatrix = 267
ColorMatrixImage = 268
+ Color = 269
+ ColorImage = 270
MogrifyRegion = 666
PPCODE:
{
color_matrix=(double *) RelinquishMagickMemory(color_matrix);
break;
}
+ case 135: /* Color */
+ {
+ MagickPixelPacket
+ color;
+
+ (void) QueryMagickColor("none",&color,exception);
+ if (attribute_flag[0] != 0)
+ (void) QueryMagickColor(argument_list[0].string_reference,
+ &color,exception);
+ (void) SetImageColor(image,&color);
+ break;
+ }
}
if (next != (Image *) NULL)
(void) CatchImageException(next);
% %
% %
% %
+% S e t I m a g e C o l o r %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% SetImageColor() set the entire image canvas to the specified color.
+%
+% The format of the SetImageColor method is:
+%
+% MagickBooleanType SetImageColor(Image *image,
+% const MagickPixelPacket *color)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o background: the image color.
+%
+*/
+MagickExport MagickBooleanType SetImageColor(Image *image,
+ const MagickPixelPacket *color)
+{
+ CacheView
+ *image_view;
+
+ ExceptionInfo
+ *exception;
+
+ long
+ y;
+
+ MagickBooleanType
+ status;
+
+ assert(image != (Image *) NULL);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
+ assert(image->signature == MagickSignature);
+ assert(color != (const MagickPixelPacket *) NULL);
+ image->colorspace=color->colorspace;
+ image->matte=color->matte;
+ image->fuzz=color->fuzz;
+ image->depth=color->depth;
+ status=MagickTrue;
+ exception=(&image->exception);
+ image_view=AcquireCacheView(image);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(dynamic,4) shared(status)
+#endif
+ for (y=0; y < (long) image->rows; y++)
+ {
+ register IndexPacket
+ *restrict indexes;
+
+ register long
+ x;
+
+ register PixelPacket
+ *restrict q;
+
+ if (status == MagickFalse)
+ continue;
+ q=QueueCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
+ if (q == (PixelPacket *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ indexes=GetCacheViewAuthenticIndexQueue(image_view);
+ for (x=0; x < (long) image->columns; x++)
+ {
+ SetPixelPacket(image,color,q,indexes+x);
+ q++;
+ }
+ if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ status=MagickFalse;
+ }
+ image_view=DestroyCacheView(image_view);
+ return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% S e t I m a g e S t o r a g e C l a s s %
% %
% %
SetImageAlphaChannel(Image *,const AlphaChannelType),
SetImageBackgroundColor(Image *),
SetImageClipMask(Image *,const Image *),
+ SetImageColor(Image *,const MagickPixelPacket *),
SetImageExtent(Image *,const unsigned long,const unsigned long),
SetImageInfo(ImageInfo *,const unsigned int,ExceptionInfo *),
SetImageMask(Image *,const Image *),
% %
% %
% %
+% M a g i c k S e t I m a g e C o l o r %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MagickSetImageColor() set the entire wand canvas to the specified color.
+%
+% The format of the MagickSetImageColor method is:
+%
+% MagickBooleanType MagickSetImageColor(MagickWand *wand,
+% const PixelWand *color)
+%
+% A description of each parameter follows:
+%
+% o wand: the magick wand.
+%
+% o background: the image color.
+%
+*/
+WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
+ const PixelWand *color)
+{
+ MagickBooleanType
+ status;
+
+ MagickPixelPacket
+ pixel;
+
+ assert(wand != (MagickWand *) NULL);
+ assert(wand->signature == WandSignature);
+ if (wand->debug != MagickFalse)
+ (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+ PixelGetMagickColor(color,&pixel);
+ status=SetImageColor(wand->images,&pixel);
+ if (status == MagickFalse)
+ InheritException(wand->exception,&wand->images->exception);
+ return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% M a g i c k S e t I m a g e C o l o r m a p C o l o r %
% %
% %
MagickSetImageChannelDepth(MagickWand *,const ChannelType,
const unsigned long),
MagickSetImageClipMask(MagickWand *,const MagickWand *),
+ MagickSetImageColor(MagickWand *,const PixelWand *),
MagickSetImageColormapColor(MagickWand *,const unsigned long,
const PixelWand *),
MagickSetImageColorspace(MagickWand *,const ColorspaceType),