% July 1992 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
%
% o length: Specifies the length of the magick string.
%
-%
*/
static MagickBooleanType IsVIFF(const unsigned char *magick,const size_t length)
{
char
comment[512];
- size_t
+ unsigned int
rows,
columns,
subrows;
int
bit;
- ssize_t
- y;
-
MagickBooleanType
status;
register unsigned char
*p;
- ssize_t
- count;
-
- unsigned char
- buffer[7],
- *viff_pixels;
-
size_t
bytes_per_pixel,
lsb_first,
max_packets,
quantum;
+ ssize_t
+ count,
+ y;
+
+ unsigned char
+ buffer[7],
+ *viff_pixels;
+
ViffInfo
viff_info;
viff_info.rows=ReadBlobLSBLong(image);
viff_info.columns=ReadBlobLSBLong(image);
viff_info.subrows=ReadBlobLSBLong(image);
- viff_info.x_offset=(ssize_t) ReadBlobLSBLong(image);
- viff_info.y_offset=(ssize_t) ReadBlobLSBLong(image);
+ viff_info.x_offset=(int) ReadBlobLSBLong(image);
+ viff_info.y_offset=(int) ReadBlobLSBLong(image);
viff_info.x_bits_per_pixel=(float) ReadBlobLSBLong(image);
viff_info.y_bits_per_pixel=(float) ReadBlobLSBLong(image);
viff_info.location_type=ReadBlobLSBLong(image);
viff_info.rows=ReadBlobMSBLong(image);
viff_info.columns=ReadBlobMSBLong(image);
viff_info.subrows=ReadBlobMSBLong(image);
- viff_info.x_offset=(ssize_t) ReadBlobMSBLong(image);
- viff_info.y_offset=(ssize_t) ReadBlobMSBLong(image);
+ viff_info.x_offset=(int) ReadBlobMSBLong(image);
+ viff_info.y_offset=(int) ReadBlobMSBLong(image);
viff_info.x_bits_per_pixel=(float) ReadBlobMSBLong(image);
viff_info.y_bits_per_pixel=(float) ReadBlobMSBLong(image);
viff_info.location_type=ReadBlobMSBLong(image);
(void) ReadBlobByte(image);
image->columns=viff_info.rows;
image->rows=viff_info.columns;
- image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL : MAGICKCORE_QUANTUM_DEPTH;
+ image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL :
+ MAGICKCORE_QUANTUM_DEPTH;
/*
Verify that we can read this VIFF image.
*/
for (bit=0; bit < 8; bit++)
if (PixelIntensity(q) < ((MagickRealType) QuantumRange/2.0))
{
- quantum=(size_t) indexes[x+bit];
+ quantum=(size_t) GetIndexPixelComponent(indexes+x+bit);
quantum|=0x01;
- indexes[x+bit]=(IndexPacket) quantum;
+ SetIndexPixelComponent(indexes+x+bit,quantum);
}
p++;
}
for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)
if (PixelIntensity(q) < ((MagickRealType) QuantumRange/2.0))
{
- quantum=(size_t) indexes[x+bit];
+ quantum=(size_t) GetIndexPixelComponent(indexes+x+bit);
quantum|=0x01;
- indexes[x+bit]=(IndexPacket) quantum;
+ SetIndexPixelComponent(indexes+x+bit,quantum);
}
p++;
}
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
- indexes[x]=(IndexPacket) (*p++);
+ SetIndexPixelComponent(indexes+x,*p++);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p);
- q->green=ScaleCharToQuantum(*(p+number_pixels));
- q->blue=ScaleCharToQuantum(*(p+2*number_pixels));
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*(p+number_pixels)));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*(p+2*number_pixels)));
if (image->colors != 0)
{
- q->red=image->colormap[(ssize_t) q->red].red;
- q->green=image->colormap[(ssize_t) q->green].green;
- q->blue=image->colormap[(ssize_t) q->blue].blue;
+ SetRedPixelComponent(q,image->colormap[(ssize_t)
+ GetRedPixelComponent(q)].red);
+ SetGreenPixelComponent(q,image->colormap[(ssize_t)
+ GetGreenPixelComponent(q)].green);
+ SetBluePixelComponent(q,image->colormap[(ssize_t)
+ GetBluePixelComponent(q)].blue);
}
- q->opacity=(Quantum) (image->matte ? QuantumRange-
- ScaleCharToQuantum(*(p+number_pixels*3)) : OpaqueOpacity);
+ SetOpacityPixelComponent(q,image->matte != MagickFalse ?
+ QuantumRange-ScaleCharToQuantum(*(p+number_pixels*3)) :
+ OpaqueOpacity);
p++;
q++;
}
columns,
subrows;
- ssize_t
+ int
x_offset,
y_offset;
unsigned int
x_bits_per_pixel,
- y_bits_per_pixel;
-
- size_t
+ y_bits_per_pixel,
location_type,
location_dimension,
number_of_images,
const char
*value;
- ssize_t
- y;
-
MagickBooleanType
status;
register unsigned char
*q;
+ ssize_t
+ y;
+
unsigned char
buffer[8],
*viff_pixels;
*viff_info.comment='\0';
value=GetImageProperty(image,"comment");
if (value != (const char *) NULL)
- (void) CopyMagickString(viff_info.comment,value,MagickMin(strlen(value),511)+1);
+ (void) CopyMagickString(viff_info.comment,value,MagickMin(strlen(value),
+ 511)+1);
viff_info.rows=image->columns;
viff_info.columns=image->rows;
viff_info.subrows=0;
viff_info.map_scheme=VFF_MS_ONEPERBAND;
viff_info.map_storage_type=VFF_MAPTYP_1_BYTE;
viff_info.map_rows=3;
- viff_info.map_columns=image->colors;
+ viff_info.map_columns=(unsigned int) image->colors;
}
else
if (image->colors <= 2)
buffer[7]=(unsigned char) viff_info.reserve[2];
(void) WriteBlob(image,8,buffer);
(void) WriteBlob(image,512,(unsigned char *) viff_info.comment);
- (void) WriteBlobMSBLong(image,viff_info.rows);
- (void) WriteBlobMSBLong(image,viff_info.columns);
- (void) WriteBlobMSBLong(image,viff_info.subrows);
- (void) WriteBlobMSBLong(image,(size_t) viff_info.x_offset);
- (void) WriteBlobMSBLong(image,(size_t) viff_info.y_offset);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.rows);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.columns);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.subrows);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.x_offset);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.y_offset);
viff_info.x_bits_per_pixel=1U*(63 << 24) | (128 << 16);
- (void) WriteBlobMSBLong(image,(size_t) viff_info.x_bits_per_pixel);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.x_bits_per_pixel);
viff_info.y_bits_per_pixel=1U*(63 << 24) | (128 << 16);
- (void) WriteBlobMSBLong(image,(size_t) viff_info.y_bits_per_pixel);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.y_bits_per_pixel);
(void) WriteBlobMSBLong(image,viff_info.location_type);
(void) WriteBlobMSBLong(image,viff_info.location_dimension);
- (void) WriteBlobMSBLong(image,viff_info.number_of_images);
- (void) WriteBlobMSBLong(image,viff_info.number_data_bands);
- (void) WriteBlobMSBLong(image,viff_info.data_storage_type);
- (void) WriteBlobMSBLong(image,viff_info.data_encode_scheme);
- (void) WriteBlobMSBLong(image,viff_info.map_scheme);
- (void) WriteBlobMSBLong(image,viff_info.map_storage_type);
- (void) WriteBlobMSBLong(image,viff_info.map_rows);
- (void) WriteBlobMSBLong(image,viff_info.map_columns);
- (void) WriteBlobMSBLong(image,viff_info.map_subrows);
- (void) WriteBlobMSBLong(image,viff_info.map_enable);
- (void) WriteBlobMSBLong(image,viff_info.maps_per_cycle);
- (void) WriteBlobMSBLong(image,viff_info.color_space_model);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.number_of_images);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.number_data_bands);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.data_storage_type);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.data_encode_scheme);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_scheme);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_storage_type);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_rows);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_columns);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_subrows);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_enable);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.maps_per_cycle);
+ (void) WriteBlobMSBLong(image,(unsigned int) viff_info.color_space_model);
for (i=0; i < 420; i++)
(void) WriteBlobByte(image,'\0');
/*
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,
*q++=byte >> (8-bit);
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType)
+ y,image->rows);
if (status == MagickFalse)
break;
}
}
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
- image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType)
+ y,image->rows);
if (status == MagickFalse)
break;
}