*/
validity = 1.0;
- invalid=distort_image->matte_color;
- if (distort_image->colorspace == CMYKColorspace)
- ConvertRGBToCMYK(&invalid); /* what about other color spaces? */
+ ConformPixelInfo(distort_image,&distort_image->matte_color,&invalid,
+ exception);
for (i=0; i < (ssize_t) distort_image->columns; i++)
{
/* map pixel coordinate to distortion space coordinate */
assert(image->signature == MagickSignature);
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
- if ((IsPixelInfoGray(&image->background_color) == MagickFalse) &&
- (IsGrayColorspace(image->colorspace) != MagickFalse))
- (void) TransformImageColorspace(image,sRGBColorspace,exception);
- if ((image->background_color.alpha_trait == BlendPixelTrait) &&
- (image->alpha_trait != BlendPixelTrait))
- (void) SetImageAlpha(image,OpaqueAlpha,exception);
- background=image->background_color;
- if (image->colorspace == CMYKColorspace)
- ConvertRGBToCMYK(&background);
+ ConformPixelInfo(image,&image->background_color,&background,exception);
/*
Set image background color.
*/
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
- if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
- (IsPixelInfoGray(fill) == MagickFalse))
- (void) SetImageColorspace(image,sRGBColorspace,exception);
- conform_fill=(*fill);
- ConformPixelInfo(image,&conform_fill,exception);
- conform_target=(*target);
- ConformPixelInfo(image,&conform_target,exception);
+ ConformPixelInfo(image,fill,&conform_fill,exception);
+ ConformPixelInfo(image,target,&conform_target,exception);
/*
Make image color opaque.
*/
%
% A description of each parameter follows:
%
-% o pixel: the pixel info.
-%
% o image: the image.
%
+% o source: the source pixel info.
+%
+% o destination: the destination pixel info.
+%
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport void ConformPixelInfo(Image *image,PixelInfo *pixel,
- ExceptionInfo *exception)
+MagickExport void ConformPixelInfo(Image *image,const PixelInfo *source,
+ PixelInfo *destination,ExceptionInfo *exception)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
- assert(pixel != (const PixelInfo *) NULL);
+ assert(destination != (const PixelInfo *) NULL);
+ *destination=(*source);
if (image->colorspace == CMYKColorspace)
{
- if (IssRGBCompatibleColorspace(pixel->colorspace))
- ConvertRGBToCMYK(pixel);
+ if (IssRGBCompatibleColorspace(destination->colorspace))
+ ConvertRGBToCMYK(destination);
}
else
- if (pixel->colorspace == CMYKColorspace)
+ if (destination->colorspace == CMYKColorspace)
{
if (IssRGBCompatibleColorspace(image->colorspace))
- ConvertCMYKToRGB(pixel);
+ ConvertCMYKToRGB(destination);
}
#if 0
if ((IsGrayColorspace(image->colorspace) != MagickFalse) &&
- (IsPixelInfoGray(pixel) == MagickFalse))
+ (IsPixelInfoGray(destination) == MagickFalse))
/* TODO: Add this method. */
- SetPixelInfoGray(pixel);
+ SetPixelInfoGray(destination);
+#else
+ if ((IsPixelInfoGray(&image->background_color) == MagickFalse) &&
+ (IsGrayColorspace(image->colorspace) != MagickFalse))
+ (void) TransformImageColorspace(image,sRGBColorspace,exception);
#endif
- if ((pixel->alpha_trait == BlendPixelTrait) &&
+ if ((destination->alpha_trait == BlendPixelTrait) &&
(image->alpha_trait != BlendPixelTrait))
(void) SetImageAlpha(image,OpaqueAlpha,exception);
}
EncodePixelGamma(const MagickRealType) magick_hot_spot;
extern MagickExport void
- ConformPixelInfo(Image *,PixelInfo *,ExceptionInfo *),
+ ConformPixelInfo(Image *,const PixelInfo *,PixelInfo *,ExceptionInfo *),
GetPixelInfo(const Image *,PixelInfo *),
InitializePixelChannelMap(Image *),
SetPixelChannelMask(Image *,const ChannelType);
image->columns=1;
if (image->rows == 0)
image->rows=1;
+ ConformPixelInfo(image,&image->background_color,&background,exception);
image->alpha_trait=BlendPixelTrait;
- GetPixelInfo(image,&background);
background.alpha=(double) TransparentAlpha;
- if (image->colorspace == CMYKColorspace)
- ConvertRGBToCMYK(&background);
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);