% July 1992 %
% %
% %
-% Copyright 1999-2009 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/color.h"
-#include "magick/constitute.h"
-#include "magick/draw.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/delegate.h"
-#include "magick/geometry.h"
-#include "magick/histogram.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/quantize.h"
-#include "magick/resource_.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
-#include "magick/transform.h"
-#include "magick/utility.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/color.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/draw.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/delegate.h"
+#include "MagickCore/geometry.h"
+#include "MagickCore/histogram.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/quantize.h"
+#include "MagickCore/resource_.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/transform.h"
+#include "MagickCore/utility.h"
\f
/*
Typedef declarations.
*/
typedef struct _EPTInfo
{
- unsigned long
+ size_t
magick;
MagickOffsetType
Forward declarations.
*/
static MagickBooleanType
- WriteEPTImage(const ImageInfo *,Image *);
+ WriteEPTImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ImageInfo
*read_info;
- ssize_t
- count;
-
MagickBooleanType
status;
MagickOffsetType
offset;
+ ssize_t
+ count;
+
/*
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)
{
ept_info.tiff_length=ReadBlobLSBLong(image);
(void) ReadBlobLSBShort(image);
ept_info.postscript=(unsigned char *) AcquireQuantumMemory(
- ept_info.postscript_length,sizeof(*ept_info.postscript));
+ ept_info.postscript_length+1,sizeof(*ept_info.postscript));
if (ept_info.postscript == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- ept_info.tiff=(unsigned char *) AcquireQuantumMemory(ept_info.tiff_length,
+ (void) ResetMagickMemory(ept_info.postscript,0,(ept_info.postscript_length+1)*
+ sizeof(*ept_info.postscript));
+ ept_info.tiff=(unsigned char *) AcquireQuantumMemory(ept_info.tiff_length+1,
sizeof(*ept_info.tiff));
- if ((ept_info.tiff_length != 0) && (ept_info.tiff == (unsigned char *) NULL))
+ if (ept_info.tiff == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ (void) ResetMagickMemory(ept_info.tiff,0,(ept_info.tiff_length+1)*
+ sizeof(*ept_info.tiff));
offset=SeekBlob(image,ept_info.tiff_offset,SEEK_SET);
if (offset < 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
count=ReadBlob(image,ept_info.tiff_length,ept_info.tiff);
if (count != (ssize_t) (ept_info.tiff_length))
- ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+ (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageWarning,
+ "InsufficientImageDataInFile","`%s'",image->filename);
offset=SeekBlob(image,ept_info.postscript_offset,SEEK_SET);
if (offset < 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
count=ReadBlob(image,ept_info.postscript_length,ept_info.postscript);
if (count != (ssize_t) (ept_info.postscript_length))
- ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+ (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageWarning,
+ "InsufficientImageDataInFile","`%s'",image->filename);
(void) CloseBlob(image);
image=DestroyImage(image);
read_info=CloneImageInfo(image_info);
%
% The format of the RegisterEPTImage method is:
%
-% unsigned long RegisterEPTImage(void)
+% size_t RegisterEPTImage(void)
%
*/
-ModuleExport unsigned long RegisterEPTImage(void)
+ModuleExport size_t RegisterEPTImage(void)
{
MagickInfo
*entry;
entry->decoder=(DecodeImageHandler *) ReadEPTImage;
entry->encoder=(EncodeImageHandler *) WriteEPTImage;
entry->magick=(IsImageFormatHandler *) IsEPT;
+ entry->seekable_stream=MagickTrue;
entry->adjoin=MagickFalse;
entry->blob_support=MagickFalse;
entry->description=ConstantString(
entry->encoder=(EncodeImageHandler *) WriteEPTImage;
entry->magick=(IsImageFormatHandler *) IsEPT;
entry->adjoin=MagickFalse;
+ entry->seekable_stream=MagickTrue;
entry->blob_support=MagickFalse;
entry->description=ConstantString(
"Encapsulated PostScript Level II with TIFF preview");
entry->decoder=(DecodeImageHandler *) ReadEPTImage;
entry->encoder=(EncodeImageHandler *) WriteEPTImage;
entry->magick=(IsImageFormatHandler *) IsEPT;
+ entry->seekable_stream=MagickTrue;
entry->blob_support=MagickFalse;
entry->description=ConstantString(
"Encapsulated PostScript Level III with TIFF preview");
%
% The format of the WriteEPTImage method is:
%
-% MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WriteEPTImage(const ImageInfo *image_info,
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-static MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
char
filename[MaxTextExtent];
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- write_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ write_image=CloneImage(image,0,0,MagickTrue,exception);
if (write_image == (Image *) NULL)
return(MagickFalse);
write_info=CloneImageInfo(image_info);
(void) ResetMagickMemory(&ept_info,0,sizeof(ept_info));
ept_info.magick=0xc6d3d0c5ul;
ept_info.postscript=(unsigned char *) ImageToBlob(write_info,write_image,
- &ept_info.postscript_length,&image->exception);
+ &ept_info.postscript_length,exception);
write_image=DestroyImage(write_image);
write_info=DestroyImageInfo(write_info);
if (ept_info.postscript == (void *) NULL)
return(MagickFalse);
- write_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ write_image=CloneImage(image,0,0,MagickTrue,exception);
if (write_image == (Image *) NULL)
return(MagickFalse);
write_info=CloneImageInfo(image_info);
(void) CopyMagickString(write_info->magick,"TIFF",MaxTextExtent);
- (void) FormatMagickString(filename,MaxTextExtent,"tiff:%.1024s",
+ (void) FormatLocaleString(filename,MaxTextExtent,"tiff:%s",
write_info->filename);
(void) CopyMagickString(write_info->filename,filename,MaxTextExtent);
- (void) TransformImage(&write_image,(char *) NULL,"512x512>");
+ (void) TransformImage(&write_image,(char *) NULL,"512x512>",exception);
if ((write_image->storage_class == DirectClass) ||
(write_image->colors > 256))
{
EPT preview requires that the image is colormapped.
*/
GetQuantizeInfo(&quantize_info);
- quantize_info.dither=IsPaletteImage(write_image,&image->exception) ==
- MagickFalse ? MagickTrue : MagickFalse;
- (void) QuantizeImage(&quantize_info,write_image);
+ quantize_info.dither_method=IsPaletteImage(write_image,exception) ==
+ MagickFalse ? RiemersmaDitherMethod : NoDitherMethod;
+ (void) QuantizeImage(&quantize_info,write_image,exception);
}
write_info->compression=NoCompression;
ept_info.tiff=(unsigned char *) ImageToBlob(write_info,write_image,
- &ept_info.tiff_length,&image->exception);
+ &ept_info.tiff_length,exception);
write_image=DestroyImage(write_image);
write_info=DestroyImageInfo(write_info);
if (ept_info.tiff == (void *) NULL)