Anonymous avatar Anonymous committed 3e02d25

- sync to 2.0.11

Comments (0)

Files changed (8)

 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57 for GD 2.0.10.
+# Generated by GNU Autoconf 2.57 for GD 2.0.11.
 #
 # Report bugs to <gd@boutell.com>.
 #
 # Identity of this package.
 PACKAGE_NAME='GD'
 PACKAGE_TARNAME='gd'
-PACKAGE_VERSION='2.0.10'
-PACKAGE_STRING='GD 2.0.10'
+PACKAGE_VERSION='2.0.11'
+PACKAGE_STRING='GD 2.0.11'
 PACKAGE_BUGREPORT='gd@boutell.com'
 
 ac_unique_file="gd.c"
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures GD 2.0.10 to adapt to many kinds of systems.
+\`configure' configures GD 2.0.11 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GD 2.0.10:";;
+     short | recursive ) echo "Configuration of GD 2.0.11:";;
    esac
   cat <<\_ACEOF
 
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-GD configure 2.0.10
+GD configure 2.0.11
 generated by GNU Autoconf 2.57
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by GD $as_me 2.0.10, which was
+It was created by GD $as_me 2.0.11, which was
 generated by GNU Autoconf 2.57.  Invocation command line was
 
   $ $0 $@
 
 GDLIB_MAJOR=2
 GDLIB_MINOR=0
-GDLIB_REVISION=10
+GDLIB_REVISION=11
 GDLIBNAME=gd
 
 
 
 # Define the identity of the package.
  PACKAGE=gd
- VERSION=2.0.10
+ VERSION=2.0.11
 
 
 cat >>confdefs.h <<_ACEOF
 fi
 
 
-if test "x$x_includes" != xNONE ; then
+if test -n "$x_includes" && test "x$x_includes" != xNONE ; then
   CPPFLAGS="$CPPFLAGS -I$x_includes"
 fi
-if test "x$x_libraries" != xNONE ; then
+if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
   LDFLAGS="$LDFLAGS -L$x_libraries"
 fi
 
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by GD $as_me 2.0.10, which was
+This file was extended by GD $as_me 2.0.11, which was
 generated by GNU Autoconf 2.57.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-GD config.status 2.0.10
+GD config.status 2.0.11
 configured by $0, generated by GNU Autoconf 2.57,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
 AC_PREREQ(2.54)
 
 #HEY! Change BOTH the vesion number and the GDLIB_REVISION setting!
-AC_INIT([GD], [2.0.10], [gd@boutell.com])
+AC_INIT([GD], [2.0.11], [gd@boutell.com])
 AC_CONFIG_SRCDIR([gd.c])
 AC_CONFIG_AUX_DIR(config)
 
 GDLIB_MAJOR=2
 GDLIB_MINOR=0
-GDLIB_REVISION=10
+GDLIB_REVISION=11
 GDLIBNAME=gd
 
 AC_SUBST(GDLIB_MAJOR)
 dnl may be required for freetype and Xpm
 AC_PATH_X
 
-if test "x$x_includes" != xNONE ; then
+if test -n "$x_includes" && test "x$x_includes" != xNONE ; then
   CPPFLAGS="$CPPFLAGS -I$x_includes"
 fi
-if test "x$x_libraries" != xNONE ; then
+if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
   LDFLAGS="$LDFLAGS -L$x_libraries"
 fi
 
 
 #define GD2_VERS                2
 #define GD2_ID                  "gd2"
+
 #define GD2_FMT_RAW             1
 #define GD2_FMT_COMPRESSED      2
 
 #include <stdlib.h>
 #include "gd.h"
 
-/* A short program which converts a .png file into a .gd file, for
+/* A short program which converts a .png file into a .gd2 file, for
    your convenience in creating images on the fly from a
-   basis image that must be loaded quickly. The .gd format
+   basis image that must be loaded quickly. The .gd2 format
    is not intended to be a general-purpose format. */
 
 int
 {
   gdImagePtr im;
   FILE *in, *out;
-  if (argc != 3)
+  int x, y, w, h;
+  if ((argc != 3) && (argc != 7))
     {
-      fprintf (stderr, "Usage: gd2topng filename.gd2 filename.png\n");
+      fprintf (stderr, "Usage: gd2topng filename.gd2 filename.png [srcx srcy width height]\n");
+      fprintf (stderr, "If the coordinates are absent,t he entire image is converted.\n");
       exit (1);
     }
+  if (argc == 7) {
+    x = atoi(argv[3]);
+    y = atoi(argv[4]);
+    w = atoi(argv[5]);
+    h = atoi(argv[6]);
+  }
   in = fopen (argv[1], "rb");
   if (!in)
     {
       fprintf (stderr, "Input file does not exist!\n");
       exit (1);
     }
-  im = gdImageCreateFromGd2 (in);
+  if (argc == 7) {
+    im = gdImageCreateFromGd2Part (in, x, y, w, h);
+  } else {
+    im = gdImageCreateFromGd2 (in);
+  }
   fclose (in);
   if (!im)
     {
 #define TRUE 1
 #define FALSE 0
 
+/* 2.11: not part of the API, as the save routine can figure it out
+	from im->trueColor, and the load routine doesn't need to tell
+	the end user the saved format. NOTE: adding 2 is assumed
+	to result in the correct format value for truecolor! */
+#define GD2_FMT_TRUECOLOR_RAW 3
+#define GD2_FMT_TRUECOLOR_COMPRESSED 4
+
+#define gd2_compressed(fmt) (((fmt) == GD2_FMT_COMPRESSED) || \
+	((fmt) == GD2_FMT_TRUECOLOR_COMPRESSED))
+
+#define gd2_truecolor(fmt) (((fmt) == GD2_FMT_TRUECOLOR_RAW) || \
+	((fmt) == GD2_FMT_TRUECOLOR_COMPRESSED))
+
 /* Use this for commenting out debug-print statements. */
 /* Just use the first '#define' to allow all the prints... */
 /*#define GD2_DBG(s) (s) */
     };
   GD2_DBG (printf ("Format: %d\n", *fmt));
 
-  if ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED))
+  if ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) &&
+		(*fmt != GD2_FMT_TRUECOLOR_RAW) &&
+		(*fmt != GD2_FMT_TRUECOLOR_COMPRESSED))
     {
       GD2_DBG (printf ("Bad data format: %d\n", *fmt));
       goto fail1;
     };
   GD2_DBG (printf ("%d Chunks vertically\n", *ncy));
 
-  if ((*fmt) == GD2_FMT_COMPRESSED)
+  if (gd2_compressed(*fmt))
     {
       nc = (*ncx) * (*ncy);
       GD2_DBG (printf ("Reading %d chunk index entries\n", nc));
       GD2_DBG (printf ("Bad GD2 header\n"));
       goto fail1;
     }
-
-  im = gdImageCreate (*sx, *sy);
+  if (gd2_truecolor(*fmt)) {
+    im = gdImageCreateTrueColor (*sx, *sy);
+  } else {
+    im = gdImageCreate (*sx, *sy);
+  }
   if (im == NULL)
     {
       GD2_DBG (printf ("Could not create gdImage\n"));
   bytesPerPixel = im->trueColor ? 4 : 1;
   nc = ncx * ncy;
 
-  if (fmt == GD2_FMT_COMPRESSED)
+  if (gd2_compressed(fmt)) 
     {
       /* Find the maximum compressed chunk size. */
       compMax = 0;
 		   ("Processing Chunk %d (%d, %d), y from %d to %d\n",
 		    chunkNum, cx, cy, ylo, yhi));
 
-	  if (fmt == GD2_FMT_COMPRESSED)
+	  if (gd2_compressed(fmt))
 	    {
 
 	      chunkLen = chunkMax;
 		  xhi = im->sx;
 		};
 	      /*GD2_DBG(printf("y=%d: ",y)); */
-	      if (fmt == GD2_FMT_RAW)
+	      if (!gd2_compressed(fmt)) 
 		{
 		  for (x = xlo; x < xhi; x++)
 		    {
 			  int r = chunkBuf[chunkPos++] << 16;
 			  int g = chunkBuf[chunkPos++] << 8;
 			  int b = chunkBuf[chunkPos++];
-			  im->pixels[y][x] = a + r + g + b;
+                          /* 2.0.11: tpixels */
+			  im->tpixels[y][x] = a + r + g + b;
 			}
 		      else
 			{
   GD2_DBG (printf ("File size is %dx%d\n", fsx, fsy));
 
   /* This is the difference - make a file based on size of chunks. */
-  im = gdImageCreate (w, h);
+  if (gd2_truecolor(fmt)) {
+    im = gdImageCreateTrueColor (w, h);
+  } else {
+    im = gdImageCreate (w, h);
+  }
   if (im == NULL)
     {
       goto fail1;
   /* Process the header info */
   nc = ncx * ncy;
 
-  if (fmt == GD2_FMT_COMPRESSED)
+  if (gd2_compressed(fmt)) 
     {
       /* Find the maximum compressed chunk size. */
       compMax = 0;
 		   ("Processing Chunk (%d, %d), from %d to %d\n", cx, cy, ylo,
 		    yhi));
 
-	  if (fmt == GD2_FMT_RAW)
+	  if (!gd2_compressed(fmt)) 
 	    {
 	      GD2_DBG (printf ("Using raw format data\n"));
 	      if (im->trueColor)
 		{
 		  dpos =
-		    (cy * (cs * fsx) + cx * cs * (yhi - ylo) * 4) + dstart;
+		    (cy * (cs * fsx) * 4 + cx * cs * (yhi - ylo) * 4) + dstart;
 		}
 	      else
 		{
 		  dpos = cy * (cs * fsx) + cx * cs * (yhi - ylo) + dstart;
 		}
-
-	      if (gdSeek (in, dpos) != 0)
+              /* gd 2.0.11: gdSeek returns TRUE on success, not 0.
+                 Longstanding bug. 01/16/03 */
+	      if (!gdSeek (in, dpos))
 		{
 		  printf ("Error from seek: %d\n", errno);
 		  goto fail2;
 
 	      for (x = xlo; x < xhi; x++)
 		{
-		  if (fmt == GD2_FMT_RAW)
+		  if (!gd2_compressed(fmt)) 
 		    {
 		      if (im->trueColor)
 			{
 		      && (y >= srcy) && (y < (srcy + h)) && (y < fsy)
 		      && (y >= 0))
 		    {
-		      im->pixels[y - srcy][x - srcx] = ch;
+                      /* 2.0.11: tpixels */
+                      if (im->trueColor) {  
+		        im->tpixels[y - srcy][x - srcx] = ch;
+                      } else {
+		        im->pixels[y - srcy][x - srcx] = ch;
+                      }   
 		    }
 		};
 	    };
   /* */
   /* Force fmt to a valid value since we don't return anything. */
   /* */
-  if ((fmt == 0) || ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED)))
-    {
-      fmt = GD2_FMT_COMPRESSED;
-    };
-
+  if ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED))
+  { 	
+      fmt = im->trueColor ? GD2_FMT_TRUECOLOR_COMPRESSED : GD2_FMT_COMPRESSED;
+  };
+  if (im->trueColor) {
+    fmt += 2;
+  }
   /* */
   /* Make sure chunk size is valid. These are arbitrary values; 64 because it seems */
   /* a little silly to expect performance improvements on a 64x64 bit scale, and  */
-  /* 4096 because we buffer one chunk, and a 16MB buffer seems a little largei - it may be */
+  /* 4096 because we buffer one chunk, and a 16MB buffer seems a little large - it may be */
   /* OK for one user, but for another to read it, they require the buffer. */
   /* */
   if (cs == 0)
   /* Write the standard header. */
   _gd2PutHeader (im, out, cs, fmt, ncx, ncy);
 
-  if (fmt == GD2_FMT_COMPRESSED)
+  if (gd2_compressed(fmt)) 
     {
       /* */
       /* Work out size of buffer for compressed data, If CHUNKSIZE is large, */
 		  xhi = im->sx;
 		};
 
-	      if (fmt == GD2_FMT_COMPRESSED)
+	      if (gd2_compressed(fmt))
 		{
 		  for (x = xlo; x < xhi; x++)
 		    {
-		      int p = im->pixels[y][x];
+                      /* 2.0.11: use truecolor pixel array. TBB */
 		      /*GD2_DBG(printf("%d...",x)); */
 		      if (im->trueColor)
 			{
+		          int p = im->tpixels[y][x];
 			  chunkData[chunkLen++] = gdTrueColorGetAlpha (p);
 			  chunkData[chunkLen++] = gdTrueColorGetRed (p);
 			  chunkData[chunkLen++] = gdTrueColorGetGreen (p);
 			}
 		      else
 			{
+		          int p = im->pixels[y][x];
 			  chunkData[chunkLen++] = p;
 			}
 		    };
 		};
 	      /*GD2_DBG(printf("y=%d done.\n",y)); */
 	    };
-	  if (fmt == GD2_FMT_COMPRESSED)
+	  if (gd2_compressed(fmt))
 	    {
 	      compLen = compMax;
 	      if (compress ((unsigned char *)
 	    };
 	};
     };
-  if (fmt == GD2_FMT_COMPRESSED)
+  if (gd2_compressed(fmt))
     {
       /* Save the position, write the index, restore position (paranoia). */
       GD2_DBG (printf ("Seeking %d to write index\n", idxPos));
   void (*putC) (struct gdIOCtx *, int);
   int (*putBuf) (struct gdIOCtx *, const void *, int);
 
-  int (*seek) (struct gdIOCtx *, const int);
+  /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
+  int (*seek) (struct gdIOCtx *, const int); 
+
   long (*tell) (struct gdIOCtx *);
 
   void (*gd_free) (struct gdIOCtx *);
 {
   fileIOCtx *fctx;
   fctx = (fileIOCtx *) ctx;
-
   return (fseek (fctx->f, pos, SEEK_SET) == 0);
 }
 
 <html>
 <head>
-<TITLE>gd 2.0.10</TITLE>
+<TITLE>gd 2.0.11</TITLE>
 </head>
 <body bgcolor="#FFFFFF">
 <!-- BANNER HERE -->
-<h1>This is gd 2.0.10.</h1>
+<h1>This is gd 2.0.11.</h1>
 <p>
-<H2>gd 2.0.10</H2>
+<H2>gd 2.0.11</H2>
 <H3>A graphics library for fast image creation</H3>
 <H3>Follow this link to the
 <A HREF="http://www.boutell.com/gd/">latest version
 new installation overwrites the old.
 <p>
 <strong>ABOUT GD AND GIF:</strong>
-gd 2.0.10 creates PNG, JPEG and WBMP images, not GIF images. This is a 
+gd 2.0.11 creates PNG, JPEG and WBMP images, not GIF images. This is a 
 good thing.  PNG is a more compact format, and full compression is
 available.  JPEG works best with photographic images, and is still
 more compatible with the major Web browsers than even PNG is. WBMP is
 modern image formats such as PNG and JPEG as soon as possible.
 
 <p>
-gd 2.0.10 <strong>requires</strong> that the following libraries 
+gd 2.0.11 <strong>requires</strong> that the following libraries 
 also be installed, in order to produce the related image formats.
 You may skip libraries associated with formats you do not use:
 <p>
 <H3>Table of Contents</H3>
 <UL>
 <LI><A HREF="#notice">Credits and license terms</A>
-<LI><A HREF="#whatsnew2.0.10">What's new in version "XYZ" of GD?</A>
+<LI><A HREF="#whatsnew2.0.11">What's new in version "XYZ" of GD?</A>
 <LI><A HREF="#whatis">What is gd?</A>
 <LI><A HREF="#gdother">What if I want to use another programming language?</A>
 <LI><A HREF="#required">What else do I need to use gd?</A>
 <A NAME="gdother"><H3>What if I want to use another programming
 language?</h3></A>
 Not all of these tools are necessarily up to date and fully compatible
-with 2.0.10.
+with 2.0.11.
 <h4>PHP</h4>
 A variant of gd 2.x is included in PHP 4.3.0. It is also possible
-to patch PHP 4.2.3 for use with gd 2.0.10; see the
+to patch PHP 4.2.3 for use with gd 2.0.11; see the
 <a href="http://www.boutell.com/gd/">gd home page</a> for a link to
 that information. It would be a Good Idea to merge all of the things
 that are better in mainstream gd and all of the things that are
 <li><a href="http://martin.gleeson.com/fly/">fly</a>, by Martin Gleeson
 </ul>
 <P>
+<A NAME="whatsnew2.0.11"><H3>What's new in version 2.0.11?</H3></A>
+<P>
+<ul>
+<li>Support for the "gd2" file format, which allows fast loading of all or
+only part of an existing image, has been properly debugged for use with
+truecolor images. (Palette images already worked properly, except for a
+bug when loading from a regular file with gdImageCreateFromGd2Part, which
+has also been fixed.) .gd2 files can be either compressed or uncompressed,
+and they allow useful tricks such as fast loading of a 500x500 pixel
+region of a 6000x3000 pixel image, without uncompressing <em>all</em> of the
+image. .gd2 is NOT a general purpose file format and should only be used
+where quick loading of a background image or subset of a larger image
+is required. For more information, see
+<a href="#gdImageGd2">gdImageGd2</a>, 
+<a href="#gdImageCreateFromGd2">gdImageCreateFromGd2</a>,
+and 
+<a href="#gdImageCreateFromGd2Part">gdImageCreateFromGd2Part</a>.
+<li>The gd2topng utility has been extended to support extraction of
+only part of an image from a .gd2 file. This is both a demonstration and 
+a practical tool.
+<li>Additional <code>configure</code> improvements by Lars Hecking.
+</ul>
+<P>
 <A NAME="whatsnew2.0.10"><H3>What's new in version 2.0.10?</H3></A>
 <P>
 <ul>
 <p>
 <dt><b>Extended I/O capabilities.</b>
 <dd>      The source/sink feature has been extended to support GD2 file formats (which
-          require seek/tell functions), and to allow more general non-file I/O.
+          require seek/tell functions; seek must return 1 for success, 0 for failure), and to allow more general non-file I/O.
 <p>
 <dt><b>Better support for Lincoln Stein's Perl Module</b>
 <dd>      The new gdImage*Ptr function returns the chosen format stored in a block of memory.
 <P>
 <A NAME="getgd"><H3>How do I get gd?</H3></A>
 <ul>
-<li><a href="http://www.boutell.com/gd/http/gd-2.0.10.tar.gz">Gzipped Tar File (Unix)</a>
-<li><a href="http://www.boutell.com/gd/http/gd-2.0.10.zip">.ZIP File (Windows)</a>
+<li><a href="http://www.boutell.com/gd/http/gd-2.0.11.tar.gz">Gzipped Tar File (Unix)</a>
+<li><a href="http://www.boutell.com/gd/http/gd-2.0.11.zip">.ZIP File (Windows)</a>
 </ul>
 <P>
 <A NAME="buildgd"><H3>How do I build gd?</H3></A>
 consult with an experienced user of your system. Sorry, we cannot
 answer questions about basic Internet skills.
 <p>
-Unpacking the archive will produce a directory called "gd-2.0.10".
+Unpacking the archive will produce a directory called "gd-2.0.11".
 <p>
 <h4>For Unix</h4>
-<code>cd</code> to the 2.0.10 directory and type:
+<code>cd</code> to the 2.0.11 directory and type:
 <p>
 <code>./configure</code>
 <P>
         void     (*putC)(struct gdIOCtx*, int);
         int     (*putBuf)(struct gdIOCtx*, const void*, int);
 
-        int     (*seek)(struct gdIOCtx*, const int);
-        long    (*tell)(struct gdIOCtx*);
+        int     (*seek)(struct gdIOCtx*, const int); /* Returns 1 on SUCCESS */
+        long    (*tell)(struct gdIOCtx*); 
 
         void    (*free)(struct gdIOCtx*);
 
 <TR><TD>All</TD><td width=20>&nbsp;</td><TD>Must have 'free',</td></tr>
 <TR><TD>Anything that reads from the context</TD><td></td><TD>Must have 'getC' and 'getBuf',</td></tr>
 <TR><TD>Anything that writes to the context</TD><td></td><TD>Must have 'putC' and 'putBuf'.</td></tr>
-<TR><TD>If gdCreateFromGd2Part is called</td><td></td><TD>Must also have 'seek' and 'tell'.</td></tr>
+<TR><TD>If gdCreateFromGd2Part is called</td><td></td><TD>Must also have 'seek' and 'tell'. Note: seek must return 1 on SUCCESS and 0 on FAILURE.</td></tr>
 <TR><TD>If gdImageGd2 is called</td><td></td><TD>Must also have 'seek' and 'tell'.</td></tr>
 </Table>
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.