Changed signature of ConformPixelInfo.

Added calls to ConformPixelInfo
This commit is contained in:
dirk
2014-11-04 19:47:44 +00:00
parent 22007ae196
commit bfdd5bc068
6 changed files with 26 additions and 35 deletions
+2 -3
View File
@@ -2386,9 +2386,8 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method,
*/
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 */
+1 -9
View File
@@ -2083,15 +2083,7 @@ MagickExport MagickBooleanType SetImageBackgroundColor(Image *image,
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.
*/
+2 -7
View File
@@ -786,13 +786,8 @@ MagickExport MagickBooleanType OpaquePaintImage(Image *image,
(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.
*/
+19 -12
View File
@@ -199,38 +199,45 @@ MagickExport PixelInfo *ClonePixelInfo(const PixelInfo *pixel)
%
% 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);
}
+1 -1
View File
@@ -244,7 +244,7 @@ extern MagickExport MagickRealType
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);
+1 -3
View File
@@ -126,11 +126,9 @@ static Image *ReadNULLImage(const ImageInfo *image_info,
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);