- sync to 2.0.21

master
pierre 2006-04-05 15:50:59 +00:00
parent ab1aba3d4d
commit 06e39b1bf5
13 changed files with 268 additions and 56 deletions

22
src/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for GD 2.0.20.
# Generated by GNU Autoconf 2.57 for GD 2.0.21.
#
# Report bugs to <gd@boutell.com>.
#
@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='GD'
PACKAGE_TARNAME='gd'
PACKAGE_VERSION='2.0.20'
PACKAGE_STRING='GD 2.0.20'
PACKAGE_VERSION='2.0.21'
PACKAGE_STRING='GD 2.0.21'
PACKAGE_BUGREPORT='gd@boutell.com'
ac_unique_file="gd.c"
@ -938,7 +938,7 @@ if test "$ac_init_help" = "long"; then
# 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.20 to adapt to many kinds of systems.
\`configure' configures GD 2.0.21 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1008,7 +1008,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of GD 2.0.20:";;
short | recursive ) echo "Configuration of GD 2.0.21:";;
esac
cat <<\_ACEOF
@ -1111,7 +1111,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
GD configure 2.0.20
GD configure 2.0.21
generated by GNU Autoconf 2.57
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
@ -1126,7 +1126,7 @@ cat >&5 <<_ACEOF
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.20, which was
It was created by GD $as_me 2.0.21, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ $0 $@
@ -1491,7 +1491,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
GDLIB_MAJOR=2
GDLIB_MINOR=0
GDLIB_REVISION=20
GDLIB_REVISION=21
GDLIBNAME=gd
@ -1738,7 +1738,7 @@ fi
# Define the identity of the package.
PACKAGE=gd
VERSION=2.0.20
VERSION=2.0.21
cat >>confdefs.h <<_ACEOF
@ -11492,7 +11492,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by GD $as_me 2.0.20, which was
This file was extended by GD $as_me 2.0.21, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -11555,7 +11555,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
GD config.status 2.0.20
GD config.status 2.0.21
configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -5,13 +5,13 @@
AC_PREREQ(2.54)
#HEY! Change BOTH the vesion number and the GDLIB_REVISION setting!
AC_INIT([GD], [2.0.20], [gd@boutell.com])
AC_INIT([GD], [2.0.21], [gd@boutell.com])
AC_CONFIG_SRCDIR([gd.c])
AC_CONFIG_AUX_DIR(config)
GDLIB_MAJOR=2
GDLIB_MINOR=0
GDLIB_REVISION=20
GDLIB_REVISION=21
GDLIBNAME=gd
AC_SUBST(GDLIB_MAJOR)

View File

@ -2280,7 +2280,8 @@ gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
mapTo = gdImageGetTrueColorPixel (src, x, y);
if (gdImageGetTransparent (src) == tmp)
{
tox++;
/* 2.0.21, TK: not tox++ */
tox += stx[x - srcX];
continue;
}
}
@ -2291,7 +2292,8 @@ gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
/* Added 7/24/95: support transparent copies */
if (gdImageGetTransparent (src) == mapTo)
{
tox++;
/* 2.0.21, TK: not tox++ */
tox += stx[x - srcX];
continue;
}
}

View File

@ -250,10 +250,13 @@ extern "C"
JPEG is always truecolor. */
BGD_EXPORT gdImagePtr gdImageCreateFromPng (FILE * fd);
BGD_EXPORT gdImagePtr gdImageCreateFromPngCtx (gdIOCtxPtr in);
BGD_EXPORT gdImagePtr gdImageCreateFromPngPtr (int size, void *data);
BGD_EXPORT gdImagePtr gdImageCreateFromWBMP (FILE * inFile);
BGD_EXPORT gdImagePtr gdImageCreateFromWBMPCtx (gdIOCtx * infile);
BGD_EXPORT gdImagePtr gdImageCreateFromWBMPPtr (int size, void *data);
BGD_EXPORT gdImagePtr gdImageCreateFromJpeg (FILE * infile);
BGD_EXPORT gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile);
BGD_EXPORT gdImagePtr gdImageCreateFromJpegPtr (int size, void *data);
/* A custom data source. */
/* The source function must return -1 on error, otherwise the number
@ -267,22 +270,29 @@ extern "C"
}
gdSource, *gdSourcePtr;
/* Deprecated in favor of gdImageCreateFromPngCtx */
BGD_EXPORT gdImagePtr gdImageCreateFromPngSource (gdSourcePtr in);
BGD_EXPORT gdImagePtr gdImageCreateFromGd (FILE * in);
BGD_EXPORT gdImagePtr gdImageCreateFromGdCtx (gdIOCtxPtr in);
BGD_EXPORT gdImagePtr gdImageCreateFromGdPtr (int size, void *data);
BGD_EXPORT gdImagePtr gdImageCreateFromGd2 (FILE * in);
BGD_EXPORT gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in);
BGD_EXPORT gdImagePtr gdImageCreateFromGd2Ptr (int size, void *data);
BGD_EXPORT gdImagePtr gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w,
int h);
BGD_EXPORT gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy,
int w, int h);
BGD_EXPORT gdImagePtr gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy,
int w, int h);
/* 2.0.10: prototype was missing */
BGD_EXPORT gdImagePtr gdImageCreateFromXpm (char *filename);
BGD_EXPORT gdImagePtr gdImageCreateFromXbm (FILE * in);
/* NOTE: filename, not FILE */
BGD_EXPORT gdImagePtr gdImageCreateFromXpm (char *filename);
BGD_EXPORT void gdImageDestroy (gdImagePtr im);
/* Replaces or blends with the background depending on the
@ -630,7 +640,22 @@ extern "C"
/* I/O Support routines. */
BGD_EXPORT gdIOCtx *gdNewFileCtx (FILE *);
BGD_EXPORT gdIOCtx *gdNewDynamicCtx (int, void *);
/* If data is null, size is ignored and an initial data buffer is
allocated automatically. NOTE: this function assumes gd has the right
to free or reallocate "data" at will! Also note that gd will free
"data" when the IO context is freed. If data is not null, it must point
to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
If not, see gdNewDynamicCtxEx for an alternative. */
BGD_EXPORT gdIOCtx *gdNewDynamicCtx (int size, void *data);
/* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
needed as described above. If freeFlag is zero, gd will never free
or reallocate "data," which means that the context should only be used
for *reading* an image from a memory buffer, or writing an image to a
memory buffer which is already large enough. If the memory buffer is
not large enough and an image write is attempted, the write operation
will fail. Those wishing to write an image to a buffer in memory have
a much simpler alternative in the gdImage[something]Ptr functions. */
BGD_EXPORT gdIOCtx *gdNewDynamicCtxEx (int size, void *data, int freeFlag);
BGD_EXPORT gdIOCtx *gdNewSSCtx (gdSourcePtr in, gdSinkPtr out);
BGD_EXPORT void *gdDPExtractData (struct gdIOCtx *ctx, int *size);

View File

@ -180,6 +180,16 @@ gdImageCreateFromGd (FILE * inFile)
return im;
}
gdImagePtr
gdImageCreateFromGdPtr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
im = gdImageCreateFromGdCtx (in);
in->gd_free (in);
return im;
}
gdImagePtr
gdImageCreateFromGdCtx (gdIOCtxPtr in)
{

View File

@ -287,6 +287,16 @@ gdImageCreateFromGd2 (FILE * inFile)
return im;
}
gdImagePtr
gdImageCreateFromGd2Ptr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
im = gdImageCreateFromGd2Ctx (in);
in->gd_free (in);
return im;
}
gdImagePtr
gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
{
@ -475,6 +485,16 @@ gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
return im;
}
gdImagePtr
gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w, int h)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
im = gdImageCreateFromGd2PartCtx (in, srcx, srcy, w, h);
in->gd_free (in);
return im;
}
gdImagePtr
gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
{

View File

@ -37,6 +37,7 @@ typedef struct dpStruct
int realSize;
int dataGood;
int pos;
int freeOK;
}
dynamicPtr;
@ -56,7 +57,7 @@ static int appendDynamic (dynamicPtr * dp, const void *src, int size);
static int gdReallocDynamic (dynamicPtr * dp, int required);
static int trimDynamic (dynamicPtr * dp);
static void gdFreeDynamicCtx (struct gdIOCtx *ctx);
static dynamicPtr *newDynamic (int initialSize, void *data);
static dynamicPtr *newDynamic (int initialSize, void *data, int freeOKFlag);
static int dynamicPutbuf (struct gdIOCtx *, const void *, int);
static void dynamicPutchar (struct gdIOCtx *, int a);
@ -70,6 +71,12 @@ static long dynamicTell (struct gdIOCtx *);
/* return data as a dynamic pointer */
gdIOCtx *
gdNewDynamicCtx (int initialSize, void *data)
{
gdNewDynamicCtxEx(initialSize, data, 1);
}
gdIOCtx *
gdNewDynamicCtxEx (int initialSize, void *data, int freeOKFlag)
{
dpIOCtx *ctx;
dynamicPtr *dp;
@ -80,7 +87,7 @@ gdNewDynamicCtx (int initialSize, void *data)
return NULL;
}
dp = newDynamic (initialSize, data);
dp = newDynamic (initialSize, data, freeOKFlag);
if (!dp)
{
gdFree (ctx);
@ -124,7 +131,8 @@ gdDPExtractData (struct gdIOCtx *ctx, int *size)
{
*size = 0;
data = NULL;
if (dp->data != NULL)
/* 2.0.21: never free memory we don't own */
if ((dp->data != NULL) && (dp->freeOK))
{
gdFree (dp->data);
}
@ -149,7 +157,8 @@ gdFreeDynamicCtx (struct gdIOCtx *ctx)
gdFree (ctx);
/* clean up the data block and return it */
if (dp->data != NULL)
/* 2.0.21: never free memory we don't own */
if ((dp->data != NULL) && (dp->freeOK))
{
gdFree (dp->data);
dp->data = NULL;
@ -187,6 +196,10 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
bytesNeeded = pos;
if (bytesNeeded > dp->realSize)
{
/* 2.0.21 */
if (!dp->freeOK) {
return FALSE;
}
if (!gdReallocDynamic (dp, dp->realSize * 2))
{
dp->dataGood = FALSE;
@ -210,7 +223,7 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
/* return data as a dynamic pointer */
static dynamicPtr *
newDynamic (int initialSize, void *data)
newDynamic (int initialSize, void *data, int freeOKFlag)
{
dynamicPtr *dp;
dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr));
@ -223,7 +236,7 @@ newDynamic (int initialSize, void *data)
return NULL;
dp->pos = 0;
dp->freeOK = freeOKFlag;
return dp;
}
@ -358,6 +371,10 @@ appendDynamic (dynamicPtr * dp, const void *src, int size)
if (bytesNeeded > dp->realSize)
{
/* 2.0.21 */
if (!dp->freeOK) {
return FALSE;
}
if (!gdReallocDynamic (dp, bytesNeeded * 2))
{
dp->dataGood = FALSE;
@ -417,5 +434,9 @@ gdReallocDynamic (dynamicPtr * dp, int required)
static int
trimDynamic (dynamicPtr * dp)
{
/* 2.0.21: we don't reallocate memory we don't own */
if (!dp->freeOK) {
return TRUE;
}
return gdReallocDynamic (dp, dp->logicalSize);
}

View File

@ -269,6 +269,16 @@ gdImageCreateFromJpeg (FILE * inFile)
return im;
}
gdImagePtr
gdImageCreateFromJpegPtr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
im = gdImageCreateFromJpegCtx (in);
in->gd_free (in);
return im;
}
void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
/*

View File

@ -107,6 +107,15 @@ gdImageCreateFromPng (FILE * inFile)
return im;
}
gdImagePtr
gdImageCreateFromPngPtr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
im = gdImageCreateFromPngCtx (in);
in->gd_free (in);
return im;
}
/* This routine is based in part on the Chapter 13 demo code in "PNG: The
* Definitive Guide" (http://www.cdrom.com/pub/png/pngbook.html).

View File

@ -197,6 +197,16 @@ gdImageCreateFromWBMP (FILE * inFile)
return (im);
}
gdImagePtr
gdImageCreateFromWBMPPtr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
im = gdImageCreateFromWBMPCtx (in);
in->gd_free (in);
return im;
}
/* gdImageWBMP
** -----------
*/

View File

@ -480,7 +480,7 @@ fontFetch (char **error, void *key)
encoding = charmap->encoding_id;
/* EAM DEBUG - Newer versions of libfree2 make it easier by defining encodings */
#ifdef FT_ENCODING_MS_SYMBOL
#if (defined(FREETYPE_MAJOR) && (FREETYPE_MAJOR >=2 ) && (FREETYPE_MINOR >= 1))
if (charmap->encoding == FT_ENCODING_MS_SYMBOL
|| charmap->encoding == FT_ENCODING_ADOBE_CUSTOM
|| charmap->encoding == FT_ENCODING_ADOBE_STANDARD) {
@ -489,7 +489,7 @@ fontFetch (char **error, void *key)
a->face->charmap = charmap;
return (void *)a;
}
#endif /* FT_ENCODING_MS_SYMBOL */
#endif /* Freetype 2.1 or better */
/* EAM DEBUG */
if ((platform == 3 && encoding == 1) /* Windows Unicode */
@ -1048,7 +1048,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
}
/* EAM DEBUG */
#ifdef FT_ENCODING_MS_SYMBOL
#if (defined(FREETYPE_MAJOR) && (FREETYPE_MAJOR >=2 ) && (FREETYPE_MINOR >= 1))
if (font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL)
{
/* I do not know the significance of the constant 0xf000. */
@ -1058,7 +1058,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
ch |= 0xf000;
next += len;
} else
#endif /* FT_ENCODING_MS_SYMBOL */
#endif /* Freetype 2.1 or better */
/* EAM DEBUG */
switch (m)

View File

@ -30,7 +30,6 @@ main (int argc, char **argv)
FILE *in, *out;
void *iptr;
int sz;
gdIOCtxPtr ctx;
char of[256];
int colRed, colBlu;
gdSource imgsrc;
@ -82,15 +81,13 @@ main (int argc, char **argv)
unlink (of);
gdImageDestroy (im2);
/* 2.0.21: use the new From*Ptr functions */
iptr = gdImagePngPtr (im, &sz);
ctx = gdNewDynamicCtx (sz, iptr);
im2 = gdImageCreateFromPngCtx (ctx);
im2 = gdImageCreateFromPngPtr (sz, iptr);
gdFree(iptr);
CompareImages ("GD->PNG ptr->GD", ref, im2);
gdImageDestroy (im2);
ctx->gd_free (ctx);
/* */
/* Send to GD2 File then Ptr */
@ -116,16 +113,13 @@ main (int argc, char **argv)
iptr = gdImageGd2Ptr (im, 128, 2, &sz);
/*printf("Got ptr %d (size %d)\n",iptr, sz); */
ctx = gdNewDynamicCtx (sz, iptr);
/*printf("Got ctx %d\n",ctx); */
im2 = gdImageCreateFromGd2Ctx (ctx);
im2 = gdImageCreateFromGd2Ptr (sz, iptr);
gdFree(iptr);
/*printf("Got img2 %d\n",im2); */
CompareImages ("GD->GD2 ptr->GD", ref, im2);
gdImageDestroy (im2);
ctx->gd_free (ctx);
/* */
/* Send to GD File then Ptr */
@ -151,15 +145,13 @@ main (int argc, char **argv)
iptr = gdImageGdPtr (im, &sz);
/*printf("Got ptr %d (size %d)\n",iptr, sz); */
ctx = gdNewDynamicCtx (sz, iptr);
/*printf("Got ctx %d\n",ctx); */
im2 = gdImageCreateFromGdCtx (ctx);
im2 = gdImageCreateFromGdPtr (sz, iptr);
gdFree(iptr);
/*printf("Got img2 %d\n",im2); */
CompareImages ("GD->GD ptr->GD", ref, im2);
gdImageDestroy (im2);
ctx->gd_free (ctx);
/*
** Test gdImageCreateFromPngSource'

View File

@ -1,10 +1,10 @@
<!-- REMEMBER TO EDIT index.html.source -->
<head>
<TITLE>gd 2.0.20</TITLE>
<TITLE>gd 2.0.21</TITLE>
</head>
<body bgcolor="#FFFFFF">
<!-- BANNER HERE -->
<H2>gd 2.0.20</H2>
<H2>gd 2.0.21</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
@ -20,7 +20,7 @@ To ensure that your
new installation overwrites the old.
<p>
<strong>ABOUT GD AND GIF:</strong>
gd 2.0.20 creates PNG, JPEG and WBMP images, not GIF images. This is a
gd 2.0.21 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
@ -33,7 +33,7 @@ solution is to move to legally unencumbered, well-compressed,
modern image formats such as PNG and JPEG as soon as possible.
<p>
When building from soruce, gd 2.0.20 <strong>requires</strong> that the
When building from soruce, gd 2.0.21 <strong>requires</strong> that the
following libraries also be installed, in order to produce the related
image formats. The win32 binary release (bgd) already contains the
appropriate libraries.
@ -66,7 +66,7 @@ information. Thank you!
<H3>Table of Contents</H3>
<UL>
<LI><A HREF="#notice">Credits and license terms</A>
<LI><A HREF="#whatsnew2.0.20">What's new in version "XYZ" of GD?</A>
<LI><A HREF="#whatsnew2.0.21">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>
@ -165,10 +165,10 @@ and so forth.
<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.20.
with 2.0.21.
<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.20; see the
to patch PHP 4.2.3 for use with gd 2.0.21; 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
@ -203,6 +203,33 @@ invoke the interpreter.
<li><a href="http://martin.gleeson.com/fly/">fly</a>, by Martin Gleeson
</ul>
<P>
<A NAME="whatsnew2.0.21"><H3>What's new in version 2.0.21?</H3></A>
<P>
<ul>
<li>Version 2.0.21 adds a <code>gdImageCreateFrom*Ptr</code> family
of functions which make it convenient to load an image in any
GD-supported format directly from memory.
<li>The new <code>gdNewDynamicCtxEx</code> function was added to
support the easy implementation of the above functions and to
correct a design problem which made life unpleasant for those passing
in memory not originally allocated by gd to the
<code>gdNewDynamicCtx</code> function by provoding a way to specify
that gd should never free or reallocate a particular block of memory.
The <code>gdNewDynamicCtx</code> function and its relatives, although
still exported for ABI compatibility, are now <b>deprecated</b> except
for internal use, in favor of <a href="#gdImageCreateFromPngPtr"><code>gdImageCreateFromPngPtr</code></a>
and its relatives.
<li>Version 2.0.21 includes a new patch from Ethan A. Merritt to
correct a bug in the conditional compilation of support for
symbol fonts in gdft.c. Symbol fonts should now work correctly.
Thanks to Mr. Merritt.
<li>Version 2.0.20 restores the <code>gdFreeFontCache</code> function,
an undocumented function added in an earlier release which now simply
calls <code>gdFontCacheShutdown</code> for backwards compatibility.
This repairs build problems when compiling PHP against the latest gd.
<li>Documentation improvements.
</ul>
<P>
<A NAME="whatsnew2.0.20"><H3>What's new in version 2.0.20?</H3></A>
<P>
<ul>
@ -995,8 +1022,8 @@ saving of alpha channel information to the file instead.
</ul>
<h4>Source Code:</h4>
<ul>
<li><a href="http://www.boutell.com/gd/http/gd-2.0.20.tar.gz">Gzipped Tar File (Unix)</a>
<li><a href="http://www.boutell.com/gd/http/gd-2.0.20.zip">.ZIP File of SOURCE CODE (Windows)</a>
<li><a href="http://www.boutell.com/gd/http/gd-2.0.21.tar.gz">Gzipped Tar File (Unix)</a>
<li><a href="http://www.boutell.com/gd/http/gd-2.0.21.zip">.ZIP File of SOURCE CODE (Windows)</a>
</ul>
<P>
<A NAME="buildgd"><H3>How do I build gd?</H3></A>
@ -1018,10 +1045,10 @@ downloaded. If you are not familiar with <code>tar</code> and
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.20".
Unpacking the archive will produce a directory called "gd-2.0.21".
<p>
<h4>For Unix</h4>
<code>cd</code> to the 2.0.20 directory and type:
<code>cd</code> to the 2.0.21 directory and type:
<p>
<code>./configure</code>
<P>
@ -1481,6 +1508,9 @@ im = gdImageCreateTrueColor(64, 64);
<DT><A NAME="gdImageCreateFromJpeg">gdImageCreateFromJpeg(FILE *in)</A>
<strong>(FUNCTION)</strong>
<br>
<A NAME="gdImageCreateFromJpegPtr">gdImageCreateFromJpegPtr(int size, void *data)</A>
<strong>(FUNCTION)</strong>
<br>
<A NAME="gdImageCreateFromJpegCtx">gdImageCreateFromJpegCtx(gdIOCtx *in)</A>
<strong>(FUNCTION)</strong>
<p>
@ -1497,6 +1527,12 @@ close the file. You can inspect the sx and sy members of the
image to determine its size. The image must eventually be destroyed
using <A HREF="#gdImageDestroy">gdImageDestroy()</A>. <strong>The
returned image is always a truecolor image.</strong>
<p>
If you already have the
image file in memory, pass the size of the file and a pointer to the
file's data to gdImageCreateFromJpegPtr, which is otherwise identical
to gdImageCreateFromJpeg.
<p>
<PRE>
<A HREF="#gdImagePtr">gdImagePtr</A> im;
... inside a function ...
@ -1509,6 +1545,8 @@ fclose(in);
</PRE>
<DT><A NAME="gdImageCreateFromPng">gdImageCreateFromPng(FILE *in)</A>
<strong>(FUNCTION)</strong>
<BR><A NAME="gdImageCreateFromPngPtr">gdImageCreateFromPngPtr(int size, void *data)</A>
<strong>(FUNCTION)</strong>
<BR><A NAME="gdImageCreateFromPngCtx">gdImageCreateFromPngCtx(<a href=#gdioctx>gdIOCtx</a> *in)</A>
<strong>(FUNCTION)</strong>
<p>
@ -1524,6 +1562,11 @@ close the file. You can inspect the sx and sy members of the
image to determine its size. The image must eventually be destroyed
using <A HREF="#gdImageDestroy">gdImageDestroy()</A>.
<p>
If you already have the
image file in memory, pass the size of the file and a pointer to the
file's data to gdImageCreateFromPngPtr, which is otherwise identical
to gdImageCreateFromPng.
<p>
If the PNG image being loaded is a truecolor image, the resulting
gdImagePtr will refer to a truecolor image. If the PNG image
being loaded is a palette or grayscale image, the resulting
@ -1548,6 +1591,10 @@ fclose(in);
<DT><A NAME="gdImageCreateFromPngSource">gdImageCreateFromPngSource(gdSourcePtr in)</A>
<strong>(FUNCTION)</strong>
<dd>
<b>Deprecated</b> in favor of
<a href="#gdImageCreateFromPngCtx">gdImageCreateFromPngCtx</a>. Should
not be used in new applications.
<p>
gdImageCreateFromPngSource is called to load a PNG from
a data source other than a file. Usage is very similar to
the <a href="#gdImageCreateFromPng">gdImageCreateFromPng</a> function,
@ -1587,6 +1634,8 @@ static int freadWrapper(void *context, char *buf, int len)
</pre>
<DT><A NAME="gdImageCreateFromGd">gdImageCreateFromGd(FILE *in)</A>
<strong>(FUNCTION)</strong>
<br><DT><A NAME="gdImageCreateFromGdPtr">gdImageCreateFromGdPtr(int size, void *data)</A>
<strong>(FUNCTION)</strong>
<BR><A NAME="gdImageCreateFromGdCtx">gdImageCreateFromGdCtx(<a href=#gdioctx>gdIOCtx</a> *in)</A>
<strong>(FUNCTION)</strong>
<p>
@ -1597,6 +1646,12 @@ with an already opened pointer to a file containing the desired image
in the <A HREF="#gdformat">gd file format</A>, which is specific to
gd and intended for very fast loading. (It is <em>not</em> intended for
compression; for compression, use PNG or JPEG.)
<p>
If you already have the
image file in memory, pass the size of the file and a pointer to the
file's data to gdImageCreateFromGdPtr, which is otherwise identical
to gdImageCreateFromGd.
<p>
gdImageCreateFromGd
returns a <A HREF="#gdImagePtr">gdImagePtr</A> to the new image, or NULL
if unable to load the image (most often because the file is corrupt or
@ -1617,6 +1672,8 @@ fclose(in);
<DT><A NAME="gdImageCreateFromGd2">gdImageCreateFromGd2(FILE *in)</A>
<strong>(FUNCTION)</strong>
<br><A NAME="gdImageCreateFromGd2Ptr">gdImageCreateFromGd2Ptr(int size, void *data)</A>
<strong>(FUNCTION)</strong>
<BR><A NAME="gdImageCreateFromGd2Ctx">gdImageCreateFromGd2Ctx(<a href=#gdioctx>gdIOCtx</a> *in)</A>
<strong>(FUNCTION)</strong>
<p>
@ -1626,10 +1683,16 @@ gdImageCreateFromGd2 is called to load images from gd2 format files.
Invoke gdImageCreateFromGd2
with an already opened pointer to a file containing the desired image
in the <A HREF="#gdformat">gd2 file format</A>, which is specific to
gd2 and intended for fast loading of parts of large images.
gd2 and intended for fast loading of parts of large images.
(It is a compressed format, but generally not as good as maximum
compression of the entire image would be.)
gdImageCreateFromGd
compression of the entire image would be.)
<p>
If you already have the
image file in memory, pass the size of the file and a pointer to the
file's data to gdImageCreateFromGd2Ptr, which is otherwise identical
to gdImageCreateFromGd2.
<p>
gdImageCreateFromGd2
returns a <A HREF="#gdImagePtr">gdImagePtr</A> to the new image, or NULL
if unable to load the image (most often because the file is corrupt or
does not contain a gd format image). gdImageCreateFromGd2 does <em>not</em>
@ -1649,6 +1712,8 @@ fclose(in);
<DT><A NAME="gdImageCreateFromGd2Part">gdImageCreateFromGd2Part(FILE *in, int srcX, int srcY, int w, int h)</A>
<strong>(FUNCTION)</strong>
<br><A NAME="gdImageCreateFromGd2PartPtr">gdImageCreateFromGd2PartPtr(int size, void *data, int srcX, int srcY, int w, int h)</A>
<strong>(FUNCTION)</strong>
<BR><A NAME="gdImageCreateFromGd2PartCtx">gdImageCreateFromGd2PartCtx(<a href=#gdioctx>gdIOCtx</a> *in)</A>
<strong>(FUNCTION)</strong>
<p>
@ -1662,6 +1727,45 @@ gdImageCreateFromGd2Part returns a <A HREF="#gdImagePtr">gdImagePtr</A> to the
new image, or NULL if unable to load the image.
The image must eventually be destroyed using <A HREF="#gdImageDestroy">gdImageDestroy()</A>.
<p>
If you already have the image file in memory, you may use
gdImageCreateFromGd2PartPtr. Pass the size of the image file,
in bytes, as the first argument and the pointer to the image file data
as the second argument.
<p>
<DT><A NAME="gdImageCreateFromWBMP">gdImageCreateFromWBMP(FILE *in)</A>
<strong>(FUNCTION)</strong>
<BR><A NAME="gdImageCreateFromWBMPPtr">gdImageCreateFromWBMPPtr(int size, void *data)</A>
<strong>(FUNCTION)</strong>
<BR><A NAME="gdImageCreateFromWBMPCtx">gdImageCreateFromWBMPCtx(<a href=#gdioctx>gdIOCtx</a> *in)</A>
<strong>(FUNCTION)</strong>
<p>
<DD>
gdImageCreateFromWBMP is called to load images from WBMP format files.
Invoke gdImageCreateFromWBMP with an already opened pointer to a file
containing the desired image.
gdImageCreateFromWBMP
returns a <A HREF="#gdImagePtr">gdImagePtr</A> to the new image, or NULL
if unable to load the image (most often because the file is corrupt or
does not contain a PNG image). gdImageCreateFromWBMP does <em>not</em>
close the file. You can inspect the sx and sy members of the
image to determine its size. The image must eventually be destroyed
using <A HREF="#gdImageDestroy">gdImageDestroy()</A>.
<p>
If you already have the
image file in memory, pass the size of the file and a pointer to the
file's data to gdImageCreateFromWBMPPtr, which is otherwise identical
to gdImageCreateFromWBMP.
<PRE>
<A HREF="#gdImagePtr">gdImagePtr</A> im;
... inside a function ...
FILE *in;
in = fopen("mywbmp.wbmp", "rb");
im = gdImageCreateFromWBMP(in);
fclose(in);
/* ... Use the image ... */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
<p>
<DT><A NAME="gdImageCreateFromXbm">gdImageCreateFromXbm(FILE *in)</A>
<strong>(FUNCTION)</strong>
<DD>
@ -4534,15 +4638,24 @@ purchase gd support at the hourly rate above.
<A HREF="#gdImageCreate">gdImageCreatePalette</A> |
<A HREF="#gdImageCreate">gdImageCreateTrueColor</A> |
<A HREF="#gdImageCreateFromGd">gdImageCreateFromGd</A> |
<A HREF="#gdImageCreateFromGdCtx">gdImageCreateFromGdCtx</A> |
<A HREF="#gdImageCreateFromGdPtr">gdImageCreateFromGdPtr</A> |
<A HREF="#gdImageCreateFromGd2">gdImageCreateFromGd2</A> |
<A HREF="#gdImageCreateFromGd2Ctx">gdImageCreateFromGd2Ctx</A> |
<A HREF="#gdImageCreateFromGd2Ptr">gdImageCreateFromGd2Ptr</A> |
<A HREF="#gdImageCreateFromGd2Part">gdImageCreateFromGd2Part</A> |
<A HREF="#gdImageCreateFromGd2PartCtx">gdImageCreateFromGd2PartCtx</A> |
<A HREF="#gdImageCreateFromGd2PartPtr">gdImageCreateFromGd2PartPtr</A> |
<A HREF="#gdImageCreateFromJpeg">gdImageCreateFromJpeg</A> |
<A HREF="#gdImageCreateFromJpegCtx">gdImageCreateFromJpegCtx</A> |
<A HREF="#gdImageCreateFromJpegPtr">gdImageCreateFromJpegPtr</A> |
<A HREF="#gdImageCreateFromPng">gdImageCreateFromPng</A> |
<A HREF="#gdImageCreateFromPngCtx">gdImageCreateFromPngCtx</A> |
<A HREF="#gdImageCreateFromPngPtr">gdImageCreateFromPngPtr</A> |
<A HREF="#gdImageCreateFromPngSource">gdImageCreateFromPngSource</A> |
<A HREF="#gdImageCreateFromWBMP">gdImageCreateFromWBMP</A> |
<A HREF="#gdImageCreateFromWBMPCtx">gdImageCreateFromWBMPCtx</A> |
<A HREF="#gdImageCreateFromWBMPPtr">gdImageCreateFromWBMPPtr</A> |
<A HREF="#gdImageCreateFromXbm">gdImageCreateFromXbm</A> |
<A HREF="#gdImageCreateFromXpm">gdImageCreateFromXpm</A> |
<A HREF="#gdImageDashedLine">gdImageDashedLine</A> |