diff --git a/coders/aai.c b/coders/aai.c
index 6a4f83b..5b49257 100644
--- a/coders/aai.c
+++ b/coders/aai.c
@@ -172,9 +172,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
if (*p == 254)
*p=255;
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p));
diff --git a/coders/avs.c b/coders/avs.c
index dac7038..ab182df 100644
--- a/coders/avs.c
+++ b/coders/avs.c
@@ -173,9 +173,9 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
if (q->opacity != OpaqueOpacity)
image->matte=MagickTrue;
q++;
diff --git a/coders/bmp.c b/coders/bmp.c
index e9d3396..7c3c13a 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -1202,9 +1202,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
SetOpacityPixelComponent(q,OpaqueOpacity);
q++;
}
diff --git a/coders/dib.c b/coders/dib.c
index c298bdf..2dac35d 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -829,11 +829,11 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
if (image->matte != MagickFalse)
- q->opacity=ScaleCharToQuantum(*p++);
+ SetOpacityPixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/fits.c b/coders/fits.c
index 93a7d20..8434e0a 100644
--- a/coders/fits.c
+++ b/coders/fits.c
@@ -447,8 +447,8 @@
pixel=GetFITSPixel(image,fits_info.bits_per_pixel);
q->red=(Quantum) ClampToQuantum(scale*(fits_info.scale*(pixel-
fits_info.min_data)+fits_info.zero));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/jp2.c b/coders/jp2.c
index 9c63098..c1091a6 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -537,8 +537,8 @@
{
pixel=(QuantumAny) jas_matrix_getv(pixels[0],x/x_step[0]);
q->red=(Quantum) ScaleAnyToQuantum((QuantumAny) pixel,range[0]);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
break;
diff --git a/coders/mtv.c b/coders/mtv.c
index 77dceb0..306173c 100644
--- a/coders/mtv.c
+++ b/coders/mtv.c
@@ -176,9 +176,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
SetOpacityPixelComponent(q,OpaqueOpacity);
q++;
}
diff --git a/coders/pict.c b/coders/pict.c
index d6c8a3d..6168b47 100644
--- a/coders/pict.c
+++ b/coders/pict.c
@@ -1204,7 +1204,7 @@
if (p > (pixels+extent+2*image->columns))
ThrowReaderException(CorruptImageError,
"NotEnoughPixelData");
- q->red=ScaleCharToQuantum(*p);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
q->green=ScaleCharToQuantum(
*(p+tile_image->columns));
q->blue=ScaleCharToQuantum(
diff --git a/coders/pnm.c b/coders/pnm.c
index 6a0290f..f84458c 100644
--- a/coders/pnm.c
+++ b/coders/pnm.c
@@ -441,8 +441,8 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
q->red=(Quantum) (PNMInteger(image,2) == 0 ? QuantumRange : 0);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -496,8 +496,8 @@
q->red=(Quantum) intensity;
if (scale != (Quantum *) NULL)
q->red=scale[ConstrainPixel(image,(ssize_t) intensity,max_value)];
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -730,8 +730,8 @@
{
p=PushCharPixel(p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
}
@@ -744,8 +744,8 @@
{
p=PushShortPixel(MSBEndian,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
}
@@ -830,9 +830,9 @@
if (image->depth == 8)
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q->opacity=OpaqueOpacity;
q++;
}
@@ -1026,8 +1026,8 @@
{
p=PushCharPixel(p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
@@ -1047,8 +1047,8 @@
{
p=PushShortPixel(MSBEndian,p,&pixel);
SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
diff --git a/coders/psd.c b/coders/psd.c
index 8df88d5..5c1aca8 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -643,8 +643,8 @@
q->red=pixel;
if (channels == 1)
{
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
}
if (image->storage_class == PseudoClass)
{
diff --git a/coders/rle.c b/coders/rle.c
index 42a689e..e5662d0 100644
--- a/coders/rle.c
+++ b/coders/rle.c
@@ -443,9 +443,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
if (image->matte != MagickFalse)
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
q++;
diff --git a/coders/sgi.c b/coders/sgi.c
index b93c0c9..6cf92ea 100644
--- a/coders/sgi.c
+++ b/coders/sgi.c
@@ -584,7 +584,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
q->green=ScaleCharToQuantum(*(p+1));
q->blue=ScaleCharToQuantum(*(p+2));
SetOpacityPixelComponent(q,OpaqueOpacity);
diff --git a/coders/sun.c b/coders/sun.c
index 347cfbb..9bceb0f 100644
--- a/coders/sun.c
+++ b/coders/sun.c
@@ -524,15 +524,15 @@
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
if (sun_info.type == RT_STANDARD)
{
- q->blue=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->red=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
}
else
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
}
if (image->colors != 0)
{
diff --git a/coders/tim.c b/coders/tim.c
index a412cb6..a3735b3 100644
--- a/coders/tim.c
+++ b/coders/tim.c
@@ -358,9 +358,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/viff.c b/coders/viff.c
index 9d3641c..9305256 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -690,7 +690,7 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
q->green=ScaleCharToQuantum(*(p+number_pixels));
q->blue=ScaleCharToQuantum(*(p+2*number_pixels));
if (image->colors != 0)
diff --git a/coders/webp.c b/coders/webp.c
index 7751534..9a4cc34 100644
--- a/coders/webp.c
+++ b/coders/webp.c
@@ -170,9 +170,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(*p++));
if (q->opacity != OpaqueOpacity)
image->matte=MagickTrue;
diff --git a/coders/wpg.c b/coders/wpg.c
index 8419b17..e38521f 100644
--- a/coders/wpg.c
+++ b/coders/wpg.c
@@ -414,9 +414,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
q++;
}
if (!SyncAuthenticPixels(image,exception))
diff --git a/coders/xcf.c b/coders/xcf.c
index 155ff80..6a20dd3 100644
--- a/coders/xcf.c
+++ b/coders/xcf.c
@@ -374,8 +374,8 @@
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
q->red=ScaleCharToQuantum(*graydata);
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=ScaleCharToQuantum((unsigned char) (255-
inLayerInfo->opacity));
graydata++;
@@ -546,8 +546,8 @@
}
else
{
- q->green=q->red;
- q->blue=q->red;
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q->opacity=ScaleCharToQuantum((unsigned char) (255-
inLayerInfo->opacity));
}
diff --git a/coders/yuv.c b/coders/yuv.c
index 936e69a..b7aaa9a 100644
--- a/coders/yuv.c
+++ b/coders/yuv.c
@@ -251,7 +251,7 @@
p+=2;
}
if (quantum == 1)
- q->red=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->red=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -270,7 +270,7 @@
p+=2;
}
if (quantum == 1)
- q->red=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->red=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -291,7 +291,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
if (quantum == 1)
- q->red=ScaleCharToQuantum(*p++);
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->red=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -340,7 +340,7 @@
{
q->red=(Quantum) 0;
if (quantum == 1)
- q->green=ScaleCharToQuantum(*p++);
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->green=ScaleShortToQuantum(((*p) << 8) | *(p+1));
@@ -374,7 +374,7 @@
for (x=0; x < (ssize_t) chroma_image->columns; x++)
{
if (quantum == 1)
- q->blue=ScaleCharToQuantum(*p++);
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
else
{
q->blue=ScaleShortToQuantum(((*p) << 8) | *(p+1));