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++)
{
- 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++;
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++;
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++;
}
break;
}
}
- preview_image=StatisticImage(thumbnail,NonpeakStatistic,i,i,
- exception);
+ preview_image=StatisticImage(thumbnail,NonpeakStatistic,(size_t) i,
+ (size_t) i,exception);
(void) FormatMagickString(label,MaxTextExtent,"+noise %s",factor);
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++;
}
{
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;
RandomInfo
**restrict random_info;
- ResampleFilter
- **restrict resample_filter;
-
size_t
width;
progress=0;
GetMagickPixelPacket(spread_image,&bias);
width=GetOptimalKernelWidth1D(radius,0.5);
- resample_filter=AcquireResampleFilterThreadSet(image,
- UndefinedVirtualPixelMethod,MagickTrue,exception);
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) ResamplePixelColor(resample_filter[id],(double) x+width*
- (GetPseudoRandomValue(random_info[id])-0.5),(double) y+width*
- (GetPseudoRandomValue(random_info[id])-0.5),&pixel);
+ (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);
- resample_filter=DestroyResampleFilterThreadSet(resample_filter);
return(spread_image);
}
\f
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% StatisticImage() makes each pixel the min / max / median / mode / etc. of
-% the neighborhood of the specified radius.
+% the neighborhood of the specified width and height.
%
% The format of the StatisticImage method is:
%
{
list->nodes[color].next[level]=list->nodes[update[level]].next[level];
list->nodes[update[level]].next[level]=color;
- }
- while (level-- > 0);
+ } while (level-- > 0);
}
static MagickPixelPacket GetMaximumPixelList(PixelList *pixel_list)
size_t
color,
+ maximum;
+
+ ssize_t
count;
unsigned short
for (channel=0; channel < 5; channel++)
{
list=pixel_list->lists+channel;
- color=65536UL;
+ color=65536L;
count=0;
+ maximum=list->nodes[color].next[0];
do
{
color=list->nodes[color].next[0];
+ if (color > maximum)
+ maximum=color;
count+=list->nodes[color].count;
- } while (count <= pixel_list->length);
- channels[channel]=(unsigned short) color;
+ } while (count < (ssize_t) pixel_list->length);
+ channels[channel]=(unsigned short) maximum;
+ }
+ 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 MagickPixelPacket GetMeanPixelList(PixelList *pixel_list)
+{
+ MagickPixelPacket
+ pixel;
+
+ MagickRealType
+ sum;
+
+ register SkipList
+ *list;
+
+ register ssize_t
+ channel;
+
+ size_t
+ color;
+
+ ssize_t
+ count;
+
+ unsigned short
+ channels[ListChannels];
+
+ /*
+ Find the mean value for each of the color.
+ */
+ for (channel=0; channel < 5; channel++)
+ {
+ list=pixel_list->lists+channel;
+ color=65536L;
+ count=0;
+ sum=0.0;
+ do
+ {
+ color=list->nodes[color].next[0];
+ sum+=(MagickRealType) list->nodes[color].count*color;
+ count+=list->nodes[color].count;
+ } while (count < (ssize_t) pixel_list->length);
+ sum/=pixel_list->length;
+ channels[channel]=(unsigned short) sum;
}
GetMagickPixelPacket((const Image *) NULL,&pixel);
pixel.red=(MagickRealType) ScaleShortToQuantum(channels[0]);
channel;
size_t
- color,
+ color;
+
+ ssize_t
count;
unsigned short
for (channel=0; channel < 5; channel++)
{
list=pixel_list->lists+channel;
- color=65536UL;
+ color=65536L;
count=0;
do
{
color=list->nodes[color].next[0];
count+=list->nodes[color].count;
- } while (count <= (pixel_list->length >> 1));
+ } while (count <= (ssize_t) (pixel_list->length >> 1));
channels[channel]=(unsigned short) color;
}
GetMagickPixelPacket((const Image *) NULL,&pixel);
channel;
size_t
- color;
+ color,
+ minimum;
+
+ ssize_t
+ count;
unsigned short
channels[ListChannels];
for (channel=0; channel < 5; channel++)
{
list=pixel_list->lists+channel;
+ count=0;
color=65536UL;
- color=list->nodes[color].next[0];
- channels[channel]=(unsigned short) color;
+ minimum=list->nodes[color].next[0];
+ do
+ {
+ color=list->nodes[color].next[0];
+ if (color < minimum)
+ minimum=color;
+ count+=list->nodes[color].count;
+ } while (count < (ssize_t) pixel_list->length);
+ channels[channel]=(unsigned short) minimum;
}
GetMagickPixelPacket((const Image *) NULL,&pixel);
pixel.red=(MagickRealType) ScaleShortToQuantum(channels[0]);
size_t
color,
- count,
max_count,
mode;
+ ssize_t
+ count;
+
unsigned short
channels[5];
for (channel=0; channel < 5; channel++)
{
list=pixel_list->lists+channel;
- color=65536UL;
+ color=65536L;
mode=color;
max_count=list->nodes[mode].count;
count=0;
max_count=list->nodes[mode].count;
}
count+=list->nodes[color].count;
- } while (count <= pixel_list->length);
+ } while (count < (ssize_t) pixel_list->length);
channels[channel]=(unsigned short) mode;
}
GetMagickPixelPacket((const Image *) NULL,&pixel);
size_t
color,
- count,
next,
previous;
+ ssize_t
+ count;
+
unsigned short
channels[5];
/*
- Finds the non peak value for each of the color.
+ Finds the non peak value for each of the colors.
*/
for (channel=0; channel < 5; channel++)
{
list=pixel_list->lists+channel;
- color=65536UL;
+ color=65536L;
next=list->nodes[color].next[0];
count=0;
do
color=next;
next=list->nodes[color].next[0];
count+=list->nodes[color].count;
- } while (count <= (pixel_list->length >> 1));
+ } while (count <= (ssize_t) (pixel_list->length >> 1));
if ((previous == 65536UL) && (next != 65536UL))
color=next;
else
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
const ChannelType channel,const StatisticType type,const size_t width,
const size_t height,ExceptionInfo *exception)
{
-#define StatisticWidth (width == 0 ? 3 : width)
-#define StatisticHeight (height == 0 ? 3 : height)
+#define StatisticWidth \
+ (width == 0 ? GetOptimalKernelWidth2D((double) width,0.5) : width)
+#define StatisticHeight \
+ (height == 0 ? GetOptimalKernelWidth2D((double) height,0.5) : height)
#define StatisticImageTag "Statistic/Image"
CacheView
ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
}
/*
- Reduce statistics image.
+ Make each pixel the min / max / median / mode / etc. of the neighborhood.
*/
status=MagickTrue;
progress=0;
p=GetCacheViewVirtualPixels(image_view,-((ssize_t) StatisticWidth/2L),y-
(ssize_t) (StatisticHeight/2L),image->columns+StatisticWidth,
StatisticHeight,exception);
- q=QueueCacheViewAuthenticPixels(statistic_view,0,y,
- statistic_image->columns,1,exception);
+ q=QueueCacheViewAuthenticPixels(statistic_view,0,y,statistic_image->columns, 1,exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
{
status=MagickFalse;
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]);
break;
}
+ case MeanStatistic:
+ {
+ pixel=GetMeanPixelList(pixel_list[id]);
+ break;
+ }
case MedianStatistic:
default:
{
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);
- if ((image->matte != MagickFalse) && ((channel & OpacityChannel) != 0))
- q->opacity=ClampToQuantum(pixel.opacity);
+ SetBluePixelComponent(q,ClampToQuantum(pixel.blue));
+ if (((channel & OpacityChannel) != 0) &&
+ (image->matte != MagickFalse))
+ 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++;