diff --git a/magick/effect.c b/magick/effect.c
index 7956a3c..2a7b6b6 100644
--- a/magick/effect.c
+++ b/magick/effect.c
@@ -141,6 +141,11 @@
#define AdaptiveBlurImageTag "Convolve/Image"
#define MagickSigma (fabs(sigma) <= MagickEpsilon ? 1.0 : sigma)
+ CacheView
+ *blur_view,
+ *edge_view,
+ *image_view;
+
double
**kernel,
normalize;
@@ -170,11 +175,6 @@
unsigned long
width;
- CacheView
- *blur_view,
- *edge_view,
- *image_view;
-
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
@@ -337,15 +337,16 @@
alpha=1.0;
if (((channel & OpacityChannel) != 0) &&
(image->matte != MagickFalse))
- alpha=(MagickRealType) (QuantumScale*(QuantumRange-p->opacity));
+ alpha=(MagickRealType) (QuantumScale*(QuantumRange-
+ GetOpacitySample(p)));
if ((channel & RedChannel) != 0)
- pixel.red+=(*k)*alpha*p->red;
+ pixel.red+=(*k)*alpha*GetRedSample(p);
if ((channel & GreenChannel) != 0)
- pixel.green+=(*k)*alpha*p->green;
+ pixel.green+=(*k)*alpha*GetGreenSample(p);
if ((channel & BlueChannel) != 0)
- pixel.blue+=(*k)*alpha*p->blue;
+ pixel.blue+=(*k)*alpha*GetBlueSample(p);
if ((channel & OpacityChannel) != 0)
- pixel.opacity+=(*k)*p->opacity;
+ pixel.opacity+=(*k)*GetOpacitySample(p);
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
pixel.index+=(*k)*alpha*indexes[x+(width-i)*v+u];
@@ -356,16 +357,16 @@
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
if ((channel & OpacityChannel) != 0)
q->opacity=RoundToQuantum(pixel.opacity);
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- blur_indexes[x]=RoundToQuantum(gamma*pixel.index);
+ blur_indexes[x]=RoundToQuantum(gamma*GetIndexSample(&pixel));
q++;
r++;
}
@@ -456,6 +457,11 @@
#define AdaptiveSharpenImageTag "Convolve/Image"
#define MagickSigma (fabs(sigma) <= MagickEpsilon ? 1.0 : sigma)
+ CacheView
+ *sharp_view,
+ *edge_view,
+ *image_view;
+
double
**kernel,
normalize;
@@ -485,11 +491,6 @@
unsigned long
width;
- CacheView
- *sharp_view,
- *edge_view,
- *image_view;
-
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
@@ -652,15 +653,15 @@
alpha=1.0;
if (((channel & OpacityChannel) != 0) &&
(image->matte != MagickFalse))
- alpha=(MagickRealType) (QuantumScale*(QuantumRange-p->opacity));
+ alpha=(MagickRealType) (QuantumScale*(QuantumRange-GetOpacitySample(p)));
if ((channel & RedChannel) != 0)
- pixel.red+=(*k)*alpha*p->red;
+ pixel.red+=(*k)*alpha*GetRedSample(p);
if ((channel & GreenChannel) != 0)
- pixel.green+=(*k)*alpha*p->green;
+ pixel.green+=(*k)*alpha*GetGreenSample(p);
if ((channel & BlueChannel) != 0)
- pixel.blue+=(*k)*alpha*p->blue;
+ pixel.blue+=(*k)*alpha*GetBlueSample(p);
if ((channel & OpacityChannel) != 0)
- pixel.opacity+=(*k)*p->opacity;
+ pixel.opacity+=(*k)*GetOpacitySample(p);
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
pixel.index+=(*k)*alpha*indexes[x+(width-i)*v+u];
@@ -671,16 +672,16 @@
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
if ((channel & OpacityChannel) != 0)
q->opacity=RoundToQuantum(pixel.opacity);
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
- sharp_indexes[x]=RoundToQuantum(gamma*pixel.index);
+ sharp_indexes[x]=RoundToQuantum(gamma*GetIndexSample(&pixel));
q++;
r++;
}
@@ -806,6 +807,10 @@
{
#define BlurImageTag "Blur/Image"
+ CacheView
+ *blur_view,
+ *image_view;
+
double
*kernel;
@@ -829,10 +834,6 @@
unsigned long
width;
- CacheView
- *blur_view,
- *image_view;
-
/*
Initialize blur image attributes.
*/
@@ -1008,11 +1009,11 @@
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
if ((channel & OpacityChannel) != 0)
{
k=kernel;
@@ -1043,7 +1044,7 @@
kernel_pixels++;
kernel_indexes++;
}
- blur_indexes[x]=RoundToQuantum(gamma*pixel.index);
+ blur_indexes[x]=RoundToQuantum(gamma*GetIndexSample(&pixel));
}
}
p++;
@@ -1186,11 +1187,11 @@
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
if ((channel & OpacityChannel) != 0)
{
k=kernel;
@@ -1221,7 +1222,7 @@
kernel_pixels++;
kernel_indexes++;
}
- blur_indexes[y]=RoundToQuantum(gamma*pixel.index);
+ blur_indexes[y]=RoundToQuantum(gamma*GetIndexSample(&pixel));
}
}
p++;
@@ -1304,6 +1305,10 @@
{
#define ConvolveImageTag "Convolve/Image"
+ CacheView
+ *convolve_view,
+ *image_view;
+
double
*normal_kernel;
@@ -1329,10 +1334,6 @@
unsigned long
width;
- CacheView
- *convolve_view,
- *image_view;
-
/*
Initialize convolve image attributes.
*/
@@ -1543,11 +1544,11 @@
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
if ((channel & OpacityChannel) != 0)
{
k=normal_kernel;
@@ -1584,7 +1585,7 @@
kernel_pixels+=image->columns+width;
kernel_indexes+=image->columns+width;
}
- convolve_indexes[x]=RoundToQuantum(gamma*pixel.index);
+ convolve_indexes[x]=RoundToQuantum(gamma*GetIndexSample(&pixel));
}
}
p++;
@@ -1885,10 +1886,10 @@
{
switch (channel)
{
- case 0: pixel[j]=p->red; break;
- case 1: pixel[j]=p->green; break;
- case 2: pixel[j]=p->blue; break;
- case 3: pixel[j]=p->opacity; break;
+ case 0: pixel[j]=GetRedSample(p); break;
+ case 1: pixel[j]=GetGreenSample(p); break;
+ case 2: pixel[j]=GetBlueSample(p); break;
+ case 3: pixel[j]=GetOpacitySample(p); break;
default: break;
}
p++;
@@ -2394,11 +2395,11 @@
}
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
if ((channel & OpacityChannel) != 0)
{
k=normal_kernel;
@@ -2435,7 +2436,7 @@
kernel_pixels+=image->columns+kernel->width;
kernel_indexes+=image->columns+kernel->width;
}
- filter_indexes[x]=RoundToQuantum(gamma*pixel.index);
+ filter_indexes[x]=RoundToQuantum(gamma*GetIndexSample(&pixel));
}
}
p++;
@@ -2889,6 +2890,10 @@
{
#define MedianFilterImageTag "MedianFilter/Image"
+ CacheView
+ *image_view,
+ *median_view;
+
Image
*median_image;
@@ -2905,10 +2910,6 @@
unsigned long
width;
- CacheView
- *image_view,
- *median_view;
-
/*
Initialize median image attributes.
*/
@@ -3126,6 +3127,10 @@
y;
} OffsetInfo;
+ CacheView
+ *blur_view,
+ *image_view;
+
double
*kernel;
@@ -3154,10 +3159,6 @@
unsigned long
width;
- CacheView
- *blur_view,
- *image_view;
-
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
@@ -3899,6 +3900,10 @@
MagickExport Image *RadialBlurImageChannel(const Image *image,
const ChannelType channel,const double angle,ExceptionInfo *exception)
{
+ CacheView
+ *blur_view,
+ *image_view;
+
Image
*blur_image;
@@ -3928,10 +3933,6 @@
unsigned long
n;
- CacheView
- *blur_view,
- *image_view;
-
/*
Allocate blur image.
*/
@@ -4622,11 +4623,11 @@
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
}
if ((channel & OpacityChannel) != 0)
{
@@ -4649,7 +4650,7 @@
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 :
gamma);
- q->opacity=RoundToQuantum(gamma*pixel.opacity);
+ q->opacity=RoundToQuantum(gamma*GetOpacitySample(&pixel));
}
}
if (((channel & IndexChannel) != 0) &&
@@ -4674,7 +4675,7 @@
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 :
gamma);
- blur_indexes[x]=RoundToQuantum(gamma*pixel.index);
+ blur_indexes[x]=RoundToQuantum(gamma*GetIndexSample(&pixel));
}
}
}
@@ -4705,11 +4706,11 @@
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
if ((channel & RedChannel) != 0)
- q->red=RoundToQuantum(gamma*pixel.red);
+ q->red=RoundToQuantum(gamma*GetRedSample(&pixel));
if ((channel & GreenChannel) != 0)
- q->green=RoundToQuantum(gamma*pixel.green);
+ q->green=RoundToQuantum(gamma*GetGreenSample(&pixel));
if ((channel & BlueChannel) != 0)
- q->blue=RoundToQuantum(gamma*pixel.blue);
+ q->blue=RoundToQuantum(gamma*GetBlueSample(&pixel));
}
if ((channel & OpacityChannel) != 0)
{
@@ -4759,7 +4760,7 @@
{
gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 :
gamma);
- blur_indexes[x]=RoundToQuantum(gamma*pixel.index);
+ blur_indexes[x]=RoundToQuantum(gamma*GetIndexSample(&pixel));
}
}
}
@@ -4829,6 +4830,10 @@
{
#define ShadeImageTag "Shade/Image"
+ CacheView
+ *image_view,
+ *shade_view;
+
Image
*shade_image;
@@ -4842,10 +4847,6 @@
PrimaryInfo
light;
- CacheView
- *image_view,
- *shade_view;
-
/*
Initialize shaded image attributes.
*/
@@ -5299,6 +5300,10 @@
{
#define SharpenImageTag "Sharpen/Image"
+ CacheView
+ *image_view,
+ *unsharp_view;
+
Image
*unsharp_image;
@@ -5315,10 +5320,6 @@
MagickRealType
quantum_threshold;
- CacheView
- *image_view,
- *unsharp_view;
-
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
@@ -5378,7 +5379,7 @@
{
pixel.red=p->red-(MagickRealType) q->red;
if (fabs(2.0*pixel.red) < quantum_threshold)
- pixel.red=(MagickRealType) p->red;
+ pixel.red=(MagickRealType) GetRedSample(p);
else
pixel.red=(MagickRealType) p->red+(pixel.red*amount);
q->red=RoundToQuantum(pixel.red);
@@ -5387,7 +5388,7 @@
{
pixel.green=p->green-(MagickRealType) q->green;
if (fabs(2.0*pixel.green) < quantum_threshold)
- pixel.green=(MagickRealType) p->green;
+ pixel.green=(MagickRealType) GetGreenSample(p);
else
pixel.green=(MagickRealType) p->green+(pixel.green*amount);
q->green=RoundToQuantum(pixel.green);
@@ -5396,7 +5397,7 @@
{
pixel.blue=p->blue-(MagickRealType) q->blue;
if (fabs(2.0*pixel.blue) < quantum_threshold)
- pixel.blue=(MagickRealType) p->blue;
+ pixel.blue=(MagickRealType) GetBlueSample(p);
else
pixel.blue=(MagickRealType) p->blue+(pixel.blue*amount);
q->blue=RoundToQuantum(pixel.blue);
@@ -5405,7 +5406,7 @@
{
pixel.opacity=p->opacity-(MagickRealType) q->opacity;
if (fabs(2.0*pixel.opacity) < quantum_threshold)
- pixel.opacity=(MagickRealType) p->opacity;
+ pixel.opacity=(MagickRealType) GetOpacitySample(p);
else
pixel.opacity=p->opacity+(pixel.opacity*amount);
q->opacity=RoundToQuantum(pixel.opacity);