diff --git a/coders/aai.c b/coders/aai.c
index 4bfdf74..d2af8aa 100644
--- a/coders/aai.c
+++ b/coders/aai.c
@@ -177,7 +177,7 @@
SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
if (*p == 254)
*p=255;
- SetOpacityPixelComponent(q,(Quantum) (QuantumRange-
+ SetOpacityPixelComponent(q,(QuantumRange-
ScaleCharToQuantum(*p++)));
if (q->opacity != OpaqueOpacity)
image->matte=MagickTrue;
diff --git a/coders/art.c b/coders/art.c
index af54e7f..5157d33 100644
--- a/coders/art.c
+++ b/coders/art.c
@@ -276,9 +276,6 @@
*/
static MagickBooleanType WriteARTImage(const ImageInfo *image_info,Image *image)
{
- ssize_t
- y;
-
MagickBooleanType
status;
@@ -292,7 +289,8 @@
count;
size_t
- length;
+ length,
+ y;
unsigned char
*pixels;
diff --git a/coders/avs.c b/coders/avs.c
index 1a22c55..4bd35f1 100644
--- a/coders/avs.c
+++ b/coders/avs.c
@@ -172,7 +172,8 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- SetOpacityPixelComponent(q,(Quantum) (QuantumRange-ScaleCharToQuantum(*p++)));
+ SetOpacityPixelComponent(q,(QuantumRange-
+ ScaleCharToQuantum(*p++)));
SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
diff --git a/coders/bgr.c b/coders/bgr.c
index 94e4bf4..7e3f3c9 100644
--- a/coders/bgr.c
+++ b/coders/bgr.c
@@ -319,8 +319,8 @@
if (((y-image->extract_info.y) >= 0) &&
((y-image->extract_info.y) < (ssize_t) image->rows))
{
- p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
- 0,canvas_image->columns,1,exception);
+ p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
+ canvas_image->columns,1,exception);
q=GetAuthenticPixels(image,0,y-image->extract_info.y,
image->columns,1,exception);
if ((p == (const PixelPacket *) NULL) ||
diff --git a/coders/bmp.c b/coders/bmp.c
index aa0c0eb..60b7f80 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -191,15 +191,12 @@
return(y);
}
-static MagickBooleanType DecodeImage(Image *image,
- const size_t compression,unsigned char *pixels)
+static MagickBooleanType DecodeImage(Image *image,const size_t compression,
+ unsigned char *pixels)
{
int
count;
- ssize_t
- y;
-
register ssize_t
i,
x;
@@ -208,6 +205,9 @@
*p,
*q;
+ ssize_t
+ y;
+
unsigned char
byte;
@@ -355,9 +355,6 @@
static size_t EncodeImage(Image *image,const size_t bytes_per_line,
const unsigned char *pixels,unsigned char *compressed_pixels)
{
- ssize_t
- y;
-
MagickBooleanType
status;
@@ -371,6 +368,9 @@
register unsigned char
*q;
+ ssize_t
+ y;
+
/*
Runlength encode pixels.
*/
@@ -403,7 +403,7 @@
*q++=(unsigned char) 0x00;
*q++=(unsigned char) 0x00;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
+ image->rows);
if (status == MagickFalse)
break;
}
@@ -493,9 +493,6 @@
IndexPacket
index;
- ssize_t
- y;
-
MagickBooleanType
status;
@@ -526,7 +523,8 @@
red;
ssize_t
- count;
+ count,
+ y;
unsigned char
magick[12],
@@ -1012,8 +1010,8 @@
for (bit=0; bit < 8; bit++)
{
index=(IndexPacket) (((*p) & (0x80 >> bit)) != 0 ? 0x01 : 0x00);
- indexes[x+bit]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x+bit,index);
+ q++;
}
p++;
}
@@ -1022,8 +1020,7 @@
for (bit=0; bit < (image->columns % 8); bit++)
{
index=(IndexPacket) (((*p) & (0x80 >> bit)) != 0 ? 0x01 : 0x00);
- indexes[x+bit]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x+bit,index);
}
p++;
}
@@ -1037,6 +1034,7 @@
break;
}
}
+ (void) SyncImage(image);
break;
}
case 4:
@@ -1054,18 +1052,15 @@
for (x=0; x < ((ssize_t) image->columns-1); x+=2)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
index=ConstrainColormapIndex(image,*p & 0x0f);
- indexes[x+1]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x+1,index);
p++;
}
if ((image->columns % 2) != 0)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0xf);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
p++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -1078,6 +1073,7 @@
break;
}
}
+ (void) SyncImage(image);
break;
}
case 8:
@@ -1098,7 +1094,6 @@
for (x = (ssize_t)image->columns; x != 0; --x)
{
index=ConstrainColormapIndex(image,*p);
- *q=image->colormap[(ssize_t) index];
SetIndexPixelComponent(indexes,index);
indexes++;
p++;
@@ -1115,6 +1110,7 @@
break;
}
}
+ (void) SyncImage(image);
break;
}
case 16:
@@ -1261,7 +1257,8 @@
if (quantum_bits.opacity == 8)
opacity|=(opacity >> 8);
SetRedPixelComponent(q,ScaleShortToQuantum((unsigned short) red));
- SetGreenPixelComponent(q,ScaleShortToQuantum((unsigned short) green));
+ SetGreenPixelComponent(q,ScaleShortToQuantum((unsigned short)
+ green));
SetBluePixelComponent(q,ScaleShortToQuantum((unsigned short) blue));
SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
@@ -1462,9 +1459,6 @@
const StringInfo
*profile;
- ssize_t
- y;
-
MagickBooleanType
have_color_info,
status;
@@ -1485,14 +1479,17 @@
register unsigned char
*q;
- unsigned char
- *bmp_data,
- *pixels;
-
size_t
bytes_per_line,
type;
+ ssize_t
+ y;
+
+ unsigned char
+ *bmp_data,
+ *pixels;
+
/*
Open output image file.
*/
@@ -1743,7 +1740,7 @@
indexes=GetVirtualIndexQueue(image);
q=pixels+(image->rows-y-1)*bytes_per_line;
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
for ( ; x < (ssize_t) bytes_per_line; x++)
*q++=0x00;
if (image->previous == (Image *) NULL)
diff --git a/coders/braille.c b/coders/braille.c
index 299b679..45a66e6 100644
--- a/coders/braille.c
+++ b/coders/braille.c
@@ -175,13 +175,13 @@
const char
*value;
+ IndexPacket
+ polarity;
+
int
unicode = 0,
iso_11548_1 = 0;
- ssize_t
- y;
-
MagickBooleanType
status;
@@ -191,15 +191,15 @@
register const PixelPacket
*p;
- IndexPacket
- polarity;
-
register ssize_t
x;
size_t
cell_height = 4;
+ ssize_t
+ y;
+
/*
Open output image file.
*/
@@ -222,27 +222,28 @@
if (!iso_11548_1)
{
value=GetImageProperty(image,"label");
- if (value != (const char *) NULL) {
- (void) FormatMagickString(buffer,MaxTextExtent,"Title: %s\n", value);
- (void) WriteBlobString(image,buffer);
- }
- if (image->page.x)
- {
- (void) FormatMagickString(buffer,MaxTextExtent,"X: %.20g\n",(double)
- image->page.x);
- (void) WriteBlobString(image,buffer);
- }
- if (image->page.y)
- {
- (void) FormatMagickString(buffer,MaxTextExtent,"Y: %.20g\n",(double)
- image->page.y);
- (void) WriteBlobString(image,buffer);
- }
- (void) FormatMagickString(buffer,MaxTextExtent,"Width: %.20g\n",
- (double) (image->columns+(image->columns % 2)));
+ if (value != (const char *) NULL)
+ {
+ (void) FormatMagickString(buffer,MaxTextExtent,"Title: %s\n", value);
+ (void) WriteBlobString(image,buffer);
+ }
+ if (image->page.x != 0)
+ {
+ (void) FormatMagickString(buffer,MaxTextExtent,"X: %.20g\n",(double)
+ image->page.x);
+ (void) WriteBlobString(image,buffer);
+ }
+ if (image->page.y != 0)
+ {
+ (void) FormatMagickString(buffer,MaxTextExtent,"Y: %.20g\n",(double)
+ image->page.y);
+ (void) WriteBlobString(image,buffer);
+ }
+ (void) FormatMagickString(buffer,MaxTextExtent,"Width: %.20g\n",(double)
+ (image->columns+(image->columns % 2)));
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"Height: %.20g\n",
- (double) image->rows);
+ (void) FormatMagickString(buffer,MaxTextExtent,"Height: %.20g\n",(double)
+ image->rows);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"\n");
}
@@ -252,8 +253,7 @@
polarity=(IndexPacket) (PixelIntensityToQuantum(&image->colormap[0]) >=
(Quantum) (QuantumRange/2));
if (image->colors == 2)
- polarity=(IndexPacket)
- (PixelIntensityToQuantum(&image->colormap[0]) >=
+ polarity=(IndexPacket) (PixelIntensityToQuantum(&image->colormap[0]) >=
PixelIntensityToQuantum(&image->colormap[1]));
}
for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) cell_height)
@@ -332,10 +332,10 @@
(void) WriteBlobByte(image,iso_to_brf[cell]);
}
}
- if (!iso_11548_1)
+ if (iso_11548_1 == 0)
(void) WriteBlobByte(image,'\n');
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
+ image->rows);
if (status == MagickFalse)
break;
}
diff --git a/coders/cals.c b/coders/cals.c
index 79e4b2f..e1cbb40 100644
--- a/coders/cals.c
+++ b/coders/cals.c
@@ -166,7 +166,7 @@
register ssize_t
i;
- unsigned long
+ size_t
density,
direction,
height,
@@ -404,15 +404,15 @@
char
pad[128];
- ssize_t
- count;
-
register const char
*p;
register ssize_t
i;
+ ssize_t
+ count;
+
i=0;
if (data != (const char *) NULL)
{
@@ -447,20 +447,18 @@
register ssize_t
i;
+ size_t
+ density,
+ length,
+ orient_x,
+ orient_y;
+
ssize_t
count;
- size_t
- length;
-
unsigned char
*group4;
- size_t
- density,
- orient_x,
- orient_y;
-
/*
Open output image file.
*/
diff --git a/coders/caption.c b/coders/caption.c
index 6a8e230..c8532d7 100644
--- a/coders/caption.c
+++ b/coders/caption.c
@@ -108,13 +108,13 @@
register ssize_t
i;
- TypeMetric
- metrics;
-
size_t
height,
width;
+ TypeMetric
+ metrics;
+
/*
Initialize Image structure.
*/
@@ -164,8 +164,7 @@
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
(void) status;
width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5);
- height=(size_t) floor(metrics.height+draw_info->stroke_width+
- 0.5);
+ height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5);
if ((width > (image->columns+1)) || (height > (image->rows+1)))
break;
draw_info->pointsize*=2.0;
@@ -183,8 +182,7 @@
(void) CloneString(&draw_info->geometry,geometry);
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5);
- height=(size_t) floor(metrics.height+draw_info->stroke_width+
- 0.5);
+ height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5);
if ((width > (image->columns+1)) || (height > (image->rows+1)))
break;
draw_info->pointsize++;
diff --git a/coders/cin.c b/coders/cin.c
index 8acb2c8..e373bc9 100644
--- a/coders/cin.c
+++ b/coders/cin.c
@@ -375,8 +375,7 @@
return(MagickTrue);
}
-static Image *ReadCINImage(const ImageInfo *image_info,
- ExceptionInfo *exception)
+static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define MonoColorType 1
#define RGBColorType 3
@@ -390,9 +389,6 @@
Image
*image;
- ssize_t
- y;
-
MagickBooleanType
status;
@@ -412,17 +408,16 @@
*q;
size_t
- length;
+ length,
+ lsb_first;
ssize_t
- count;
+ count,
+ y;
unsigned char
*pixels;
- size_t
- lsb_first;
-
/*
Open image file.
*/
@@ -488,14 +483,14 @@
switch (cin.image.orientation)
{
default:
- case 0: image->orientation=TopLeftOrientation; break;
- case 1: image->orientation=TopRightOrientation; break;
- case 2: image->orientation=BottomLeftOrientation; break;
- case 3: image->orientation=BottomRightOrientation; break;
- case 4: image->orientation=LeftTopOrientation; break;
- case 5: image->orientation=RightTopOrientation; break;
- case 6: image->orientation=LeftBottomOrientation; break;
- case 7: image->orientation=RightBottomOrientation; break;
+ case 0: image->orientation=TopLeftOrientation; break;
+ case 1: image->orientation=TopRightOrientation; break;
+ case 2: image->orientation=BottomLeftOrientation; break;
+ case 3: image->orientation=BottomRightOrientation; break;
+ case 4: image->orientation=LeftTopOrientation; break;
+ case 5: image->orientation=RightTopOrientation; break;
+ case 6: image->orientation=LeftBottomOrientation; break;
+ case 7: image->orientation=RightBottomOrientation; break;
}
cin.image.number_channels=(unsigned char) ReadBlobByte(image);
offset++;
@@ -854,9 +849,6 @@
const StringInfo
*profile;
- ssize_t
- y;
-
MagickBooleanType
status;
@@ -879,7 +871,8 @@
length;
ssize_t
- count;
+ count,
+ y;
struct tm
local_time;
diff --git a/coders/cip.c b/coders/cip.c
index 03684e0..4f12719 100644
--- a/coders/cip.c
+++ b/coders/cip.c
@@ -170,9 +170,6 @@
const char
*value;
- ssize_t
- y;
-
MagickBooleanType
status;
@@ -183,6 +180,9 @@
i,
x;
+ ssize_t
+ y;
+
unsigned char
byte;
@@ -257,7 +257,7 @@
(void) WriteBlobString(image,buffer);
}
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
+ image->rows);
if (status == MagickFalse)
break;
}
diff --git a/coders/clipboard.c b/coders/clipboard.c
index f40c270..40bfbbf 100644
--- a/coders/clipboard.c
+++ b/coders/clipboard.c
@@ -3,6 +3,11 @@
% %
% %
% %
+% CCCC L IIIII PPPP BBBB OOO AAA RRRR DDDD %
+% C L I P P B B O O A A R R D D %
+% C L I PPP BBBB O O AAAAA RRRR D D %
+% C L I P B B O O A A R R D D %
+% CCCC LLLLL IIIII P BBBB OOO A A R R DDDD %
% %
% %
% Read/Write Windows Clipboard. %
@@ -101,15 +106,15 @@
Image
*image;
- ssize_t
- y;
-
register ssize_t
x;
register PixelPacket
*q;
+ ssize_t
+ y;
+
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
@@ -208,9 +213,9 @@
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(pBits->rgbRed);
- q->green=ScaleCharToQuantum(pBits->rgbGreen);
- q->blue=ScaleCharToQuantum(pBits->rgbBlue);
+ SetRedPixelComponent(q,ScaleCharToQuantum(pBits->rgbRed));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(pBits->rgbGreen));
+ SetBluePixelComponent(q,ScaleCharToQuantum(pBits->rgbBlue));
SetOpacityPixelComponent(q,OpaqueOpacity);
pBits++;
q++;
@@ -334,7 +339,7 @@
HBITMAP
bitmapH;
- OpenClipboard( NULL );
+ OpenClipboard(NULL);
EmptyClipboard();
bitmapH=(HBITMAP) ImageToHBITMAP(image);
SetClipboardData(CF_BITMAP,bitmapH);
diff --git a/coders/cmyk.c b/coders/cmyk.c
index 7e7e45e..c5a55b4 100644
--- a/coders/cmyk.c
+++ b/coders/cmyk.c
@@ -117,13 +117,13 @@
register ssize_t
i;
+ size_t
+ length;
+
ssize_t
count,
y;
- size_t
- length;
-
unsigned char
*pixels;
@@ -365,7 +365,8 @@
}
case BlackQuantum:
{
- indexes[x]=canvas_indexes[image->extract_info.x+x];
+ SetIndexPixelComponent(indexes+x,GetIndexPixelComponent(
+ canvas_indexes+image->extract_info.x+x));
break;
}
case OpacityQuantum:
@@ -605,7 +606,8 @@
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
- indexes[x]=canvas_indexes[image->extract_info.x+x];
+ SetIndexPixelComponent(indexes+x,GetIndexPixelComponent(
+ canvas_indexes+image->extract_info.x+x));
p++;
q++;
}
@@ -968,7 +970,8 @@
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
- indexes[x]=canvas_indexes[image->extract_info.x+x];
+ SetIndexPixelComponent(indexes+x,GetIndexPixelComponent(
+ canvas_indexes+image->extract_info.x+x));
p++;
q++;
}
diff --git a/coders/cut.c b/coders/cut.c
index 39f0a37..26c569c 100644
--- a/coders/cut.c
+++ b/coders/cut.c
@@ -102,11 +102,10 @@
IndexPacket index;
register IndexPacket *indexes;
-
index=(IndexPacket) 0;
exception=(&image->exception);
switch (depth)
- {
+ {
case 1: /* Convert bitmap scanline. */
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
@@ -114,22 +113,20 @@
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < ((ssize_t) image->columns-7); x+=8)
+ {
+ for (bit=0; bit < 8; bit++)
{
- for (bit=0; bit < 8; bit++)
- {
- index=(IndexPacket) ((((*p) & (0x80 >> bit)) != 0) ? 0x01 : 0x00);
- indexes[x+bit]=index;
- *q++=image->colormap[(ssize_t) index];
- }
- p++;
+ index=(IndexPacket) ((((*p) & (0x80 >> bit)) != 0) ? 0x01 : 0x00);
+ SetIndexPixelComponent(indexes+x+bit,index);
}
+ p++;
+ }
if ((image->columns % 8) != 0)
{
for (bit=0; bit < (image->columns % 8); bit++)
{
index=(IndexPacket) ((((*p) & (0x80 >> bit)) != 0) ? 0x01 : 0x00);
- indexes[x+bit]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x+bit,index);
}
p++;
}
@@ -146,36 +143,29 @@
for (x=0; x < ((ssize_t) image->columns-1); x+=2)
{
index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
index=ConstrainColormapIndex(image,(*p) & 0x3);
- indexes[x+1]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x+1,index);
p++;
}
if ((image->columns % 4) != 0)
{
index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
if ((image->columns % 4) >= 1)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
if ((image->columns % 4) >= 2)
{
index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
}
}
p++;
@@ -194,18 +184,15 @@
for (x=0; x < ((ssize_t) image->columns-1); x+=2)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0xf);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
index=ConstrainColormapIndex(image,(*p) & 0xf);
- indexes[x+1]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x+1,index);
p++;
}
if ((image->columns % 2) != 0)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0xf);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
+ SetIndexPixelComponent(indexes+x,index);
p++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -217,14 +204,12 @@
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL) break;
indexes=GetAuthenticIndexQueue(image);
-
for (x=0; x < (ssize_t) image->columns; x++)
- {
- index=ConstrainColormapIndex(image,*p);
- indexes[x]=index;
- *q++=image->colormap[(ssize_t) index];
- p++;
- }
+ {
+ index=ConstrainColormapIndex(image,*p);
+ SetIndexPixelComponent(indexes+x,index);
+ p++;
+ }
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
@@ -241,17 +226,17 @@
ExceptionInfo
*exception;
- ssize_t
- x,
- y;
-
- PixelPacket
- *q;
-
Quantum
intensity,
scale_intensity;
+ register PixelPacket
+ *q;
+
+ ssize_t
+ x,
+ y;
+
exception=(&image->exception);
intensity=0;
scale_intensity=ScaleCharToQuantum(16);
@@ -529,8 +514,8 @@
RunCount=(unsigned char) ReadBlobByte(image);
RunCountMasked=RunCount & 0x7F;
- while((int) RunCountMasked!=0)
- {
+ while ((int) RunCountMasked != 0)
+ {
if((ssize_t) RunCountMasked>j)
{ /*Wrong Data*/
RunCountMasked=(unsigned char) j;
@@ -559,6 +544,7 @@
InsertRow(depth,BImgBuff,i,image);
}
+ (void) SyncImage(image);
/*detect monochrome image*/
@@ -586,9 +572,11 @@
q=QueueAuthenticPixels(image,0,i,image->columns,1,exception);
for (j=0; j < (ssize_t)image->columns; j++)
{
- if(q->red==ScaleCharToQuantum(1))
+ if (q->red==ScaleCharToQuantum(1))
{
- q->red=q->green=q->blue=(Quantum) QuantumRange;
+ SetRedPixelComponent(q,QuantumRange);
+ SetGreenPixelComponent(q,QuantumRange);
+ SetBluePixelComponent(q,QuantumRange);
}
q++;
}
diff --git a/coders/dcm.c b/coders/dcm.c
index 1bb43d6..8a1ee06 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -2810,13 +2810,6 @@
index,
*redmap;
- ssize_t
- element,
- group,
- scene,
- window_center,
- y;
-
MagickBooleanType
explicit_file,
use_explicit,
@@ -2860,7 +2853,13 @@
window_width;
ssize_t
- count;
+ count,
+ element,
+ group,
+ scene,
+ window_center,
+ y;
+
unsigned char
*data;
@@ -3599,12 +3598,12 @@
}
if (image->compression == RLECompression)
{
- unsigned int
- tag;
-
size_t
length;
+ unsigned int
+ tag;
+
/*
Read RLE offset table.
*/
@@ -3725,26 +3724,27 @@
{
case 0:
{
- q->red=ScaleCharToQuantum((unsigned char)
- ReadDCMByte(stream_info,image));
+ SetRedPixelComponent(q,ScaleCharToQuantum((unsigned char)
+ ReadDCMByte(stream_info,image)));
break;
}
case 1:
{
- q->green=ScaleCharToQuantum((unsigned char)
- ReadDCMByte(stream_info,image));
+ SetGreenPixelComponent(q,ScaleCharToQuantum((unsigned char)
+ ReadDCMByte(stream_info,image)));
break;
}
case 2:
{
- q->blue=ScaleCharToQuantum((unsigned char)
- ReadDCMByte(stream_info,image));
+ SetBluePixelComponent(q,ScaleCharToQuantum((unsigned char)
+ ReadDCMByte(stream_info,image)));
break;
}
case 3:
{
- q->opacity=(Quantum) (QuantumRange-ScaleCharToQuantum(
- (unsigned char) ReadDCMByte(stream_info,image)));
+ SetOpacityPixelComponent(q,(QuantumRange-
+ ScaleCharToQuantum((unsigned char) ReadDCMByte(stream_info,
+ image))));
break;
}
default:
@@ -3757,7 +3757,7 @@
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
- image->rows);
+ image->rows);
if (status == MagickFalse)
break;
}
@@ -3865,7 +3865,7 @@
}
index&=mask;
index=(int) ConstrainColormapIndex(image,(size_t) index);
- indexes[x]=(IndexPacket) index;
+ SetIndexPixelComponent(indexes+x,index);
pixel.red=1UL*image->colormap[index].red;
pixel.green=1UL*image->colormap[index].green;
pixel.blue=1UL*image->colormap[index].blue;
@@ -3903,9 +3903,9 @@
pixel.blue=scale[pixel.blue];
}
}
- q->red=(Quantum) pixel.red;
- q->green=(Quantum) pixel.green;
- q->blue=(Quantum) pixel.blue;
+ SetRedPixelComponent(q,pixel.red);
+ SetGreenPixelComponent(q,pixel.green);
+ SetBluePixelComponent(q,pixel.blue);
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -3995,7 +3995,7 @@
}
index&=mask;
index=(int) ConstrainColormapIndex(image,(size_t) index);
- indexes[x]=(IndexPacket) index;
+ SetIndexPixelComponent(indexes+x,index);
pixel.red=1UL*image->colormap[index].red;
pixel.green=1UL*image->colormap[index].green;
pixel.blue=1UL*image->colormap[index].blue;
@@ -4033,12 +4033,12 @@
pixel.blue=scale[pixel.blue];
}
}
- q->red=(Quantum) (((size_t) q->red) |
- (((size_t) pixel.red) << 8));
- q->green=(Quantum) (((size_t) q->green) |
- (((size_t) pixel.green) << 8));
- q->blue=(Quantum) (((size_t) q->green) |
- (((size_t) pixel.blue) << 8));
+ SetRedPixelComponent(q,(((size_t) q->red) |
+ (((size_t) pixel.red) << 8)));
+ SetGreenPixelComponent(q,(((size_t) q->green) |
+ (((size_t) pixel.green) << 8)));
+ SetBluePixelComponent(q,(((size_t) q->green) |
+ (((size_t) pixel.blue) << 8)));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/dib.c b/coders/dib.c
index 2dac35d..29f03b4 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -659,7 +659,7 @@
for (bit=0; bit < 8; bit++)
{
index=(IndexPacket) ((*p) & (0x80 >> bit) ? 0x01 : 0x00);
- indexes[x+bit]=index;
+ SetIndexPixelComponent(indexes+x+bit,index);
*q++=image->colormap[(ssize_t) index];
}
p++;
@@ -669,7 +669,7 @@
for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)
{
index=(IndexPacket) ((*p) & (0x80 >> bit) ? 0x01 : 0x00);
- indexes[x+bit]=index;
+ SetIndexPixelComponent(indexes+x+bit,index);
*q++=image->colormap[(ssize_t) index];
}
p++;
@@ -1129,7 +1129,7 @@
indexes=GetVirtualIndexQueue(image);
q=pixels+(image->rows-y-1)*bytes_per_line;
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
for ( ; x < (ssize_t) bytes_per_line; x++)
*q++=0x00;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
diff --git a/coders/icon.c b/coders/icon.c
index f7568ed..a4ba2bb 100644
--- a/coders/icon.c
+++ b/coders/icon.c
@@ -1074,7 +1074,7 @@
indexes=GetVirtualIndexQueue(next);
q=pixels+(next->rows-y-1)*bytes_per_line;
for (x=0; x < (ssize_t) next->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
if (next->previous == (Image *) NULL)
{
status=SetImageProgress(next,SaveImageTag,y,next->rows);
diff --git a/coders/map.c b/coders/map.c
index f6d6bdf..be3876b 100644
--- a/coders/map.c
+++ b/coders/map.c
@@ -433,7 +433,7 @@
{
if (image->colors > 256)
*q++=(unsigned char) ((size_t) indexes[x] >> 8);
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
}
(void) WriteBlob(image,(size_t) (q-pixels),pixels);
}
diff --git a/coders/pcl.c b/coders/pcl.c
index 40baa6f..6ba965f 100644
--- a/coders/pcl.c
+++ b/coders/pcl.c
@@ -891,7 +891,7 @@
Colormapped image.
*/
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
break;
}
case 24:
diff --git a/coders/pcx.c b/coders/pcx.c
index f8f8356..66d629f 100644
--- a/coders/pcx.c
+++ b/coders/pcx.c
@@ -1071,7 +1071,7 @@
indexes=GetVirtualIndexQueue(image);
q=pcx_pixels;
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
if (PCXWritePixels(&pcx_info,pcx_pixels,image) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
diff --git a/coders/pdb.c b/coders/pdb.c
index 6c8a044..64aeefc 100644
--- a/coders/pdb.c
+++ b/coders/pdb.c
@@ -447,7 +447,7 @@
for (bit=0; bit < 8; bit++)
{
index=(IndexPacket) (*p & (0x80 >> bit) ? 0x00 : 0x01);
- indexes[x+bit]=index;
+ SetIndexPixelComponent(indexes+x+bit,index);
*q++=image->colormap[(ssize_t) index];
}
p++;
diff --git a/coders/pdf.c b/coders/pdf.c
index 1d53491..39f132a 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -1809,7 +1809,7 @@
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,
@@ -2240,7 +2240,7 @@
break;
indexes=GetVirtualIndexQueue(tile_image);
for (x=0; x < (ssize_t) tile_image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
}
#if defined(MAGICKCORE_ZLIB_DELEGATE)
if (compression == ZipCompression)
diff --git a/coders/ps2.c b/coders/ps2.c
index 97e7e27..a9391b3 100644
--- a/coders/ps2.c
+++ b/coders/ps2.c
@@ -1026,7 +1026,7 @@
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows);
if (progress == MagickFalse)
break;
diff --git a/coders/ps3.c b/coders/ps3.c
index b2472dd..be4416b 100644
--- a/coders/ps3.c
+++ b/coders/ps3.c
@@ -414,7 +414,7 @@
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
diff --git a/coders/rle.c b/coders/rle.c
index 0c34790..2f96ace 100644
--- a/coders/rle.c
+++ b/coders/rle.c
@@ -447,7 +447,7 @@
SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
if (image->matte != MagickFalse)
- SetOpacityPixelComponent(q,(Quantum) (QuantumRange-ScaleCharToQuantum(*p++)));
+ SetOpacityPixelComponent(q,(QuantumRange-ScaleCharToQuantum(*p++)));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -531,7 +531,7 @@
q->red=image->colormap[*p++].red;
q->green=image->colormap[*p++].green;
q->blue=image->colormap[*p++].blue;
- SetOpacityPixelComponent(q,(Quantum) (QuantumRange-ScaleCharToQuantum(*p++)));
+ SetOpacityPixelComponent(q,(QuantumRange-ScaleCharToQuantum(*p++)));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
diff --git a/coders/sun.c b/coders/sun.c
index d7d9fcd..62b41c6 100644
--- a/coders/sun.c
+++ b/coders/sun.c
@@ -521,7 +521,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
if (image->matte != MagickFalse)
- SetOpacityPixelComponent(q,(Quantum) (QuantumRange-ScaleCharToQuantum(*p++)));
+ SetOpacityPixelComponent(q,(QuantumRange-ScaleCharToQuantum(*p++)));
if (sun_info.type == RT_STANDARD)
{
SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
diff --git a/coders/tga.c b/coders/tga.c
index 467ba98..88540aa 100644
--- a/coders/tga.c
+++ b/coders/tga.c
@@ -788,7 +788,7 @@
for (x=0; x < (ssize_t) image->columns; x++)
{
if (targa_info.image_type == TargaColormap)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
else
if (targa_info.image_type == TargaMonochrome)
*q++=(unsigned char) ScaleQuantumToChar(PixelIntensityToQuantum(p));
diff --git a/coders/viff.c b/coders/viff.c
index 9305256..036c8ce 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -1144,7 +1144,7 @@
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
diff --git a/coders/webp.c b/coders/webp.c
index c90dfbc..7444b84 100644
--- a/coders/webp.c
+++ b/coders/webp.c
@@ -173,7 +173,7 @@
SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
- SetOpacityPixelComponent(q,(Quantum) (QuantumRange-ScaleCharToQuantum(*p++)));
+ SetOpacityPixelComponent(q,(QuantumRange-ScaleCharToQuantum(*p++)));
if (q->opacity != OpaqueOpacity)
image->matte=MagickTrue;
q++;
diff --git a/coders/wpg.c b/coders/wpg.c
index e38521f..d86186e 100644
--- a/coders/wpg.c
+++ b/coders/wpg.c
@@ -296,7 +296,7 @@
for (bit=0; bit < 8; bit++)
{
index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);
- indexes[x+bit]=index;
+ SetIndexPixelComponent(indexes+x+bit,index);
*q++=image->colormap[(int) index];
}
p++;
@@ -306,7 +306,7 @@
for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)
{
index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);
- indexes[x+bit]=index;
+ SetIndexPixelComponent(indexes+x+bit,index);
*q++=image->colormap[(int) index];
}
p++;
diff --git a/coders/xwd.c b/coders/xwd.c
index c1824c8..e00c1b3 100644
--- a/coders/xwd.c
+++ b/coders/xwd.c
@@ -768,7 +768,7 @@
{
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- *q++=(unsigned char) indexes[x];
+ *q++=(unsigned char) GetIndexPixelComponent(indexes+x);
}
else
for (x=0; x < (ssize_t) image->columns; x++)
diff --git a/magick/cache.c b/magick/cache.c
index cabba26..73021e6 100644
--- a/magick/cache.c
+++ b/magick/cache.c
@@ -3280,9 +3280,9 @@
}
case GrayVirtualPixelMethod:
{
- SetRedPixelComponent(&virtual_pixel,(Quantum) QuantumRange/2);
- SetGreenPixelComponent(&virtual_pixel,(Quantum) QuantumRange/2);
- SetBluePixelComponent(&virtual_pixel,(Quantum) QuantumRange/2);
+ SetRedPixelComponent(&virtual_pixel,QuantumRange/2);
+ SetGreenPixelComponent(&virtual_pixel,QuantumRange/2);
+ SetBluePixelComponent(&virtual_pixel,QuantumRange/2);
SetOpacityPixelComponent(&virtual_pixel,OpaqueOpacity);
break;
}
@@ -3297,9 +3297,9 @@
case MaskVirtualPixelMethod:
case WhiteVirtualPixelMethod:
{
- SetRedPixelComponent(&virtual_pixel,(Quantum) QuantumRange);
- SetGreenPixelComponent(&virtual_pixel,(Quantum) QuantumRange);
- SetBluePixelComponent(&virtual_pixel,(Quantum) QuantumRange);
+ SetRedPixelComponent(&virtual_pixel,QuantumRange);
+ SetGreenPixelComponent(&virtual_pixel,QuantumRange);
+ SetBluePixelComponent(&virtual_pixel,QuantumRange);
SetOpacityPixelComponent(&virtual_pixel,OpaqueOpacity);
break;
}
diff --git a/magick/image.c b/magick/image.c
index a05085b..96b21d9 100644
--- a/magick/image.c
+++ b/magick/image.c
@@ -2428,9 +2428,9 @@
{
for (x=0; x < (ssize_t) image->columns; x++)
{
- SetRedPixelComponent(q,(Quantum) GetAlphaPixelComponent(q));
- SetGreenPixelComponent(q,(Quantum) GetAlphaPixelComponent(q));
- SetBluePixelComponent(q,(Quantum) GetAlphaPixelComponent(q));
+ SetRedPixelComponent(q,GetAlphaPixelComponent(q));
+ SetGreenPixelComponent(q,GetAlphaPixelComponent(q));
+ SetBluePixelComponent(q,GetAlphaPixelComponent(q));
q++;
}
break;
@@ -2439,7 +2439,7 @@
{
for (x=0; x < (ssize_t) image->columns; x++)
{
- SetOpacityPixelComponent(q,(Quantum) (QuantumRange-
+ SetOpacityPixelComponent(q,(QuantumRange-
PixelIntensityToQuantum(q)));
q++;
}
diff --git a/magick/pixel.h b/magick/pixel.h
index cea64bb..3e6da4f 100644
--- a/magick/pixel.h
+++ b/magick/pixel.h
@@ -47,20 +47,21 @@
#define GetYellowPixelComponent(pixel) ((pixel)->blue)
#define SetAlphaPixelComponent(pixel,value) \
((pixel)->opacity=(Quantum) (QuantumRange-(value)))
-#define SetBlackPixelComponent(index,value) (*(index)=(value))
-#define SetBluePixelComponent(pixel,value) ((pixel)->blue=(value))
-#define SetCbPixelComponent(pixel,value) ((pixel)->green=(value))
-#define SetCrPixelComponent(pixel,value) ((pixel)->blue=(value))
-#define SetCyanPixelComponent(pixel,value) ((pixel)->red=(value))
+#define SetBlackPixelComponent(index,value) (*(index)=(Quantum) (value))
+#define SetBluePixelComponent(pixel,value) ((pixel)->blue=(Quantum) (value))
+#define SetCbPixelComponent(pixel,value) ((pixel)->green=(Quantum) (value))
+#define SetCrPixelComponent(pixel,value) ((pixel)->blue=(Quantum) (value))
+#define SetCyanPixelComponent(pixel,value) ((pixel)->red=(Quantum) (value))
#define SetGrayPixelComponent(pixel,value) \
- ((pixel)->red=(pixel)->green=(pixel)->blue=(value))
-#define SetGreenPixelComponent(pixel,value) ((pixel)->green=(value))
-#define SetIndexPixelComponent(indexes,value) (*(indexes)=(value))
-#define SetMagentaPixelComponent(pixel,value) ((pixel)->green=(value))
-#define SetOpacityPixelComponent(pixel,value) ((pixel)->opacity=(value))
-#define SetRedPixelComponent(pixel,value) ((pixel)->red=(value))
-#define SetYellowPixelComponent(pixel,value) ((pixel)->blue=(value))
-#define SetYPixelComponent(pixel,value) ((pixel)->red=(value))
+ ((pixel)->red=(pixel)->green=(pixel)->blue=(Quantum) (value))
+#define SetGreenPixelComponent(pixel,value) ((pixel)->green=(Quantum) (value))
+#define SetIndexPixelComponent(indexes,value) (*(indexes)=(IndexPacket) (value))
+#define SetMagentaPixelComponent(pixel,value) ((pixel)->green=(Quantum) (value))
+#define SetOpacityPixelComponent(pixel,value) \
+ ((pixel)->opacity=(Quantum) (value))
+#define SetRedPixelComponent(pixel,value) ((pixel)->red=(Quantum) (value))
+#define SetYellowPixelComponent(pixel,value) ((pixel)->blue=(Quantum) (value))
+#define SetYPixelComponent(pixel,value) ((pixel)->red=(Quantum) (value))
typedef enum
{