From f191883e890adb7dd1d5d42a537026fd9b08b575 Mon Sep 17 00:00:00 2001 From: cristy Date: Tue, 25 Oct 2011 11:40:59 +0000 Subject: [PATCH] --- MagickCore/decorate.c | 25 +++++++++++++------------ MagickCore/distort.c | 5 ++++- MagickCore/histogram.c | 8 ++++---- MagickCore/identify.c | 2 +- MagickCore/image.c | 17 ++++++++++++++--- MagickCore/magick-config.h | 22 ++++++++++------------ MagickCore/paint.c | 6 +++--- MagickCore/pixel-accessor.h | 13 +++++++++++++ MagickCore/shear.c | 6 ++++-- MagickWand/drawing-wand.c | 14 +++++++------- MagickWand/mogrify.c | 2 +- coders/avs.c | 2 +- coders/palm.c | 3 ++- 13 files changed, 77 insertions(+), 48 deletions(-) diff --git a/MagickCore/decorate.c b/MagickCore/decorate.c index 4771b9ea0..6f12c2c66 100644 --- a/MagickCore/decorate.c +++ b/MagickCore/decorate.c @@ -185,6 +185,7 @@ MagickExport Image *FrameImage(const Image *image,const FrameInfo *frame_info, PixelInfo accentuate, + border, highlight, interior, matte, @@ -240,39 +241,39 @@ MagickExport Image *FrameImage(const Image *image,const FrameInfo *frame_info, /* Initialize 3D effects color. */ - interior=image->border_color; - matte=image->matte_color; - accentuate=matte; + GetPixelInfo(frame_image,&interior); + SetPixelInfoPacket(frame_image,&image->border_color,&interior); + GetPixelInfo(frame_image,&matte); + matte.colorspace=RGBColorspace; + SetPixelInfoPacket(frame_image,&image->matte_color,&matte); + GetPixelInfo(frame_image,&border); + border.colorspace=RGBColorspace; + SetPixelInfoPacket(frame_image,&image->border_color,&border); + GetPixelInfo(frame_image,&accentuate); accentuate.red=(MagickRealType) (QuantumScale*((QuantumRange- AccentuateModulate)*matte.red+(QuantumRange*AccentuateModulate))); accentuate.green=(MagickRealType) (QuantumScale*((QuantumRange- AccentuateModulate)*matte.green+(QuantumRange*AccentuateModulate))); accentuate.blue=(MagickRealType) (QuantumScale*((QuantumRange- AccentuateModulate)*matte.blue+(QuantumRange*AccentuateModulate))); - accentuate.black=(MagickRealType) (QuantumScale*((QuantumRange- - AccentuateModulate)*matte.black+(QuantumRange*AccentuateModulate))); accentuate.alpha=matte.alpha; - highlight=matte; + GetPixelInfo(frame_image,&highlight); highlight.red=(MagickRealType) (QuantumScale*((QuantumRange- HighlightModulate)*matte.red+(QuantumRange*HighlightModulate))); highlight.green=(MagickRealType) (QuantumScale*((QuantumRange- HighlightModulate)*matte.green+(QuantumRange*HighlightModulate))); highlight.blue=(MagickRealType) (QuantumScale*((QuantumRange- HighlightModulate)*matte.blue+(QuantumRange*HighlightModulate))); - highlight.black=(MagickRealType) (QuantumScale*((QuantumRange- - HighlightModulate)*matte.black+(QuantumRange*HighlightModulate))); highlight.alpha=matte.alpha; - shadow=matte; + GetPixelInfo(frame_image,&shadow); shadow.red=QuantumScale*matte.red*ShadowModulate; shadow.green=QuantumScale*matte.green*ShadowModulate; shadow.blue=QuantumScale*matte.blue*ShadowModulate; - shadow.black=QuantumScale*matte.black*ShadowModulate; shadow.alpha=matte.alpha; - trough=matte; + GetPixelInfo(frame_image,&trough); trough.red=QuantumScale*matte.red*TroughModulate; trough.green=QuantumScale*matte.green*TroughModulate; trough.blue=QuantumScale*matte.blue*TroughModulate; - trough.black=QuantumScale*matte.black*TroughModulate; trough.alpha=matte.alpha; status=MagickTrue; progress=0; diff --git a/MagickCore/distort.c b/MagickCore/distort.c index 5d1be362d..b934e1b7c 100644 --- a/MagickCore/distort.c +++ b/MagickCore/distort.c @@ -2311,7 +2311,10 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method, */ validity = 1.0; - invalid=distort_image->matte_color; + GetPixelInfo(distort_image,&invalid); + SetPixelInfoPacket(distort_image,&distort_image->matte_color,&invalid); + if (distort_image->colorspace == CMYKColorspace) + ConvertRGBToCMYK(&invalid); /* what about other color spaces? */ for (i=0; i < (ssize_t) distort_image->columns; i++) { /* map pixel coordinate to distortion space coordinate */ diff --git a/MagickCore/histogram.c b/MagickCore/histogram.c index 816268bdb..af17ac290 100644 --- a/MagickCore/histogram.c +++ b/MagickCore/histogram.c @@ -257,7 +257,7 @@ static CubeInfo *ClassifyImageColors(const Image *image, } for (i=0; i < (ssize_t) node_info->number_unique; i++) { - target=node_info->list[i]; + SetPixelInfoPacket(image,&node_info->list[i],&target); if (IsPixelInfoEquivalent(&pixel,&target) != MagickFalse) break; } @@ -725,7 +725,7 @@ MagickExport MagickBooleanType IsHistogramImage(const Image *image, break; for (i=0; i < (ssize_t) node_info->number_unique; i++) { - target=node_info->list[i]; + SetPixelInfoPacket(image,&node_info->list[i],&target); if (IsPixelInfoEquivalent(&pixel,&target) != MagickFalse) break; } @@ -885,7 +885,7 @@ MagickExport MagickBooleanType IsPaletteImage(const Image *image, break; for (i=0; i < (ssize_t) node_info->number_unique; i++) { - target=node_info->list[i]; + SetPixelInfoPacket(image,&node_info->list[i],&target); if (IsPixelInfoEquivalent(&pixel,&target) != MagickFalse) break; } @@ -1134,7 +1134,7 @@ MagickExport size_t GetNumberColors(const Image *image,FILE *file, status=MagickTrue; for (i=0; i < (ssize_t) number_colors; i++) { - pixel=(*p); + SetPixelInfoPacket(image,p,&pixel); (void) CopyMagickString(tuple,"(",MaxTextExtent); ConcatenateColorComponent(&pixel,RedPixelChannel,X11Compliance,tuple); (void) ConcatenateMagickString(tuple,",",MaxTextExtent); diff --git a/MagickCore/identify.c b/MagickCore/identify.c index d6d7501d8..ba1c16def 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -647,7 +647,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, p=image->colormap; for (i=0; i < (ssize_t) image->colors; i++) { - pixel=(*p); + SetPixelInfoPacket(image,p,&pixel); (void) CopyMagickString(tuple,"(",MaxTextExtent); ConcatenateColorComponent(&pixel,RedPixelChannel,X11Compliance, tuple); diff --git a/MagickCore/image.c b/MagickCore/image.c index 742d48058..c31f1a363 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -2433,6 +2433,9 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, PixelInfo background; + PixelInfo + pixel; + ssize_t y; @@ -2443,7 +2446,9 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, break; if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) break; - background=image->background_color; + GetPixelInfo(image,&background); + SetPixelInfoPacket(image,&image->background_color,&background); + SetPacketPixelInfo(image,&background,&pixel); image_view=AcquireCacheView(image); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(dynamic,4) shared(status) @@ -2501,7 +2506,8 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, /* Reset all color channels to background color. */ - background=image->background_color; + GetPixelInfo(image,&background); + SetPixelInfoPacket(image,&(image->background_color),&background); (void) LevelImageColors(image,&background,&background,MagickTrue, exception); } @@ -2583,6 +2589,9 @@ MagickExport MagickBooleanType SetImageBackgroundColor(Image *image, PixelInfo background; + PixelInfo + pixel; + ssize_t y; @@ -2595,11 +2604,13 @@ MagickExport MagickBooleanType SetImageBackgroundColor(Image *image, if (image->background_color.alpha != OpaqueAlpha) image->matte=MagickTrue; GetPixelInfo(image,&background); - background=image->background_color; + SetPixelInfoPacket(image,&image->background_color,&background); + SetPacketPixelInfo(image,&background,&pixel); /* Set image background color. */ status=MagickTrue; + pixel.black=0; image_view=AcquireCacheView(image); for (y=0; y < (ssize_t) image->rows; y++) { diff --git a/MagickCore/magick-config.h b/MagickCore/magick-config.h index 1bf8a4958..cc7a5e5cb 100644 --- a/MagickCore/magick-config.h +++ b/MagickCore/magick-config.h @@ -441,15 +441,15 @@ #endif /* Define if you have the header file. */ -/* #undef HAVE_LCMS2_H */ +#ifndef MAGICKCORE_HAVE_LCMS2_H +#define MAGICKCORE_HAVE_LCMS2_H 1 +#endif /* Define if you have the header file. */ /* #undef HAVE_LCMS2_LCMS2_H */ /* Define if you have the header file. */ -#ifndef MAGICKCORE_HAVE_LCMS_H -#define MAGICKCORE_HAVE_LCMS_H 1 -#endif +/* #undef HAVE_LCMS_H */ /* Define if you have the header file. */ /* #undef HAVE_LCMS_LCMS_H */ @@ -1208,9 +1208,7 @@ #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 @@ -1222,7 +1220,7 @@ /* 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/tracker-0.12:/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 */ @@ -1484,9 +1482,7 @@ #endif /* 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 */ @@ -1553,7 +1549,9 @@ /* #undef _MINIX */ /* Define this for the OpenCL Accelerator */ -/* #undef _OPENCL */ +#ifndef MAGICKCORE__OPENCL +#define MAGICKCORE__OPENCL 1 +#endif /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ diff --git a/MagickCore/paint.c b/MagickCore/paint.c index 5dc2bd31d..5d13857cb 100644 --- a/MagickCore/paint.c +++ b/MagickCore/paint.c @@ -335,7 +335,7 @@ MagickExport MagickBooleanType FloodfillPaintImage(Image *image, if (GetPixelAlpha(floodplane_image,p) != OpaqueAlpha) { (void) GetFillColor(draw_info,x,y,&fill_color,exception); - fill=fill_color; + SetPixelInfoPacket(image,&fill_color,&fill); if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) SetPixelRed(image,ClampToQuantum(fill.red),q); if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) @@ -456,9 +456,9 @@ MagickExport MagickBooleanType GradientImage(Image *image, sizeof(*gradient->stops)); for (i=0; i < (ssize_t) gradient->number_stops; i++) GetPixelInfo(image,&gradient->stops[i].color); - gradient->stops[0].color=(*start_color); + SetPixelInfoPacket(image,start_color,&gradient->stops[0].color); gradient->stops[0].offset=0.0; - gradient->stops[1].color=(*stop_color); + SetPixelInfoPacket(image,stop_color,&gradient->stops[1].color); gradient->stops[1].offset=1.0; /* Draw a gradient on the image. diff --git a/MagickCore/pixel-accessor.h b/MagickCore/pixel-accessor.h index 872099726..c480fd69f 100644 --- a/MagickCore/pixel-accessor.h +++ b/MagickCore/pixel-accessor.h @@ -525,6 +525,19 @@ static inline void SetPixelInfo(const Image *image,const Quantum *pixel, pixel[image->channel_map[IndexPixelChannel].channel]; } +static inline void SetPixelInfoPacket(const Image *image, + const PixelInfo *pixel,PixelInfo *pixel_info) +{ + pixel_info->red=(MagickRealType) pixel->red; + pixel_info->green=(MagickRealType) pixel->green; + pixel_info->blue=(MagickRealType) pixel->blue; + pixel_info->alpha=(MagickRealType) pixel->alpha; + if (image->colorspace == CMYKColorspace) + pixel_info->black=(MagickRealType) pixel->black; + if (image->storage_class == PseudoClass) + pixel_info->index=(MagickRealType) pixel->index; +} + static inline void SetPixelMagenta(const Image *image,const Quantum magenta, Quantum *pixel) { diff --git a/MagickCore/shear.c b/MagickCore/shear.c index 7377f5966..384faee80 100644 --- a/MagickCore/shear.c +++ b/MagickCore/shear.c @@ -1480,7 +1480,8 @@ static MagickBooleanType XShearImage(Image *image,const MagickRealType degrees, assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - background=image->background_color; + GetPixelInfo(image,&background); + SetPixelInfoPacket(image,&image->background_color,&background); /* X shear image. */ @@ -1695,7 +1696,8 @@ static MagickBooleanType YShearImage(Image *image,const MagickRealType degrees, assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - background=image->background_color; + GetPixelInfo(image,&background); + SetPixelInfoPacket(image,&image->background_color,&background); /* Y Shear image. */ diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c index 8827cda6a..5aa037b62 100644 --- a/MagickWand/drawing-wand.c +++ b/MagickWand/drawing-wand.c @@ -2464,17 +2464,17 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) if (child != (XMLTreeInfo *) NULL) { if (CurrentContext->fill.alpha != OpaqueAlpha) - pixel.matte=CurrentContext->fill.alpha != OpaqueAlpha ? MagickTrue : - MagickFalse; - pixel=CurrentContext->fill; + pixel.matte=CurrentContext->fill.alpha != OpaqueAlpha ? + MagickTrue : MagickFalse; + SetPixelInfoPacket(wand->image,&CurrentContext->fill,&pixel); GetColorTuple(&pixel,MagickTrue,value); (void) SetXMLTreeContent(child,value); } child=AddChildToXMLTree(xml_info,"fill-alpha",0); if (child != (XMLTreeInfo *) NULL) { - (void) FormatLocaleString(value,MaxTextExtent,"%g",(double) QuantumScale* - CurrentContext->fill.alpha); + (void) FormatLocaleString(value,MaxTextExtent,"%g", + (double) QuantumScale*CurrentContext->fill.alpha); (void) SetXMLTreeContent(child,value); } child=AddChildToXMLTree(xml_info,"fill-rule",0); @@ -2532,7 +2532,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) if (CurrentContext->stroke.alpha != OpaqueAlpha) pixel.matte=CurrentContext->stroke.alpha != OpaqueAlpha ? MagickTrue : MagickFalse; - pixel=CurrentContext->stroke; + SetPixelInfoPacket(wand->image,&CurrentContext->stroke,&pixel); GetColorTuple(&pixel,MagickTrue,value); (void) SetXMLTreeContent(child,value); } @@ -2625,7 +2625,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) if (CurrentContext->undercolor.alpha != OpaqueAlpha) pixel.matte=CurrentContext->undercolor.alpha != OpaqueAlpha ? MagickTrue : MagickFalse; - pixel=CurrentContext->undercolor; + SetPixelInfoPacket(wand->image,&CurrentContext->undercolor,&pixel); GetColorTuple(&pixel,MagickTrue,value); (void) SetXMLTreeContent(child,value); } diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index c70f7be8a..b73476e32 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -678,7 +678,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, quantize_info=AcquireQuantizeInfo(mogrify_info); SetGeometryInfo(&geometry_info); GetPixelInfo(*image,&fill); - fill=(*image)->background_color; + SetPixelInfoPacket(*image,&(*image)->background_color,&fill); attenuate=1.0; compose=(*image)->compose; interpolate_method=UndefinedInterpolatePixel; diff --git a/coders/avs.c b/coders/avs.c index 970544390..54eb1e883 100644 --- a/coders/avs.c +++ b/coders/avs.c @@ -141,6 +141,7 @@ static Image *ReadAVSImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Read AVS X image. */ + image->matte=MagickTrue; width=ReadBlobMSBLong(image); height=ReadBlobMSBLong(image); if (EOFBlob(image) != MagickFalse) @@ -152,7 +153,6 @@ static Image *ReadAVSImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Convert AVS raster image to pixel packets. */ - image->matte=MagickTrue; image->columns=width; image->rows=height; image->depth=8; diff --git a/coders/palm.c b/coders/palm.c index 8baf5412e..fd1fa99b6 100644 --- a/coders/palm.c +++ b/coders/palm.c @@ -513,7 +513,8 @@ static Image *ReadPALMImage(const ImageInfo *image_info, if (flags & PALM_HAS_TRANSPARENCY_FLAG) { if (bits_per_pixel != 16) - transpix=image->colormap[mask-transparentIndex]; + SetPixelInfoPacket(image,image->colormap+(mask-transparentIndex), + &transpix); (void) TransparentPaintImage(image,&transpix,(Quantum) TransparentAlpha, MagickFalse,exception); } -- 2.40.0