% July 1992 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2013 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 %
/*
Include declarations.
*/
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/colormap.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/colormap.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bits_per_pixel,
has_clut;
- ssize_t
- y;
-
MagickBooleanType
status;
- register IndexPacket
- *indexes;
-
register ssize_t
x;
- register PixelPacket
+ register Quantum
*q;
register ssize_t
register unsigned char
*p;
+ size_t
+ bytes_per_line,
+ height,
+ image_size,
+ pixel_mode,
+ width;
+
ssize_t
- count;
+ count,
+ y;
unsigned char
*tim_data,
unsigned short
word;
- size_t
- bytes_per_line,
- height,
- image_size,
- pixel_mode,
- width;
-
/*
Open image file.
*/
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
case 3: bits_per_pixel=24; break;
default: bits_per_pixel=4; break;
}
+ image->depth=8;
if (has_clut)
{
unsigned char
height=ReadBlobLSBShort(image);
image->columns=width;
image->rows=height;
- if (AcquireImageColormap(image,pixel_mode == 1 ? 256UL : 16UL) == MagickFalse)
+ if (AcquireImageColormap(image,pixel_mode == 1 ? 256UL : 16UL,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
tim_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,
2UL*sizeof(*tim_colormap));
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
p=tim_pixels+y*bytes_per_line;
for (x=0; x < ((ssize_t) image->columns-1); x+=2)
{
- indexes[x]=(IndexPacket) ((*p) & 0x0f);
- indexes[x+1]=(IndexPacket) ((*p >> 4) & 0x0f);
+ SetPixelIndex(image,(*p) & 0x0f,q);
+ q+=GetPixelChannels(image);
+ SetPixelIndex(image,(*p >> 4) & 0x0f,q);
p++;
+ q+=GetPixelChannels(image);
}
if ((image->columns % 2) != 0)
{
- indexes[x]=(IndexPacket) ((*p >> 4) & 0x0f);
+ SetPixelIndex(image,(*p >> 4) & 0x0f,q);
p++;
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
p=tim_pixels+y*bytes_per_line;
for (x=0; x < (ssize_t) image->columns; x++)
- indexes[x]=(*p++);
+ {
+ SetPixelIndex(image,*p++,q);
+ q+=GetPixelChannels(image);
+ }
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
p=tim_pixels+y*bytes_per_line;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
word=(*p++);
word|=(*p++ << 8);
- q->blue=ScaleCharToQuantum(ScaleColor5to8((1UL*word >> 10) & 0x1f));
- q->green=ScaleCharToQuantum(ScaleColor5to8((1UL*word >> 5) & 0x1f));
- q->red=ScaleCharToQuantum(ScaleColor5to8(1UL*word & 0x1f));
- q++;
+ SetPixelBlue(image,ScaleCharToQuantum(ScaleColor5to8(
+ (1UL*word >> 10) & 0x1f)),q);
+ SetPixelGreen(image,ScaleCharToQuantum(ScaleColor5to8(
+ (1UL*word >> 5) & 0x1f)),q);
+ SetPixelRed(image,ScaleCharToQuantum(ScaleColor5to8(
+ (1UL*word >> 0) & 0x1f)),q);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
{
p=tim_pixels+y*bytes_per_line;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=ScaleCharToQuantum(*p++);
- q->green=ScaleCharToQuantum(*p++);
- q->blue=ScaleCharToQuantum(*p++);
- q++;
+ SetPixelRed(image,ScaleCharToQuantum(*p++),q);
+ SetPixelGreen(image,ScaleCharToQuantum(*p++),q);
+ SetPixelBlue(image,ScaleCharToQuantum(*p++),q);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
if (image->storage_class == PseudoClass)
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
tim_pixels=(unsigned char *) RelinquishMagickMemory(tim_pixels);
if (EOFBlob(image) != MagickFalse)
{
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);