% July 1992 %
% %
% %
-% Copyright 1999-2009 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 %
#include "magick/list.h"
#include "magick/magick.h"
#include "magick/memory_.h"
+#include "magick/module.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/pixel-private.h"
#include "magick/static.h"
#include "magick/statistic.h"
#include "magick/string_.h"
-#include "magick/module.h"
+#include "magick/string-private.h"
\f
/*
Forward declarations.
%
*/
-static inline long ConstrainPixel(Image *image,const long offset,
- const unsigned long extent)
+static inline ssize_t ConstrainPixel(Image *image,const ssize_t offset,
+ const size_t extent)
{
- if ((offset < 0) || (offset > (long) extent))
+ if ((offset < 0) || (offset > (ssize_t) extent))
{
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,"InvalidPixel","`%s'",image->filename);
return(offset);
}
-static unsigned long PNMInteger(Image *image,const unsigned int base)
+static size_t PNMInteger(Image *image,const unsigned int base)
{
char
*comment;
*p;
size_t
- extent;
-
- unsigned long
+ extent,
value;
/*
comment=DestroyString(comment);
}
if (base == 2)
- return((unsigned long) (c-(int) '0'));
+ return((size_t) (c-(int) '0'));
/*
Evaluate number.
*/
Image
*image;
- long
- row,
- y;
-
MagickBooleanType
status;
QuantumType
quantum_type;
- register long
+ register ssize_t
i;
size_t
+ depth,
extent,
+ max_value,
packet_size;
ssize_t
- count;
-
- unsigned long
- depth,
- max_value;
-
- CacheView
- *image_view;
+ count,
+ row,
+ y;
/*
Open image file.
scale[MaxTextExtent];
(void) ReadBlobString(image,scale);
- quantum_scale=atof(scale);
+ quantum_scale=StringToDouble(scale);
}
else
{
Assign a value to the specified keyword.
*/
if (LocaleCompare(keyword,"depth") == 0)
- packet_size=(unsigned long) atol(value);
+ packet_size=StringToUnsignedLong(value);
+ (void) packet_size;
if (LocaleCompare(keyword,"height") == 0)
- image->rows=(unsigned long) atol(value);
+ image->rows=StringToUnsignedLong(value);
if (LocaleCompare(keyword,"maxval") == 0)
- max_value=(unsigned long) atol(value);
+ max_value=StringToUnsignedLong(value);
if (LocaleCompare(keyword,"TUPLTYPE") == 0)
{
if (LocaleCompare(value,"BLACKANDWHITE") == 0)
}
}
if (LocaleCompare(keyword,"width") == 0)
- image->columns=(unsigned long) atol(value);
+ image->columns=StringToUnsignedLong(value);
}
}
if ((image->columns == 0) || (image->rows == 0))
/*
Convert PBM image to pixel packets.
*/
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ 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;
+ SetRedPixelComponent(q,PNMInteger(image,2) == 0 ? QuantumRange : 0);
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,LoadImageTag,y,image->rows);
+ status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
}
case '2':
{
- unsigned long
+ size_t
intensity;
/*
sizeof(*scale));
if (scale == (Quantum *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- for (i=0; i <= (long) max_value; i++)
+ for (i=0; i <= (ssize_t) max_value; i++)
scale[i]=(Quantum) (((double) QuantumRange*i)/max_value+0.5);
}
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
intensity=PNMInteger(image,10);
+ SetRedPixelComponent(q,intensity);
if (scale != (Quantum *) NULL)
- intensity=(unsigned long) scale[ConstrainPixel(image,(long)
- intensity,max_value)];
- q->red=(Quantum) intensity;
- q->green=q->red;
- q->blue=q->red;
+ SetRedPixelComponent(q,scale[ConstrainPixel(image,(ssize_t)
+ intensity,max_value)]);
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,LoadImageTag,y,image->rows);
+ status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
sizeof(*scale));
if (scale == (Quantum *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- for (i=0; i <= (long) max_value; i++)
+ for (i=0; i <= (ssize_t) max_value; i++)
scale[i]=(Quantum) (((double) QuantumRange*i)/max_value+0.5);
}
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
pixel.red=(MagickRealType) PNMInteger(image,10);
pixel.green=(MagickRealType) PNMInteger(image,10);
pixel.blue=(MagickRealType) PNMInteger(image,10);
if (scale != (Quantum *) NULL)
{
- pixel.red=(MagickRealType) scale[ConstrainPixel(image,(long)
+ pixel.red=(MagickRealType) scale[ConstrainPixel(image,(ssize_t)
pixel.red,max_value)];
- pixel.green=(MagickRealType) scale[ConstrainPixel(image,(long)
- pixel.green,max_value)];
- pixel.blue=(MagickRealType) scale[ConstrainPixel(image,(long)
+ pixel.green=(MagickRealType) scale[ConstrainPixel(image,
+ (ssize_t) pixel.green,max_value)];
+ pixel.blue=(MagickRealType) scale[ConstrainPixel(image,(ssize_t)
pixel.blue,max_value)];
}
- 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)
break;
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,LoadImageTag,y,image->rows);
+ status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
SetQuantumMinIsWhite(quantum_info,MagickTrue);
extent=GetQuantumExtent(image,quantum_info,quantum_type);
- image_view=AcquireCacheView(image);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp parallel for schedule(static,1) shared(row,status,quantum_type)
-#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- long
- offset;
-
MagickBooleanType
sync;
register PixelPacket
- *__restrict q;
+ *restrict q;
ssize_t
- count;
+ count,
+ offset;
size_t
length;
if (status == MagickFalse)
continue;
pixels=GetQuantumPixels(quantum_info);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp critical (MagickCore_ReadPNMImage)
-#endif
{
count=ReadBlob(image,extent,pixels);
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
MagickBooleanType
proceed;
- proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
+ proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+ row,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
if (count != (ssize_t) extent)
status=MagickFalse;
- q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
- exception);
+ q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
- length=ImportQuantumPixels(image,image_view,quantum_info,quantum_type,
- pixels,exception);
+ length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
+ quantum_type,pixels,exception);
if (length != extent)
status=MagickFalse;
- sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ sync=SyncAuthenticPixels(image,exception);
if (sync == MagickFalse)
status=MagickFalse;
}
- image_view=DestroyCacheView(image_view);
quantum_info=DestroyQuantumInfo(quantum_info);
if (status == MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- image_view=AcquireCacheView(image);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp parallel for schedule(static,1) shared(row,status,quantum_type)
-#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- long
- offset;
-
MagickBooleanType
sync;
register const unsigned char
- *p;
+ *restrict p;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
ssize_t
- count;
+ count,
+ offset;
unsigned char
*pixels;
if (status == MagickFalse)
continue;
pixels=GetQuantumPixels(quantum_info);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp critical (MagickCore_ReadPNMImage)
-#endif
{
count=ReadBlob(image,extent,pixels);
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
MagickBooleanType
proceed;
- proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
+ proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+ row,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
if (count != (ssize_t) extent)
status=MagickFalse;
- q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
- exception);
+ q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
}
p=pixels;
if ((image->depth == 8) || (image->depth == 16))
- (void) ImportQuantumPixels(image,image_view,quantum_info,
+ (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
else
if (image->depth <= 8)
unsigned char
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushCharPixel(p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
- q->green=q->red;
- q->blue=q->red;
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
}
unsigned short
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
- q->green=q->red;
- q->blue=q->red;
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
q++;
}
}
- sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ sync=SyncAuthenticPixels(image,exception);
if (sync == MagickFalse)
status=MagickFalse;
}
- image_view=DestroyCacheView(image_view);
quantum_info=DestroyQuantumInfo(quantum_info);
if (status == MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- image_view=AcquireCacheView(image);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp parallel for schedule(static,1) shared(row,status,type)
-#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- long
- offset;
-
MagickBooleanType
sync;
register const unsigned char
- *p;
+ *restrict p;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
ssize_t
- count;
-
- size_t
- length;
+ count,
+ offset;
unsigned char
*pixels;
if (status == MagickFalse)
continue;
pixels=GetQuantumPixels(quantum_info);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp critical (MagickCore_ReadPNMImage)
-#endif
{
count=ReadBlob(image,extent,pixels);
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
MagickBooleanType
proceed;
- proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
+ proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+ row,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
if (count != (ssize_t) extent)
status=MagickFalse;
- q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
- exception);
+ q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
p=pixels;
- if ((image->depth == 8) || (image->depth == 16))
+ if (image->depth == 8)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- length=ImportQuantumPixels(image,image_view,quantum_info,
- quantum_type,pixels,exception);
- if (length != extent)
- status=MagickFalse;
+ SetRedPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetGreenPixelComponent(q,ScaleCharToQuantum(*p++));
+ SetBluePixelComponent(q,ScaleCharToQuantum(*p++));
+ q->opacity=OpaqueOpacity;
+ q++;
}
else
- if (image->depth <= 8)
- {
- unsigned char
- pixel;
-
- register PixelPacket
- *__restrict r;
-
- r=q;
- for (x=0; x < (long) image->columns; x++)
- {
- p=PushCharPixel(p,&pixel);
- r->red=ScaleAnyToQuantum(pixel,range);
- p=PushCharPixel(p,&pixel);
- r->green=ScaleAnyToQuantum(pixel,range);
- p=PushCharPixel(p,&pixel);
- r->blue=ScaleAnyToQuantum(pixel,range);
- r++;
- }
- }
- else
+ if (image->depth == 16)
{
unsigned short
pixel;
- register PixelPacket
- *__restrict r;
-
- r=q;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- r->red=ScaleAnyToQuantum(pixel,range);
+ SetRedPixelComponent(q,ScaleShortToQuantum(pixel));
p=PushShortPixel(MSBEndian,p,&pixel);
- r->green=ScaleAnyToQuantum(pixel,range);
+ SetGreenPixelComponent(q,ScaleShortToQuantum(pixel));
p=PushShortPixel(MSBEndian,p,&pixel);
- r->blue=ScaleAnyToQuantum(pixel,range);
- r++;
+ SetBluePixelComponent(q,ScaleShortToQuantum(pixel));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
+ q++;
}
}
+ else
+ if (image->depth <= 8)
+ {
+ unsigned char
+ pixel;
+
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ p=PushCharPixel(p,&pixel);
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ p=PushCharPixel(p,&pixel);
+ SetGreenPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ p=PushCharPixel(p,&pixel);
+ SetBluePixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
+ q++;
+ }
+ }
+ else
+ {
+ unsigned short
+ pixel;
+
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ p=PushShortPixel(MSBEndian,p,&pixel);
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ p=PushShortPixel(MSBEndian,p,&pixel);
+ SetGreenPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ p=PushShortPixel(MSBEndian,p,&pixel);
+ SetBluePixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
+ q++;
+ }
+ }
if ((type == BilevelType) || (type == GrayscaleType))
- for (x=0; x < (long) image->columns; x++)
{
- if ((type == BilevelType) &&
- (IsMonochromePixel(q) == MagickFalse))
- type=IsGrayPixel(q) == MagickFalse ? UndefinedType :
- GrayscaleType;
- if ((type == GrayscaleType) && (IsGrayPixel(q) == MagickFalse))
- type=UndefinedType;
- if ((type != BilevelType) && (type != GrayscaleType))
- break;
- q++;
+ q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ if ((type == BilevelType) &&
+ (IsMonochromePixel(q) == MagickFalse))
+ type=IsGrayPixel(q) == MagickFalse ? UndefinedType :
+ GrayscaleType;
+ if ((type == GrayscaleType) && (IsGrayPixel(q) == MagickFalse))
+ type=UndefinedType;
+ if ((type != BilevelType) && (type != GrayscaleType))
+ break;
+ q++;
+ }
}
- sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ sync=SyncAuthenticPixels(image,exception);
if (sync == MagickFalse)
status=MagickFalse;
}
- image_view=DestroyCacheView(image_view);
quantum_info=DestroyQuantumInfo(quantum_info);
if (status == MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
QuantumAny
range;
- unsigned long
+ size_t
channels;
/*
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- image_view=AcquireCacheView(image);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp parallel for schedule(static,1) shared(row,status,quantum_type)
-#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- long
- offset;
-
MagickBooleanType
sync;
register const unsigned char
- *p;
+ *restrict p;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
ssize_t
- count;
+ count,
+ offset;
unsigned char
*pixels;
if (status == MagickFalse)
continue;
pixels=GetQuantumPixels(quantum_info);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp critical (MagickCore_ReadPNMImage)
-#endif
{
count=ReadBlob(image,extent,pixels);
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
MagickBooleanType
proceed;
- proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
+ proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+ row,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
if (count != (ssize_t) extent)
status=MagickFalse;
- q=QueueCacheViewAuthenticPixels(image_view,0,offset,image->columns,1,
- exception);
+ q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
- indexes=GetCacheViewAuthenticIndexQueue(image_view);
+ indexes=GetAuthenticIndexQueue(image);
p=pixels;
if ((image->depth == 8) || (image->depth == 16))
- (void) ImportQuantumPixels(image,image_view,quantum_info,
+ (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
else
switch (quantum_type)
unsigned char
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushCharPixel(p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
- q->green=q->red;
- q->blue=q->red;
- q->opacity=OpaqueOpacity;
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
p=PushCharPixel(p,&pixel);
- q->opacity=ScaleAnyToQuantum(pixel,range);
+ SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,
+ range));
}
q++;
}
unsigned short
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
- q->green=q->red;
- q->blue=q->red;
- q->opacity=OpaqueOpacity;
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetGreenPixelComponent(q,GetRedPixelComponent(q));
+ SetBluePixelComponent(q,GetRedPixelComponent(q));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- q->opacity=ScaleAnyToQuantum(pixel,range);
+ SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,
+ range));
}
q++;
}
unsigned char
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushCharPixel(p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushCharPixel(p,&pixel);
- q->green=ScaleAnyToQuantum(pixel,range);
+ SetGreenPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushCharPixel(p,&pixel);
- q->blue=ScaleAnyToQuantum(pixel,range);
+ SetBluePixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushCharPixel(p,&pixel);
- indexes[x]=ScaleAnyToQuantum(pixel,range);
- q->opacity=OpaqueOpacity;
+ SetIndexPixelComponent(indexes+x,ScaleAnyToQuantum(pixel,
+ range));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
p=PushCharPixel(p,&pixel);
- q->opacity=ScaleAnyToQuantum(pixel,range);
+ SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,
+ range));
}
q++;
}
unsigned short
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushShortPixel(MSBEndian,p,&pixel);
- q->green=ScaleAnyToQuantum(pixel,range);
+ SetGreenPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushShortPixel(MSBEndian,p,&pixel);
- q->blue=ScaleAnyToQuantum(pixel,range);
+ SetBluePixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushShortPixel(MSBEndian,p,&pixel);
- indexes[x]=ScaleAnyToQuantum(pixel,range);
- q->opacity=OpaqueOpacity;
+ SetIndexPixelComponent(indexes+x,ScaleAnyToQuantum(pixel,
+ range));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- q->opacity=ScaleAnyToQuantum(pixel,range);
+ SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,
+ range));
}
q++;
}
unsigned char
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushCharPixel(p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushCharPixel(p,&pixel);
- q->green=ScaleAnyToQuantum(pixel,range);
+ SetGreenPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushCharPixel(p,&pixel);
- q->blue=ScaleAnyToQuantum(pixel,range);
- q->opacity=OpaqueOpacity;
+ SetBluePixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
p=PushCharPixel(p,&pixel);
- q->opacity=ScaleAnyToQuantum(pixel,range);
+ SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,
+ range));
}
q++;
}
unsigned short
pixel;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- q->red=ScaleAnyToQuantum(pixel,range);
+ SetRedPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushShortPixel(MSBEndian,p,&pixel);
- q->green=ScaleAnyToQuantum(pixel,range);
+ SetGreenPixelComponent(q,ScaleAnyToQuantum(pixel,range));
p=PushShortPixel(MSBEndian,p,&pixel);
- q->blue=ScaleAnyToQuantum(pixel,range);
- q->opacity=OpaqueOpacity;
+ SetBluePixelComponent(q,ScaleAnyToQuantum(pixel,range));
+ SetOpacityPixelComponent(q,OpaqueOpacity);
if (image->matte != MagickFalse)
{
p=PushShortPixel(MSBEndian,p,&pixel);
- q->opacity=ScaleAnyToQuantum(pixel,range);
+ SetOpacityPixelComponent(q,ScaleAnyToQuantum(pixel,
+ range));
}
q++;
}
break;
}
}
- sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ sync=SyncAuthenticPixels(image,exception);
if (sync == MagickFalse)
status=MagickFalse;
}
- image_view=DestroyCacheView(image_view);
quantum_info=DestroyQuantumInfo(quantum_info);
if (status == MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
SetQuantumScale(quantum_info,(MagickRealType) QuantumRange*
fabs(quantum_scale));
extent=GetQuantumExtent(image,quantum_info,quantum_type);
- image_view=AcquireCacheView(image);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp parallel for schedule(static,1) shared(row,status,quantum_type)
-#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- long
- offset;
-
MagickBooleanType
sync;
register PixelPacket
- *__restrict q;
+ *restrict q;
ssize_t
- count;
+ count,
+ offset;
size_t
length;
if (status == MagickFalse)
continue;
pixels=GetQuantumPixels(quantum_info);
-#if defined(_OPENMP) && (_OPENMP > 200505)
- #pragma omp critical (MagickCore_ReadPNMImage)
-#endif
{
count=ReadBlob(image,extent,pixels);
if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
MagickBooleanType
proceed;
- proceed=SetImageProgress(image,LoadImageTag,row,image->rows);
+ proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+ row,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
if ((size_t) count != extent)
status=MagickFalse;
- q=QueueCacheViewAuthenticPixels(image_view,0,(long) (image->rows-
- offset-1),image->columns,1,exception);
+ q=QueueAuthenticPixels(image,0,(ssize_t) (image->rows-offset-1),
+ image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
- length=ImportQuantumPixels(image,image_view,quantum_info,quantum_type,
- pixels,exception);
+ length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
+ quantum_type,pixels,exception);
if (length != extent)
status=MagickFalse;
- sync=SyncCacheViewAuthenticPixels(image_view,exception);
+ sync=SyncAuthenticPixels(image,exception);
if (sync == MagickFalse)
status=MagickFalse;
}
- image_view=DestroyCacheView(image_view);
quantum_info=DestroyQuantumInfo(quantum_info);
if (status == MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
%
% The format of the RegisterPNMImage method is:
%
-% unsigned long RegisterPNMImage(void)
+% size_t RegisterPNMImage(void)
%
*/
-ModuleExport unsigned long RegisterPNMImage(void)
+ModuleExport size_t RegisterPNMImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("PFM");
entry->decoder=(DecodeImageHandler *) ReadPNMImage;
entry->encoder=(EncodeImageHandler *) WritePNMImage;
+ entry->endian_support=MagickTrue;
entry->description=ConstantString("Portable float format");
entry->module=ConstantString("PFM");
(void) RegisterMagickInfo(entry);
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% Procedure WritePNMImage() writes an image to a file in the PNM rasterfile
-% format.
+% WritePNMImage() writes an image to a file in the PNM rasterfile format.
%
% The format of the WritePNMImage method is:
%
IndexPacket
index;
- long
- y;
-
MagickBooleanType
status;
QuantumType
quantum_type;
- register long
- i;
-
register unsigned char
*pixels,
*q;
- ssize_t
- count;
-
size_t
extent,
packet_size;
+ ssize_t
+ count,
+ y;
+
/*
Open output image file.
*/
{
if (image->colorspace != RGBColorspace)
(void) TransformImageColorspace(image,RGBColorspace);
- (void) FormatMagickString(buffer,MaxTextExtent,"%lu %lu\n",
- image->columns,image->rows);
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g %.20g\n",
+ (double) image->columns,(double) image->rows);
(void) WriteBlobString(image,buffer);
}
else
PAM header.
*/
(void) FormatMagickString(buffer,MaxTextExtent,
- "WIDTH %lu\nHEIGHT %lu\n",image->columns,image->rows);
+ "WIDTH %.20g\nHEIGHT %.20g\n",(double) image->columns,(double)
+ image->rows);
(void) WriteBlobString(image,buffer);
quantum_type=GetQuantumType(image,&image->exception);
switch (quantum_type)
if (image->depth > 16)
image->depth=16;
(void) FormatMagickString(buffer,MaxTextExtent,
- "DEPTH %lu\nMAXVAL %lu\n",(unsigned long) packet_size,(unsigned long)
+ "DEPTH %.20g\nMAXVAL %.20g\n",(double) packet_size,(double)
GetQuantumRange(image->depth));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"TUPLTYPE %s\nENDHDR\n",
Convert image to a PBM image.
*/
q=pixels;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register const IndexPacket
- *__restrict indexes;
-
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=PixelIntensityToQuantum(p);
*q++=(unsigned char) (pixel >= (Quantum) (QuantumRange/2) ?
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
q=pixels;
- i=0;
}
p++;
}
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
else
(void) WriteBlobString(image,"65535\n");
q=pixels;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
index=PixelIntensityToQuantum(p);
if (image->depth <= 8)
}
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
else
(void) WriteBlobString(image,"65535\n");
q=pixels;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (image->depth <= 8)
count=(ssize_t) FormatMagickString(buffer,MaxTextExtent,
- "%u %u %u ",ScaleQuantumToChar(p->red),
- ScaleQuantumToChar(p->green),ScaleQuantumToChar(p->blue));
+ "%u %u %u ",ScaleQuantumToChar(GetRedPixelComponent(p)),
+ ScaleQuantumToChar(GetGreenPixelComponent(p)),
+ ScaleQuantumToChar(GetBluePixelComponent(p)));
else
count=(ssize_t) FormatMagickString(buffer,MaxTextExtent,
- "%u %u %u ",ScaleQuantumToShort(p->red),
- ScaleQuantumToShort(p->green),ScaleQuantumToShort(p->blue));
+ "%u %u %u ",ScaleQuantumToShort(GetRedPixelComponent(p)),
+ ScaleQuantumToShort(GetGreenPixelComponent(p)),
+ ScaleQuantumToShort(GetBluePixelComponent(p)));
extent=(size_t) count;
(void) strncpy((char *) q,buffer,extent);
q+=extent;
}
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
quantum_info->min_is_white=MagickTrue;
pixels=GetQuantumPixels(quantum_info);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
*/
if (image->depth > 8)
image->depth=16;
- (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",(unsigned long)
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double)
GetQuantumRange(image->depth));
(void) WriteBlobString(image,buffer);
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
pixels=GetQuantumPixels(quantum_info);
extent=GetQuantumExtent(image,quantum_info,GrayQuantum);
range=GetQuantumRange(image->depth);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
else
{
if (image->depth <= 8)
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsGrayPixel(p) == MagickFalse)
pixel=ScaleQuantumToAny(PixelIntensityToQuantum(p),range);
else
{
if (image->depth == 8)
- pixel=ScaleQuantumToChar(p->red);
+ pixel=ScaleQuantumToChar(GetRedPixelComponent(p));
else
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
}
q=PopCharPixel((unsigned char) pixel,q);
p++;
}
else
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsGrayPixel(p) == MagickFalse)
pixel=ScaleQuantumToAny(PixelIntensityToQuantum(p),range);
else
{
if (image->depth == 16)
- pixel=ScaleQuantumToShort(p->red);
+ pixel=ScaleQuantumToShort(GetRedPixelComponent(p));
else
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
}
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
p++;
break;
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
*/
if (image->depth > 8)
image->depth=16;
- (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",(unsigned long)
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double)
GetQuantumRange(image->depth));
(void) WriteBlobString(image,buffer);
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
pixels=GetQuantumPixels(quantum_info);
extent=GetQuantumExtent(image,quantum_info,quantum_type);
range=GetQuantumRange(image->depth);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
else
{
if (image->depth <= 8)
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- pixel=ScaleQuantumToAny(p->green,range);
+ pixel=ScaleQuantumToAny(GetGreenPixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- pixel=ScaleQuantumToAny(p->blue,range);
+ pixel=ScaleQuantumToAny(GetBluePixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- if (image->matte != MagickFalse)
- {
- pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
- p->opacity),range);
- q=PopCharPixel((unsigned char) pixel,q);
- }
p++;
}
else
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- pixel=ScaleQuantumToAny(p->green,range);
+ pixel=ScaleQuantumToAny(GetGreenPixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- pixel=ScaleQuantumToAny(p->blue,range);
+ pixel=ScaleQuantumToAny(GetBluePixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- if (image->matte != MagickFalse)
- {
- pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
- p->opacity),range);
- q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- }
p++;
}
extent=(size_t) (q-pixels);
break;
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
quantum_info=AcquireQuantumInfo((const ImageInfo *) NULL,image);
pixels=GetQuantumPixels(quantum_info);
range=GetQuantumRange(image->depth);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const IndexPacket
- *__restrict indexes;
+ *restrict indexes;
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
case GrayAlphaQuantum:
{
if (image->depth <= 8)
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(PixelIntensityToQuantum(p),range);
q=PopCharPixel((unsigned char) pixel,q);
if (image->matte != MagickFalse)
{
- pixel=(unsigned char) ScaleQuantumToAny(p->opacity,
- range);
+ pixel=(unsigned char) ScaleQuantumToAny(
+ GetOpacityPixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
}
p++;
}
else
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ScaleQuantumToAny(PixelIntensityToQuantum(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
if (image->matte != MagickFalse)
{
- pixel=(unsigned char) ScaleQuantumToAny(p->opacity,
- range);
+ pixel=(unsigned char) ScaleQuantumToAny(
+ GetOpacityPixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
}
p++;
case CMYKAQuantum:
{
if (image->depth <= 8)
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- pixel=ScaleQuantumToAny(p->green,range);
+ pixel=ScaleQuantumToAny(GetGreenPixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- pixel=ScaleQuantumToAny(p->blue,range);
+ pixel=ScaleQuantumToAny(GetBluePixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- pixel=ScaleQuantumToAny(indexes[x],range);
+ pixel=ScaleQuantumToAny(
+ GetIndexPixelComponent(indexes+x),range);
q=PopCharPixel((unsigned char) pixel,q);
if (image->matte != MagickFalse)
{
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
- p->opacity),range);
+ GetOpacityPixelComponent(p)),range);
q=PopCharPixel((unsigned char) pixel,q);
}
p++;
}
else
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- pixel=ScaleQuantumToAny(p->green,range);
+ pixel=ScaleQuantumToAny(GetGreenPixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- pixel=ScaleQuantumToAny(p->blue,range);
+ pixel=ScaleQuantumToAny(GetBluePixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- pixel=ScaleQuantumToAny(indexes[x],range);
+ pixel=ScaleQuantumToAny(
+ GetIndexPixelComponent(indexes+x),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
if (image->matte != MagickFalse)
{
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
- p->opacity),range);
+ GetOpacityPixelComponent(p)),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
}
p++;
default:
{
if (image->depth <= 8)
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- pixel=ScaleQuantumToAny(p->green,range);
+ pixel=ScaleQuantumToAny(GetGreenPixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
- pixel=ScaleQuantumToAny(p->blue,range);
+ pixel=ScaleQuantumToAny(GetBluePixelComponent(p),range);
q=PopCharPixel((unsigned char) pixel,q);
if (image->matte != MagickFalse)
{
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
- p->opacity),range);
+ GetOpacityPixelComponent(p)),range);
q=PopCharPixel((unsigned char) pixel,q);
}
p++;
}
else
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- pixel=ScaleQuantumToAny(p->red,range);
+ pixel=ScaleQuantumToAny(GetRedPixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- pixel=ScaleQuantumToAny(p->green,range);
+ pixel=ScaleQuantumToAny(GetGreenPixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
- pixel=ScaleQuantumToAny(p->blue,range);
+ pixel=ScaleQuantumToAny(GetBluePixelComponent(p),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
if (image->matte != MagickFalse)
{
pixel=ScaleQuantumToAny((Quantum) (QuantumRange-
- p->opacity),range);
+ GetOpacityPixelComponent(p)),range);
q=PopShortPixel(MSBEndian,(unsigned short) pixel,q);
}
p++;
break;
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}
if (status == MagickFalse)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=GetQuantumPixels(quantum_info);
- for (y=(long) image->rows-1; y >= 0; y--)
+ for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
(void) WriteBlob(image,extent,pixels);
if (image->previous == (Image *) NULL)
{
- status=SetImageProgress(image,SaveImageTag,y,image->rows);
+ status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+ image->rows);
if (status == MagickFalse)
break;
}