]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 25 Sep 2009 14:34:31 +0000 (14:34 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 25 Sep 2009 14:34:31 +0000 (14:34 +0000)
Makefile.in
coders/Makefile.am
coders/pdf.c
coders/ps2.c
coders/ps3.c
magick/version.h

index 4b5bfa3840ff66843339ff6236c6f2ab473f5c8f..d26bd03b2db826ac1de55744ef7da2efdc5c50e6 100644 (file)
@@ -875,8 +875,7 @@ coders_pdb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 @WITH_MODULES_TRUE@am_coders_pdb_la_rpath = -rpath $(codersdir)
 coders_pdf_la_DEPENDENCIES = $(MAGICKCORE_LIBS) $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_coders_pdf_la_OBJECTS = coders/coders_pdf_la-pdf.lo
 coders_pdf_la_OBJECTS = $(am_coders_pdf_la_OBJECTS)
 coders_pdf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -941,7 +940,7 @@ coders_ps_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 @WITH_MODULES_TRUE@am_coders_ps_la_rpath = -rpath $(codersdir)
 coders_ps2_la_DEPENDENCIES = $(MAGICKCORE_LIBS) $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 am_coders_ps2_la_OBJECTS = coders/coders_ps2_la-ps2.lo
 coders_ps2_la_OBJECTS = $(am_coders_ps2_la_OBJECTS)
 coders_ps2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -950,7 +949,7 @@ coders_ps2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 @WITH_MODULES_TRUE@am_coders_ps2_la_rpath = -rpath $(codersdir)
 coders_ps3_la_DEPENDENCIES = $(MAGICKCORE_LIBS) $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 am_coders_ps3_la_OBJECTS = coders/coders_ps3_la-ps3.lo
 coders_ps3_la_OBJECTS = $(am_coders_ps3_la_OBJECTS)
 coders_ps3_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -3381,7 +3380,7 @@ coders_pdb_la_LIBADD = $(MAGICKCORE_LIBS)
 coders_pdf_la_SOURCES = coders/pdf.c
 coders_pdf_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
 coders_pdf_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_pdf_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
+coders_pdf_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
 
 # PICT coder module
 coders_pict_la_SOURCES = coders/pict.c
@@ -3429,13 +3428,13 @@ coders_ps_la_LIBADD = $(MAGICKCORE_LIBS) $(GS_LIBS) $(MATH_LIBS)
 coders_ps2_la_SOURCES = coders/ps2.c
 coders_ps2_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
 coders_ps2_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_ps2_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps2_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
 
 # PS3 coder module
 coders_ps3_la_SOURCES = coders/ps3.c
 coders_ps3_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
 coders_ps3_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_ps3_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps3_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
 
 # PSD coder module
 coders_psd_la_SOURCES = coders/psd.c
index 6ce099941ead9b486da07cebc44479b06c2d6351..bdb220c4340eca8339a1be8eff447d16fb437a0a 100644 (file)
@@ -686,7 +686,7 @@ coders_pdb_la_LIBADD       = $(MAGICKCORE_LIBS)
 coders_pdf_la_SOURCES      = coders/pdf.c
 coders_pdf_la_CPPFLAGS     = $(MODULE_EXTRA_CPPFLAGS)
 coders_pdf_la_LDFLAGS      = $(MODULECOMMONFLAGS)
-coders_pdf_la_LIBADD       = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
+coders_pdf_la_LIBADD       = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
 
 # PICT coder module
 coders_pict_la_SOURCES     = coders/pict.c
@@ -734,13 +734,13 @@ coders_ps_la_LIBADD        = $(MAGICKCORE_LIBS) $(GS_LIBS) $(MATH_LIBS)
 coders_ps2_la_SOURCES      = coders/ps2.c
 coders_ps2_la_CPPFLAGS     = $(MODULE_EXTRA_CPPFLAGS)
 coders_ps2_la_LDFLAGS      = $(MODULECOMMONFLAGS)
-coders_ps2_la_LIBADD       = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps2_la_LIBADD       = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
 
 # PS3 coder module
 coders_ps3_la_SOURCES      = coders/ps3.c
 coders_ps3_la_CPPFLAGS     = $(MODULE_EXTRA_CPPFLAGS)
 coders_ps3_la_LDFLAGS      = $(MODULECOMMONFLAGS)
-coders_ps3_la_LIBADD       = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps3_la_LIBADD       = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
 
 # PSD coder module
 coders_psd_la_SOURCES      = coders/psd.c
index 30e309ef0800e4823c082088bd82106dc207dcf4..8fbbb321e30bfc9fcb584fad5667c71111fea2af 100644 (file)
 #include "magick/transform.h"
 #include "magick/utility.h"
 #include "magick/module.h"
+\f
+/*
+  Define declarations.
+*/
 #if defined(MAGICKCORE_TIFF_DELEGATE)
-#if defined(MAGICKCORE_HAVE_TIFFCONF_H)
-#include "tiffconf.h"
-#endif
-#include "tiffio.h"
 #define CCITTParam  "-1"
 #else
 #define CCITTParam  "0"
@@ -851,154 +851,41 @@ static char *EscapeParenthesis(const char *text)
   return(buffer);
 }
 
-#if defined(MAGICKCORE_TIFF_DELEGATE)
 static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
   Image *image,Image *inject_image)
 {
-  char
-    filename[MaxTextExtent];
-
-  FILE
-    *file;
-
   Image
-    *huffman_image;
+    *group4_image;
 
   ImageInfo
     *write_info;
 
-  int
-    unique_file;
-
   MagickBooleanType
     status;
 
-  register long
-    i;
-
-  ssize_t
-    count;
-
-  TIFF
-    *tiff;
-
-  uint16
-    fillorder;
-
-  uint32
-    *byte_count,
-    strip_size;
+  size_t
+    length;
 
   unsigned char
-    *buffer;
+    *group4;
 
-  /*
-    Write image as CCITTFax4 TIFF image to a temporary file.
-  */
-  assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
-  assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(inject_image != (Image *) NULL);
-  assert(inject_image->signature == MagickSignature);
-  huffman_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
-  if (huffman_image == (Image *) NULL)
-    return(MagickFalse);
-  file=(FILE *) NULL;
-  unique_file=AcquireUniqueFileResource(filename);
-  if (unique_file != -1)
-    file=fdopen(unique_file,"wb"); 
-  if ((unique_file == -1) || (file == (FILE *) NULL))
-    {
-      ThrowFileException(&image->exception,FileOpenError,
-        "UnableToCreateTemporaryFile",filename);
-      return(MagickFalse);
-    }
-  (void) FormatMagickString(huffman_image->filename,MaxTextExtent,"tiff:%s",
-    filename);
   write_info=CloneImageInfo(image_info);
-  SetImageInfoFile(write_info,file);
-  write_info->compression=Group4Compression;
-  write_info->type=BilevelType;
-  (void) SetImageOption(write_info,"quantum:polarity","min-is-white");
-  status=WriteImage(write_info,huffman_image);
-  (void) fflush(file);
+  (void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
+  (void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
+  group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+  if (group4_image == (Image *) NULL)
+    return(MagickFalse);
+  group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
+    &image->exception);
+  group4_image=DestroyImage(group4_image);
+  if (group4 == (unsigned char *) NULL)
+    return(MagickFalse);
   write_info=DestroyImageInfo(write_info);
-  if (status == MagickFalse)
-    {
-      (void) RelinquishUniqueFileResource(filename);
-      return(MagickFalse);
-    }
-  tiff=TIFFOpen(filename,"rb");
-  if (tiff == (TIFF *) NULL)
-    {
-      huffman_image=DestroyImage(huffman_image);
-      (void) fclose(file);
-      (void) RelinquishUniqueFileResource(filename);
-      ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
-        image_info->filename);
-      return(MagickFalse);
-    }
-  /*
-    Allocate raw strip buffer.
-  */
-  byte_count=0;
-  (void) TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count);
-  strip_size=byte_count[0];
-  for (i=1; i < (long) TIFFNumberOfStrips(tiff); i++)
-    if (byte_count[i] > strip_size)
-      strip_size=byte_count[i];
-  buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size,
-    sizeof(*buffer));
-  if (buffer == (unsigned char *) NULL)
-    {
-      TIFFClose(tiff);
-      huffman_image=DestroyImage(huffman_image);
-      (void) fclose(file);
-      (void) RelinquishUniqueFileResource(filename);
-      ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
-        image_info->filename);
-    }
-  /*
-    Compress runlength encoded to 2D Huffman pixels.
-  */
-  fillorder=FILLORDER_LSB2MSB;
-  (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&fillorder);
-  for (i=0; i < (long) TIFFNumberOfStrips(tiff); i++)
-  {
-    count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,(long)
-      byte_count[i]);
-    if (fillorder == FILLORDER_LSB2MSB)
-      TIFFReverseBits(buffer,(unsigned long) count);
-    (void) WriteBlob(image,(size_t) count,buffer);
-  }
-  buffer=(unsigned char *) RelinquishMagickMemory(buffer);
-  TIFFClose(tiff);
-  huffman_image=DestroyImage(huffman_image);
-  (void) fclose(file);
-  (void) RelinquishUniqueFileResource(filename);
-  return(MagickTrue);
-}
-#else
-static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
-  Image *image,Image *inject_image)
-{
-  assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
-  assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(inject_image != (Image *) NULL);
-  assert(inject_image->signature == MagickSignature);
-  (void) ThrowMagickException(&image->exception,GetMagickModule(),
-    MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (TIFF)",
-    image->filename);
-  return(MagickFalse);
+  if (WriteBlob(image,length,group4) != (ssize_t) length)
+    status=MagickFalse;
+  group4=(unsigned char *) RelinquishMagickMemory(group4);
+  return(status);
 }
-#endif
 
 static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image)
 {
@@ -1571,7 +1458,7 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image)
           MaxTextExtent);
         (void) WriteBlobString(image,buffer);
         (void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
-          "/K %s /BlackIs1 true /Columns %ld /Rows %ld >> ]\n",CCITTParam,
+          "/K %s /BlackIs1 false /Columns %ld /Rows %ld >> ]\n",CCITTParam,
           image->columns,image->rows);
         break;
       }
@@ -2013,7 +1900,7 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image)
           MaxTextExtent);
         (void) WriteBlobString(image,buffer);
         (void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
-          "/K %s /BlackIs1 true /Columns %lu /Rows %lu >> ]\n",CCITTParam,
+          "/K %s /BlackIs1 false /Columns %lu /Rows %lu >> ]\n",CCITTParam,
           tile_image->columns,tile_image->rows);
         break;
       }
index c6b1912eaeb28b8b2a2f94ccda6501bb76be6310..d51e73c7866b60b0979e334ab9286390aabfd476 100644 (file)
 #include "magick/string_.h"
 #include "magick/module.h"
 #include "magick/utility.h"
+\f
+/*
+  Define declarations.
+*/
 #if defined(MAGICKCORE_TIFF_DELEGATE)
-#if defined(MAGICKCORE_HAVE_TIFFCONF_H)
-#include "tiffconf.h"
-#endif
-#include "tiffio.h"
 #define CCITTParam  "-1"
 #else
 #define CCITTParam  "0"
@@ -180,154 +180,41 @@ ModuleExport void UnregisterPS2Image(void)
 %
 */
 
-#if defined(MAGICKCORE_TIFF_DELEGATE)
 static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
   Image *image,Image *inject_image)
 {
-  char
-    filename[MaxTextExtent];
-
-  FILE
-    *file;
-
   Image
-    *huffman_image;
+    *group4_image;
 
   ImageInfo
     *write_info;
 
-  int
-    unique_file;
-
   MagickBooleanType
     status;
 
-  register long
-    i;
-
-  ssize_t
-    count;
-
-  TIFF
-    *tiff;
-
-  uint16
-    fillorder;
-
-  uint32
-    *byte_count,
-    strip_size;
+  size_t
+    length;
 
   unsigned char
-    *buffer;
+    *group4;
 
-  /*
-    Write image as CCITTFax4 TIFF image to a temporary file.
-  */
-  assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
-  assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(inject_image != (Image *) NULL);
-  assert(inject_image->signature == MagickSignature);
-  huffman_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
-  if (huffman_image == (Image *) NULL)
-    return(MagickFalse);
-  file=(FILE *) NULL;
-  unique_file=AcquireUniqueFileResource(filename);
-  if (unique_file != -1)
-    file=fdopen(unique_file,"wb"); 
-  if ((unique_file == -1) || (file == (FILE *) NULL))
-    {
-      ThrowFileException(&image->exception,FileOpenError,
-        "UnableToCreateTemporaryFile",filename);
-      return(MagickFalse);
-    }
-  (void) FormatMagickString(huffman_image->filename,MaxTextExtent,"tiff:%s",
-    filename);
   write_info=CloneImageInfo(image_info);
-  SetImageInfoFile(write_info,file);
-  write_info->compression=Group4Compression;
-  write_info->type=BilevelType;
-  (void) SetImageOption(write_info,"quantum:polarity","min-is-white");
-  status=WriteImage(write_info,huffman_image);
-  (void) fflush(file);
+  (void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
+  (void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
+  group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+  if (group4_image == (Image *) NULL)
+    return(MagickFalse);
+  group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
+    &image->exception);
+  group4_image=DestroyImage(group4_image);
+  if (group4 == (unsigned char *) NULL)
+    return(MagickFalse);
   write_info=DestroyImageInfo(write_info);
-  if (status == MagickFalse)
-    {
-      (void) RelinquishUniqueFileResource(filename);
-      return(MagickFalse);
-    }
-  tiff=TIFFOpen(filename,"rb");
-  if (tiff == (TIFF *) NULL)
-    {
-      huffman_image=DestroyImage(huffman_image);
-      (void) fclose(file);
-      (void) RelinquishUniqueFileResource(filename);
-      ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
-        image_info->filename);
-      return(MagickFalse);
-    }
-  /*
-    Allocate raw strip buffer.
-  */
-  byte_count=0;
-  (void) TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count);
-  strip_size=byte_count[0];
-  for (i=1; i < (long) TIFFNumberOfStrips(tiff); i++)
-    if (byte_count[i] > strip_size)
-      strip_size=byte_count[i];
-  buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size,
-    sizeof(*buffer));
-  if (buffer == (unsigned char *) NULL)
-    {
-      TIFFClose(tiff);
-      huffman_image=DestroyImage(huffman_image);
-      (void) fclose(file);
-      (void) RelinquishUniqueFileResource(filename);
-      ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
-        image_info->filename);
-    }
-  /*
-    Compress runlength encoded to 2D Huffman pixels.
-  */
-  fillorder=FILLORDER_LSB2MSB;
-  (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&fillorder);
-  for (i=0; i < (long) TIFFNumberOfStrips(tiff); i++)
-  {
-    count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,(long)
-      byte_count[i]);
-    if (fillorder == FILLORDER_LSB2MSB)
-      TIFFReverseBits(buffer,(unsigned long) count);
-    (void) WriteBlob(image,(size_t) count,buffer);
-  }
-  buffer=(unsigned char *) RelinquishMagickMemory(buffer);
-  TIFFClose(tiff);
-  huffman_image=DestroyImage(huffman_image);
-  (void) fclose(file);
-  (void) RelinquishUniqueFileResource(filename);
-  return(MagickTrue);
+  if (WriteBlob(image,length,group4) != (ssize_t) length)
+    status=MagickFalse;
+  group4=(unsigned char *) RelinquishMagickMemory(group4);
+  return(status);
 }
-#else
-static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
-  Image *image,Image *inject_image)
-{
-  assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
-  assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(inject_image != (Image *) NULL);
-  assert(inject_image->signature == MagickSignature);
-  (void) ThrowMagickException(&image->exception,GetMagickModule(),
-    MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (TIFF)",
-    image->filename);
-  return(MagickFalse);
-}
-#endif
 
 static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
 {
@@ -356,8 +243,8 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
       "      /Decode [0 1 0 1 0 1]",
       "      /ImageMatrix [columns 0 0 rows neg 0 rows]",
       "      compression 0 gt",
-      "      { /DataSource pixel_stream /%s filter }",
-      "      { /DataSource pixel_stream /%s filter } ifelse",
+      "      { /DataSource pixel_stream %s }",
+      "      { /DataSource pixel_stream %s } ifelse",
       "    >> image",
       "  }",
       "  {",
@@ -370,8 +257,8 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
       "      /Decode [1 0 1 0 1 0 1 0]",
       "      /ImageMatrix [columns 0 0 rows neg 0 rows]",
       "      compression 0 gt",
-      "      { /DataSource pixel_stream /%s filter }",
-      "      { /DataSource pixel_stream /%s filter } ifelse",
+      "      { /DataSource pixel_stream %s }",
+      "      { /DataSource pixel_stream %s } ifelse",
       "    >> image",
       "  } ifelse",
       "} bind def",
@@ -402,9 +289,9 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
       "      /Decode [0 1]",
       "      /ImageMatrix [columns 0 0 rows neg 0 rows]",
       "      compression 0 gt",
-      "      { /DataSource pixel_stream /%s filter }",
+      "      { /DataSource pixel_stream %s }",
       "      {",
-      "        /DataSource pixel_stream /%s filter",
+      "        /DataSource pixel_stream %s",
       "        <<",
       "           /K "CCITTParam,
       "           /Columns columns",
@@ -430,8 +317,8 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
       "      /Decode [0 255]",
       "      /ImageMatrix [columns 0 0 rows neg 0 rows]",
       "      compression 0 gt",
-      "      { /DataSource pixel_stream /%s filter }",
-      "      { /DataSource pixel_stream /%s filter } ifelse",
+      "      { /DataSource pixel_stream %s }",
+      "      { /DataSource pixel_stream %s } ifelse",
       "    >> image",
       "  } ifelse",
       "} bind def",
@@ -732,30 +619,31 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
             case NoCompression:
             {
               (void) FormatMagickString(buffer,MaxTextExtent,*q,
-                "ASCII85Decode");
+                "/ASCII85Decode filter");
               break;
             }
             case JPEGCompression:
             {
-              (void) FormatMagickString(buffer,MaxTextExtent,*q,"DCTDecode");
+              (void) FormatMagickString(buffer,MaxTextExtent,*q,
+                "/DCTDecode filter");
               break;
             }
             case LZWCompression:
             {
-              (void) FormatMagickString(buffer,MaxTextExtent,*q,"LZWDecode");
+              (void) FormatMagickString(buffer,MaxTextExtent,*q,
+                "/LZWDecode filter");
               break;
             }
             case FaxCompression:
             case Group4Compression:
             {
-              (void) FormatMagickString(buffer,MaxTextExtent,*q,
-                "ASCII85Decode");
+              (void) FormatMagickString(buffer,MaxTextExtent,*q," ");
               break;
             }
             default:
             {
               (void) FormatMagickString(buffer,MaxTextExtent,*q,
-                "RunLengthDecode");
+                "/RunLengthDecode filter");
               break;
             }
           }
index f7eb69e78c18baa1edeb2df6e8338e3ae666016f..8bb6345a9812ce9e2e0b7bf307a458c61f3d626c 100644 (file)
 #include "magick/token.h"
 #include "magick/utility.h"
 #include "magick/module.h"
-#if defined(MAGICKCORE_TIFF_DELEGATE)
-#if defined(MAGICKCORE_HAVE_TIFFCONF_H)
-#include "tiffconf.h"
-#endif
-#include "tiffio.h"
-#define CCITTParam  "-1"
-#else
-#define CCITTParam  "0"
-#endif
 \f
 /*
   Define declarations.
 
 #define PS3_DirectClass "0"
 #define PS3_PseudoClass "1"
+
+#if defined(MAGICKCORE_TIFF_DELEGATE)
+#include "tiffio.h"
+#define CCITTParam  "-1"
+#else
+#define CCITTParam  "0"
+#endif
 \f
 /*
   Forward declarations.
@@ -194,154 +192,42 @@ ModuleExport void UnregisterPS3Image(void)
 %
 */
 
-#if defined(MAGICKCORE_TIFF_DELEGATE)
 static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
   Image *image,Image *inject_image)
 {
-  char
-    filename[MaxTextExtent];
-
-  FILE
-    *file;
-
   Image
-    *huffman_image;
+    *group4_image;
 
   ImageInfo
     *write_info;
 
-  int
-    unique_file;
-
   MagickBooleanType
     status;
 
-  register long
-    i;
-
-  ssize_t
-    count;
-
-  TIFF
-    *tiff;
-
-  uint16
-    fillorder;
-
-  uint32
-    *byte_count,
-    strip_size;
+  size_t
+    length;
 
   unsigned char
-    *buffer;
+    *group4;
 
-  /*
-    Write image as CCITTFax4 TIFF image to a temporary file.
-  */
-  assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
-  assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(inject_image != (Image *) NULL);
-  assert(inject_image->signature == MagickSignature);
-  huffman_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
-  if (huffman_image == (Image *) NULL)
-    return(MagickFalse);
-  file=(FILE *) NULL;
-  unique_file=AcquireUniqueFileResource(filename);
-  if (unique_file != -1)
-    file=fdopen(unique_file,"wb"); 
-  if ((unique_file == -1) || (file == (FILE *) NULL))
-    {
-      ThrowFileException(&image->exception,FileOpenError,
-        "UnableToCreateTemporaryFile",filename);
-      return(MagickFalse);
-    }
-  (void) FormatMagickString(huffman_image->filename,MaxTextExtent,"tiff:%s",
-    filename);
   write_info=CloneImageInfo(image_info);
-  SetImageInfoFile(write_info,file);
-  write_info->compression=Group4Compression;
-  write_info->type=BilevelType;
-  (void) SetImageOption(write_info,"quantum:polarity","min-is-white");
-  status=WriteImage(write_info,huffman_image);
-  (void) fflush(file);
+  (void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
+  (void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
+  group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+  if (group4_image == (Image *) NULL)
+    return(MagickFalse);
+  group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
+    &image->exception);
+  group4_image=DestroyImage(group4_image);
+  if (group4 == (unsigned char *) NULL)
+    return(MagickFalse);
   write_info=DestroyImageInfo(write_info);
-  if (status == MagickFalse)
-    {
-      (void) RelinquishUniqueFileResource(filename);
-      return(MagickFalse);
-    }
-  tiff=TIFFOpen(filename,"rb");
-  if (tiff == (TIFF *) NULL)
-    {
-      huffman_image=DestroyImage(huffman_image);
-      (void) fclose(file);
-      (void) RelinquishUniqueFileResource(filename);
-      ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
-        image_info->filename);
-      return(MagickFalse);
-    }
-  /*
-    Allocate raw strip buffer.
-  */
-  byte_count=0;
-  (void) TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count);
-  strip_size=byte_count[0];
-  for (i=1; i < (long) TIFFNumberOfStrips(tiff); i++)
-    if (byte_count[i] > strip_size)
-      strip_size=byte_count[i];
-  buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size,
-    sizeof(*buffer));
-  if (buffer == (unsigned char *) NULL)
-    {
-      TIFFClose(tiff);
-      huffman_image=DestroyImage(huffman_image);
-      (void) fclose(file);
-      (void) RelinquishUniqueFileResource(filename);
-      ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
-        image_info->filename);
-    }
-  /*
-    Compress runlength encoded to 2D Huffman pixels.
-  */
-  fillorder=FILLORDER_LSB2MSB;
-  (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&fillorder);
-  for (i=0; i < (long) TIFFNumberOfStrips(tiff); i++)
-  {
-    count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,(long)
-      byte_count[i]);
-    if (fillorder == FILLORDER_LSB2MSB)
-      TIFFReverseBits(buffer,(unsigned long) count);
-    (void) WriteBlob(image,(size_t) count,buffer);
-  }
-  buffer=(unsigned char *) RelinquishMagickMemory(buffer);
-  TIFFClose(tiff);
-  huffman_image=DestroyImage(huffman_image);
-  (void) fclose(file);
-  (void) RelinquishUniqueFileResource(filename);
-  return(MagickTrue);
-}
-#else
-static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
-  Image *image,Image *inject_image)
-{
-  assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
-  assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(inject_image != (Image *) NULL);
-  assert(inject_image->signature == MagickSignature);
-  (void) ThrowMagickException(&image->exception,GetMagickModule(),
-    MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (TIFF)",
-    image->filename);
-  return(MagickFalse);
+  if (WriteBlob(image,length,group4) != (ssize_t) length)
+    status=MagickFalse;
+  group4=(unsigned char *) RelinquishMagickMemory(group4);
+  return(status);
 }
-#endif
+
 
 static MagickBooleanType SerializeImage(const ImageInfo *image_info,
   Image *image,unsigned char **pixels,size_t *length)
index 1c8c1bd832b3e4d5ddefde9ea3ea9dd0e450c7be..3ae390ccfd25f02083f36f719e61584670b6683b 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
 #define MagickLibVersionNumber  2,0,0
 #define MagickLibSubversion  "-5"
 #define MagickReleaseDate  "2009-09-25"
-#define MagickChangeDate   "20090922"
+#define MagickChangeDate   "20090925"
 #define MagickAuthoritativeURL  "http://www.imagemagick.org"
 #define MagickHomeURL  "file:///usr/local/share/doc/ImageMagick-6.5.6/index.html"
 #if (MAGICKCORE_QUANTUM_DEPTH == 8)