pixel.opacity+=(*k)*GetOpacityPixelComponent(p);
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- pixel.index+=(*k)*alpha*indexes[x+(width-i)*v+u];
+ pixel.index+=(*k)*alpha*GetIndexPixelComponent(indexes+x+(width-i)*
+ v+u);
gamma+=(*k)*alpha;
k++;
p++;
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
if ((channel & OpacityChannel) != 0)
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- blur_indexes[x]=ClampToQuantum(gamma*GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(gamma*
+ pixel.index));
q++;
r++;
}
pixel.opacity+=(*k)*GetOpacityPixelComponent(p);
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- pixel.index+=(*k)*alpha*indexes[x+(width-i)*v+u];
+ pixel.index+=(*k)*alpha*GetIndexPixelComponent(indexes+x+(width-i)*
+ v+u);
gamma+=(*k)*alpha;
k++;
p++;
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
if ((channel & OpacityChannel) != 0)
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- sharp_indexes[x]=ClampToQuantum(gamma*GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(sharp_indexes+x,ClampToQuantum(gamma*
+ pixel.index));
q++;
r++;
}
for (i=0; i < (ssize_t) width; i++)
{
*message='\0';
- (void) FormatMagickString(format,MaxTextExtent,"%.20g: ",(double) i);
+ (void) FormatLocaleString(format,MaxTextExtent,"%.20g: ",(double) i);
(void) ConcatenateString(&message,format);
- (void) FormatMagickString(format,MaxTextExtent,"%g ",*k++);
+ (void) FormatLocaleString(format,MaxTextExtent,"%g ",*k++);
(void) ConcatenateString(&message,format);
(void) LogMagickEvent(TransformEvent,GetMagickModule(),"%s",message);
}
{
for (i=0; i < (ssize_t) width; i++)
{
- pixel.red+=(*k)*kernel_pixels->red;
- pixel.green+=(*k)*kernel_pixels->green;
- pixel.blue+=(*k)*kernel_pixels->blue;
+ pixel.red+=(*k)*GetRedPixelComponent(kernel_pixels);
+ pixel.green+=(*k)*GetGreenPixelComponent(kernel_pixels);
+ pixel.blue+=(*k)*GetBluePixelComponent(kernel_pixels);
k++;
kernel_pixels++;
}
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)
{
k=kernel;
kernel_pixels=p;
for (i=0; i < (ssize_t) width; i++)
{
- pixel.opacity+=(*k)*kernel_pixels->opacity;
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(kernel_pixels);
k++;
kernel_pixels++;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
kernel_indexes=indexes;
for (i=0; i < (ssize_t) width; i++)
{
- pixel.index+=(*k)*(*kernel_indexes);
+ pixel.index+=(*k)*GetIndexPixelComponent(kernel_indexes);
k++;
kernel_indexes++;
}
- blur_indexes[x]=ClampToQuantum(pixel.index);
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(
+ pixel.index));
}
}
else
{
alpha=(MagickRealType) (QuantumScale*
GetAlphaPixelComponent(kernel_pixels));
- pixel.red+=(*k)*alpha*kernel_pixels->red;
- pixel.green+=(*k)*alpha*kernel_pixels->green;
- pixel.blue+=(*k)*alpha*kernel_pixels->blue;
+ pixel.red+=(*k)*alpha*GetRedPixelComponent(kernel_pixels);
+ pixel.green+=(*k)*alpha*GetGreenPixelComponent(kernel_pixels);
+ pixel.blue+=(*k)*alpha*GetBluePixelComponent(kernel_pixels);
gamma+=(*k)*alpha;
k++;
kernel_pixels++;
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
if ((channel & OpacityChannel) != 0)
{
k=kernel;
kernel_pixels=p;
for (i=0; i < (ssize_t) width; i++)
{
- pixel.opacity+=(*k)*kernel_pixels->opacity;
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(kernel_pixels);
k++;
kernel_pixels++;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
kernel_pixels++;
kernel_indexes++;
}
- blur_indexes[x]=ClampToQuantum(gamma*
- GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(gamma*
+ pixel.index));
}
}
indexes++;
{
for (i=0; i < (ssize_t) width; i++)
{
- pixel.red+=(*k)*kernel_pixels->red;
- pixel.green+=(*k)*kernel_pixels->green;
- pixel.blue+=(*k)*kernel_pixels->blue;
+ pixel.red+=(*k)*GetRedPixelComponent(kernel_pixels);
+ pixel.green+=(*k)*GetGreenPixelComponent(kernel_pixels);
+ pixel.blue+=(*k)*GetBluePixelComponent(kernel_pixels);
k++;
kernel_pixels++;
}
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)
{
k=kernel;
kernel_pixels=p;
for (i=0; i < (ssize_t) width; i++)
{
- pixel.opacity+=(*k)*kernel_pixels->opacity;
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(kernel_pixels);
k++;
kernel_pixels++;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
kernel_indexes=indexes;
for (i=0; i < (ssize_t) width; i++)
{
- pixel.index+=(*k)*(*kernel_indexes);
+ pixel.index+=(*k)*GetIndexPixelComponent(kernel_indexes);
k++;
kernel_indexes++;
}
- blur_indexes[y]=ClampToQuantum(pixel.index);
+ SetIndexPixelComponent(blur_indexes+y,ClampToQuantum(
+ pixel.index));
}
}
else
{
alpha=(MagickRealType) (QuantumScale*
GetAlphaPixelComponent(kernel_pixels));
- pixel.red+=(*k)*alpha*kernel_pixels->red;
- pixel.green+=(*k)*alpha*kernel_pixels->green;
- pixel.blue+=(*k)*alpha*kernel_pixels->blue;
+ pixel.red+=(*k)*alpha*GetRedPixelComponent(kernel_pixels);
+ pixel.green+=(*k)*alpha*GetGreenPixelComponent(kernel_pixels);
+ pixel.blue+=(*k)*alpha*GetBluePixelComponent(kernel_pixels);
gamma+=(*k)*alpha;
k++;
kernel_pixels++;
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
if ((channel & OpacityChannel) != 0)
{
k=kernel;
kernel_pixels=p;
for (i=0; i < (ssize_t) width; i++)
{
- pixel.opacity+=(*k)*kernel_pixels->opacity;
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(kernel_pixels);
k++;
kernel_pixels++;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
kernel_pixels++;
kernel_indexes++;
}
- blur_indexes[y]=ClampToQuantum(gamma*
- GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(blur_indexes+y,ClampToQuantum(gamma*
+ pixel.index));
}
}
indexes++;
for (v=0; v < (ssize_t) width; v++)
{
*message='\0';
- (void) FormatMagickString(format,MaxTextExtent,"%.20g: ",(double) v);
+ (void) FormatLocaleString(format,MaxTextExtent,"%.20g: ",(double) v);
(void) ConcatenateString(&message,format);
for (u=0; u < (ssize_t) width; u++)
{
- (void) FormatMagickString(format,MaxTextExtent,"%g ",*k++);
+ (void) FormatLocaleString(format,MaxTextExtent,"%g ",*k++);
(void) ConcatenateString(&message,format);
}
(void) LogMagickEvent(TransformEvent,GetMagickModule(),"%s",message);
kernel_pixels+=image->columns+width;
}
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)
{
k=normal_kernel;
}
kernel_pixels+=image->columns+width;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
for (u=0; u < (ssize_t) width; u++)
{
- pixel.index+=(*k)*kernel_indexes[u];
+ pixel.index+=(*k)*GetIndexPixelComponent(kernel_indexes+u);
k++;
}
kernel_indexes+=image->columns+width;
}
- convolve_indexes[x]=ClampToQuantum(pixel.index);
+ SetIndexPixelComponent(convolve_indexes+x,ClampToQuantum(
+ pixel.index));
}
}
else
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
if ((channel & OpacityChannel) != 0)
{
k=normal_kernel;
{
for (u=0; u < (ssize_t) width; u++)
{
- pixel.opacity+=(*k)*kernel_pixels[u].opacity;
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(kernel_pixels+u);
k++;
}
kernel_pixels+=image->columns+width;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
alpha=(MagickRealType) (QuantumScale*(QuantumRange-
kernel_pixels[u].opacity));
- pixel.index+=(*k)*alpha*kernel_indexes[u];
+ pixel.index+=(*k)*alpha*GetIndexPixelComponent(
+ kernel_indexes+u);
k++;
}
kernel_pixels+=image->columns+width;
kernel_indexes+=image->columns+width;
}
- convolve_indexes[x]=ClampToQuantum(gamma*
- GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(convolve_indexes+x,ClampToQuantum(gamma*
+ pixel.index));
}
}
indexes++;
case 1: pixel[j]=GetGreenPixelComponent(p); break;
case 2: pixel[j]=GetBluePixelComponent(p); break;
case 3: pixel[j]=GetOpacityPixelComponent(p); break;
- case 4: pixel[j]=GetBlackPixelComponent(indexes,x); break;
+ case 4: pixel[j]=GetBlackPixelComponent(indexes+x); break;
default: break;
}
p++;
{
switch (i)
{
- case 0: q->red=pixel[j]; break;
- case 1: q->green=pixel[j]; break;
- case 2: q->blue=pixel[j]; break;
- case 3: q->opacity=pixel[j]; break;
- case 4: indexes[x]=pixel[j]; break;
+ case 0: SetRedPixelComponent(q,pixel[j]); break;
+ case 1: SetGreenPixelComponent(q,pixel[j]); break;
+ case 2: SetBluePixelComponent(q,pixel[j]); break;
+ case 3: SetOpacityPixelComponent(q,pixel[j]); break;
+ case 4: SetIndexPixelComponent(indexes+x,pixel[j]); break;
default: break;
}
q++;
for (v=0; v < (ssize_t) kernel->height; v++)
{
*message='\0';
- (void) FormatMagickString(format,MaxTextExtent,"%.20g: ",(double) v);
+ (void) FormatLocaleString(format,MaxTextExtent,"%.20g: ",(double) v);
(void) ConcatenateString(&message,format);
for (u=0; u < (ssize_t) kernel->width; u++)
{
- (void) FormatMagickString(format,MaxTextExtent,"%g ",*k++);
+ (void) FormatLocaleString(format,MaxTextExtent,"%g ",*k++);
(void) ConcatenateString(&message,format);
}
(void) LogMagickEvent(TransformEvent,GetMagickModule(),"%s",message);
kernel_pixels+=image->columns+kernel->width;
}
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)
{
k=kernel->values;
}
kernel_pixels+=image->columns+kernel->width;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
for (u=0; u < (ssize_t) kernel->height; u++)
{
- pixel.index+=(*k)*kernel_indexes[u];
+ pixel.index+=(*k)*GetIndexPixelComponent(kernel_indexes+u);
k++;
}
kernel_indexes+=image->columns+kernel->width;
}
- filter_indexes[x]=ClampToQuantum(pixel.index);
+ SetIndexPixelComponent(filter_indexes+x,ClampToQuantum(
+ pixel.index));
}
}
else
for (u=0; u < (ssize_t) kernel->height; u++)
{
alpha=(MagickRealType) (QuantumScale*(QuantumRange-
- kernel_pixels[u].opacity));
- pixel.red+=(*k)*alpha*kernel_pixels[u].red;
- pixel.green+=(*k)*alpha*kernel_pixels[u].green;
- pixel.blue+=(*k)*alpha*kernel_pixels[u].blue;
+ GetOpacityPixelComponent(kernel_pixels+u)));
+ pixel.red+=(*k)*alpha*GetRedPixelComponent(kernel_pixels+u);
+ pixel.green+=(*k)*alpha*GetGreenPixelComponent(kernel_pixels+u);
+ pixel.blue+=(*k)*alpha*GetBluePixelComponent(kernel_pixels+u);
gamma+=(*k)*alpha;
k++;
}
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
if ((channel & OpacityChannel) != 0)
{
k=kernel->values;
{
for (u=0; u < (ssize_t) kernel->height; u++)
{
- pixel.opacity+=(*k)*kernel_pixels[u].opacity;
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(kernel_pixels+u);
k++;
}
kernel_pixels+=image->columns+kernel->width;
}
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
alpha=(MagickRealType) (QuantumScale*(QuantumRange-
kernel_pixels[u].opacity));
- pixel.index+=(*k)*alpha*kernel_indexes[u];
+ pixel.index+=(*k)*alpha*GetIndexPixelComponent(
+ kernel_indexes+u);
k++;
}
kernel_pixels+=image->columns+kernel->width;
kernel_indexes+=image->columns+kernel->width;
}
- filter_indexes[x]=ClampToQuantum(gamma*
- GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(filter_indexes+x,ClampToQuantum(gamma*
+ pixel.index));
}
}
indexes++;
k++;
}
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(qixel.red);
+ SetRedPixelComponent(q,ClampToQuantum(qixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(qixel.green);
+ SetGreenPixelComponent(q,ClampToQuantum(qixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(qixel.blue);
+ SetBluePixelComponent(q,ClampToQuantum(qixel.blue));
if ((channel & OpacityChannel) != 0)
- q->opacity=ClampToQuantum(qixel.opacity);
+ SetOpacityPixelComponent(q,ClampToQuantum(qixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- blur_indexes[x]=(IndexPacket) ClampToQuantum(qixel.index);
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(qixel.index));
}
else
{
if (image->colorspace == CMYKColorspace)
{
indexes=GetCacheViewVirtualIndexQueue(image_view);
- qixel.index+=(*k)*alpha*(*indexes);
+ qixel.index+=(*k)*alpha*GetIndexPixelComponent(indexes);
}
gamma+=(*k)*alpha;
k++;
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*qixel.red);
+ SetRedPixelComponent(q,ClampToQuantum(gamma*qixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*qixel.green);
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*qixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*qixel.blue);
+ SetBluePixelComponent(q,ClampToQuantum(gamma*qixel.blue));
if ((channel & OpacityChannel) != 0)
- q->opacity=ClampToQuantum(qixel.opacity);
+ SetOpacityPixelComponent(q,ClampToQuantum(qixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- blur_indexes[x]=(IndexPacket) ClampToQuantum(gamma*qixel.index);
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(gamma*
+ qixel.index));
}
q++;
}
{
degrees+=45.0;
preview_image=RotateImage(thumbnail,degrees,exception);
- (void) FormatMagickString(label,MaxTextExtent,"rotate %g",degrees);
+ (void) FormatLocaleString(label,MaxTextExtent,"rotate %g",degrees);
break;
}
case ShearPreview:
{
degrees+=5.0;
preview_image=ShearImage(thumbnail,degrees,degrees,exception);
- (void) FormatMagickString(label,MaxTextExtent,"shear %gx%g",
+ (void) FormatLocaleString(label,MaxTextExtent,"shear %gx%g",
degrees,2.0*degrees);
break;
}
x=(ssize_t) ((i+1)*thumbnail->columns)/NumberTiles;
y=(ssize_t) ((i+1)*thumbnail->rows)/NumberTiles;
preview_image=RollImage(thumbnail,x,y,exception);
- (void) FormatMagickString(label,MaxTextExtent,"roll %+.20gx%+.20g",
+ (void) FormatLocaleString(label,MaxTextExtent,"roll %+.20gx%+.20g",
(double) x,(double) y);
break;
}
preview_image=CloneImage(thumbnail,0,0,MagickTrue,exception);
if (preview_image == (Image *) NULL)
break;
- (void) FormatMagickString(factor,MaxTextExtent,"100,100,%g",
+ (void) FormatLocaleString(factor,MaxTextExtent,"100,100,%g",
2.0*percentage);
(void) ModulateImage(preview_image,factor);
- (void) FormatMagickString(label,MaxTextExtent,"modulate %s",factor);
+ (void) FormatLocaleString(label,MaxTextExtent,"modulate %s",factor);
break;
}
case SaturationPreview:
preview_image=CloneImage(thumbnail,0,0,MagickTrue,exception);
if (preview_image == (Image *) NULL)
break;
- (void) FormatMagickString(factor,MaxTextExtent,"100,%g",
+ (void) FormatLocaleString(factor,MaxTextExtent,"100,%g",
2.0*percentage);
(void) ModulateImage(preview_image,factor);
- (void) FormatMagickString(label,MaxTextExtent,"modulate %s",factor);
+ (void) FormatLocaleString(label,MaxTextExtent,"modulate %s",factor);
break;
}
case BrightnessPreview:
preview_image=CloneImage(thumbnail,0,0,MagickTrue,exception);
if (preview_image == (Image *) NULL)
break;
- (void) FormatMagickString(factor,MaxTextExtent,"%g",2.0*percentage);
+ (void) FormatLocaleString(factor,MaxTextExtent,"%g",2.0*percentage);
(void) ModulateImage(preview_image,factor);
- (void) FormatMagickString(label,MaxTextExtent,"modulate %s",factor);
+ (void) FormatLocaleString(label,MaxTextExtent,"modulate %s",factor);
break;
}
case GammaPreview:
break;
gamma+=0.4f;
(void) GammaImageChannel(preview_image,DefaultChannels,gamma);
- (void) FormatMagickString(label,MaxTextExtent,"gamma %g",gamma);
+ (void) FormatLocaleString(label,MaxTextExtent,"gamma %g",gamma);
break;
}
case SpiffPreview:
if (preview_image != (Image *) NULL)
for (x=0; x < i; x++)
(void) ContrastImage(preview_image,MagickTrue);
- (void) FormatMagickString(label,MaxTextExtent,"contrast (%.20g)",
+ (void) FormatLocaleString(label,MaxTextExtent,"contrast (%.20g)",
(double) i+1);
break;
}
break;
for (x=0; x < i; x++)
(void) ContrastImage(preview_image,MagickFalse);
- (void) FormatMagickString(label,MaxTextExtent,"+contrast (%.20g)",
+ (void) FormatLocaleString(label,MaxTextExtent,"+contrast (%.20g)",
(double) i+1);
break;
}
quantize_info.number_colors=colors;
quantize_info.colorspace=GRAYColorspace;
(void) QuantizeImage(&quantize_info,preview_image);
- (void) FormatMagickString(label,MaxTextExtent,
+ (void) FormatLocaleString(label,MaxTextExtent,
"-colorspace gray -colors %.20g",(double) colors);
break;
}
colors<<=1;
quantize_info.number_colors=colors;
(void) QuantizeImage(&quantize_info,preview_image);
- (void) FormatMagickString(label,MaxTextExtent,"colors %.20g",(double)
+ (void) FormatLocaleString(label,MaxTextExtent,"colors %.20g",(double)
colors);
break;
}
preview_image=DespeckleImage(thumbnail,exception);
if (preview_image == (Image *) NULL)
break;
- (void) FormatMagickString(label,MaxTextExtent,"despeckle (%.20g)",
+ (void) FormatLocaleString(label,MaxTextExtent,"despeckle (%.20g)",
(double) i+1);
break;
}
{
preview_image=StatisticImage(thumbnail,NonpeakStatistic,(size_t) radius,
(size_t) radius,exception);
- (void) FormatMagickString(label,MaxTextExtent,"noise %g",radius);
+ (void) FormatLocaleString(label,MaxTextExtent,"noise %g",radius);
break;
}
case AddNoisePreview:
}
preview_image=StatisticImage(thumbnail,NonpeakStatistic,(size_t) i,
(size_t) i,exception);
- (void) FormatMagickString(label,MaxTextExtent,"+noise %s",factor);
+ (void) FormatLocaleString(label,MaxTextExtent,"+noise %s",factor);
break;
}
case SharpenPreview:
{
preview_image=SharpenImage(thumbnail,radius,sigma,exception);
- (void) FormatMagickString(label,MaxTextExtent,"sharpen %gx%g",
+ (void) FormatLocaleString(label,MaxTextExtent,"sharpen %gx%g",
radius,sigma);
break;
}
case BlurPreview:
{
preview_image=BlurImage(thumbnail,radius,sigma,exception);
- (void) FormatMagickString(label,MaxTextExtent,"blur %gx%g",radius,
+ (void) FormatLocaleString(label,MaxTextExtent,"blur %gx%g",radius,
sigma);
break;
}
break;
(void) BilevelImage(thumbnail,
(double) (percentage*((MagickRealType) QuantumRange+1.0))/100.0);
- (void) FormatMagickString(label,MaxTextExtent,"threshold %g",
+ (void) FormatLocaleString(label,MaxTextExtent,"threshold %g",
(double) (percentage*((MagickRealType) QuantumRange+1.0))/100.0);
break;
}
case EdgeDetectPreview:
{
preview_image=EdgeImage(thumbnail,radius,exception);
- (void) FormatMagickString(label,MaxTextExtent,"edge %g",radius);
+ (void) FormatLocaleString(label,MaxTextExtent,"edge %g",radius);
break;
}
case SpreadPreview:
{
preview_image=SpreadImage(thumbnail,radius,exception);
- (void) FormatMagickString(label,MaxTextExtent,"spread %g",
+ (void) FormatLocaleString(label,MaxTextExtent,"spread %g",
radius+0.5);
break;
}
break;
(void) SolarizeImage(preview_image,(double) QuantumRange*
percentage/100.0);
- (void) FormatMagickString(label,MaxTextExtent,"solarize %g",
+ (void) FormatLocaleString(label,MaxTextExtent,"solarize %g",
(QuantumRange*percentage)/100.0);
break;
}
degrees+=10.0;
preview_image=ShadeImage(thumbnail,MagickTrue,degrees,degrees,
exception);
- (void) FormatMagickString(label,MaxTextExtent,"shade %gx%g",
+ (void) FormatLocaleString(label,MaxTextExtent,"shade %gx%g",
degrees,degrees);
break;
}
geometry.x=i/2;
geometry.y=i/2;
(void) RaiseImage(preview_image,&geometry,MagickTrue);
- (void) FormatMagickString(label,MaxTextExtent,
+ (void) FormatLocaleString(label,MaxTextExtent,
"raise %.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
geometry.height,(double) geometry.x,(double) geometry.y);
break;
threshold+=0.4f;
(void) SegmentImage(preview_image,RGBColorspace,MagickFalse,threshold,
threshold);
- (void) FormatMagickString(label,MaxTextExtent,"segment %gx%g",
+ (void) FormatLocaleString(label,MaxTextExtent,"segment %gx%g",
threshold,threshold);
break;
}
case SwirlPreview:
{
preview_image=SwirlImage(thumbnail,degrees,exception);
- (void) FormatMagickString(label,MaxTextExtent,"swirl %g",degrees);
+ (void) FormatLocaleString(label,MaxTextExtent,"swirl %g",degrees);
degrees+=45.0;
break;
}
{
degrees+=0.1f;
preview_image=ImplodeImage(thumbnail,degrees,exception);
- (void) FormatMagickString(label,MaxTextExtent,"implode %g",degrees);
+ (void) FormatLocaleString(label,MaxTextExtent,"implode %g",degrees);
break;
}
case WavePreview:
{
degrees+=5.0f;
preview_image=WaveImage(thumbnail,0.5*degrees,2.0*degrees,exception);
- (void) FormatMagickString(label,MaxTextExtent,"wave %gx%g",
+ (void) FormatLocaleString(label,MaxTextExtent,"wave %gx%g",
0.5*degrees,2.0*degrees);
break;
}
case OilPaintPreview:
{
preview_image=OilPaintImage(thumbnail,(double) radius,exception);
- (void) FormatMagickString(label,MaxTextExtent,"paint %g",radius);
+ (void) FormatLocaleString(label,MaxTextExtent,"paint %g",radius);
break;
}
case CharcoalDrawingPreview:
{
preview_image=CharcoalImage(thumbnail,(double) radius,(double) sigma,
exception);
- (void) FormatMagickString(label,MaxTextExtent,"charcoal %gx%g",
+ (void) FormatLocaleString(label,MaxTextExtent,"charcoal %gx%g",
radius,sigma);
break;
}
if (preview_image == (Image *) NULL)
break;
preview_info->quality=(size_t) percentage;
- (void) FormatMagickString(factor,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(factor,MaxTextExtent,"%.20g",(double)
preview_info->quality);
file=AcquireUniqueFileResource(filename);
if (file != -1)
file=close(file)-1;
- (void) FormatMagickString(preview_image->filename,MaxTextExtent,
+ (void) FormatLocaleString(preview_image->filename,MaxTextExtent,
"jpeg:%s",filename);
status=WriteImage(preview_info,preview_image);
if (status != MagickFalse)
}
(void) RelinquishUniqueFileResource(preview_image->filename);
if ((GetBlobSize(preview_image)/1024) >= 1024)
- (void) FormatMagickString(label,MaxTextExtent,"quality %s\n%gmb ",
+ (void) FormatLocaleString(label,MaxTextExtent,"quality %s\n%gmb ",
factor,(double) ((MagickOffsetType) GetBlobSize(preview_image))/
1024.0/1024.0);
else
if (GetBlobSize(preview_image) >= 1024)
- (void) FormatMagickString(label,MaxTextExtent,
+ (void) FormatLocaleString(label,MaxTextExtent,
"quality %s\n%gkb ",factor,(double) ((MagickOffsetType)
GetBlobSize(preview_image))/1024.0);
else
- (void) FormatMagickString(label,MaxTextExtent,"quality %s\n%.20gb ",
+ (void) FormatLocaleString(label,MaxTextExtent,"quality %s\n%.20gb ",
factor,(double) GetBlobSize(thumbnail));
break;
}
normalize=1.0/(fabs((double) normalize) <= MagickEpsilon ? 1.0 :
normalize);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(normalize*qixel.red);
+ SetRedPixelComponent(q,ClampToQuantum(normalize*qixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(normalize*qixel.green);
+ SetGreenPixelComponent(q,ClampToQuantum(normalize*qixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(normalize*qixel.blue);
+ SetBluePixelComponent(q,ClampToQuantum(normalize*qixel.blue));
if ((channel & OpacityChannel) != 0)
- q->opacity=ClampToQuantum(normalize*qixel.opacity);
+ SetOpacityPixelComponent(q,ClampToQuantum(normalize*qixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- blur_indexes[x]=(IndexPacket) ClampToQuantum(normalize*qixel.index);
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(normalize*
+ qixel.index));
}
else
{
normalize=1.0/(fabs((double) normalize) <= MagickEpsilon ? 1.0 :
normalize);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*qixel.red);
+ SetRedPixelComponent(q,ClampToQuantum(gamma*qixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*qixel.green);
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*qixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*qixel.blue);
+ SetBluePixelComponent(q,ClampToQuantum(gamma*qixel.blue));
if ((channel & OpacityChannel) != 0)
- q->opacity=ClampToQuantum(normalize*qixel.opacity);
+ SetOpacityPixelComponent(q,ClampToQuantum(normalize*qixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- blur_indexes[x]=(IndexPacket) ClampToQuantum(gamma*qixel.index);
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(gamma*
+ qixel.index));
}
q++;
}
for (v=0; v < (ssize_t) width; v++)
{
*message='\0';
- (void) FormatMagickString(format,MaxTextExtent,"%.20g: ",(double) v);
+ (void) FormatLocaleString(format,MaxTextExtent,"%.20g: ",(double) v);
(void) ConcatenateString(&message,format);
for (u=0; u < (ssize_t) width; u++)
{
- (void) FormatMagickString(format,MaxTextExtent,"%+f ",*k++);
+ (void) FormatLocaleString(format,MaxTextExtent,"%+f ",*k++);
(void) ConcatenateString(&message,format);
}
(void) LogMagickEvent(TransformEvent,GetMagickModule(),"%s",message);
{
if (SelectiveContrast(p+u+j,q,threshold) != MagickFalse)
{
- pixel.red+=(*k)*(p+u+j)->red;
- pixel.green+=(*k)*(p+u+j)->green;
- pixel.blue+=(*k)*(p+u+j)->blue;
+ pixel.red+=(*k)*GetRedPixelComponent(p+u+j);
+ pixel.green+=(*k)*GetGreenPixelComponent(p+u+j);
+ pixel.blue+=(*k)*GetBluePixelComponent(p+u+j);
gamma+=(*k);
k++;
}
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
}
if ((channel & OpacityChannel) != 0)
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 :
gamma);
SetOpacityPixelComponent(q,ClampToQuantum(gamma*
- GetOpacityPixelComponent(&pixel)));
+ pixel.opacity));
}
}
if (((channel & IndexChannel) != 0) &&
{
if (SelectiveContrast(p+u+j,q,threshold) != MagickFalse)
{
- pixel.index+=(*k)*indexes[x+u+j];
+ pixel.index+=(*k)*GetIndexPixelComponent(indexes+x+u+j);
gamma+=(*k);
k++;
}
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 :
gamma);
- blur_indexes[x]=ClampToQuantum(gamma*
- GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(gamma*
+ pixel.index));
}
}
}
{
alpha=(MagickRealType) (QuantumScale*
GetAlphaPixelComponent(p+u+j));
- pixel.red+=(*k)*alpha*(p+u+j)->red;
- pixel.green+=(*k)*alpha*(p+u+j)->green;
- pixel.blue+=(*k)*alpha*(p+u+j)->blue;
- pixel.opacity+=(*k)*(p+u+j)->opacity;
+ pixel.red+=(*k)*alpha*GetRedPixelComponent(p+u+j);
+ pixel.green+=(*k)*alpha*GetGreenPixelComponent(p+u+j);
+ pixel.blue+=(*k)*alpha*GetBluePixelComponent(p+u+j);
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(p+u+j);
gamma+=(*k)*alpha;
k++;
}
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(gamma*GetRedPixelComponent(&pixel));
+ SetRedPixelComponent(q,ClampToQuantum(gamma*pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(gamma*GetGreenPixelComponent(&pixel));
+ SetGreenPixelComponent(q,ClampToQuantum(gamma*pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(gamma*GetBluePixelComponent(&pixel));
+ SetBluePixelComponent(q,ClampToQuantum(gamma*pixel.blue));
}
if ((channel & OpacityChannel) != 0)
{
{
if (SelectiveContrast(p+u+j,q,threshold) != MagickFalse)
{
- pixel.opacity+=(*k)*(p+u+j)->opacity;
+ pixel.opacity+=(*k)*GetOpacityPixelComponent(p+u+j);
gamma+=(*k);
k++;
}
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 :
gamma);
- SetOpacityPixelComponent(q,
- ClampOpacityPixelComponent(&pixel));
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
}
if (((channel & IndexChannel) != 0) &&
{
alpha=(MagickRealType) (QuantumScale*
GetAlphaPixelComponent(p+u+j));
- pixel.index+=(*k)*alpha*indexes[x+u+j];
+ pixel.index+=(*k)*alpha*GetIndexPixelComponent(indexes+x+
+ u+j);
gamma+=(*k);
k++;
}
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 :
gamma);
- blur_indexes[x]=ClampToQuantum(gamma*
- GetIndexPixelComponent(&pixel));
+ SetIndexPixelComponent(blur_indexes+x,ClampToQuantum(gamma*
+ pixel.index));
}
}
}
}
if (gray != MagickFalse)
{
- q->red=(Quantum) shade;
- q->green=(Quantum) shade;
- q->blue=(Quantum) shade;
+ SetRedPixelComponent(q,shade);
+ SetGreenPixelComponent(q,shade);
+ SetBluePixelComponent(q,shade);
}
else
{
- q->red=ClampToQuantum(QuantumScale*shade*s1->red);
- q->green=ClampToQuantum(QuantumScale*shade*s1->green);
- q->blue=ClampToQuantum(QuantumScale*shade*s1->blue);
+ SetRedPixelComponent(q,ClampToQuantum(QuantumScale*shade*
+ GetRedPixelComponent(s1)));
+ SetGreenPixelComponent(q,ClampToQuantum(QuantumScale*shade*
+ GetGreenPixelComponent(s1)));
+ SetBluePixelComponent(q,ClampToQuantum(QuantumScale*shade*
+ GetBluePixelComponent(s1)));
}
q->opacity=s1->opacity;
s0++;
#define SpreadImageTag "Spread/Image"
CacheView
- *image_view;
+ *image_view,
+ *spread_view;
Image
*spread_image;
GetMagickPixelPacket(spread_image,&bias);
width=GetOptimalKernelWidth1D(radius,0.5);
random_info=AcquireRandomInfoThreadSet();
- image_view=AcquireCacheView(spread_image);
+ image_view=AcquireCacheView(image);
+ spread_view=AcquireCacheView(spread_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(1)
#endif
if (status == MagickFalse)
continue;
- q=QueueCacheViewAuthenticPixels(image_view,0,y,spread_image->columns,1,
+ q=QueueCacheViewAuthenticPixels(spread_view,0,y,spread_image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
- indexes=GetCacheViewAuthenticIndexQueue(image_view);
+ indexes=GetCacheViewAuthenticIndexQueue(spread_view);
pixel=bias;
for (x=0; x < (ssize_t) spread_image->columns; x++)
{
- (void) InterpolatePixelPacket(image,image_view,image->interpolate,
- (double) x+width*(GetPseudoRandomValue(random_info[id])-0.5),(double)
- y+width*(GetPseudoRandomValue(random_info[id])-0.5),&pixel,
- exception);
+ (void) InterpolateMagickPixelPacket(image,image_view,
+ UndefinedInterpolatePixel,(double) x+width*(GetPseudoRandomValue(
+ random_info[id])-0.5),(double) y+width*(GetPseudoRandomValue(
+ random_info[id])-0.5),&pixel,exception);
SetPixelPacket(spread_image,&pixel,q,indexes+x);
q++;
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (SyncCacheViewAuthenticPixels(spread_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
status=MagickFalse;
}
}
+ spread_view=DestroyCacheView(spread_view);
image_view=DestroyCacheView(image_view);
random_info=DestroyRandomInfoThreadSet(random_info);
return(spread_image);
MagickPixelPacket
pixel;
+ MagickRealType
+ sum;
+
register SkipList
*list;
channel;
size_t
- color,
- mean;
+ color;
ssize_t
count;
list=pixel_list->lists+channel;
color=65536L;
count=0;
- mean=0;
+ sum=0.0;
do
{
color=list->nodes[color].next[0];
- mean+=list->nodes[color].count*color;
+ sum+=(MagickRealType) list->nodes[color].count*color;
count+=list->nodes[color].count;
} while (count < (ssize_t) pixel_list->length);
- channels[channel]=(unsigned short) (mean/pixel_list->length);
+ sum/=pixel_list->length;
+ channels[channel]=(unsigned short) sum;
}
GetMagickPixelPacket((const Image *) NULL,&pixel);
pixel.red=(MagickRealType) ScaleShortToQuantum(channels[0]);
return(pixel);
}
+static MagickPixelPacket GetStandardDeviationPixelList(PixelList *pixel_list)
+{
+ MagickPixelPacket
+ pixel;
+
+ MagickRealType
+ sum,
+ sum_squared;
+
+ register SkipList
+ *list;
+
+ register ssize_t
+ channel;
+
+ size_t
+ color;
+
+ ssize_t
+ count;
+
+ unsigned short
+ channels[ListChannels];
+
+ /*
+ Find the standard-deviation value for each of the color.
+ */
+ for (channel=0; channel < 5; channel++)
+ {
+ list=pixel_list->lists+channel;
+ color=65536L;
+ count=0;
+ sum=0.0;
+ sum_squared=0.0;
+ do
+ {
+ register ssize_t
+ i;
+
+ color=list->nodes[color].next[0];
+ sum+=(MagickRealType) list->nodes[color].count*color;
+ for (i=0; i < (ssize_t) list->nodes[color].count; i++)
+ sum_squared+=((MagickRealType) color)*((MagickRealType) color);
+ count+=list->nodes[color].count;
+ } while (count < (ssize_t) pixel_list->length);
+ sum/=pixel_list->length;
+ sum_squared/=pixel_list->length;
+ channels[channel]=(unsigned short) sqrt(sum_squared-(sum*sum));
+ }
+ GetMagickPixelPacket((const Image *) NULL,&pixel);
+ pixel.red=(MagickRealType) ScaleShortToQuantum(channels[0]);
+ pixel.green=(MagickRealType) ScaleShortToQuantum(channels[1]);
+ pixel.blue=(MagickRealType) ScaleShortToQuantum(channels[2]);
+ pixel.opacity=(MagickRealType) ScaleShortToQuantum(channels[3]);
+ pixel.index=(MagickRealType) ScaleShortToQuantum(channels[4]);
+ return(pixel);
+}
+
static inline void InsertPixelList(const Image *image,const PixelPacket *pixel,
const IndexPacket *indexes,PixelList *pixel_list)
{
unsigned short
index;
- index=ScaleQuantumToShort(pixel->red);
+ index=ScaleQuantumToShort(GetRedPixelComponent(pixel));
signature=pixel_list->lists[0].nodes[index].signature;
if (signature == pixel_list->signature)
pixel_list->lists[0].nodes[index].count++;
else
AddNodePixelList(pixel_list,0,index);
- index=ScaleQuantumToShort(pixel->green);
+ index=ScaleQuantumToShort(GetGreenPixelComponent(pixel));
signature=pixel_list->lists[1].nodes[index].signature;
if (signature == pixel_list->signature)
pixel_list->lists[1].nodes[index].count++;
else
AddNodePixelList(pixel_list,1,index);
- index=ScaleQuantumToShort(pixel->blue);
+ index=ScaleQuantumToShort(GetBluePixelComponent(pixel));
signature=pixel_list->lists[2].nodes[index].signature;
if (signature == pixel_list->signature)
pixel_list->lists[2].nodes[index].count++;
else
AddNodePixelList(pixel_list,2,index);
- index=ScaleQuantumToShort(pixel->opacity);
+ index=ScaleQuantumToShort(GetOpacityPixelComponent(pixel));
signature=pixel_list->lists[3].nodes[index].signature;
if (signature == pixel_list->signature)
pixel_list->lists[3].nodes[index].count++;
else
AddNodePixelList(pixel_list,3,index);
if (image->colorspace == CMYKColorspace)
- index=ScaleQuantumToShort(*indexes);
+ index=ScaleQuantumToShort(GetIndexPixelComponent(indexes));
signature=pixel_list->lists[4].nodes[index].signature;
if (signature == pixel_list->signature)
pixel_list->lists[4].nodes[index].count++;
AddNodePixelList(pixel_list,4,index);
}
+static inline MagickRealType MagickAbsoluteValue(const MagickRealType x)
+{
+ if (x < 0)
+ return(-x);
+ return(x);
+}
+
static void ResetPixelList(PixelList *pixel_list)
{
int
r+=image->columns+StatisticWidth;
s+=image->columns+StatisticWidth;
}
+ GetMagickPixelPacket(image,&pixel);
+ SetMagickPixelPacket(image,p+StatisticWidth*StatisticHeight/2,indexes+
+ StatisticWidth*StatisticHeight/2+x,&pixel);
switch (type)
{
+ case GradientStatistic:
+ {
+ MagickPixelPacket
+ maximum,
+ minimum;
+
+ minimum=GetMinimumPixelList(pixel_list[id]);
+ maximum=GetMaximumPixelList(pixel_list[id]);
+ pixel.red=MagickAbsoluteValue(maximum.red-minimum.red);
+ pixel.green=MagickAbsoluteValue(maximum.green-minimum.green);
+ pixel.blue=MagickAbsoluteValue(maximum.blue-minimum.blue);
+ pixel.opacity=MagickAbsoluteValue(maximum.opacity-minimum.opacity);
+ if (image->colorspace == CMYKColorspace)
+ pixel.index=MagickAbsoluteValue(maximum.index-minimum.index);
+ break;
+ }
case MaximumStatistic:
{
pixel=GetMaximumPixelList(pixel_list[id]);
pixel=GetNonpeakPixelList(pixel_list[id]);
break;
}
+ case StandardDeviationStatistic:
+ {
+ pixel=GetStandardDeviationPixelList(pixel_list[id]);
+ break;
+ }
}
if ((channel & RedChannel) != 0)
- q->red=ClampToQuantum(pixel.red);
+ SetRedPixelComponent(q,ClampToQuantum(pixel.red));
if ((channel & GreenChannel) != 0)
- q->green=ClampToQuantum(pixel.green);
+ SetGreenPixelComponent(q,ClampToQuantum(pixel.green));
if ((channel & BlueChannel) != 0)
- q->blue=ClampToQuantum(pixel.blue);
+ SetBluePixelComponent(q,ClampToQuantum(pixel.blue));
if (((channel & OpacityChannel) != 0) &&
(image->matte != MagickFalse))
- q->opacity=ClampToQuantum(pixel.opacity);
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- statistic_indexes[x]=(IndexPacket) ClampToQuantum(pixel.index);
+ SetIndexPixelComponent(statistic_indexes+x,ClampToQuantum(pixel.index));
p++;
q++;
}
{
if ((channel & RedChannel) != 0)
{
- pixel.red=p->red-(MagickRealType) q->red;
+ pixel.red=GetRedPixelComponent(p)-(MagickRealType)
+ GetRedPixelComponent(q);
if (fabs(2.0*pixel.red) < quantum_threshold)
pixel.red=(MagickRealType) GetRedPixelComponent(p);
else
- pixel.red=(MagickRealType) p->red+(pixel.red*amount);
- SetRedPixelComponent(q,ClampRedPixelComponent(&pixel));
+ pixel.red=(MagickRealType) GetRedPixelComponent(p)+
+ (pixel.red*amount);
+ SetRedPixelComponent(q,ClampToQuantum(pixel.red));
}
if ((channel & GreenChannel) != 0)
{
- pixel.green=p->green-(MagickRealType) q->green;
+ pixel.green=GetGreenPixelComponent(p)-(MagickRealType) q->green;
if (fabs(2.0*pixel.green) < quantum_threshold)
pixel.green=(MagickRealType) GetGreenPixelComponent(p);
else
- pixel.green=(MagickRealType) p->green+(pixel.green*amount);
- SetGreenPixelComponent(q,ClampGreenPixelComponent(&pixel));
+ pixel.green=(MagickRealType) GetGreenPixelComponent(p)+(pixel.green*amount);
+ SetGreenPixelComponent(q,ClampToQuantum(pixel.green));
}
if ((channel & BlueChannel) != 0)
{
- pixel.blue=p->blue-(MagickRealType) q->blue;
+ pixel.blue=GetBluePixelComponent(p)-(MagickRealType) q->blue;
if (fabs(2.0*pixel.blue) < quantum_threshold)
pixel.blue=(MagickRealType) GetBluePixelComponent(p);
else
- pixel.blue=(MagickRealType) p->blue+(pixel.blue*amount);
- SetBluePixelComponent(q,ClampBluePixelComponent(&pixel));
+ pixel.blue=(MagickRealType) GetBluePixelComponent(p)+(pixel.blue*amount);
+ SetBluePixelComponent(q,ClampToQuantum(pixel.blue));
}
if ((channel & OpacityChannel) != 0)
{
- pixel.opacity=p->opacity-(MagickRealType) q->opacity;
+ pixel.opacity=GetOpacityPixelComponent(p)-(MagickRealType) q->opacity;
if (fabs(2.0*pixel.opacity) < quantum_threshold)
pixel.opacity=(MagickRealType) GetOpacityPixelComponent(p);
else
- pixel.opacity=p->opacity+(pixel.opacity*amount);
- SetOpacityPixelComponent(q,ClampOpacityPixelComponent(&pixel));
+ pixel.opacity=GetOpacityPixelComponent(p)+(pixel.opacity*amount);
+ SetOpacityPixelComponent(q,ClampToQuantum(pixel.opacity));
}
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
{
- pixel.index=indexes[x]-(MagickRealType) unsharp_indexes[x];
+ pixel.index=GetIndexPixelComponent(indexes+x)-(MagickRealType)
+ GetIndexPixelComponent(unsharp_indexes+x);
if (fabs(2.0*pixel.index) < quantum_threshold)
- pixel.index=(MagickRealType) indexes[x];
+ pixel.index=(MagickRealType) GetIndexPixelComponent(indexes+x);
else
- pixel.index=(MagickRealType) indexes[x]+(pixel.index*amount);
- unsharp_indexes[x]=ClampToQuantum(pixel.index);
+ pixel.index=(MagickRealType) GetIndexPixelComponent(indexes+x)+
+ (pixel.index*amount);
+ SetIndexPixelComponent(unsharp_indexes+x,ClampToQuantum(pixel.index));
}
p++;
q++;