]> granicus.if.org Git - imagemagick/blobdiff - coders/ept.c
(no commit message)
[imagemagick] / coders / ept.c
index b2527cbe68a86fe277fe9d99dac99806058a8101..24aa7388fe392fb50b450eb3a0070fad050f5d82 100644 (file)
 %           Read/Write Encapsulated Postscript Format (with preview).         %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2015 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  %
@@ -184,7 +184,7 @@ static Image *ReadEPTImage(const ImageInfo *image_info,ExceptionInfo *exception)
       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)
     {
@@ -240,7 +240,11 @@ static Image *ReadEPTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     }
   read_info=DestroyImageInfo(read_info);
   if (image != (Image *) NULL)
-    (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
+    {
+      (void) CopyMagickString(image->filename,image_info->filename,
+        MaxTextExtent);
+      (void) CopyMagickString(image->magick,"EPT",MaxTextExtent);
+    }
   ept_info.tiff=(unsigned char *) RelinquishMagickMemory(ept_info.tiff);
   ept_info.postscript=(unsigned char *) RelinquishMagickMemory(
     ept_info.postscript);
@@ -279,9 +283,9 @@ ModuleExport size_t RegisterEPTImage(void)
   entry->decoder=(DecodeImageHandler *) ReadEPTImage;
   entry->encoder=(EncodeImageHandler *) WriteEPTImage;
   entry->magick=(IsImageFormatHandler *) IsEPT;
-  entry->seekable_stream=MagickTrue;
-  entry->adjoin=MagickFalse;
-  entry->blob_support=MagickFalse;
+  entry->flags|=CoderSeekableStreamFlag;
+  entry->flags^=CoderAdjoinFlag;
+  entry->flags^=CoderBlobSupportFlag;
   entry->description=ConstantString(
     "Encapsulated PostScript with TIFF preview");
   entry->module=ConstantString("EPT");
@@ -290,9 +294,9 @@ ModuleExport size_t RegisterEPTImage(void)
   entry->decoder=(DecodeImageHandler *) ReadEPTImage;
   entry->encoder=(EncodeImageHandler *) WriteEPTImage;
   entry->magick=(IsImageFormatHandler *) IsEPT;
-  entry->adjoin=MagickFalse;
-  entry->seekable_stream=MagickTrue;
-  entry->blob_support=MagickFalse;
+  entry->flags^=CoderAdjoinFlag;
+  entry->flags|=CoderSeekableStreamFlag;
+  entry->flags^=CoderBlobSupportFlag;
   entry->description=ConstantString(
     "Encapsulated PostScript Level II with TIFF preview");
   entry->module=ConstantString("EPT");
@@ -301,8 +305,8 @@ ModuleExport size_t RegisterEPTImage(void)
   entry->decoder=(DecodeImageHandler *) ReadEPTImage;
   entry->encoder=(EncodeImageHandler *) WriteEPTImage;
   entry->magick=(IsImageFormatHandler *) IsEPT;
-  entry->seekable_stream=MagickTrue;
-  entry->blob_support=MagickFalse;
+  entry->flags|=CoderSeekableStreamFlag;
+  entry->flags^=CoderBlobSupportFlag;
   entry->description=ConstantString(
     "Encapsulated PostScript Level III with TIFF preview");
   entry->module=ConstantString("EPT");
@@ -398,6 +402,7 @@ static MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image,
   if (write_image == (Image *) NULL)
     return(MagickFalse);
   write_info=CloneImageInfo(image_info);
+  *write_info->magick='\0';
   (void) CopyMagickString(write_info->magick,"EPS",MaxTextExtent);
   if (LocaleCompare(image_info->magick,"EPT2") == 0)
     (void) CopyMagickString(write_info->magick,"EPS2",MaxTextExtent);
@@ -415,11 +420,12 @@ static MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image,
   if (write_image == (Image *) NULL)
     return(MagickFalse);
   write_info=CloneImageInfo(image_info);
+  *write_info->magick='\0';
   (void) CopyMagickString(write_info->magick,"TIFF",MaxTextExtent);
   (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))
     {
@@ -430,8 +436,8 @@ static MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image,
         EPT preview requires that the image is colormapped.
       */
       GetQuantizeInfo(&quantize_info);
-      quantize_info.dither=IsPaletteImage(write_image,exception) == MagickFalse
-        ? MagickTrue : MagickFalse;
+      quantize_info.dither_method=IsPaletteImage(write_image,exception) ==
+        MagickFalse ? RiemersmaDitherMethod : NoDitherMethod;
       (void) QuantizeImage(&quantize_info,write_image,exception);
     }
   write_info->compression=NoCompression;