% 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 declarations.
*/
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/colorspace.h"
-#include "magick/constitute.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/quantum-private.h"
-#include "magick/static.h"
-#include "magick/statistic.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/colorspace.h"
+#include "MagickCore/constitute.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/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/statistic.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
\f
/*
Forward declarations.
*canvas_image,
*image;
- long
- y;
-
MagickBooleanType
status;
QuantumType
quantum_type;
- register long
- i;
-
- ssize_t
- count;
-
size_t
length;
+ ssize_t
+ count,
+ y;
+
unsigned char
*pixels;
image=DestroyImageList(image);
return((Image *) NULL);
}
- for (i=0; i < image->offset; i++)
- if (ReadBlobByte(image) == EOF)
- {
- ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
- image->filename);
- break;
- }
+ if (DiscardBlobBytes(image,image->offset) == MagickFalse)
+ ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
+ image->filename);
/*
Create virtual canvas to support cropping (i.e. image.gray[100x100+10+20]).
*/
*/
image->scene++;
length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
count=ReadBlob(image,length,pixels);
if (count != (ssize_t) length)
length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
count=ReadBlob(image,length,pixels);
}
- for (y=0; y < (long) image->extract_info.height; y++)
+ for (y=0; y < (ssize_t) image->extract_info.height; y++)
{
- register const PixelPacket
- *__restrict p;
+ register const Quantum
+ *restrict p;
- register long
- x;
+ register Quantum
+ *restrict q;
- register PixelPacket
- *__restrict q;
+ register ssize_t
+ x;
if (count != (ssize_t) length)
{
break;
}
q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (const Quantum *) NULL)
break;
length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
break;
if (((y-image->extract_info.y) >= 0) &&
- ((y-image->extract_info.y) < (long) image->rows))
+ ((y-image->extract_info.y) < (ssize_t) image->rows))
{
p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
image->columns,1,exception);
q=QueueAuthenticPixels(image,0,y-image->extract_info.y,image->columns,
1,exception);
- if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
+ if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=p->red;
- q->green=p->green;
- q->blue=p->blue;
- p++;
- q++;
+ SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+ SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+ SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+ p+=GetPixelChannels(canvas_image);
+ q+=GetPixelChannels(image);
}
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;
}
%
% The format of the RegisterRAWImage method is:
%
-% unsigned long RegisterRAWImage(void)
+% size_t RegisterRAWImage(void)
%
*/
-ModuleExport unsigned long RegisterRAWImage(void)
+ModuleExport size_t RegisterRAWImage(void)
{
MagickInfo
*entry;
entry->encoder=(EncodeImageHandler *) WriteRAWImage;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
- entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw red samples");
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
entry->encoder=(EncodeImageHandler *) WriteRAWImage;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
- entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw cyan samples");
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
entry->encoder=(EncodeImageHandler *) WriteRAWImage;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
- entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw green samples");
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
entry->encoder=(EncodeImageHandler *) WriteRAWImage;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
- entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw magenta samples");
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
entry->description=ConstantString("Raw blue samples");
- entry->format_type=ExplicitFormatType;
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("Y");
entry->encoder=(EncodeImageHandler *) WriteRAWImage;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
- entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw yellow samples");
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
entry->encoder=(EncodeImageHandler *) WriteRAWImage;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
- entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw opacity samples");
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
entry->encoder=(EncodeImageHandler *) WriteRAWImage;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
- entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw black samples");
entry->module=ConstantString("RAW");
(void) RegisterMagickInfo(entry);
*/
static MagickBooleanType WriteRAWImage(const ImageInfo *image_info,Image *image)
{
- long
- y;
-
MagickOffsetType
scene;
MagickBooleanType
status;
- register const PixelPacket
+ register const Quantum
*p;
- ssize_t
- count;
-
size_t
length;
+ ssize_t
+ count,
+ y;
+
unsigned char
*pixels;
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=GetQuantumPixels(quantum_info);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ if (p == (const Quantum *) NULL)
break;
- length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
+ length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
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;
}