From: dirk Date: Tue, 4 Nov 2014 19:47:44 +0000 (+0000) Subject: Changed signature of ConformPixelInfo. X-Git-Tag: 7.0.1-0~1789 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bfdd5bc06830778f14dfa0659b389ff630b7fbfe;p=imagemagick Changed signature of ConformPixelInfo. Added calls to ConformPixelInfo --- diff --git a/MagickCore/distort.c b/MagickCore/distort.c index 0e13c4b8b..d20ec57d7 100644 --- a/MagickCore/distort.c +++ b/MagickCore/distort.c @@ -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 */ diff --git a/MagickCore/image.c b/MagickCore/image.c index 4c6b25500..d38834344 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -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. */ diff --git a/MagickCore/paint.c b/MagickCore/paint.c index 9ce61d74e..b87686633 100644 --- a/MagickCore/paint.c +++ b/MagickCore/paint.c @@ -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. */ diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index a3be57ee7..b63dc888d 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -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); } diff --git a/MagickCore/pixel.h b/MagickCore/pixel.h index ad8cbbfe7..d42713610 100644 --- a/MagickCore/pixel.h +++ b/MagickCore/pixel.h @@ -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); diff --git a/coders/null.c b/coders/null.c index 34ebe4f85..6859c5e2a 100644 --- a/coders/null.c +++ b/coders/null.c @@ -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);