#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/option.h"
+#include "magick/pixel-private.h"
#include "magick/quantum.h"
#include "magick/quantum-private.h"
#include "magick/resample.h"
GetMagickToken(p,&p,token);
switch (i)
{
- case 0: color_correction.red.slope=StringToDouble(token); break;
- case 1: color_correction.green.slope=StringToDouble(token); break;
- case 2: color_correction.blue.slope=StringToDouble(token); break;
+ case 0: color_correction.red.slope=LocaleToDouble(token,(char **) NULL); break;
+ case 1: color_correction.green.slope=LocaleToDouble(token,(char **) NULL); break;
+ case 2: color_correction.blue.slope=LocaleToDouble(token,(char **) NULL); break;
}
}
}
GetMagickToken(p,&p,token);
switch (i)
{
- case 0: color_correction.red.offset=StringToDouble(token); break;
- case 1: color_correction.green.offset=StringToDouble(token); break;
- case 2: color_correction.blue.offset=StringToDouble(token); break;
+ case 0: color_correction.red.offset=LocaleToDouble(token,(char **) NULL); break;
+ case 1: color_correction.green.offset=LocaleToDouble(token,(char **) NULL); break;
+ case 2: color_correction.blue.offset=LocaleToDouble(token,(char **) NULL); break;
}
}
}
GetMagickToken(p,&p,token);
switch (i)
{
- case 0: color_correction.red.power=StringToDouble(token); break;
- case 1: color_correction.green.power=StringToDouble(token); break;
- case 2: color_correction.blue.power=StringToDouble(token); break;
+ case 0: color_correction.red.power=LocaleToDouble(token,(char **) NULL); break;
+ case 1: color_correction.green.power=LocaleToDouble(token,(char **) NULL); break;
+ case 2: color_correction.blue.power=LocaleToDouble(token,(char **) NULL); break;
}
}
}
content=GetXMLTreeContent(saturation);
p=(const char *) content;
GetMagickToken(p,&p,token);
- color_correction.saturation=StringToDouble(token);
+ color_correction.saturation=LocaleToDouble(token,(char **) NULL);
}
}
ccc=DestroyXMLTree(ccc);
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- luma=0.2126*q->red+0.7152*q->green+0.0722*q->blue;
- q->red=ClampToQuantum(luma+color_correction.saturation*
- (cdl_map[ScaleQuantumToMap(q->red)].red-luma));
- q->green=ClampToQuantum(luma+color_correction.saturation*
- (cdl_map[ScaleQuantumToMap(q->green)].green-luma));
- q->blue=ClampToQuantum(luma+color_correction.saturation*
- (cdl_map[ScaleQuantumToMap(q->blue)].blue-luma));
+ luma=0.2126*GetRedPixelComponent(q)+0.7152*GetGreenPixelComponent(q)+
+ 0.0722*GetBluePixelComponent(q);
+ SetRedPixelComponent(q,ClampToQuantum(luma+color_correction.saturation*
+ (cdl_map[ScaleQuantumToMap(GetRedPixelComponent(q))].red-luma)));
+ SetGreenPixelComponent(q,ClampToQuantum(luma+color_correction.saturation*
+ (cdl_map[ScaleQuantumToMap(GetGreenPixelComponent(q))].green-luma)));
+ SetBluePixelComponent(q,ClampToQuantum(luma+color_correction.saturation*
+ (cdl_map[ScaleQuantumToMap(GetBluePixelComponent(q))].blue-luma)));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
#define ClutImageTag "Clut/Image"
CacheView
+ *clut_view,
*image_view;
ExceptionInfo
register ssize_t
i;
- ResampleFilter
- **restrict resample_filter;
-
ssize_t
adjust,
y;
progress=0;
adjust=(ssize_t) (clut_image->interpolate == IntegerInterpolatePixel ? 0 : 1);
exception=(&image->exception);
- resample_filter=AcquireResampleFilterThreadSet(clut_image,
- UndefinedVirtualPixelMethod,MagickTrue,exception);
+ clut_view=AcquireCacheView(clut_image);
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(dynamic,4)
+#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
GetMagickPixelPacket(clut_image,clut_map+i);
- (void) ResamplePixelColor(resample_filter[0],QuantumScale*i*
- (clut_image->columns-adjust),QuantumScale*i*(clut_image->rows-adjust),
- clut_map+i);
+ (void) InterpolateMagickPixelPacket(clut_image,clut_view,
+ UndefinedInterpolatePixel,QuantumScale*i*(clut_image->columns-adjust),
+ QuantumScale*i*(clut_image->rows-adjust),clut_map+i,exception);
}
+ clut_view=DestroyCacheView(clut_view);
image_view=AcquireCacheView(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
+ MagickPixelPacket
+ pixel;
+
register IndexPacket
*restrict indexes;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
+ GetMagickPixelPacket(image,&pixel);
for (x=0; x < (ssize_t) image->columns; x++)
{
+ SetMagickPixelPacket(image,q,indexes+x,&pixel);
if ((channel & RedChannel) != 0)
SetRedPixelComponent(q,ClampRedPixelComponent(clut_map+
- ScaleQuantumToMap(q->red)));
+ ScaleQuantumToMap(GetRedPixelComponent(q))));
if ((channel & GreenChannel) != 0)
SetGreenPixelComponent(q,ClampGreenPixelComponent(clut_map+
- ScaleQuantumToMap(q->green)));
+ ScaleQuantumToMap(GetGreenPixelComponent(q))));
if ((channel & BlueChannel) != 0)
SetBluePixelComponent(q,ClampBluePixelComponent(clut_map+
- ScaleQuantumToMap(q->blue)));
+ ScaleQuantumToMap(GetBluePixelComponent(q))));
if ((channel & OpacityChannel) != 0)
{
if (clut_image->matte == MagickFalse)
- q->opacity=(Quantum) (QuantumRange-MagickPixelIntensityToQuantum(
- clut_map+ScaleQuantumToMap(GetAlphaPixelComponent(q))));
+ SetOpacityPixelComponent(q,(QuantumRange-
+ MagickPixelIntensityToQuantum(clut_map+ScaleQuantumToMap(
+ (Quantum) GetAlphaPixelComponent(q)))));
else
if (image->matte == MagickFalse)
SetOpacityPixelComponent(q,ClampOpacityPixelComponent(clut_map+
- ScaleQuantumToMap(PixelIntensity(q))));
+ ScaleQuantumToMap((Quantum) MagickPixelIntensity(&pixel))));
else
SetOpacityPixelComponent(q,ClampOpacityPixelComponent(
- clut_map+ScaleQuantumToMap(q->opacity)));
+ clut_map+ScaleQuantumToMap(GetOpacityPixelComponent(q))));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- indexes[x]=ClampToQuantum((clut_map+(ssize_t) indexes[x])->index);
+ SetIndexPixelComponent(indexes+x,ClampToQuantum((clut_map+(ssize_t)
+ GetIndexPixelComponent(indexes+x))->index));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
}
}
image_view=DestroyCacheView(image_view);
- resample_filter=DestroyResampleFilterThreadSet(resample_filter);
clut_map=(MagickPixelPacket *) RelinquishMagickMemory(clut_map);
if ((clut_image->matte != MagickFalse) && ((channel & OpacityChannel) != 0))
(void) SetImageAlphaChannel(image,ActivateAlphaChannel);
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
+ Quantum
+ blue,
+ green,
+ red;
+
register PixelPacket
*restrict q;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
- Contrast(sign,&q->red,&q->green,&q->blue);
+ red=GetRedPixelComponent(q);
+ green=GetGreenPixelComponent(q);
+ blue=GetBluePixelComponent(q);
+ Contrast(sign,&red,&green,&blue);
+ SetRedPixelComponent(q,red);
+ SetGreenPixelComponent(q,green);
+ SetBluePixelComponent(q,blue);
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
histogram[ScaleQuantumToMap(GetOpacityPixelComponent(p))].opacity++;
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- histogram[ScaleQuantumToMap(indexes[x])].index++;
+ histogram[ScaleQuantumToMap(GetIndexPixelComponent(
+ indexes+x))].index++;
p++;
}
}
if ((channel & RedChannel) != 0)
{
if (black.red != white.red)
- q->red=ClampToQuantum(stretch_map[ScaleQuantumToMap(q->red)].red);
+ SetRedPixelComponent(q,ClampToQuantum(stretch_map[
+ ScaleQuantumToMap(GetRedPixelComponent(q))].red));
}
if ((channel & GreenChannel) != 0)
{
if (black.green != white.green)
- q->green=ClampToQuantum(stretch_map[ScaleQuantumToMap(
- q->green)].green);
+ SetGreenPixelComponent(q,ClampToQuantum(stretch_map[
+ ScaleQuantumToMap(GetGreenPixelComponent(q))].green));
}
if ((channel & BlueChannel) != 0)
{
if (black.blue != white.blue)
- q->blue=ClampToQuantum(stretch_map[ScaleQuantumToMap(
- q->blue)].blue);
+ SetBluePixelComponent(q,ClampToQuantum(stretch_map[
+ ScaleQuantumToMap(GetBluePixelComponent(q))].blue));
}
if ((channel & OpacityChannel) != 0)
{
if (black.opacity != white.opacity)
- q->opacity=ClampToQuantum(stretch_map[ScaleQuantumToMap(
- q->opacity)].opacity);
+ SetOpacityPixelComponent(q,ClampToQuantum(stretch_map[
+ ScaleQuantumToMap(GetOpacityPixelComponent(q))].opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
if (black.index != white.index)
- indexes[x]=(IndexPacket) ClampToQuantum(stretch_map[
- ScaleQuantumToMap(indexes[x])].index);
+ SetIndexPixelComponent(indexes+x,ClampToQuantum(stretch_map[
+ ScaleQuantumToMap(GetIndexPixelComponent(indexes+x))].index));
}
q++;
}
MagickExport Image *EnhanceImage(const Image *image,ExceptionInfo *exception)
{
#define Enhance(weight) \
- mean=((MagickRealType) r->red+pixel.red)/2; \
- distance=(MagickRealType) r->red-(MagickRealType) pixel.red; \
+ mean=((MagickRealType) GetRedPixelComponent(r)+pixel.red)/2; \
+ distance=(MagickRealType) GetRedPixelComponent(r)-(MagickRealType) pixel.red; \
distance_squared=QuantumScale*(2.0*((MagickRealType) QuantumRange+1.0)+ \
mean)*distance*distance; \
- mean=((MagickRealType) r->green+pixel.green)/2; \
- distance=(MagickRealType) r->green-(MagickRealType) pixel.green; \
+ mean=((MagickRealType) GetGreenPixelComponent(r)+pixel.green)/2; \
+ distance=(MagickRealType) GetGreenPixelComponent(r)-(MagickRealType) \
+ pixel.green; \
distance_squared+=4.0*distance*distance; \
- mean=((MagickRealType) r->blue+pixel.blue)/2; \
- distance=(MagickRealType) r->blue-(MagickRealType) pixel.blue; \
+ mean=((MagickRealType) GetBluePixelComponent(r)+pixel.blue)/2; \
+ distance=(MagickRealType) GetBluePixelComponent(r)-(MagickRealType) \
+ pixel.blue; \
distance_squared+=QuantumScale*(3.0*((MagickRealType) \
QuantumRange+1.0)-1.0-mean)*distance*distance; \
mean=((MagickRealType) r->opacity+pixel.opacity)/2; \
if (distance_squared < ((MagickRealType) QuantumRange*(MagickRealType) \
QuantumRange/25.0f)) \
{ \
- aggregate.red+=(weight)*r->red; \
- aggregate.green+=(weight)*r->green; \
- aggregate.blue+=(weight)*r->blue; \
- aggregate.opacity+=(weight)*r->opacity; \
+ aggregate.red+=(weight)*GetRedPixelComponent(r); \
+ aggregate.green+=(weight)*GetGreenPixelComponent(r); \
+ aggregate.blue+=(weight)*GetBluePixelComponent(r); \
+ aggregate.opacity+=(weight)*GetOpacityPixelComponent(r); \
total_weight+=(weight); \
} \
r++;
Enhance(8.0); Enhance(20.0); Enhance(40.0); Enhance(20.0); Enhance(8.0);
r=p+4*(image->columns+4);
Enhance(5.0); Enhance(8.0); Enhance(10.0); Enhance(8.0); Enhance(5.0);
- q->red=(Quantum) ((aggregate.red+(total_weight/2)-1)/total_weight);
- q->green=(Quantum) ((aggregate.green+(total_weight/2)-1)/total_weight);
- q->blue=(Quantum) ((aggregate.blue+(total_weight/2)-1)/total_weight);
- q->opacity=(Quantum) ((aggregate.opacity+(total_weight/2)-1)/
+ SetRedPixelComponent(q,(aggregate.red+(total_weight/2)-1)/total_weight);
+ SetGreenPixelComponent(q,(aggregate.green+(total_weight/2)-1)/
+ total_weight);
+ SetBluePixelComponent(q,(aggregate.blue+(total_weight/2)-1)/total_weight);
+ SetOpacityPixelComponent(q,(aggregate.opacity+(total_weight/2)-1)/
total_weight);
p++;
q++;
histogram[ScaleQuantumToMap(GetOpacityPixelComponent(p))].opacity++;
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- histogram[ScaleQuantumToMap(indexes[x])].index++;
+ histogram[ScaleQuantumToMap(GetIndexPixelComponent(indexes+x))].index++;
p++;
}
}
for (x=0; x < (ssize_t) image->columns; x++)
{
if (((channel & RedChannel) != 0) && (white.red != black.red))
- q->red=ClampToQuantum(equalize_map[ScaleQuantumToMap(q->red)].red);
+ SetRedPixelComponent(q,ClampToQuantum(equalize_map[
+ ScaleQuantumToMap(GetRedPixelComponent(q))].red));
if (((channel & GreenChannel) != 0) && (white.green != black.green))
- q->green=ClampToQuantum(equalize_map[ScaleQuantumToMap(
- q->green)].green);
+ SetGreenPixelComponent(q,ClampToQuantum(equalize_map[
+ ScaleQuantumToMap(GetGreenPixelComponent(q))].green));
if (((channel & BlueChannel) != 0) && (white.blue != black.blue))
- q->blue=ClampToQuantum(equalize_map[ScaleQuantumToMap(q->blue)].blue);
+ SetBluePixelComponent(q,ClampToQuantum(equalize_map[
+ ScaleQuantumToMap(GetBluePixelComponent(q))].blue));
if (((channel & OpacityChannel) != 0) && (white.opacity != black.opacity))
- q->opacity=ClampToQuantum(equalize_map[ScaleQuantumToMap(
- q->opacity)].opacity);
+ SetOpacityPixelComponent(q,ClampToQuantum(equalize_map[
+ ScaleQuantumToMap(GetOpacityPixelComponent(q))].opacity));
if ((((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace)) &&
(white.index != black.index))
- indexes[x]=ClampToQuantum(equalize_map[ScaleQuantumToMap(
- indexes[x])].index);
+ SetIndexPixelComponent(indexes+x,ClampToQuantum(equalize_map[
+ ScaleQuantumToMap(GetIndexPixelComponent(indexes+x))].index));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
{
if (channel == DefaultChannels)
{
- q->red=gamma_map[ScaleQuantumToMap(q->red)];
- q->green=gamma_map[ScaleQuantumToMap(q->green)];
- q->blue=gamma_map[ScaleQuantumToMap(q->blue)];
+ SetRedPixelComponent(q,gamma_map[ScaleQuantumToMap(
+ GetRedPixelComponent(q))]);
+ SetGreenPixelComponent(q,gamma_map[ScaleQuantumToMap(
+ GetGreenPixelComponent(q))]);
+ SetBluePixelComponent(q,gamma_map[ScaleQuantumToMap(
+ GetBluePixelComponent(q))]);
}
else
{
if ((channel & RedChannel) != 0)
- q->red=gamma_map[ScaleQuantumToMap(q->red)];
+ SetRedPixelComponent(q,gamma_map[ScaleQuantumToMap(
+ GetRedPixelComponent(q))]);
if ((channel & GreenChannel) != 0)
- q->green=gamma_map[ScaleQuantumToMap(q->green)];
+ SetGreenPixelComponent(q,gamma_map[ScaleQuantumToMap(
+ GetGreenPixelComponent(q))]);
if ((channel & BlueChannel) != 0)
- q->blue=gamma_map[ScaleQuantumToMap(q->blue)];
+ SetBluePixelComponent(q,gamma_map[ScaleQuantumToMap(
+ GetBluePixelComponent(q))]);
if ((channel & OpacityChannel) != 0)
{
if (image->matte == MagickFalse)
- q->opacity=gamma_map[ScaleQuantumToMap(q->opacity)];
+ SetOpacityPixelComponent(q,gamma_map[ScaleQuantumToMap(
+ GetOpacityPixelComponent(q))]);
else
- q->opacity=(Quantum) QuantumRange-gamma_map[
- ScaleQuantumToMap((Quantum) GetAlphaPixelComponent(q))];
+ SetOpacityPixelComponent(q,(Quantum) QuantumRange-gamma_map[
+ ScaleQuantumToMap((Quantum) GetAlphaPixelComponent(q))]);
}
}
q++;
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
for (x=0; x < (ssize_t) image->columns; x++)
- indexes[x]=gamma_map[ScaleQuantumToMap(indexes[x])];
+ SetIndexPixelComponent(indexes+x,gamma_map[ScaleQuantumToMap(
+ GetIndexPixelComponent(indexes+x))]);
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
} HaldInfo;
CacheView
+ *hald_view,
*image_view;
double
MagickPixelPacket
zero;
- ResampleFilter
- **restrict resample_filter;
-
size_t
cube_size,
length,
width=(double) hald_image->columns;
GetMagickPixelPacket(hald_image,&zero);
exception=(&image->exception);
- resample_filter=AcquireResampleFilterThreadSet(hald_image,
- UndefinedVirtualPixelMethod,MagickTrue,exception);
image_view=AcquireCacheView(image);
+ hald_view=AcquireCacheView(hald_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
- const int
- id = GetOpenMPThreadId();
-
double
offset;
status=MagickFalse;
continue;
}
- indexes=GetCacheViewAuthenticIndexQueue(image_view);
+ indexes=GetCacheViewAuthenticIndexQueue(hald_view);
pixel=zero;
pixel1=zero;
pixel2=zero;
pixel4=zero;
for (x=0; x < (ssize_t) image->columns; x++)
{
- point.x=QuantumScale*(level-1.0)*q->red;
- point.y=QuantumScale*(level-1.0)*q->green;
- point.z=QuantumScale*(level-1.0)*q->blue;
+ point.x=QuantumScale*(level-1.0)*GetRedPixelComponent(q);
+ point.y=QuantumScale*(level-1.0)*GetGreenPixelComponent(q);
+ point.z=QuantumScale*(level-1.0)*GetBluePixelComponent(q);
offset=point.x+level*floor(point.y)+cube_size*floor(point.z);
point.x-=floor(point.x);
point.y-=floor(point.y);
point.z-=floor(point.z);
- (void) ResamplePixelColor(resample_filter[id],fmod(offset,width),
- floor(offset/width),&pixel1);
- (void) ResamplePixelColor(resample_filter[id],fmod(offset+level,width),
- floor((offset+level)/width),&pixel2);
+ (void) InterpolateMagickPixelPacket(image,hald_view,
+ UndefinedInterpolatePixel,fmod(offset,width),floor(offset/width),
+ &pixel1,exception);
+ (void) InterpolateMagickPixelPacket(image,hald_view,
+ UndefinedInterpolatePixel,fmod(offset+level,width),floor((offset+level)/
+ width),&pixel2,exception);
MagickPixelCompositeAreaBlend(&pixel1,pixel1.opacity,&pixel2,
pixel2.opacity,point.y,&pixel3);
offset+=cube_size;
- (void) ResamplePixelColor(resample_filter[id],fmod(offset,width),
- floor(offset/width),&pixel1);
- (void) ResamplePixelColor(resample_filter[id],fmod(offset+level,width),
- floor((offset+level)/width),&pixel2);
+ (void) InterpolateMagickPixelPacket(image,hald_view,
+ UndefinedInterpolatePixel,fmod(offset,width),floor(offset/width),
+ &pixel1,exception);
+ (void) InterpolateMagickPixelPacket(image,hald_view,
+ UndefinedInterpolatePixel,fmod(offset+level,width),floor((offset+level)/
+ width),&pixel2,exception);
MagickPixelCompositeAreaBlend(&pixel1,pixel1.opacity,&pixel2,
pixel2.opacity,point.y,&pixel4);
MagickPixelCompositeAreaBlend(&pixel3,pixel3.opacity,&pixel4,
pixel4.opacity,point.z,&pixel);
if ((channel & RedChannel) != 0)
- SetRedPixelComponent(q,ClampRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(pixel.red));
if ((channel & GreenChannel) != 0)
- SetGreenPixelComponent(q,ClampGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(pixel.green));
if ((channel & BlueChannel) != 0)
- SetBluePixelComponent(q,ClampBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(pixel.blue));
if (((channel & OpacityChannel) != 0) && (image->matte != MagickFalse))
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- indexes[x]=ClampToQuantum(pixel.index);
+ SetIndexPixelComponent(indexes+x,ClampToQuantum(pixel.index));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
}
+ hald_view=DestroyCacheView(hald_view);
image_view=DestroyCacheView(image_view);
- resample_filter=DestroyResampleFilterThreadSet(resample_filter);
return(status);
}
\f
for (x=0; x < (ssize_t) image->columns; x++)
{
if ((channel & RedChannel) != 0)
- q->red=LevelQuantum(q->red);
+ SetRedPixelComponent(q,LevelQuantum(GetRedPixelComponent(q)));
if ((channel & GreenChannel) != 0)
- q->green=LevelQuantum(q->green);
+ SetGreenPixelComponent(q,LevelQuantum(GetGreenPixelComponent(q)));
if ((channel & BlueChannel) != 0)
- q->blue=LevelQuantum(q->blue);
+ SetBluePixelComponent(q,LevelQuantum(GetBluePixelComponent(q)));
if (((channel & OpacityChannel) != 0) &&
(image->matte == MagickTrue))
- q->opacity=(Quantum) (QuantumRange-LevelQuantum(QuantumRange-
+ SetOpacityPixelComponent(q,QuantumRange-LevelQuantum(QuantumRange-
q->opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- indexes[x]=LevelQuantum(indexes[x]);
+ SetIndexPixelComponent(indexes+x,LevelQuantum(
+ GetIndexPixelComponent(indexes+x)));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
for (x=0; x < (ssize_t) image->columns; x++)
{
if ((channel & RedChannel) != 0)
- q->red=LevelizeValue(q->red);
+ SetRedPixelComponent(q,LevelizeValue(GetRedPixelComponent(q)));
if ((channel & GreenChannel) != 0)
- q->green=LevelizeValue(q->green);
+ SetGreenPixelComponent(q,LevelizeValue(GetGreenPixelComponent(q)));
if ((channel & BlueChannel) != 0)
- q->blue=LevelizeValue(q->blue);
+ SetBluePixelComponent(q,LevelizeValue(GetBluePixelComponent(q)));
if (((channel & OpacityChannel) != 0) &&
(image->matte == MagickTrue))
- q->opacity=LevelizeValue(q->opacity);
+ SetOpacityPixelComponent(q,LevelizeValue(GetOpacityPixelComponent(q)));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- indexes[x]=LevelizeValue(indexes[x]);
+ SetIndexPixelComponent(indexes+x,LevelizeValue(
+ GetIndexPixelComponent(indexes+x)));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
colorspace=UndefinedColorspace;
artifact=GetImageArtifact(image,"modulate:colorspace");
if (artifact != (const char *) NULL)
- colorspace=(ColorspaceType) ParseMagickOption(MagickColorspaceOptions,
+ colorspace=(ColorspaceType) ParseCommandOption(MagickColorspaceOptions,
MagickFalse,artifact);
if (image->storage_class == PseudoClass)
{
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
+ Quantum
+ blue,
+ green,
+ red;
+
register PixelPacket
*restrict q;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
+ red=GetRedPixelComponent(q);
+ green=GetGreenPixelComponent(q);
+ blue=GetBluePixelComponent(q);
switch (colorspace)
{
case HSBColorspace:
{
ModulateHSB(percent_hue,percent_saturation,percent_brightness,
- &q->red,&q->green,&q->blue);
+ &red,&green,&blue);
break;
}
case HSLColorspace:
default:
{
ModulateHSL(percent_hue,percent_saturation,percent_brightness,
- &q->red,&q->green,&q->blue);
+ &red,&green,&blue);
break;
}
case HWBColorspace:
{
ModulateHWB(percent_hue,percent_saturation,percent_brightness,
- &q->red,&q->green,&q->blue);
+ &red,&green,&blue);
break;
}
}
+ SetRedPixelComponent(q,red);
+ SetGreenPixelComponent(q,green);
+ SetBluePixelComponent(q,blue);
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
indexes=GetCacheViewAuthenticIndexQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
{
- if ((q->red != q->green) || (q->green != q->blue))
+ if ((GetRedPixelComponent(q) != GetGreenPixelComponent(q)) ||
+ (GetGreenPixelComponent(q) != GetBluePixelComponent(q)))
{
q++;
continue;
}
if ((channel & RedChannel) != 0)
- q->red=(Quantum) QuantumRange-q->red;
+ SetRedPixelComponent(q,QuantumRange-GetRedPixelComponent(q));
if ((channel & GreenChannel) != 0)
- q->green=(Quantum) QuantumRange-q->green;
+ SetGreenPixelComponent(q,QuantumRange-GetGreenPixelComponent(q));
if ((channel & BlueChannel) != 0)
- q->blue=(Quantum) QuantumRange-q->blue;
+ SetBluePixelComponent(q,QuantumRange-GetBluePixelComponent(q));
if ((channel & OpacityChannel) != 0)
- q->opacity=(Quantum) QuantumRange-q->opacity;
+ SetOpacityPixelComponent(q,QuantumRange-
+ GetOpacityPixelComponent(q));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- indexes[x]=(IndexPacket) QuantumRange-indexes[x];
+ SetIndexPixelComponent(indexes+x,QuantumRange-
+ GetIndexPixelComponent(indexes+x));
q++;
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
for (x=0; x < (ssize_t) image->columns; x++)
{
if ((channel & RedChannel) != 0)
- q->red=(Quantum) QuantumRange-q->red;
+ SetRedPixelComponent(q,QuantumRange-GetRedPixelComponent(q));
if ((channel & GreenChannel) != 0)
- q->green=(Quantum) QuantumRange-q->green;
+ SetGreenPixelComponent(q,QuantumRange-GetGreenPixelComponent(q));
if ((channel & BlueChannel) != 0)
- q->blue=(Quantum) QuantumRange-q->blue;
+ SetBluePixelComponent(q,QuantumRange-GetBluePixelComponent(q));
if ((channel & OpacityChannel) != 0)
- q->opacity=(Quantum) QuantumRange-q->opacity;
+ SetOpacityPixelComponent(q,QuantumRange-GetOpacityPixelComponent(q));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- indexes[x]=(IndexPacket) QuantumRange-indexes[x];
+ SetIndexPixelComponent(indexes+x,QuantumRange-
+ GetIndexPixelComponent(indexes+x));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
for (x=0; x < (ssize_t) image->columns; x++)
{
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(sigmoidal_map[ScaleQuantumToMap(q->red)]);
+ SetRedPixelComponent(q,ClampToQuantum(sigmoidal_map[ScaleQuantumToMap(
+ GetRedPixelComponent(q))]));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(sigmoidal_map[ScaleQuantumToMap(q->green)]);
+ SetGreenPixelComponent(q,ClampToQuantum(sigmoidal_map[ScaleQuantumToMap(
+ GetGreenPixelComponent(q))]));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(sigmoidal_map[ScaleQuantumToMap(q->blue)]);
+ SetBluePixelComponent(q,ClampToQuantum(sigmoidal_map[ScaleQuantumToMap(
+ GetBluePixelComponent(q))]));
if ((channel & OpacityChannel) != 0)
- q->opacity=ClampToQuantum(sigmoidal_map[ScaleQuantumToMap(q->opacity)]);
+ SetOpacityPixelComponent(q,ClampToQuantum(sigmoidal_map[
+ ScaleQuantumToMap(GetOpacityPixelComponent(q))]));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- indexes[x]=(IndexPacket) ClampToQuantum(sigmoidal_map[
- ScaleQuantumToMap(indexes[x])]);
+ SetIndexPixelComponent(indexes+x,ClampToQuantum(sigmoidal_map[
+ ScaleQuantumToMap(GetIndexPixelComponent(indexes+x))]));
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)