- sync to 2.0.12

master
pierre 2006-04-05 15:47:57 +00:00
parent 2315062bd3
commit 871d0d852c
23 changed files with 2381 additions and 915 deletions

View File

@ -17,7 +17,7 @@ include_HEADERS = gd.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.
lib_LTLIBRARIES = libgd.la
libgd_la_SOURCES = gd.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c gd_topal.c gd_wbmp.c gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c gdft.c gdhelpers.c gdhelpers.h gdkanji.c gdtables.c gdxpm.c jisx0208.h mathmake.c wbmp.c wbmp.h
libgd_la_SOURCES = gd.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c gd_topal.c gd_wbmp.c gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c gdft.c gdhelpers.c gdhelpers.h gdkanji.c gdtables.c gdxpm.c jisx0208.h wbmp.c wbmp.h
libgd_la_LDFLAGS = -version-info 2:0:0

View File

@ -142,7 +142,7 @@ include_HEADERS = gd.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.
lib_LTLIBRARIES = libgd.la
libgd_la_SOURCES = gd.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c gd_topal.c gd_wbmp.c gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c gdft.c gdhelpers.c gdhelpers.h gdkanji.c gdtables.c gdxpm.c jisx0208.h mathmake.c wbmp.c wbmp.h
libgd_la_SOURCES = gd.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c gd_topal.c gd_wbmp.c gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c gdft.c gdhelpers.c gdhelpers.h gdkanji.c gdtables.c gdxpm.c jisx0208.h wbmp.c wbmp.h
libgd_la_LDFLAGS = -version-info 2:0:0
@ -159,7 +159,7 @@ am_libgd_la_OBJECTS = gd.lo gd_gd.lo gd_gd2.lo gd_io.lo gd_io_dp.lo \
gd_io_file.lo gd_io_ss.lo gd_jpeg.lo gd_png.lo gd_ss.lo \
gd_topal.lo gd_wbmp.lo gdcache.lo gdfontg.lo gdfontl.lo \
gdfontmb.lo gdfonts.lo gdfontt.lo gdft.lo gdhelpers.lo \
gdkanji.lo gdtables.lo gdxpm.lo mathmake.lo wbmp.lo
gdkanji.lo gdtables.lo gdxpm.lo wbmp.lo
libgd_la_OBJECTS = $(am_libgd_la_OBJECTS)
bin_PROGRAMS = annotate$(EXEEXT) gdparttopng$(EXEEXT) gdtopng$(EXEEXT) \
gd2copypal$(EXEEXT) gd2topng$(EXEEXT) pngtogd$(EXEEXT) \
@ -268,9 +268,9 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/gdparttopng.Po ./$(DEPDIR)/gdtables.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/gdtest.Po ./$(DEPDIR)/gdtestft.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gdtopng.Po ./$(DEPDIR)/gdxpm.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/mathmake.Plo ./$(DEPDIR)/pngtogd.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pngtogd2.Po ./$(DEPDIR)/testac.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/wbmp.Plo ./$(DEPDIR)/webpng.Po
@AMDEP_TRUE@ ./$(DEPDIR)/pngtogd.Po ./$(DEPDIR)/pngtogd2.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/testac.Po ./$(DEPDIR)/wbmp.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/webpng.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@ -506,7 +506,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdtestft.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdtopng.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdxpm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mathmake.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtogd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtogd2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testac.Po@am__quote@

View File

@ -20,6 +20,13 @@ enum
int
main (int argc, char *argv[])
{
#ifndef HAVE_LIBFREETYPE
/* 2.0.12 */
fprintf (stderr, "annotate is not useful without freetype.\n"
"Install freetype, then './configure; make clean; make install'\n"
"the gd library again.\n");
return 1;
#else
gdImagePtr im;
char *iin, *iout;
FILE *in, *out;
@ -201,4 +208,5 @@ main (int argc, char *argv[])
gdImageDestroy (im);
fclose (out);
return 0;
#endif /* HAVE_LIBFREETYPE */
}

View File

@ -27,6 +27,9 @@
/* Define to 1 if you have the `jpeg' library (-ljpeg). */
#undef HAVE_LIBJPEG
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `png' library (-lpng). */
#undef HAVE_LIBPNG

175
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.11.
# Generated by GNU Autoconf 2.57 for GD 2.0.12.
#
# 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.11'
PACKAGE_STRING='GD 2.0.11'
PACKAGE_VERSION='2.0.12'
PACKAGE_STRING='GD 2.0.12'
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.11 to adapt to many kinds of systems.
\`configure' configures GD 2.0.12 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.11:";;
short | recursive ) echo "Configuration of GD 2.0.12:";;
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.11
GD configure 2.0.12
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.11, which was
It was created by GD $as_me 2.0.12, 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=11
GDLIB_REVISION=12
GDLIBNAME=gd
@ -1738,7 +1738,7 @@ fi
# Define the identity of the package.
PACKAGE=gd
VERSION=2.0.11
VERSION=2.0.12
cat >>confdefs.h <<_ACEOF
@ -9549,13 +9549,155 @@ done
#AC_FUNC_VPRINTF
#AC_CHECK_FUNCS([floor memset sqrt strchr strdup strtol])
echo "$as_me:$LINENO: checking for sin" >&5
echo $ECHO_N "checking for sin... $ECHO_C" >&6
if test "${ac_cv_func_sin+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char sin (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char sin ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_sin) || defined (__stub___sin)
choke me
#else
char (*f) () = sin;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != sin;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_sin=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_sin=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5
echo "${ECHO_T}$ac_cv_func_sin" >&6
if test $ac_cv_func_sin = yes; then
:
else
echo "$as_me:$LINENO: checking for sin in -lm" >&5
echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6
if test "${ac_cv_lib_m_sin+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char sin ();
int
main ()
{
sin ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_m_sin=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_m_sin=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5
echo "${ECHO_T}$ac_cv_lib_m_sin" >&6
if test $ac_cv_lib_m_sin = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
LIBS="-lm $LIBS"
fi
fi
echo "$as_me:$LINENO: checking for deflate in -lz" >&5
echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6
if test "${ac_cv_lib_z_deflate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lz -lm $LIBS"
LIBS="-lz $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@ -9604,7 +9746,7 @@ fi
echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5
echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6
if test $ac_cv_lib_z_deflate = yes; then
LIBS="-lz -lm $LIBS"
LIBS="-lz $LIBS"
cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBZ 1
@ -9668,7 +9810,8 @@ fi
if test -n "$LIBPNG_CONFIG"; then
libpng_CPPFLAGS=`libpng-config --cflags`
# should be --ldopts, but it's currently broken
libpng_LDFLAGS=`libpng-config --ldflags | sed 's/-l[^ ][^ ]*//g'`
libpng_LDFLAGS=`libpng-config --ldflags`
libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[^ ][^ ]*//g'`
elif test -d "$withval"; then
libpng_CPPFLAGS="-I$withval/include"
libpng_LDFLAGS="-L$withval/lib"
@ -10140,11 +10283,11 @@ fi
if test -n "$FREETYPE_CONFIG"; then
if test -n "$FREETYPE_DIR"; then
libft_INCLUDES="`$FREETYPE_CONFIG --cflags` -I$FREETYPE_DIR/include"
libft_LDFLAGS=`$FREETYPE_CONFIG --libs |sed 's/-l[^ ][^ ]*//g'`
else
libft_INCLUDES=`$FREETYPE_CONFIG --cflags`
libft_LDFLAGS=`$FREETYPE_CONFIG --libs |sed 's/-l[^ ][^ ]*//g'`
fi
libft_LDFLAGS=`$FREETYPE_CONFIG --libs`
libft_LDFLAGS=`echo " $libft_LDFLAGS" |sed 's/ -l[^ ][^ ]*//g'`
else
if test -n "$FREETYPE_DIR"; then
libft_INCLUDES="-I$FREETYPE_DIR/include/freetype2 -I$FREETYPE_DIR/include"
@ -10956,7 +11099,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by GD $as_me 2.0.11, which was
This file was extended by GD $as_me 2.0.12, which was
generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -11019,7 +11162,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
GD config.status 2.0.11
GD config.status 2.0.12
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.11], [gd@boutell.com])
AC_INIT([GD], [2.0.12], [gd@boutell.com])
AC_CONFIG_SRCDIR([gd.c])
AC_CONFIG_AUX_DIR(config)
GDLIB_MAJOR=2
GDLIB_MINOR=0
GDLIB_REVISION=11
GDLIB_REVISION=12
GDLIBNAME=gd
AC_SUBST(GDLIB_MAJOR)
@ -67,11 +67,14 @@ AC_CHECK_HEADERS(iconv.h,
#AC_FUNC_VPRINTF
#AC_CHECK_FUNCS([floor memset sqrt strchr strdup strtol])
dnl do we need to specify -lm explicitly?
AC_CHECK_FUNC(sin,,[AC_CHECK_LIB(m,sin)])
dnl zlib is required
AC_CHECK_LIB(z,deflate,
[LIBS="-lz -lm $LIBS"
[LIBS="-lz $LIBS"
AC_DEFINE(HAVE_LIBZ, 1, [ Define if you have zlib. ])],
[AC_MSG_WARN([zlib is required - see http://www.gzip.org/zlib/])],[-lm])
[AC_MSG_WARN([zlib is required - see http://www.gzip.org/zlib/])])
dnl libpng is required
AC_ARG_WITH(png,dnl
@ -83,7 +86,8 @@ if test "$withval" != no; then
if test -n "$LIBPNG_CONFIG"; then
libpng_CPPFLAGS=`libpng-config --cflags`
# should be --ldopts, but it's currently broken
libpng_LDFLAGS=`libpng-config --ldflags | sed 's/-l[[^ ]][[^ ]]*//g'`
libpng_LDFLAGS=`libpng-config --ldflags`
libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[[^ ]][[^ ]]*//g'`
elif test -d "$withval"; then
libpng_CPPFLAGS="-I$withval/include"
libpng_LDFLAGS="-L$withval/lib"
@ -127,11 +131,11 @@ if test "$withval" != no; then
if test -n "$FREETYPE_CONFIG"; then
if test -n "$FREETYPE_DIR"; then
libft_INCLUDES="`$FREETYPE_CONFIG --cflags` -I$FREETYPE_DIR/include"
libft_LDFLAGS=`$FREETYPE_CONFIG --libs |sed 's/-l[[^ ]][[^ ]]*//g'`
else
libft_INCLUDES=`$FREETYPE_CONFIG --cflags`
libft_LDFLAGS=`$FREETYPE_CONFIG --libs |sed 's/-l[[^ ]][[^ ]]*//g'`
fi
libft_LDFLAGS=`$FREETYPE_CONFIG --libs`
libft_LDFLAGS=`echo " $libft_LDFLAGS" |sed 's/ -l[[^ ]][[^ ]]*//g'`
else
if test -n "$FREETYPE_DIR"; then
libft_INCLUDES="-I$FREETYPE_DIR/include/freetype2 -I$FREETYPE_DIR/include"

519
src/gd.c
View File

@ -11,7 +11,8 @@
#include "gd.h"
#include "gdhelpers.h"
#define gdImageBoundsSafeMacro(im, x, y) (!((((y) < 0) || ((y) >= (im)->sy)) || (((x) < 0) || ((x) >= (im)->sx))))
/* 2.0.12: this now checks the clipping rectangle */
#define gdImageBoundsSafeMacro(im, x, y) (!((((y) < (im)->cy1) || ((y) > (im)->cy2)) || (((x) < (im)->cx1) || ((x) > (im)->cx2))))
#ifdef _OSD_POSIX /* BS2000 uses the EBCDIC char set instead of ASCII */
#define CHARSET_EBCDIC
@ -65,6 +66,7 @@ extern int gdSinT[];
static void gdImageBrushApply (gdImagePtr im, int x, int y);
static void gdImageTileApply (gdImagePtr im, int x, int y);
static void gdImageAntiAliasedApply (gdImagePtr im, int x, int y);
static int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y);
gdImagePtr
@ -76,6 +78,8 @@ gdImageCreate (int sx, int sy)
memset (im, 0, sizeof (gdImage));
/* Row-major ever since gd 1.3 */
im->pixels = (unsigned char **) gdMalloc (sizeof (unsigned char *) * sy);
im->AA_opacity =
(unsigned char **) gdMalloc (sizeof (unsigned char *) * sy);
im->polyInts = 0;
im->polyAllocated = 0;
im->brush = 0;
@ -85,6 +89,8 @@ gdImageCreate (int sx, int sy)
{
/* Row-major ever since gd 1.3 */
im->pixels[i] = (unsigned char *) gdCalloc (sx, sizeof (unsigned char));
im->AA_opacity[i] =
(unsigned char *) gdCalloc (sx, sizeof (unsigned char));
}
im->sx = sx;
im->sy = sy;
@ -92,6 +98,8 @@ gdImageCreate (int sx, int sy)
im->transparent = (-1);
im->interlace = 0;
im->thick = 1;
im->AA = 0;
im->AA_polygon = 0;
for (i = 0; (i < gdMaxColors); i++)
{
im->open[i] = 1;
@ -101,6 +109,10 @@ gdImageCreate (int sx, int sy)
};
im->trueColor = 0;
im->tpixels = 0;
im->cx1 = 0;
im->cy1 = 0;
im->cx2 = im->sx - 1;
im->cy2 = im->sy - 1;
return im;
}
@ -112,6 +124,8 @@ gdImageCreateTrueColor (int sx, int sy)
im = (gdImage *) gdMalloc (sizeof (gdImage));
memset (im, 0, sizeof (gdImage));
im->tpixels = (int **) gdMalloc (sizeof (int *) * sy);
im->AA_opacity =
(unsigned char **) gdMalloc (sizeof (unsigned char *) * sy);
im->polyInts = 0;
im->polyAllocated = 0;
im->brush = 0;
@ -120,6 +134,8 @@ gdImageCreateTrueColor (int sx, int sy)
for (i = 0; (i < sy); i++)
{
im->tpixels[i] = (int *) gdCalloc (sx, sizeof (int));
im->AA_opacity[i] =
(unsigned char *) gdCalloc (sx, sizeof (unsigned char));
}
im->sx = sx;
im->sy = sy;
@ -134,6 +150,12 @@ gdImageCreateTrueColor (int sx, int sy)
im->saveAlphaFlag = 0;
im->alphaBlendingFlag = 1;
im->thick = 1;
im->AA = 0;
im->AA_polygon = 0;
im->cx1 = 0;
im->cy1 = 0;
im->cx2 = im->sx - 1;
im->cy2 = im->sy - 1;
return im;
}
@ -157,6 +179,14 @@ gdImageDestroy (gdImagePtr im)
}
gdFree (im->tpixels);
}
if (im->AA_opacity)
{
for (i = 0; (i < im->sy); i++)
{
gdFree (im->AA_opacity[i]);
}
gdFree (im->AA_opacity);
}
if (im->polyInts)
{
gdFree (im->polyInts);
@ -632,50 +662,58 @@ gdImagePaletteCopy (gdImagePtr to, gdImagePtr from)
the second call!) The code is simplified from that in the article,
as we know that gd images always start at (0,0) */
static int clip_1d(int *x0, int *y0, int *x1, int *y1, int maxdim) {
double m; /* gradient of line */
if(*x0 < 0) { /* start of line is left of window */
if(*x1 < 0) /* as is the end, so the line never cuts the window */
return 0;
m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
/* adjust x0 to be on the left boundary (ie to be zero), and y0 to match */
*y0 -= m * *x0;
*x0 = 0;
/* now, perhaps, adjust the far end of the line as well */
if(*x1 > maxdim) {
static int
clip_1d (int *x0, int *y0, int *x1, int *y1, int maxdim)
{
double m; /* gradient of line */
if (*x0 < 0)
{ /* start of line is left of window */
if (*x1 < 0) /* as is the end, so the line never cuts the window */
return 0;
m = (*y1 - *y0) / (double) (*x1 - *x0); /* calculate the slope of the line */
/* adjust x0 to be on the left boundary (ie to be zero), and y0 to match */
*y0 -= m * *x0;
*x0 = 0;
/* now, perhaps, adjust the far end of the line as well */
if (*x1 > maxdim)
{
*y1 += m * (maxdim - *x1);
*x1 = maxdim;
}
return 1;
}
if (*x0 > maxdim)
{ /* start of line is right of window -
complement of above */
if (*x1 > maxdim) /* as is the end, so the line misses the window */
return 0;
m = (*y1 - *y0) / (double) (*x1 - *x0); /* calculate the slope of the line */
*y0 += m * (maxdim - *x0); /* adjust so point is on the right
boundary */
*x0 = maxdim;
/* now, perhaps, adjust the end of the line */
if (*x1 < 0)
{
*y1 -= m * *x1;
*x1 = 0;
}
return 1;
}
/* the final case - the start of the line is inside the window */
if (*x1 > maxdim)
{ /* other end is outside to the right */
m = (*y1 - *y0) / (double) (*x1 - *x0); /* calculate the slope of the line */
*y1 += m * (maxdim - *x1);
*x1 = maxdim;
return 1;
}
return 1;
}
if(*x0 > maxdim) { /* start of line is right of window -
complement of above */
if(*x1 > maxdim) /* as is the end, so the line misses the window */
return 0;
m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
*y0 += m * (maxdim - *x0); /* adjust so point is on the right
boundary */
*x0 = maxdim;
/* now, perhaps, adjust the end of the line */
if(*x1 < 0) {
if (*x1 < 0)
{ /* other end is outside to the left */
m = (*y1 - *y0) / (double) (*x1 - *x0); /* calculate the slope of the line */
*y1 -= m * *x1;
*x1 = 0;
return 1;
}
return 1;
}
/* the final case - the start of the line is inside the window */
if(*x1 > maxdim) { /* other end is outside to the right */
m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
*y1 += m * (maxdim - *x1);
*x1 = maxdim;
return 1;
}
if(*x1 < 0) { /* other end is outside to the left */
m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */
*y1 -= m * *x1;
*x1 = 0;
return 1;
}
/* only get here if both points are inside the window */
return 1;
}
@ -723,6 +761,9 @@ gdImageSetPixel (gdImagePtr im, int x, int y, int color)
case gdTiled:
gdImageTileApply (im, x, y);
break;
case gdAntiAliased:
gdImageAntiAliasedApply (im, x, y);
break;
default:
if (gdImageBoundsSafeMacro (im, x, y))
{
@ -767,21 +808,46 @@ gdImageBrushApply (gdImagePtr im, int x, int y)
srcy = 0;
if (im->trueColor)
{
for (ly = y1; (ly < y2); ly++)
if (im->brush->trueColor)
{
srcx = 0;
for (lx = x1; (lx < x2); lx++)
for (ly = y1; (ly < y2); ly++)
{
int p;
p = gdImageGetTrueColorPixel (im->brush, srcx, srcy);
/* 2.0.9, Thomas Winzig: apply simple full transparency */
if (p != gdImageGetTransparent (im->brush))
srcx = 0;
for (lx = x1; (lx < x2); lx++)
{
gdImageSetPixel (im, lx, ly, p);
int p;
p = gdImageGetTrueColorPixel (im->brush, srcx, srcy);
/* 2.0.9, Thomas Winzig: apply simple full transparency */
if (p != gdImageGetTransparent (im->brush))
{
gdImageSetPixel (im, lx, ly, p);
}
srcx++;
}
srcx++;
srcy++;
}
}
else
{
/* 2.0.12: Brush palette, image truecolor (thanks to Thorben Kundinger
for pointing out the issue) */
for (ly = y1; (ly < y2); ly++)
{
srcx = 0;
for (lx = x1; (lx < x2); lx++)
{
int p, tc;
p = gdImageGetPixel (im->brush, srcx, srcy);
tc = gdImageGetTrueColorPixel (im->brush, srcx, srcy);
/* 2.0.9, Thomas Winzig: apply simple full transparency */
if (p != gdImageGetTransparent (im->brush))
{
gdImageSetPixel (im, lx, ly, tc);
}
srcx++;
}
srcy++;
}
srcy++;
}
}
else
@ -868,6 +934,63 @@ gdImageTileApply (gdImagePtr im, int x, int y)
}
}
static void
gdImageAntiAliasedApply (gdImagePtr im, int px, int py)
{
float p_dist, p_alpha;
unsigned char opacity;
/*
* Find the perpendicular distance from point C (px, py) to the line
* segment AB that is being drawn. (Adapted from an algorithm from the
* comp.graphics.algorithms FAQ.)
*/
int LAC_2, LBC_2;
int Ax_Cx = im->AAL_x1 - px;
int Ay_Cy = im->AAL_y1 - py;
int Bx_Cx = im->AAL_x2 - px;
int By_Cy = im->AAL_y2 - py;
/* Get the squares of the lengths of the segemnts AC and BC. */
LAC_2 = (Ax_Cx * Ax_Cx) + (Ay_Cy * Ay_Cy);
LBC_2 = (Bx_Cx * Bx_Cx) + (By_Cy * By_Cy);
if (((im->AAL_LAB_2 + LAC_2) >= LBC_2) &&
((im->AAL_LAB_2 + LBC_2) >= LAC_2))
{
/* The two angles are acute. The point lies inside the portion of the
* plane spanned by the line segment. */
p_dist = fabs ((float) ((Ay_Cy * im->AAL_Bx_Ax) -
(Ax_Cx * im->AAL_By_Ay)) / im->AAL_LAB);
}
else
{
/* The point is past an end of the line segment. It's length from the
* segment is the shorter of the lengths from the endpoints, but call
* the distance -1, so as not to compute the alpha nor draw the pixel.
*/
p_dist = -1;
}
if ((p_dist >= 0) && (p_dist <= (float) (im->thick)))
{
p_alpha = pow (1.0 - (p_dist / 1.5), 2);
if (p_alpha > 0)
{
if (p_alpha >= 1)
opacity = 255;
else
opacity = (unsigned char) (p_alpha * 255.0);
if (!(im->AA_polygon) || (im->AA_opacity[py][px] < opacity))
im->AA_opacity[py][px] = opacity;
}
}
}
int
gdImageGetPixel (gdImagePtr im, int x, int y)
{
@ -904,6 +1027,63 @@ gdImageGetTrueColorPixel (gdImagePtr im, int x, int y)
}
}
void
gdImageAABlend (gdImagePtr im)
{
float p_alpha, old_alpha;
int color = im->AA_color, color_red, color_green, color_blue;
int old_color, old_red, old_green, old_blue;
int p_color, p_red, p_green, p_blue;
int px, py;
color_red = gdImageRed (im, color);
color_green = gdImageGreen (im, color);
color_blue = gdImageBlue (im, color);
/* Impose the anti-aliased drawing on the image. */
for (py = 0; py < im->sy; py++)
{
for (px = 0; px < im->sx; px++)
{
if (im->AA_opacity[py][px] != 0)
{
old_color = gdImageGetPixel (im, px, py);
if ((old_color != color)
&& ((old_color != im->AA_dont_blend)
|| (im->AA_opacity[py][px] == 255)))
{
/* Only blend with different colors that aren't the
* dont_blend color. */
p_alpha = (float) (im->AA_opacity[py][px]) / 255.0;
old_alpha = 1.0 - p_alpha;
if (p_alpha >= 1.0)
p_color = color;
else
{
old_red = gdImageRed (im, old_color);
old_green = gdImageGreen (im, old_color);
old_blue = gdImageBlue (im, old_color);
p_red = (int) (((float) color_red * p_alpha) +
((float) old_red * old_alpha));
p_green = (int) (((float) color_green * p_alpha) +
((float) old_green * old_alpha));
p_blue = (int) (((float) color_blue * p_alpha) +
((float) old_blue * old_alpha));
p_color =
gdImageColorResolve (im, p_red, p_green, p_blue);
}
gdImageSetPixel (im, px, py, p_color);
}
}
}
/* Clear the AA_opacity array behind us. */
memset (im->AA_opacity[py], 0, im->sx);
}
}
/* Bresenham as presented in Foley & Van Dam */
void
gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
@ -916,11 +1096,31 @@ gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no
points need to be drawn */
if(clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) == 0)
if (clip_1d (&x1, &y1, &x2, &y2, gdImageSX (im)) == 0)
return;
if(clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)) == 0)
if (clip_1d (&y1, &x1, &y2, &x2, gdImageSY (im)) == 0)
return;
/* gdAntiAliased passed as color: set anti-aliased line (AAL) global vars. */
if (color == gdAntiAliased)
{
im->AAL_x1 = x1;
im->AAL_y1 = y1;
im->AAL_x2 = x2;
im->AAL_y2 = y2;
/* Compute what we can for point-to-line distance calculation later. */
im->AAL_Bx_Ax = x2 - x1;
im->AAL_By_Ay = y2 - y1;
im->AAL_LAB_2 =
(im->AAL_Bx_Ax * im->AAL_Bx_Ax) + (im->AAL_By_Ay * im->AAL_By_Ay);
im->AAL_LAB = sqrt (im->AAL_LAB_2);
/* For AA, we must draw pixels outside the width of the line. Keep in
* mind that this will be curtailed by cos/sin of theta later. */
thick += 4;
}
dx = abs (x2 - x1);
dy = abs (y2 - y1);
if (dy <= dx)
@ -933,7 +1133,17 @@ gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
}
else
{
wid = thick * cos (atan2 (dy, dx));
/* 2.0.12: Michael Schwartz: divide rather than multiply;
TBB: but watch out for /0! */
double ac = cos (atan2 (dy, dx));
if (ac != 0)
{
wid = thick / ac;
}
else
{
wid = 1;
}
if (wid == 0)
{
wid = 1;
@ -1004,7 +1214,17 @@ gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
else
{
/* More-or-less vertical. use wid for horizontal stroke */
wid = thick * sin (atan2 (dy, dx));
/* 2.0.12: Michael Schwartz: divide rather than multiply;
TBB: but watch out for /0! */
double as = sin (atan2 (dy, dx));
if (as != 0)
{
wid = thick / as;
}
else
{
wid = 1;
}
if (wid == 0)
wid = 1;
@ -1070,6 +1290,10 @@ gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
}
}
}
/* If this is the only line we are drawing, go ahead and blend. */
if ((color == gdAntiAliased) && !(im->AA_polygon))
gdImageAABlend (im);
}
static void dashedSet (gdImagePtr im, int x, int y, int color,
int *onP, int *dashStepP, int wid, int vert);
@ -1089,7 +1313,17 @@ gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
if (dy <= dx)
{
/* More-or-less horizontal. use wid for vertical stroke */
wid = thick * sin (atan2 (dy, dx));
/* 2.0.12: Michael Schwartz: divide rather than multiply;
TBB: but watch out for /0! */
double as = sin (atan2 (dy, dx));
if (as != 0)
{
wid = thick / as;
}
else
{
wid = 1;
}
vert = 1;
d = 2 * dy - dx;
@ -1147,8 +1381,17 @@ gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
}
else
{
/* More-or-less vertical. use wid for horizontal stroke */
wid = thick * sin (atan2 (dy, dx));
/* 2.0.12: Michael Schwartz: divide rather than multiply;
TBB: but watch out for /0! */
double as = sin (atan2 (dy, dx));
if (as != 0)
{
wid = thick / as;
}
else
{
wid = 1;
}
vert = 0;
d = 2 * dx - dy;
@ -1242,7 +1485,7 @@ dashedSet (gdImagePtr im, int x, int y, int color,
int
gdImageBoundsSafe (gdImagePtr im, int x, int y)
{
return gdImageBoundsSafeMacro(im, x, y);
return gdImageBoundsSafeMacro (im, x, y);
}
void
@ -1411,9 +1654,6 @@ gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e,
int i;
int lx = 0, ly = 0;
int fx = 0, fy = 0;
int w2, h2;
w2 = w / 2;
h2 = h / 2;
while (e < s)
{
e += 360;
@ -1421,8 +1661,8 @@ gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e,
for (i = s; (i <= e); i++)
{
int x, y;
x = ((long) gdCosT[i % 360] * (long) w2 / 1024) + cx;
y = ((long) gdSinT[i % 360] * (long) h2 / 1024) + cy;
x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
if (i != s)
{
if (!(style & gdChord))
@ -1746,14 +1986,14 @@ gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
/* Nick Atty: limit the points at the edge. Note that this also
nicely kills any plotting for rectangles completely outside the
window as it makes the tests in the for loops fail */
if(x1 < 0)
x1=0;
if(x1 > gdImageSX(im))
x1=gdImageSX(im);
if(y1 < 0)
if (x1 < 0)
x1 = 0;
if (x1 > gdImageSX (im))
x1 = gdImageSX (im);
if (y1 < 0)
y1 = 0;
if(y1 > gdImageSY(im))
y1 = gdImageSY(im);
if (y1 > gdImageSY (im))
y1 = gdImageSY (im);
for (y = y1; (y <= y2); y++)
{
@ -1777,17 +2017,18 @@ gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX,
{
/* 2.0: much easier when the destination is truecolor. */
/* 2.0.10: needs a transparent-index check that is still valid if
the source is not truecolor. Thanks to Frank Warmerdam. */
the source is not truecolor. Thanks to Frank Warmerdam. */
for (y = 0; (y < h); y++)
{
for (x = 0; (x < w); x++)
{
int p = gdImageGetPixel(src, srcX + x, srcY + y);
if (p != src->transparent) {
int c = gdImageGetTrueColorPixel (src, srcX + x,
srcY + y);
gdImageSetPixel (dst, dstX + x, dstY + y, c);
}
int p = gdImageGetPixel (src, srcX + x, srcY + y);
if (p != src->transparent)
{
int c = gdImageGetTrueColorPixel (src, srcX + x,
srcY + y);
gdImageSetPixel (dst, dstX + x, dstY + y, c);
}
}
}
return;
@ -1878,8 +2119,12 @@ gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
tox++;
continue;
}
/* If it's the same image, mapping is trivial */
if (dst == src)
/*
* If it's the same image, mapping is NOT trivial since we
* merge with greyscale target, but if pct is 100, the grey
* value is not used, so it becomes trivial. pjw 2.0.12.
*/
if (dst == src && pct == 100)
{
nc = c;
}
@ -1942,11 +2187,11 @@ gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
+ 0.58700 * dst->green[dc] + 0.11400 * dst->blue[dc];
ncR = gdImageRed (src, c) * (pct / 100.0)
+ gdImageRed (dst, dc) * g * ((100 - pct) / 100.0);
+ g * ((100 - pct) / 100.0);
ncG = gdImageGreen (src, c) * (pct / 100.0)
+ gdImageGreen (dst, dc) * g * ((100 - pct) / 100.0);
+ g * ((100 - pct) / 100.0);
ncB = gdImageBlue (src, c) * (pct / 100.0)
+ gdImageBlue (dst, dc) * g * ((100 - pct) / 100.0);
+ g * ((100 - pct) / 100.0);
/* First look for an exact match */
nc = gdImageColorExact (dst, ncR, ncG, ncB);
@ -2457,6 +2702,12 @@ gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c)
{
return;
}
/* Let it be known that we are drawing a polygon so that the opacity
* mask doesn't get cleared after each line. */
if (c == gdAntiAliased)
im->AA_polygon = 1;
lx = p->x;
ly = p->y;
gdImageLine (im, lx, ly, p[n - 1].x, p[n - 1].y, c);
@ -2467,6 +2718,12 @@ gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c)
lx = p->x;
ly = p->y;
}
if (c == gdAntiAliased)
{
im->AA_polygon = 0;
gdImageAABlend (im);
}
}
int gdCompareInt (const void *a, const void *b);
@ -2488,10 +2745,17 @@ gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c)
int x2, y2;
int ind1, ind2;
int ints;
int fill_color;
if (!n)
{
return;
}
if (c == gdAntiAliased)
fill_color = im->AA_color;
else
fill_color = c;
if (!im->polyAllocated)
{
im->polyInts = (int *) gdMalloc (sizeof (int) * n);
@ -2556,22 +2820,33 @@ gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c)
{
continue;
}
/* Do the following math as float intermediately, and round to ensure
* that Polygon and FilledPolygon for the same set of points have the
* same footprint. */
if ((y >= y1) && (y < y2))
{
im->polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) /
(float) (y2 - y1) + 0.5 + x1;
}
else if ((y == maxy) && (y > y1) && (y <= y2))
{
im->polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) /
(float) (y2 - y1) + 0.5 + x1;
}
}
qsort (im->polyInts, ints, sizeof (int), gdCompareInt);
for (i = 0; (i < (ints)); i += 2)
{
gdImageLine (im, im->polyInts[i], y, im->polyInts[i + 1], y, c);
gdImageLine (im, im->polyInts[i], y, im->polyInts[i + 1], y,
fill_color);
}
}
/* If we are drawing this AA, then redraw the border with AA lines. */
if (c == gdAntiAliased)
gdImagePolygon (im, p, n, c);
}
int
@ -2639,6 +2914,22 @@ gdImageSetTile (gdImagePtr im, gdImagePtr tile)
}
}
void
gdImageSetAntiAliased (gdImagePtr im, int c)
{
im->AA = 1;
im->AA_color = c;
im->AA_dont_blend = -1;
}
void
gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend)
{
im->AA = 1;
im->AA_color = c;
im->AA_dont_blend = dont_blend;
}
void
gdImageInterlace (gdImagePtr im, int interlaceArg)
{
@ -2697,8 +2988,14 @@ gdImageCompare (gdImagePtr im1, gdImagePtr im2)
{
for (x = 0; (x < sx); x++)
{
p1 = im1->pixels[y][x];
p2 = im2->pixels[y][x];
p1 =
im1->trueColor ? gdImageTrueColorPixel (im1, x,
y) :
gdImagePalettePixel (im1, x, y);
p2 =
im2->trueColor ? gdImageTrueColorPixel (im2, x,
y) :
gdImagePalettePixel (im2, x, y);
if (gdImageRed (im1, p1) != gdImageRed (im2, p2))
{
cmpStatus |= GD_CMP_COLOR + GD_CMP_IMAGE;
@ -2735,7 +3032,12 @@ gdImageCompare (gdImagePtr im1, gdImagePtr im2)
int
gdAlphaBlend (int dst, int src)
{
return (((((gdAlphaTransparent - gdTrueColorGetAlpha (src)) *
/* 2.0.12: TBB: alpha in the destination should be a
component of the result. Thanks to Frank Warmerdam for
pointing out the issue. */
return ((((gdTrueColorGetAlpha (src) *
gdTrueColorGetAlpha (dst)) / gdAlphaMax) << 24) +
((((gdAlphaTransparent - gdTrueColorGetAlpha (src)) *
gdTrueColorGetRed (src) / gdAlphaMax) +
(gdTrueColorGetAlpha (src) *
gdTrueColorGetRed (dst)) / gdAlphaMax) << 16) +
@ -2760,3 +3062,46 @@ gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg)
{
im->saveAlphaFlag = saveAlphaArg;
}
void
gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2)
{
if (x1 < 0) {
x1 = 0;
}
if (x1 >= im->sx) {
x1 = im->sx - 1;
}
if (x2 < 0) {
x2 = 0;
}
if (x2 >= im->sx) {
x2 = im->sx - 1;
}
if (y1 < 0) {
y1 = 0;
}
if (y1 >= im->sy) {
y1 = im->sy - 1;
}
if (y2 < 0) {
y2 = 0;
}
if (y2 >= im->sy) {
y2 = im->sy - 1;
}
im->cx1 = x1;
im->cy1 = y1;
im->cx2 = x2;
im->cy2 = y2;
}
void
gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P)
{
*x1P = im->cx1;
*y1P = im->cy1;
*x2P = im->cx2;
*y2P = im->cy2;
}

View File

@ -6,9 +6,14 @@ extern "C"
{
#endif
/* some might want to set DEFAULT_FONTPATH from configure in config.h */
#ifndef DEFAULT_FONTPATH
/* default fontpath for unix systems - whatever happened to standards ! */
#define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1"
#endif
#ifndef PATHSEPARATOR
#define PATHSEPARATOR ":"
#endif
/* gd.h: declarations file for the graphic-draw module.
* Permission to use, copy, modify, and distribute this software and its
@ -131,6 +136,31 @@ extern "C"
PNG at the moment; other future formats may also
have that capability. JPEG doesn't. */
int saveAlphaFlag;
/* 2.0.12: anti-aliased globals */
int AA;
int AA_color;
int AA_dont_blend;
unsigned char **AA_opacity;
int AA_polygon;
/* Stored and pre-computed variables for determining the perpendicular
distance from a point to the anti-aliased line being drawn: */
int AAL_x1;
int AAL_y1;
int AAL_x2;
int AAL_y2;
int AAL_Bx_Ax;
int AAL_By_Ay;
int AAL_LAB_2;
float AAL_LAB;
/* 2.0.12: simple clipping rectangle. These values
must be checked for safety when set; please use
gdImageSetClip */
int cx1;
int cy1;
int cx2;
int cy2;
}
gdImage;
@ -171,6 +201,8 @@ extern "C"
This is used in line styles only. */
#define gdTransparent (-6)
#define gdAntiAliased (-7)
/* Functions to manipulate images. */
/* Creates a palette-based image (up to 256 colors). */
@ -235,6 +267,8 @@ extern "C"
int gdImageGetPixel (gdImagePtr im, int x, int y);
void gdImageAABlend (gdImagePtr im);
void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
/* For backwards compatibility only. Use gdImageSetStyle()
@ -248,6 +282,8 @@ extern "C"
/* Solid bar. Upper left corner first, lower right corner second. */
void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
int color);
void gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
void gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
int gdImageBoundsSafe (gdImagePtr im, int x, int y);
void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c,
int color);
@ -280,12 +316,23 @@ extern "C"
typedef struct
{
int flags; /* for future expansion logical OR of gdFTEX_ values */
int flags; /* Logical OR of gdFTEX_ values */
double linespacing; /* fine tune line spacing for '\n' */
int charmap; /* TBB: 2.0.12: may be gdFTEX_Unicode,
gdFTEX_Shift_JIS, or gdFTEX_Big5;
when not specified, maps are searched
for in the above order. */
}
gdFTStringExtra, *gdFTStringExtraPtr;
#define gdFTEX_LINESPACE 1
#define gdFTEX_CHARMAP 2
/* These are NOT flags; set one in 'charmap' if you set the
gdFTEX_CHARMAP bit in 'flags'. */
#define gdFTEX_Unicode 0
#define gdFTEX_Shift_JIS 1
#define gdFTEX_Big5 2
char *gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
double ptsize, double angle, int x, int y,
@ -375,6 +422,12 @@ extern "C"
void gdImagePaletteCopy (gdImagePtr dst, gdImagePtr src);
void gdImagePng (gdImagePtr im, FILE * out);
void gdImagePngCtx (gdImagePtr im, gdIOCtx * out);
/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
1 is FASTEST but produces larger files, 9 provides the best
compression (smallest files) but takes a long time to compress, and
-1 selects the default compiled into the zlib library. */
void gdImagePngEx (gdImagePtr im, FILE * out, int level);
void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level);
void gdImageWBMP (gdImagePtr image, int fg, FILE * out);
void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out);
@ -413,6 +466,7 @@ extern "C"
/* Best to free this memory with gdFree(), not free() */
void *gdImagePngPtr (gdImagePtr im, int *size);
void *gdImagePngPtrEx (gdImagePtr im, int *size, int level);
/* Best to free this memory with gdFree(), not free() */
void *gdImageGdPtr (gdImagePtr im, int *size);
@ -492,6 +546,8 @@ extern "C"
void gdImageSetBrush (gdImagePtr im, gdImagePtr brush);
void gdImageSetTile (gdImagePtr im, gdImagePtr tile);
void gdImageSetAntiAliased (gdImagePtr im, int c);
void gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend);
void gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels);
/* Line thickness (defaults to 1). Affects lines, ellipses,
rectangles, polygons and so forth. */

View File

@ -20,27 +20,33 @@ main (int argc, char **argv)
int x, y, w, h;
if ((argc != 3) && (argc != 7))
{
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");
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]);
}
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);
}
if (argc == 7) {
im = gdImageCreateFromGd2Part (in, x, y, w, h);
} else {
im = gdImageCreateFromGd2 (in);
}
if (argc == 7)
{
im = gdImageCreateFromGd2Part (in, x, y, w, h);
}
else
{
im = gdImageCreateFromGd2 (in);
}
fclose (in);
if (!im)
{

View File

@ -30,7 +30,15 @@ _gdGetColors (gdIOCtx * in, gdImagePtr im, int gd2xFlag)
int i;
if (gd2xFlag)
{
if (!gdGetByte (&im->trueColor, in))
int trueColorFlag;
if (!gdGetByte (&trueColorFlag, in))
{
goto fail1;
}
/* 2.0.12: detect bad truecolor .gd files created by pre-2.0.12.
Beginning in 2.0.12 truecolor is indicated by the initial 2-byte
signature. */
if (trueColorFlag != im->trueColor)
{
goto fail1;
}
@ -66,7 +74,10 @@ _gdGetColors (gdIOCtx * in, gdImagePtr im, int gd2xFlag)
GD2_DBG (printf
("Pallette had %d colours (T=%d)\n", im->colorsTotal,
im->transparent));
if (im->trueColor)
{
return TRUE;
}
for (i = 0; (i < gdMaxColors); i++)
{
if (!gdGetByte (&im->red[i], in))
@ -102,21 +113,28 @@ fail1:
/* */
/* Use the common basic header info to make the image object. */
/* This is also called from _gd2CreateFromFile */
/* */
static gdImagePtr
_gdCreateFromFile (gdIOCtx * in, int *sx, int *sy)
{
gdImagePtr im;
int gd2xFlag = 0;
int trueColorFlag = 0;
if (!gdGetWord (sx, in))
{
goto fail1;
}
if (*sx == 65535)
if ((*sx == 65535) || (*sx == 65534))
{
/* This is a gd 2.0 .gd file */
gd2xFlag = 1;
/* 2.0.12: 65534 signals a truecolor .gd file.
There is a slight redundancy here but we can
live with it. */
if (*sx == 65534)
{
trueColorFlag = 1;
}
if (!gdGetWord (sx, in))
{
goto fail1;
@ -128,9 +146,14 @@ _gdCreateFromFile (gdIOCtx * in, int *sx, int *sy)
}
GD2_DBG (printf ("Image is %dx%d\n", *sx, *sy));
im = gdImageCreate (*sx, *sy);
if (trueColorFlag)
{
im = gdImageCreateTrueColor (*sx, *sy);
}
else
{
im = gdImageCreate (*sx, *sy);
}
if (!_gdGetColors (in, im, gd2xFlag))
{
goto fail2;
@ -173,21 +196,40 @@ gdImageCreateFromGdCtx (gdIOCtxPtr in)
};
/* Then the data... */
for (y = 0; (y < sy); y++)
/* 2.0.12: support truecolor properly in .gd as well as in .gd2.
Problem reported by Andreas Pfaller. */
if (im->trueColor)
{
for (x = 0; (x < sx); x++)
for (y = 0; (y < sy); y++)
{
int ch;
ch = gdGetC (in);
if (ch == EOF)
for (x = 0; (x < sx); x++)
{
goto fail2;
int pix;
if (!gdGetInt (&pix, in))
{
goto fail2;
}
im->tpixels[y][x] = pix;
}
}
}
else
{
for (y = 0; (y < sy); y++)
{
for (x = 0; (x < sx); x++)
{
int ch;
ch = gdGetC (in);
if (ch == EOF)
{
goto fail2;
}
/* ROW-MAJOR IN GD 1.3 */
im->pixels[y][x] = ch;
}
/* ROW-MAJOR IN GD 1.3 */
im->pixels[y][x] = ch;
}
}
return im;
fail2:
@ -222,8 +264,16 @@ _gdPutColors (gdImagePtr im, gdIOCtx * out)
static void
_gdPutHeader (gdImagePtr im, gdIOCtx * out)
{
/* 65535 indicates this is a gd 2.x .gd file. */
gdPutWord (65535, out);
/* 65535 indicates this is a gd 2.x .gd file.
2.0.12: 65534 indicates truecolor. */
if (im->trueColor)
{
gdPutWord (65534, out);
}
else
{
gdPutWord (65535, out);
}
gdPutWord (im->sx, out);
gdPutWord (im->sy, out);

View File

@ -143,8 +143,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
GD2_DBG (printf ("Format: %d\n", *fmt));
if ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) &&
(*fmt != GD2_FMT_TRUECOLOR_RAW) &&
(*fmt != GD2_FMT_TRUECOLOR_COMPRESSED))
(*fmt != GD2_FMT_TRUECOLOR_RAW) &&
(*fmt != GD2_FMT_TRUECOLOR_COMPRESSED))
{
GD2_DBG (printf ("Bad data format: %d\n", *fmt));
goto fail1;
@ -165,7 +165,7 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
};
GD2_DBG (printf ("%d Chunks vertically\n", *ncy));
if (gd2_compressed(*fmt))
if (gd2_compressed (*fmt))
{
nc = (*ncx) * (*ncy);
GD2_DBG (printf ("Reading %d chunk index entries\n", nc));
@ -205,11 +205,14 @@ _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy,
GD2_DBG (printf ("Bad GD2 header\n"));
goto fail1;
}
if (gd2_truecolor(*fmt)) {
im = gdImageCreateTrueColor (*sx, *sy);
} else {
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"));
@ -316,7 +319,7 @@ gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
bytesPerPixel = im->trueColor ? 4 : 1;
nc = ncx * ncy;
if (gd2_compressed(fmt))
if (gd2_compressed (fmt))
{
/* Find the maximum compressed chunk size. */
compMax = 0;
@ -357,7 +360,7 @@ gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
("Processing Chunk %d (%d, %d), y from %d to %d\n",
chunkNum, cx, cy, ylo, yhi));
if (gd2_compressed(fmt))
if (gd2_compressed (fmt))
{
chunkLen = chunkMax;
@ -365,7 +368,7 @@ gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
if (!_gd2ReadChunk (chunkIdx[chunkNum].offset,
compBuf,
chunkIdx[chunkNum].size,
chunkBuf, &chunkLen, in))
(char *) chunkBuf, &chunkLen, in))
{
GD2_DBG (printf ("Error reading comproessed chunk\n"));
goto fail2;
@ -384,7 +387,7 @@ gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
xhi = im->sx;
};
/*GD2_DBG(printf("y=%d: ",y)); */
if (!gd2_compressed(fmt))
if (!gd2_compressed (fmt))
{
for (x = xlo; x < xhi; x++)
{
@ -425,7 +428,7 @@ gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
int r = chunkBuf[chunkPos++] << 16;
int g = chunkBuf[chunkPos++] << 8;
int b = chunkBuf[chunkPos++];
/* 2.0.11: tpixels */
/* 2.0.11: tpixels */
im->tpixels[y][x] = a + r + g + b;
}
else
@ -480,9 +483,12 @@ gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
int x, y, ylo, yhi, xlo, xhi;
int dstart, dpos;
int i;
int ch, vers, fmt;
/* 2.0.12: unsigned is correct; fixes problems with color munging.
Thanks to Steven Brown. */
unsigned int ch;
int vers, fmt;
t_chunk_info *chunkIdx = NULL;
char *chunkBuf = NULL;
unsigned char *chunkBuf = NULL;
int chunkNum;
int chunkMax = 0;
uLongf chunkLen;
@ -506,11 +512,14 @@ gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
GD2_DBG (printf ("File size is %dx%d\n", fsx, fsy));
/* This is the difference - make a file based on size of chunks. */
if (gd2_truecolor(fmt)) {
im = gdImageCreateTrueColor (w, h);
} else {
im = gdImageCreate (w, h);
}
if (gd2_truecolor (fmt))
{
im = gdImageCreateTrueColor (w, h);
}
else
{
im = gdImageCreate (w, h);
}
if (im == NULL)
{
goto fail1;
@ -525,7 +534,7 @@ gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
/* Process the header info */
nc = ncx * ncy;
if (gd2_compressed(fmt))
if (gd2_compressed (fmt))
{
/* Find the maximum compressed chunk size. */
compMax = 0;
@ -608,20 +617,21 @@ gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
("Processing Chunk (%d, %d), from %d to %d\n", cx, cy, ylo,
yhi));
if (!gd2_compressed(fmt))
if (!gd2_compressed (fmt))
{
GD2_DBG (printf ("Using raw format data\n"));
if (im->trueColor)
{
dpos =
(cy * (cs * fsx) * 4 + 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;
}
/* gd 2.0.11: gdSeek returns TRUE on success, not 0.
Longstanding bug. 01/16/03 */
/* 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);
@ -657,7 +667,7 @@ gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
for (x = xlo; x < xhi; x++)
{
if (!gd2_compressed(fmt))
if (!gd2_compressed (fmt))
{
if (im->trueColor)
{
@ -699,12 +709,15 @@ gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
&& (y >= srcy) && (y < (srcy + h)) && (y < fsy)
&& (y >= 0))
{
/* 2.0.11: tpixels */
if (im->trueColor) {
im->tpixels[y - srcy][x - srcx] = ch;
} else {
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;
}
}
};
};
@ -775,12 +788,13 @@ _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
/* Force fmt to a valid value since we don't return anything. */
/* */
if ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED))
{
{
fmt = im->trueColor ? GD2_FMT_TRUECOLOR_COMPRESSED : GD2_FMT_COMPRESSED;
};
if (im->trueColor) {
fmt += 2;
}
};
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 */
@ -807,7 +821,7 @@ _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
/* Write the standard header. */
_gd2PutHeader (im, out, cs, fmt, ncx, ncy);
if (gd2_compressed(fmt))
if (gd2_compressed (fmt))
{
/* */
/* Work out size of buffer for compressed data, If CHUNKSIZE is large, */
@ -869,15 +883,15 @@ _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
xhi = im->sx;
};
if (gd2_compressed(fmt))
if (gd2_compressed (fmt))
{
for (x = xlo; x < xhi; x++)
{
/* 2.0.11: use truecolor pixel array. TBB */
/* 2.0.11: use truecolor pixel array. TBB */
/*GD2_DBG(printf("%d...",x)); */
if (im->trueColor)
{
int p = im->tpixels[y][x];
int p = im->tpixels[y][x];
chunkData[chunkLen++] = gdTrueColorGetAlpha (p);
chunkData[chunkLen++] = gdTrueColorGetRed (p);
chunkData[chunkLen++] = gdTrueColorGetGreen (p);
@ -885,7 +899,7 @@ _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
}
else
{
int p = im->pixels[y][x];
int p = im->pixels[y][x];
chunkData[chunkLen++] = p;
}
};
@ -908,7 +922,7 @@ _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
};
/*GD2_DBG(printf("y=%d done.\n",y)); */
};
if (gd2_compressed(fmt))
if (gd2_compressed (fmt))
{
compLen = compMax;
if (compress ((unsigned char *)
@ -936,7 +950,7 @@ _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
};
};
};
if (gd2_compressed(fmt))
if (gd2_compressed (fmt))
{
/* Save the position, write the index, restore position (paranoia). */
GD2_DBG (printf ("Seeking %d to write index\n", idxPos));

View File

@ -3,6 +3,10 @@
#include <stdio.h>
#ifdef VMS
#define Putchar gdPutchar
#endif
typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
@ -12,7 +16,7 @@ typedef struct gdIOCtx
int (*putBuf) (struct gdIOCtx *, const void *, int);
/* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek) (struct gdIOCtx *, const int);
int (*seek) (struct gdIOCtx *, const int);
long (*tell) (struct gdIOCtx *);

View File

@ -432,7 +432,7 @@ gdImageCreateFromJpegCtx (gdIOCtx * infile)
}
rowptr[0] = row;
for (i = 0; i < cinfo.output_height; i++)
for (i = 0; i < cinfo.output_height; i++)
{
register JSAMPROW currow = row;
register int *tpix = im->tpixels[i];
@ -443,10 +443,10 @@ gdImageCreateFromJpegCtx (gdIOCtx * infile)
" returns %u, expected 1\n", nrows);
goto error;
}
for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++)
{
*tpix = gdTrueColor (currow[0], currow[1], currow[2]);
}
for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++)
{
*tpix = gdTrueColor (currow[0], currow[1], currow[2]);
}
}
if (jpeg_finish_decompress (&cinfo) != TRUE)
@ -496,7 +496,7 @@ typedef struct
gdIOCtx *infile; /* source stream */
unsigned char *buffer; /* start of buffer */
safeboolean start_of_file; /* have we gotten any data yet? */
}
my_source_mgr;
@ -556,44 +556,45 @@ init_source (j_decompress_ptr cinfo)
*/
#define END_JPEG_SEQUENCE "\r\n[*]--:END JPEG:--[*]\r\n"
safeboolean
safeboolean
fill_input_buffer (j_decompress_ptr cinfo)
{
my_src_ptr src = (my_src_ptr) cinfo->src;
size_t nbytes = 0;
/* size_t got; */
/* char *s; */
memset (src->buffer, 0, INPUT_BUF_SIZE);
while (nbytes < INPUT_BUF_SIZE)
/* 2.0.12: signed size. Thanks to Geert Jansen */
ssize_t nbytes = 0;
/* ssize_t got; */
/* char *s; */
memset (src->buffer, 0, INPUT_BUF_SIZE);
while (nbytes < INPUT_BUF_SIZE)
{
int got = gdGetBuf (src->buffer + nbytes,
INPUT_BUF_SIZE - nbytes,
src->infile);
if ((got == EOF) || (got == 0))
int got = gdGetBuf (src->buffer + nbytes,
INPUT_BUF_SIZE - nbytes,
src->infile);
if ((got == EOF) || (got == 0))
{
/* EOF or error. If we got any data, don't worry about it.
If we didn't, then this is unexpected. */
if (!nbytes)
/* EOF or error. If we got any data, don't worry about it.
If we didn't, then this is unexpected. */
if (!nbytes)
{
nbytes = -1;
}
break;
}
nbytes += got;
}
if (nbytes <= 0)
nbytes = -1;
}
break;
}
nbytes += got;
}
if (nbytes <= 0)
{
if (src->start_of_file) /* Treat empty input file as fatal error */
ERREXIT (cinfo, JERR_INPUT_EMPTY);
@ -669,11 +670,11 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
void
term_source (j_decompress_ptr cinfo)
{
#if 0
/* never used */
my_src_ptr src = (my_src_ptr) cinfo->src;
my_src_ptr src = (my_src_ptr) cinfo->src;
#endif
}
@ -705,8 +706,8 @@ jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile)
src->buffer = (unsigned char *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
INPUT_BUF_SIZE * sizeof (unsigned char));
}
}
src = (my_src_ptr) cinfo->src;
src->pub.init_source = init_source;

View File

@ -334,7 +334,6 @@ gdImageCreateFromPngCtx (gdIOCtx * infile)
if (!im->trueColor)
{
im->colorsTotal = num_palette;
im->transparent = transparent;
/* load the palette and mark all entries "open" (unused) for now */
open = im->open;
for (i = 0; i < num_palette; ++i)
@ -349,6 +348,9 @@ gdImageCreateFromPngCtx (gdIOCtx * infile)
open[i] = 1;
}
}
/* 2.0.12: Slaven Rezic: palette images are not the only images
with a simple transparent color setting */
im->transparent = transparent;
im->interlace = (interlace_type == PNG_INTERLACE_ADAM7);
/* can't nuke structs until done with palette */
@ -422,11 +424,19 @@ gdImageCreateFromPngCtx (gdIOCtx * infile)
}
void
gdImagePngEx (gdImagePtr im, FILE * outFile, int level)
{
gdIOCtx *out = gdNewFileCtx (outFile);
gdImagePngCtxEx (im, out, level);
out->gd_free (out);
}
void
gdImagePng (gdImagePtr im, FILE * outFile)
{
gdIOCtx *out = gdNewFileCtx (outFile);
gdImagePngCtx (im, out);
gdImagePngCtxEx (im, out, -1);
out->gd_free (out);
}
@ -435,18 +445,35 @@ gdImagePngPtr (gdImagePtr im, int *size)
{
void *rv;
gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
gdImagePngCtx (im, out);
gdImagePngCtxEx (im, out, -1);
rv = gdDPExtractData (out, size);
out->gd_free (out);
return rv;
}
void *
gdImagePngPtrEx (gdImagePtr im, int *size, int level)
{
void *rv;
gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
gdImagePngCtxEx (im, out, level);
rv = gdDPExtractData (out, size);
out->gd_free (out);
return rv;
}
void
gdImagePngCtx (gdImagePtr im, gdIOCtx * outfile)
{
return gdImagePngCtxEx (im, outfile, -1);
}
/* This routine is based in part on code from Dale Lutz (Safe Software Inc.)
* and in part on demo code from Chapter 15 of "PNG: The Definitive Guide"
* (http://www.cdrom.com/pub/png/pngbook.html).
*/
void
gdImagePngCtx (gdImagePtr im, gdIOCtx * outfile)
gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level)
{
int i, j, bit_depth = 0, interlace_type;
int width = im->sx;
@ -503,8 +530,8 @@ gdImagePngCtx (gdImagePtr im, gdIOCtx * outfile)
fussing with such things. */
/* png_set_filter(png_ptr, 0, PNG_FILTER_NONE); */
/* may want to force maximum compression, but time penalty is large */
/* png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); */
/* 2.0.12: this is finally a parameter */
png_set_compression_level (png_ptr, level);
/* can set this to a smaller value without compromising compression if all
* image data is 16K or less; will save some decoder memory [min == 8] */

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
* element is replaced in the event of a cache miss after the cache has
* reached a given size.
*
* John Ellson (ellson@lucent.com) Oct 31, 1997
* John Ellson (ellson@graphviz.org) Oct 31, 1997
*
* Test this with:
* gcc -o gdcache -g -Wall -DTEST gdcache.c

View File

@ -5,7 +5,7 @@
* element is replaced in the event of a cache miss after the cache has
* reached a given size.
*
* John Ellson (ellson@lucent.com) Oct 31, 1997
* John Ellson (ellson@graphviz.org) Oct 31, 1997
*
* Test this with:
* gcc -o gdcache -g -Wall -DTEST gdcache.c

View File

@ -5,6 +5,7 @@
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "gd.h"
#include "gdfontg.h"
#include "gdfonts.h"
@ -31,6 +32,7 @@ main (void)
/* Points for polygon */
gdPoint points[3];
int i;
/* Create output image, in true color. */
im_out = gdImageCreateTrueColor (256 + 384, 384);
@ -74,11 +76,13 @@ main (void)
red = gdImageColorAllocate (im_out, 255, 0, 0);
green = gdImageColorAllocate (im_out, 0, 255, 0);
blue = gdImageColorAllocate (im_out, 0, 0, 255);
/* Rectangle */
/* Fat Rectangle */
gdImageSetThickness (im_out, 4);
gdImageLine (im_out, 16, 16, 240, 16, green);
gdImageLine (im_out, 240, 16, 240, 240, green);
gdImageLine (im_out, 240, 240, 16, 240, green);
gdImageLine (im_out, 16, 240, 16, 16, green);
gdImageSetThickness (im_out, 1);
/* Circle */
gdImageArc (im_out, 128, 128, 60, 20, 0, 720, blue);
/* Arc */
@ -94,6 +98,13 @@ main (void)
points[2].x = 128;
points[2].y = 128;
gdImageFilledPolygon (im_out, points, 3, green);
/* 2.0.12: Antialiased Polygon */
gdImageSetAntiAliased (im_out, green);
for (i = 0; (i < 3); i++)
{
points[i].x += 128;
}
gdImageFilledPolygon (im_out, points, 3, gdAntiAliased);
/* Brush. A fairly wild example also involving a line style! */
if (im_in)
{
@ -118,15 +129,34 @@ main (void)
/* Draw the styled, brushed line */
gdImageLine (im_out, 0, 255, 255, 0, gdStyledBrushed);
}
/* Text */
/* Text (non-truetype; see gdtestft for a freetype demo) */
gdImageString (im_out, gdFontGiant, 32, 32, (unsigned char *) "hi", red);
gdImageStringUp (im_out, gdFontSmall, 64, 64, (unsigned char *) "hi", red);
/* Random antialiased lines; coordinates all over the image,
but the output will respect a small clipping rectangle */
gdImageSetClip(im_out, 0, gdImageSY(im_out) - 100,
100, gdImageSY(im_out));
/* Fixed seed for reproducibility of results */
srand(100);
for (i = 0; (i < 100); i++) {
int x1 = rand() % gdImageSX(im_out);
int y1 = rand() % gdImageSY(im_out);
int x2 = rand() % gdImageSX(im_out);
int y2 = rand() % gdImageSY(im_out);
gdImageSetAntiAliased(im_out, white);
gdImageLine (im_out, x1, y1, x2, y2, gdAntiAliased);
}
/* Make output image interlaced (progressive, in the case of JPEG) */
gdImageInterlace (im_out, 1);
out = fopen ("demoout.png", "wb");
/* Write PNG */
gdImagePng (im_out, out);
fclose (out);
/* 2.0.12: also write a paletteized version */
out = fopen ("demooutp.png", "wb");
gdImageTrueColorToPalette (im_out, 0, 256);
gdImagePng (im_out, out);
fclose (out);
gdImageDestroy (im_out);
if (im_in)
{

View File

@ -2,7 +2,7 @@
/********************************************/
/* gd interface to freetype library */
/* */
/* John Ellson ellson@lucent.com */
/* John Ellson ellson@graphviz.org */
/********************************************/
#ifdef HAVE_CONFIG_H
@ -21,6 +21,7 @@
#include <unistd.h>
#else
#include <io.h>
#define R_OK 04 /* Needed in Windows */
#endif
/* number of antialised colors for indexed bitmaps */
@ -77,7 +78,7 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
/*
* DEFAULT_FONTPATH and PATHSEPARATOR are host type dependent and
* are normally set by configure in gvconfig.h. These are just
* are normally set by configure in config.h. These are just
* some last resort values that might match some Un*x system
* if building this version of gd separate from graphviz.
*/
@ -379,8 +380,8 @@ fontFetch (char **error, void *key)
*/
fullname = gdRealloc (fullname,
strlen (fontsearchpath) + strlen (name) + 6);
/* if name is an absolute filename then test directly */
if (*name == '/'
/* if name is an absolute or relative pathname then test directly */
if (strchr (name, '/')
|| (name[0] != 0 && name[1] == ':'
&& (name[2] == '/' || name[2] == '\\')))
{
@ -421,12 +422,21 @@ fontFetch (char **error, void *key)
if (!font_found)
{
*error = "Could not find/open font";
/* 2.0.12: TBB: free these. Thanks to Frank Faubert. */
free (a->fontlist);
free (fullname);
gdFree (a);
return NULL;
}
err = FT_New_Face (*b->library, fullname, 0, &a->face);
if (err)
{
/* 2.0.12: TBB: free these. Thanks to Frank Faubert. */
free (a->fontlist);
free (fullname);
gdFree (a);
*error = "Could not read font";
return NULL;
}
@ -471,6 +481,9 @@ fontFetch (char **error, void *key)
if (!found)
{
*error = "Unable to find a CharMap that I can handle";
/* 2.0.12: TBB: free these. Thanks to Frank Faubert. */
free (a->fontlist);
gdFree (a);
return NULL;
}
/* 2.0.5: we should actually return this */
@ -797,6 +810,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
int render = (im && (im->trueColor || (fg <= 255 && fg >= -255)));
FT_BitmapGlyph bm;
int render_mode = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
int m, mfound;
/* Now tuneable thanks to Wez Furlong */
double linespace = LINESPACE;
/* 2.0.6: put this declaration with the other declarations! */
@ -868,6 +882,50 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
{
render_mode |= FT_LOAD_MONOCHROME;
}
/* 2.0.12: allow explicit specification of the preferred map;
but we still fall back if it is not available. */
m = gdFTEX_Unicode;
if (strex && (strex->flags & gdFTEX_CHARMAP))
{
m = strex->charmap;
}
/* Try all three types of maps, but start with the specified one */
mfound = 0;
for (i = 0; (i < 3); i++)
{
switch (m)
{
case gdFTEX_Unicode:
if (font->have_char_map_unicode)
{
mfound = 1;
}
break;
case gdFTEX_Shift_JIS:
if (font->have_char_map_sjis)
{
mfound = 1;
}
break;
case gdFTEX_Big5:
{
/* This was the 'else' case, we can't really 'detect' it */
mfound = 1;
}
break;
}
if (mfound)
{
break;
}
m++;
m %= 3;
}
if (!mfound)
{
/* No character set found! */
return "No character set found";
}
#ifndef JISX0208
if (font->have_char_map_sjis)
@ -916,62 +974,68 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
next++;
continue;
}
if (font->have_char_map_unicode)
switch (m)
{
/* use UTF-8 mapping from ASCII */
len = gdTcl_UtfToUniChar (next, &ch);
next += len;
}
else if (font->have_char_map_sjis)
{
unsigned char c;
int jiscode;
c = *next;
if (0xA1 <= c && c <= 0xFE)
case gdFTEX_Unicode:
if (font->have_char_map_unicode)
{
next++;
jiscode = 0x100 * (c & 0x7F) + ((*next) & 0x7F);
/* use UTF-8 mapping from ASCII */
len = gdTcl_UtfToUniChar (next, &ch);
next += len;
}
break;
case gdFTEX_Shift_JIS:
if (font->have_char_map_sjis)
{
unsigned char c;
int jiscode;
c = *next;
if (0xA1 <= c && c <= 0xFE)
{
next++;
jiscode = 0x100 * (c & 0x7F) + ((*next) & 0x7F);
ch = (jiscode >> 8) & 0xFF;
jiscode &= 0xFF;
ch = (jiscode >> 8) & 0xFF;
jiscode &= 0xFF;
if (ch & 1)
jiscode += 0x40 - 0x21;
if (ch & 1)
jiscode += 0x40 - 0x21;
else
jiscode += 0x9E - 0x21;
if (jiscode >= 0x7F)
jiscode++;
ch = (ch - 0x21) / 2 + 0x81;
if (ch >= 0xA0)
ch += 0x40;
ch = (ch << 8) + jiscode;
}
else
jiscode += 0x9E - 0x21;
if (jiscode >= 0x7F)
jiscode++;
ch = (ch - 0x21) / 2 + 0x81;
if (ch >= 0xA0)
ch += 0x40;
ch = (ch << 8) + jiscode;
}
else
{
ch = c & 0xFF; /* don't extend sign */
}
next++;
}
else
{
/*
* Big 5 mapping:
* use "JIS-8 half-width katakana" coding from 8-bit characters. Ref:
* ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/japan.inf-032092.sjs
*/
ch = (*next) & 0xFF; /* don't extend sign */
next++;
if (ch >= 161 /* first code of JIS-8 pair */
&& *next)
{ /* don't advance past '\0' */
/* TBB: Fix from Kwok Wah On: & 255 needed */
ch = (ch * 256) + ((*next) & 255);
{
ch = c & 0xFF; /* don't extend sign */
}
next++;
}
break;
case gdFTEX_Big5:
{
/*
* Big 5 mapping:
* use "JIS-8 half-width katakana" coding from 8-bit characters. Ref:
* ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/japan.inf-032092.sjs
*/
ch = (*next) & 0xFF; /* don't extend sign */
next++;
if (ch >= 161 /* first code of JIS-8 pair */
&& *next)
{ /* don't advance past '\0' */
/* TBB: Fix from Kwok Wah On: & 255 needed */
ch = (ch * 256) + ((*next) & 255);
next++;
}
}
break;
}
/* set rotation transform */
FT_Set_Transform (face, &matrix, NULL);
@ -984,6 +1048,8 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
FT_Get_Kerning (face, previous, glyph_index,
ft_kerning_default, &delta);
pen.x += delta.x;
/* 2.0.12: indispensable for an accurate bounding box. */
penf.x += delta.x;
}
/* load glyph image into the slot (erase previous one) */

View File

@ -391,7 +391,8 @@ do_convert (unsigned char *to, unsigned char *from, const char *code)
from_len = strlen ((const char *) from) + 1;
to_len = BUFSIZ;
if (iconv (cd, (char **) &from, &from_len, (char **) &to, &to_len) == -1)
if ((int) (iconv (cd, (char **) &from, &from_len, (char **) &to, &to_len))
== -1)
{
#ifdef HAVE_ERRNO_H
if (errno == EINVAL)

View File

@ -4,6 +4,7 @@
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
#include <process.h>
int

View File

@ -189,7 +189,7 @@ main (int argc, char *argv[])
fprintf (stderr, "Can't create test/fttest.png\n");
exit (1);
}
/* 2.0.10: correct ifdef, thanks to Gabriele Verzeletti */
/* 2.0.10: correct ifdef, thanks to Gabriele Verzeletti */
#ifdef HAVE_LIBPNG
gdImagePng (im, out);
#else

View File

@ -1,12 +1,12 @@
<html>
<head>
<TITLE>gd 2.0.11</TITLE>
<TITLE>gd 2.0.12</TITLE>
</head>
<body bgcolor="#FFFFFF">
<!-- BANNER HERE -->
<h1>This is gd 2.0.11.</h1>
<h1>This is gd 2.0.12.</h1>
<p>
<H2>gd 2.0.11</H2>
<H2>gd 2.0.12</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
@ -22,7 +22,7 @@ To ensure that your
new installation overwrites the old.
<p>
<strong>ABOUT GD AND GIF:</strong>
gd 2.0.11 creates PNG, JPEG and WBMP images, not GIF images. This is a
gd 2.0.12 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
@ -35,7 +35,7 @@ solution is to move to legally unencumbered, well-compressed,
modern image formats such as PNG and JPEG as soon as possible.
<p>
gd 2.0.11 <strong>requires</strong> that the following libraries
gd 2.0.12 <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>
@ -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.11">What's new in version "XYZ" of GD?</A>
<LI><A HREF="#whatsnew2.0.12">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>
@ -106,9 +106,9 @@ Portions relating to GD2 format copyright 1999, 2000, 2001, 2002 Philip Warner.
<p>
Portions relating to PNG copyright 1999, 2000, 2001, 2002 Greg Roelofs.
<p>
Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002 John Ellson (ellson@lucent.com).
Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002 John Ellson (ellson@graphviz.org).
<p>
Portions relating to gdft.c copyright 2001, 2002 John Ellson (ellson@lucent.com).
Portions relating to gdft.c copyright 2001, 2002 John Ellson (ellson@graphviz.org).
<p>
Portions relating to JPEG and to color quantization copyright 2000, 2001, 2002, Doug Becker and copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, Thomas G. Lane. This software is based
in part on the work of the Independent JPEG Group. See the file
@ -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.11.
with 2.0.12.
<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.11; see the
to patch PHP 4.2.3 for use with gd 2.0.12; 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
@ -200,6 +200,87 @@ invoke the interpreter.
<li><a href="http://martin.gleeson.com/fly/">fly</a>, by Martin Gleeson
</ul>
<P>
<A NAME="whatsnew2.0.12"><H3>What's new in version 2.0.12?</H3></A>
<P>
<ul>
<li>Small but numerous code cleanups by Dr. Martin Zinser.
<li><a href="#gdImageSetClip">gdImageSetClip</a> and
<a href="#gdImageGetClip">gdImageGetClip</a> have been added. All
drawing routines now stay within the specified clipping rectangle.
Note that the <a href="#gdImageBoundsSafe">gdImageBoundsSafe</a> function
now returns true only if the specified location is within the
clipping rectangle. Of course, the default clipping area is the
entire image. The behavior of existing gd applications does not change.
<li>Support for fast drawing of antialiased lines and polygons,
by Bright Fulton and Frank Faubert. To learn more about this feature,
read about the <a href="#gdImageSetAntiAliased">gdImageSetAntiAliased</a>
function, which is used to set the foreground color for antialiasing,
as well as the <a href="#gdAntiAliased">gdAntiAliased</a> constant, which
is passed to line- and polygon-drawing functions in place of a color.
This code does not currently support an alpha channel component in the
specified foreground color, or in the existing background image,
but <em>does</em> perform alpha blending against an opaque background.
Also see the
<a href="#gdImageSetAntiAliasedDontBlend">gdImageSetAntiAliasedDontBlend</a>
function, which allows the specification of a special background
color that should never be blended with the foreground.
<li>Fixes to color mapping in <a href="#gdImageCopyMergeGray">gdImageCopyMergeGray</a>. Thanks to Philip Warner.
<li><a href="#gdImageStringFTEx">gdImageStringFTEx</a> now supports
explicit specification of the desired character mapping.
This is useful when a font offers more than one of Unicode,
Shift_JIS, and Big5.
<li>The PNG compression level can now be specified when writing PNG
images. See the new <a href="#gdImagePngEx">gdImagePngEx</a>,
<a href="#gdImagePngEx">gdImagePngEx</a>,
<a href="#gdImagePngCtxEx">gdImagePngCtxEx</a>, and
<a href="#gdImagePngPtrEx">gdImagePngPtrEx</a> functions.
<li>The annotate utility builds without error in the absence of
freetype, although of course it is not useful without freetype.
<li>Thorben Kundinger fixed a bug relating to the use of palette-based
images as brushes when drawing on truecolor images.
<li>Michael Schwartz corrected a problem with his code for drawing
thick lines.
<li>Prior to 2.0.12, any alpha channel component in the
<em>destination</em> image was ignored when drawing with
alpha blending in effect (see
<a href="#gdImageAlphaBlending">gdImageAlphaBlending</a>). 2.0.12
correctly preserves an appropriate proportion of the alpha component
of the destination, just as it preserves an appropriate proportion
of the red, green and blue components, depending on the opacity
of the foreground. Thanks to Frank Warmerdam for pointing out the issue.
<li>Memory leaks on failed attempts to load fonts
in <a href="#gdImageStringFTEx">gdImageStringFTEx</a> were corrected.
Thanks to Frank Faubert.
<li>The impact of kerning is now correctly included in the calculation
of the bounding box returned by the freetype text routines. This issue
was pointed out by several individuals.
<li>Color problems with the <code>gd2</code> file format routines
were fixed by Steven Brown. These problems were due to the
incorrect use of a signed integer.
<li>Version 2.0.12 supports the <code>gd</code> file format correctly
for truecolor images. Truecolor <code>gd</code> files created with
earlier releases in the 2.0 series must be written again. The <code>gd</code>
file format is used to quickly load an entire uncompressed image, typically
an existing background to which additional material will be added; it is not a
general purpose file format. More advanced capabilities are also available
via the <code>gd2</code> format. Thanks to Andreas Pfaller for reporting
the problem.
<li>Signed vs. unsigned problem caused misbehavior when attempting to
load a bad JPEG image. Thanks to Geert Jansen.
<li>Existing truecolor PNG images with simple single-color transparency are
now loaded properly, thanks to Slaven Rezic.
<li>The <a href="#gdImageTrueColorToPalette">gdImageTrueColorToPalette</a>
function no longer attempts to preserve an alpha channel in the original.
My attempt to do so resulted in significantly inferior output even if no
alpha channel was present in the original. Thanks to Barend Gehrels for
submitting a new adaptation of Tom Lane's jquant2.c which does a very
high-quality job of palette conversion. Thanks also to Steven Brown, who
submitted patches allowing a single 100% transparent color in the
original truecolor image to be preserved. In practice, more complex
alpha channels in palettes are ill-supported and difficult to
allocate skillfully.
</ul>
<P>
<A NAME="whatsnew2.0.11"><H3>What's new in version 2.0.11?</H3></A>
<P>
<ul>
@ -346,6 +427,7 @@ works properly.
very handy tool for adding freetype text to existing JPEGs. After
<code>make install</code>, type <code>annotate -h</code> for more
information. Thanks to Joel Dubiner.
</ul>
<P>
<A NAME="whatsnew2.0.2"><H3>What's new in version 2.0.2?</H3></A>
<ul>
@ -493,7 +575,7 @@ read old .gd and .gd2 files correctly.
</ul>
<P><A NAME="whatsnew1.8.4"><H3>What's new in version 1.8.4?</H3></A>
<ul>
<li>Add support for FreeType2 (John Ellson ellson@lucent.com)
<li>Add support for FreeType2 (John Ellson ellson@graphviz.org)
<li>Add support for finding in fonts in a builtin DEFAULT_FONTPATH,
or in a path from the GDFONTPATH environment variable.
<li>remove some unused symbols to reduce compiler warnings
@ -605,7 +687,7 @@ Version 1.6.3 corrects a memory leak in gd_png.c. This leak caused
a significant amount of memory to be allocated and not freed when
writing a PNG image.
<P><A NAME="whatsnew1.6.2"><H3>What's new in version 1.6.2?</H3></A>
Version 1.6.2 from John Ellson <ellson@lucent.com> adds two new functions:
Version 1.6.2 from John Ellson <ellson@graphviz.org> adds two new functions:
<ul>
<li>gdImageStringTTF - scalable, rotatable, anti-aliased, TrueType strings using
the FreeType library, but only if libttf is found by configure.
@ -791,8 +873,8 @@ saving of alpha channel information to the file instead.
<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.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>
<li><a href="http://www.boutell.com/gd/http/gd-2.0.12.tar.gz">Gzipped Tar File (Unix)</a>
<li><a href="http://www.boutell.com/gd/http/gd-2.0.12.zip">.ZIP File (Windows)</a>
</ul>
<P>
<A NAME="buildgd"><H3>How do I build gd?</H3></A>
@ -803,10 +885,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.11".
Unpacking the archive will produce a directory called "gd-2.0.12".
<p>
<h4>For Unix</h4>
<code>cd</code> to the 2.0.11 directory and type:
<code>cd</code> to the 2.0.12 directory and type:
<p>
<code>./configure</code>
<P>
@ -1085,6 +1167,51 @@ binary code that references particular structure members.
A pointer to an image structure. <A HREF="#gdImageCreate">gdImageCreate</A>
returns this type, and the other functions expect it as the first
argument.
<DT><A NAME="gdIoCtx">gdIOCtx</a> <strong>(TYPE)</strong>
<DD>
Most of the gd functions that read and write files, such as
<a href="#gdImagePng">gdImagePng</a> and <a href="#gdImageCreateFromJpeg</a>,
also have variants that accept a gdIOCtx structure; see
<a href="#gdImagePngCtx">gdImagePngCtx</a> and
<a href="#gdImageCreateFromJpegCtx</a>. Those who wish to provide
their own custom routines to read and write images can populate a
gdIOCtx structure with functions of their own devising to
to read and write data. For image reading, the only mandatory
functions are getC and getBuf, which must return the number of
characters actually read, or a negative value on error or EOF.
These functions must read the number of characters requested
unless at the end of the file. For image writing, the only mandatory
functions are putC and putBuf, which return the number of
characters written; these functions must write the number of
characters requested except in the event of an error. The seek
and tell functions are only required in conjunction with the
<code>gd2</code> file format, which supports quick loading of
partial images. The gd_free function will not be invoked when
calling the standard Ctx functions; it is an implementation
convenience when adding new data types to gd. For examples,
see gd_png.c, gd_gd2.c, gd_jpeg.c, etc., all of which rely
on gdIOCtx to implement the standard image read and write functions.
<pre>
typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
int (*getBuf) (struct gdIOCtx *, void *, int wanted);
void (*putC) (struct gdIOCtx *, int);
int (*putBuf) (struct gdIOCtx *, const void *, int wanted);
/* 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 *);
} gdIOCtx;
</pre>
<DT><A NAME="gdFont">gdFont</A> <strong>(TYPE)</strong>
<DD>
A font structure. Used to declare the characteristics of a font.
@ -1466,7 +1593,7 @@ im = <A HREF="#gdImageCreate">gdImageCreate</A>(10, 10);
<DT><A NAME="gdImageJpeg">
void gdImageJpeg(gdImagePtr im, FILE *out, int quality)</A>
<STRONG>(FUNCTION)</STRONG><BR>
void gdImageJpegCtx(gdImagePtr im, gdIOCtx *out, int quality)</A>
<a name="gdImageJpegCtx">void gdImageJpegCtx(gdImagePtr im, gdIOCtx *out, int quality)</A>
<STRONG>(FUNCTION)</STRONG><BR>
<DD>
gdImageJpeg outputs the specified image to the specified
@ -1523,6 +1650,10 @@ build time.</strong> The 'size' parameter receives the total size of the block
of memory.
<DT><A NAME="gdImagePng">
void gdImagePng(gdImagePtr im, FILE *out)</A>
<br>
<A NAME="gdImagePngCtx">
void gdImagePngCtx(gdImagePtr im, gdIOCtx *out)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
gdImagePng outputs the specified image to the specified
@ -1553,7 +1684,24 @@ fclose(out);
/* Destroy image */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
<DT><A NAME="gdImagePngEx">
void gdImagePngEx(gdImagePtr im, FILE *out, int level)</A>
<br>
<A NAME="gdImagePngCtxEx">
void gdImagePngCtxEx(gdImagePtr im, gdIOCtx *out, int level)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
Like <a href="#gdImagePng">gdImagePng</a>, gdImagePngEx outputs the
specified image to the specified file in PNG format. In addition,
gdImagePngEx allows the level of compression to be specified. A compression
level of 0 means "no compression." A compression level of 1 means
"compressed, but as quickly as possible." A compression level of 9
means "compressed as much as possible to produce the smallest possible
file." A compression level of -1 will use the default compression level
at the time zlib was compiled on your system.
<p>
For more information, see <a href="#gdImagePng">gdImagePng</a>.
<DT><A NAME="gdImagePngPtr">
void* gdImagePngPtr(gdImagePtr im, int *size)</A>
<STRONG>(FUNCTION)</STRONG>
@ -1564,7 +1712,20 @@ unless the caller is absolutely certain that the same implementations of
malloc, free, etc. are used both at library build time and at application
build time.</strong> The 'size' parameter receives the total size of the block
of memory.
<DT><A NAME="gdImagePngPtrEx">
void* gdImagePngPtrEx(gdImagePtr im, int *size, int level)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
Like <a href="#gdImagePngPtr">gdImagePngPtr</a>, gdImagePngPtrEx returns a
pointer to a PNG image in allocated memory.
In addition, gdImagePngPtrEx allows the level of compression to be
specified. A compression level of 0 means "no compression." A compression level of 1 means
"compressed, but as quickly as possible." A compression level of 9
means "compressed as much as possible to produce the smallest possible
file." A compression level of -1 will use the default compression level
at the time zlib was compiled on your system.
<p>
For more information, see <a href="#gdImagePngPtr">gdImagePngPtr</a>.
<DT><A NAME="gdImagePngToSink">gdImagePngToSink(gdImagePtr im, gdSinkPtr out)</A>
<strong>(FUNCTION)</strong>
<dd>
@ -1701,6 +1862,9 @@ of memory.
<DT><A NAME="gdImageGd2">
void gdImageGd2(gdImagePtr im, FILE *out, int chunkSize, int fmt)</A>
<br>
<A NAME="gdImageGd2Ctx">
void gdImageGd2Ctx(gdImagePtr im, gdIOCtx *out, int chunkSize, int fmt)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
gdImageGd2 outputs the specified image to the specified
@ -1758,24 +1922,28 @@ unless the caller is absolutely certain that the same implementations of
malloc, free, etc. are used both at library build time and at application
build time.</strong> The 'size' parameter receives the total size of the block
of memory.
<DT><A NAME="gdImageToPalette">
void gdImageToPalette(gdImagePtr im, int ditherFlag, int colorsWanted)</A>
<DT><A NAME="gdImageTrueColorToPalette">
void gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>Converts a truecolor image to a palette-based image,
using a high-quality two-pass quantization routine
which attempts to preserve alpha channel information
as well as R/G/B color information when creating
a palette. If ditherFlag is set, the image will be
using a high-quality two-pass quantization routine.
If ditherFlag is set, the image will be
dithered to approximate colors better, at the expense
of some obvious "speckling." colorsWanted can be
anything up to 256. If the original source image
includes photographic information or anything that
came out of a JPEG, 256 is strongly recommended.
came out of a JPEG, 256 is strongly recommended.
100% transparency of a single transparent color in the
original truecolor image will be preserved. There is no other
support for preservation of alpha channel or transparency in
the destination image.
<p>
Better yet, don't use this function -- write real
For best results, don't use this function -- write real
truecolor PNGs and JPEGs. The disk space gain of
conversion to palette is not great (for small images
it can be negative) and the quality loss is ugly.
it can be negative) and the quality loss is ugly. However,
the version of this function included in version 2.0.12 does
do a better job than the version included prior to 2.0.12.
</DL>
<H3><A NAME="drawing">Drawing Functions</A></H3>
<DL>
@ -2150,6 +2318,87 @@ gdImageFill(im, 50, 50, red);
/* Destroy it */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
<DT><A NAME="gdImageSetAntiAliased">void gdImageSetAntiAliased(gdImagePtr im, int c)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
"Antialiasing" is a process by which jagged edges associated with line
drawing can be reduced by blending the foreground color with an appropriate
percentage of the background, depending on how much of the pixel in question
is actually within the boundaries of the line being drawn.
All line-drawing functions,
such as <A HREF="#gdImageLine">gdImageLine</A> and
<A HREF="#gdImagePolygon">gdImagePolygon</A>, will draw antialiased lines
if the special "color" <A HREF="#gdAntiAliased">
gdAntiAliased</A> is used when calling them.
<P>
gdImageSetAntiAliased is used to specify the actual foreground color
to be used when drawing antialiased lines. You may set any color to
be the foreground, however as of version 2.0.12 an alpha channel
component is not supported.
<p>
Antialiased lines can be drawn on both truecolor and palette-based
images. However, attempts to draw antialiased lines on
highly complex palette-based backgrounds may not give satisfactory
results, due to the limited number of colors available in the
palette. Antialiased line-drawing on simple backgrounds should
work well with palette-based images; otherwise create or fetch
a truecolor image instead.
<P>
You need not take any special action when you are finished
with antialised line drawing.
<PRE>
... inside a function ...
<A HREF="#gdImagePtr">gdImagePtr</A> im, brush;
int black;
int blue;
im = <A HREF="#gdImageCreate">gdImageCreate</A>(100, 100);
/* Background color (first allocated) */
black = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 0, 0, 0);
blue = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 0, 0, 255);
gdImageSetAntiAliased(im, blue);
/* Draw a smooth line from the upper left corner to the lower right corner. */
<A HREF="#gdImageLine">gdImageLine</A>(im, 0, 0, 99, 99, <A HREF="#gdBrushed">gdAntiAliased</A>);
/* ... Do something with the image, such as saving it to a file... */
/* Destroy it */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
See also <a href="#gdAntiAliased">gdAntiAliased</a> and
<a href="#gdSetAntiAliasedDontBlend">gdSetAntiAliasedDontBlend</a>.
<DT><A NAME="gdImageSetAntiAliasedDontBlend">void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
Normally, when drawing lines with the special
<a href="#gdAntiAliased">gdAntiAliased</a> "color," blending with the
background to reduce jagged edges is the desired behavior. However, when
it is desired that lines not be blended with one particular color when
it is encountered in the background, the
gdImageSetAntiAliasedDontBlend function can be used to indicate the
special color that the foreground should stand out more clearly against.
<PRE>
... inside a function ...
<A HREF="#gdImagePtr">gdImagePtr</A> im, brush;
int black;
int blue;
int white;
im = <A HREF="#gdImageCreate">gdImageCreate</A>(100, 100);
/* Background color (first allocated) */
black = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 0, 0, 0);
blue = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 0, 0, 255);
white = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 255, 255, 255);
gdImageSetAntiAliased(im, blue);
/* The portion of the line that crosses this white rectangle will
not be blended smoothly */
gdImageSetAntiAliasedDontBlend(im, white);
gdImageFilledRectangle(im, 25, 25, 75, 75, white);
/* Draw a smooth line from the upper left corner to the lower right corner. */
<A HREF="#gdImageLine">gdImageLine</A>(im, 0, 0, 99, 99, <A HREF="#gdBrushed">gdAntiAliased</A>);
/* ... Do something with the image, such as saving it to a file... */
/* Destroy it */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
See also <a href="#gdAntiAliased">gdAntiAliased</a> and
<a href="#gdSetAntiAliased">gdSetAntiAliased</a>.
<DT><A NAME="gdImageSetBrush">void gdImageSetBrush(gdImagePtr im, gdImagePtr brush)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
@ -2330,6 +2579,28 @@ gdImageSetStyle(im, styleDashed, 6);
/* ... Do something with the image, such as saving it to a file ... */
/* Destroy it */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
<DT><A NAME="gdImageSetThickness">void gdImageSetThickness(gdImagePtr im, int thickness)</A> <STRONG>(FUNCTION)</STRONG>
<DD>gdImageSetThickness determines the width of lines drawn by the
<a href="#gdImageLine">gdImageLine</a>, <a href="#gdImagePolygon">gdImagePolygon</a>
and related functions, in pixels.
<PRE>
... inside a function ...
<A HREF="#gdImagePtr">gdImagePtr</A> im;
int black;
int white;
im = <A HREF="#gdImageCreate">gdImageCreate</A>(100, 100);
/* Background color (first allocated) */
black = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 0, 0, 0);
/* Allocate the color white (red, green and blue all maximum). */
white = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 255, 255, 255);
/* Set thickness. */
gdImageSetThickness(im, 4);
/* Draw a fat line from the upper left corner to the lower right corner. */
gdImageLine(im, 0, 0, 99, 99, white);
/* ... Do something with the image, such as saving it to a file... */
/* Destroy it */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
@ -2377,7 +2648,7 @@ gdImageAlphaBlending(im, 0);
void gdImageSaveAlpha(gdImagePtr im, int saveFlag)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
By default, gd 2.0.2 and above does not attempt to save full alpha channel information
By default, gd 2.0.2 and above do not attempt to save full alpha channel information
(as opposed to single-color transparency) when saving PNG images. (PNG
is currently the only output format supported by gd which can accommodate
alpa channel information.) This saves space in the output file. If you wish
@ -2387,6 +2658,60 @@ information, and call <a href="#gdImageAlphaBlending">gdImageAlphaBlending(im, 0
to turn off alpha blending within the library so that alpha channel
information is actually stored in the image rather than being composited
immediately at the time that drawing functions are invoked.
<DT><A NAME="gdImageSetClip">
void gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
Establishes a clipping rectangle. Once gdImageSetClip has been called,
all future drawing operations will remain within the specified clipping
area, until a new gdImageSetClip call takes place. For instance,
if a clipping rectangle of 25, 25, 75, 75 has been set within a
100x100 image, a diagonal line from 0,0 to 99,99 will appear only
between 25,25 and 75,75.
<p>
If gdImageSetClip is never called, the clipping area will be the
entire image.
<p>
The parameters passed to gdImageSetClip are checked against the dimensions
of the image and limited to "safe" values.
<PRE>
... inside a function ...
<A HREF="#gdImagePtr">gdImagePtr</A> im;
int black;
int white;
im = <A HREF="#gdImageCreate">gdImageCreate</A>(100, 100);
/* Background color (first allocated) */
black = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 0, 0, 0);
/* Allocate the color white (red, green and blue all maximum). */
white = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 255, 255, 255);
/* Set the clipping rectangle. */
gdImageSetClip(im, 25, 25, 75, 75);
/* Draw a line from the upper left corner to the lower right corner.
Only the part within the clipping rectangle will appear. */
<a href="#gdImageLine">gdImageLine</a>(im, 0, 0, 99, 99, white);
/* ... Do something with the image, such as saving it to a file ... */
/* Destroy it */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
See also <a href="#gdImageGetClip">gdImageGetClip</a>.
<DT><A NAME="gdImageGetClip">
void gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
Fetches the boundaries of the current clipping rectangle.
<pre>
... Inside a function ...
gdImagePtr im = <a href="#gdImageCreateTrueColor">gdImageCreateTrueColor</a>(100, 100);
int x1, y1, x2, y2;
gdImageSetClip(im, 25, 25, 75, 75);
gdImageGetClip(im, &x1, &y1, &x2, &y2);
printf("%d %d %d %d\n", x1, y1, x2, y2);
</pre>
The above code would print:
<pre>
25 25 75 75
</pre>
See also <a href="#gdImageSetClip">gdImageSetClip</a>.
</DL>
<H3><A NAME="query">Query Functions</A></H3>
<DL>
@ -2430,10 +2755,13 @@ printf("The value of the center pixel is %d; RGB values are %d,%d,%d\n",
int gdImageBoundsSafe(gdImagePtr im, int x, int y)</A>
<STRONG>(FUNCTION)</STRONG>
<DD>
gdImageBoundsSafe returns true (1) if the specified point is within the bounds
of the image, false (0) if not. This function is intended primarily for
gdImageBoundsSafe returns true (1) if the specified point is within the
current clipping rectangle, false (0) if not. The clipping rectangle is
set by <a href="#gdImageSetClip">gdImageSetClip</a> and defaults
to the entire image. This function is intended primarily for
use by those who wish to add functions to gd. All of the gd drawing
functions already clip safely to the edges of the image.
functions already clip safely using this function or its macro
equivalent in gd.c, gdImageBoundsSafeMacro.
<PRE>
... inside a function ...
<A HREF="#gdImagePtr">gdImagePtr</A> im;
@ -2804,6 +3132,7 @@ if (err) {fprintf(stderr,err); return 1;}
/* Destroy it */
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
</PRE>
See also <a href="#gdImageStringFTEx">gdImageStringFTEx</a>.
<DT><A NAME="gdImageStringFTEx">
char *gdImageStringFTEx(gdImagePtr im, int *brect,
int fg, char *fontname, double ptsize, double angle,
@ -2824,11 +3153,17 @@ typedef struct {
int flags;
/* fine tune line spacing for '\n' */
double linespacing;
/* Preferred character mapping */
int charmap;
} gdFTStringExtra, *gdFTStringExtraPtr;
</pre>
To output multiline text with a specific line spacing, set
<code>flags</code> to <code>gdFTEX_LINESPACE</code>, and set
<code>linespacing</code> to the desired spacing, expressed as a
To output multiline text with a specific line spacing,
include <code>gdFTEX_LINESPACE</code> in the setting of
<code>flags</code>:
<pre>
flags |= gdFTEX_LINESPACE;
</pre>
And also set <code>linespacing</code> to the desired spacing, expressed as a
multiple of the font height. Thus a line spacing of 1.0 is the
minimum to guarantee that lines of text do not collide.
<p>
@ -2836,6 +3171,19 @@ If <code>gdFTEX_LINESPACE</code> is not present, or
<code>strex</code> is null, or <a href="#gdImageStringFT">gdImageStringFT</a>
is called, <code>linespacing</code> defaults to 1.05.
<p>
To specify a preference for Unicode, Shift_JIS Big5 character encoding,
set or To output multiline text with a specific line spacing,
include <code>gdFTEX_CHARMAP</code> in the setting of
<code>flags</code>:
<pre>
flags |= gdFTEX_CHARMAP;
</pre>
And set <code>charmap</code> to the desired value, which can be
any of gdFTEX_Unicode, gdFTEX_Shift_JIS, or gdFTEX_Big5. If you do not
specify a preference, Unicode will be tried first. If the preferred
character mapping is not found in the font, other character mappings
are attempted.
<p>
For more information, see <a href="#gdImageStringFT">gdImageStringFT</a>.
<DT><A NAME="gdImageStringTTF">
char *gdImageStringTTF(gdImagePtr im, int *brect,
@ -3183,25 +3531,25 @@ gdImageColorsTotal is a macro which returns the number of
colors currently allocated in a palette image. For truecolor
images, the result of this call is undefined and should not
be used.
<DT><A NAME="gdImageColorRed">
int gdImageColorRed(gdImagePtr im, int c)</A>
<DT><A NAME="gdImageRed">
int gdImageRed(gdImagePtr im, int c)</A>
<STRONG>(MACRO)</STRONG>
<DD>
gdImageColorRed is a macro which returns the red portion
gdImageRed is a macro which returns the red portion
of the specified color in the image. This macro works
for both palette and truecolor images.
<DT><A NAME="gdImageColorGreen">
int gdImageColorGreen(gdImagePtr im, int c)</A>
<DT><A NAME="gdImageGreen">
int gdImageGreen(gdImagePtr im, int c)</A>
<STRONG>(MACRO)</STRONG>
<DD>
gdImageColorGreen is a macro which returns the green portion
gdImageGreen is a macro which returns the green portion
of the specified color in the image. This macro works
for both palette and truecolor images.
<DT><A NAME="gdImageColorBlue">
int gdImageColorBlue(gdImagePtr im, int c)</A>
<DT><A NAME="gdImageBlue">
int gdImageBlue(gdImagePtr im, int c)</A>
<STRONG>(MACRO)</STRONG>
<DD>
gdImageColorBlue is a macro which returns the blue portion
gdImageBlue is a macro which returns the blue portion
of the specified color in the image. This macro works
for both palette and truecolor images.
<DT><A NAME="gdImageGetInterlaced">
@ -3688,6 +4036,17 @@ originally allocated the block.
</DL>
<H3><A NAME="constants">Constants</A></H3>
<DL>
<DT><A NAME="gdAntiAliased">gdAntiAliased</A> <strong>(CONSTANT)</strong>
<DD>
Used in place of a color when invoking a line-drawing
function such as <A HREF="#gdImageLine">gdImageLine</A>
or <A HREF="#gdImageRectangle">gdImageRectangle</A>.
When gdAntiAliased is used as the color, the foreground color
set with <a href="#gdImageSetAntiAliased">gdImageSetAntiAliased</a>
is used, with antialiasing mechanisms to minimize any
"jagged" appearance.
For more information, see
<a href="#gdImageSetAntiAliased">gdImageSetAntiAliased</a>.
<DT><A NAME="gdBrushed">gdBrushed</A> <strong>(CONSTANT)</strong>
<DD>
Used in place of a color when invoking a line-drawing
@ -3702,9 +4061,10 @@ of a wide paintbrush). See also
to draw broken lines with a series of distinct copies of an image.
<DT><A NAME="gdMaxColors"><code>gdMaxColors</code><strong>(CONSTANT)</strong>
<DD>
The constant 256. This is the maximum number of colors in a PNG file
according to the PNG standard, and is also the maximum number of
colors in a gd image.
The constant 256. This is the maximum number of colors in a palette-based
PNG file according to the PNG standard, and is also the maximum number of
colors in a palette-based gd image. This of course does not apply to
truecolor images.
<DT><A NAME="gdStyled">gdStyled</A> <strong>(CONSTANT)</strong>
<DD>
Used in place of a color when invoking a line-drawing
@ -3881,6 +4241,7 @@ and/or confusion, be sure to specifically mention that you wish to
purchase gd support at the hourly rate above.
<H3><A NAME="index">Alphabetical quick index</A></H3>
<A HREF="#gdAntiAliased">gdAntiAliased</A> |
<A HREF="#gdBrushed">gdBrushed</A> |
<A HREF="#gdDashSize">gdDashSize</A> |
<A HREF="#gdFont">gdFont</A> |
@ -3915,9 +4276,13 @@ purchase gd support at the hourly rate above.
<A HREF="#gdImageCreate">gdImageCreateTrueColor</A> |
<A HREF="#gdImageCreateFromGd">gdImageCreateFromGd</A> |
<A HREF="#gdImageCreateFromGd2">gdImageCreateFromGd2</A> |
<A HREF="#gdImageCreateFromGd2Ctx">gdImageCreateFromGd2Ctx</A> |
<A HREF="#gdImageCreateFromGd2Part">gdImageCreateFromGd2Part</A> |
<A HREF="#gdImageCreateFromGd2PartCtx">gdImageCreateFromGd2PartCtx</A> |
<A HREF="#gdImageCreateFromJpeg">gdImageCreateFromJpeg</A> |
<A HREF="#gdImageCreateFromJpegCtx">gdImageCreateFromJpegCtx</A> |
<A HREF="#gdImageCreateFromPng">gdImageCreateFromPng</A> |
<A HREF="#gdImageCreateFromPngCtx">gdImageCreateFromPngCtx</A> |
<A HREF="#gdImageCreateFromPngSource">gdImageCreateFromPngSource</A> |
<A HREF="#gdImageCreateFromXbm">gdImageCreateFromXbm</A> |
<A HREF="#gdImageCreateFromXpm">gdImageCreateFromXpm</A> |
@ -3936,20 +4301,30 @@ purchase gd support at the hourly rate above.
<A HREF="#gdImageGreen">gdImageGreen</A> |
<A HREF="#gdImageInterlace">gdImageInterlace</A> |
<A HREF="#gdImageJpeg">gdImageJpeg</A> |
<A HREF="#gdImageJpegCtx">gdImageJpegCtx</A> |
<A HREF="#gdImageLine">gdImageLine</A> |
<A HREF="#gdImageFilledPolygon">gdImageFilledPolygon</A> |
<A HREF="#gdImagePaletteCopy">gdImagePaletteCopy</A> |
<A HREF="#gdImagePng">gdImagePng</A> |
<A HREF="#gdImagePngEx">gdImagePngEx</A> |
<A HREF="#gdImagePngCtx">gdImagePngCtx</A> |
<A HREF="#gdImagePngCtxEx">gdImagePngCtxEx</A> |
<A HREF="#gdImagePngPtr">gdImagePngPtr</A> |
<A HREF="#gdImagePngPtrEx">gdImagePngPtrEx</A> |
<A HREF="#gdImagePngToSink">gdImagePngToSink</A> |
<A HREF="#gdImagePolygon">gdImagePolygon</A> |
<A HREF="#gdImagePtr">gdImagePtr</A> |
<A HREF="#gdImageWBMP">gdImageWBMP</A> |
<A HREF="#gdImageWBMPCtx">gdImageWBMPCtx</A> |
<A HREF="#gdImageRectangle">gdImageRectangle</A> |
<A HREF="#gdImageRed">gdImageRed</A> |
<A HREF="#gdImageSaveAlpha">gdImageSaveAlpha</A> |
<A HREF="#gdImageSetAntiAliased">gdImageSetAntiAliased</A> |
<A HREF="#gdImageSetAntiAliasedDontBlend">gdImageSetAntiAliasedDontBlend</A> |
<A HREF="#gdImageSetBrush">gdImageSetBrush</A> |
<A HREF="#gdImageSetPixel">gdImageSetPixel</A> |
<A HREF="#gdImageSetStyle">gdImageSetStyle</A> |
<A HREF="#gdImageSetThickness">gdImageSetThickness</A> |
<A HREF="#gdImageSetTile">gdImageSetTile</A> |
<A HREF="#gdImageString">gdImageString</A> |
<A HREF="#gdImageString16">gdImageString16</A> |