% Read URT RLE Image Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 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 %
MagickSizeType
number_pixels;
+ MemoryInfo
+ *pixel_info;
+
register ssize_t
x;
*colormap,
pixel,
plane,
- *rle_pixels;
+ *pixels;
/*
Open image file.
image->columns=ReadBlobLSBShort(image);
image->rows=ReadBlobLSBShort(image);
flags=(MagickStatusType) ReadBlobByte(image);
- image->matte=flags & 0x04 ? MagickTrue : MagickFalse;
+ image->alpha_trait=flags & 0x04 ? BlendPixelTrait : UndefinedPixelTrait;
number_planes=1UL*ReadBlobByte(image);
bits_per_pixel=1UL*ReadBlobByte(image);
number_colormaps=1UL*ReadBlobByte(image);
one=1;
- map_length=one << ReadBlobByte(image);
+ map_length=one << (unsigned char) ReadBlobByte(image);
if ((number_planes == 0) || (number_planes == 2) || (bits_per_pixel != 8) ||
(image->columns == 0))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/*
Allocate RLE pixels.
*/
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
number_planes++;
number_pixels=(MagickSizeType) image->columns*image->rows;
if ((number_pixels*number_planes) != (size_t) (number_pixels*number_planes))
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- rle_pixels=(unsigned char *) AcquireQuantumMemory(image->columns,
- image->rows*number_planes*sizeof(*rle_pixels));
- if (rle_pixels == (unsigned char *) NULL)
+ pixel_info=AcquireVirtualMemory(image->columns,image->rows*number_planes*
+ sizeof(*pixels));
+ if (pixel_info == (MemoryInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
if ((flags & 0x01) && !(flags & 0x02))
{
ssize_t
/*
Set background color.
*/
- p=rle_pixels;
+ p=pixels;
for (i=0; i < (ssize_t) number_pixels; i++)
{
- if (image->matte == MagickFalse)
+ if (image->alpha_trait != BlendPixelTrait)
for (j=0; j < (ssize_t) number_planes; j++)
*p++=background_color[j];
else
operand=ReadBlobByte(image);
if (opcode & 0x40)
operand=(int) ReadBlobLSBShort(image);
- p=rle_pixels+((image->rows-y-1)*image->columns*number_planes)+
+ p=pixels+((image->rows-y-1)*image->columns*number_planes)+
x*number_planes+plane;
operand++;
for (i=0; i < (ssize_t) operand; i++)
pixel=(unsigned char) ReadBlobByte(image);
(void) ReadBlobByte(image);
operand++;
- p=rle_pixels+((image->rows-y-1)*image->columns*number_planes)+
+ p=pixels+((image->rows-y-1)*image->columns*number_planes)+
x*number_planes+plane;
for (i=0; i < (ssize_t) operand; i++)
{
Apply colormap affineation to image.
*/
mask=(MagickStatusType) (map_length-1);
- p=rle_pixels;
+ p=pixels;
if (number_colormaps == 1)
for (i=0; i < (ssize_t) number_pixels; i++)
{
/*
Convert raster image to DirectClass pixel packets.
*/
- p=rle_pixels;
+ p=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
SetPixelRed(image,ScaleCharToQuantum(*p++),q);
SetPixelGreen(image,ScaleCharToQuantum(*p++),q);
SetPixelBlue(image,ScaleCharToQuantum(*p++),q);
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);
q+=GetPixelChannels(image);
}
image->colormap[i].blue=ScaleCharToQuantum(*(p+map_length*2));
p++;
}
- p=rle_pixels;
- if (image->matte == MagickFalse)
+ p=pixels;
+ if (image->alpha_trait != BlendPixelTrait)
{
/*
Convert raster image to PseudoClass pixel packets.
break;
}
}
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
}
else
{
}
if (number_colormaps != 0)
colormap=(unsigned char *) RelinquishMagickMemory(colormap);
- rle_pixels=(unsigned char *) RelinquishMagickMemory(rle_pixels);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
if (EOFBlob(image) != MagickFalse)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",