mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-24 00:45:52 +00:00
upgrade to 2.0.11
Submitted by: Mikhail Teterin <mi+mx@aldan.algebra.com>
This commit is contained in:
parent
bde4f77e6b
commit
bf9d8d81b3
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=77433
@ -6,8 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME= gd
|
||||
PORTVERSION= 2.0.1
|
||||
PORTREVISION= 3
|
||||
PORTVERSION= 2.0.11
|
||||
CATEGORIES+= graphics
|
||||
MASTER_SITES= http://www.boutell.com/gd/http/ \
|
||||
ftp://ftp.boutell.com/pub/boutell/gd/ \
|
||||
@ -41,8 +40,12 @@ MAKE_ARGS+= -j2
|
||||
MAKE_ARGS+= $v="${$v}"
|
||||
.endfor
|
||||
|
||||
pre-fetch:
|
||||
.if defined(HAVE_UNISYS_LICENSE)
|
||||
WITH_LZW= yes
|
||||
.endif
|
||||
|
||||
.if !defined(WITH_LZW)
|
||||
pre-fetch:
|
||||
@${ECHO_CMD} "************************************************************"
|
||||
@${ECHO_CMD} "* If you live outside US and Canada, you can define *"
|
||||
@${ECHO_CMD} "* WITH_LZW to enable GIF compression support. *"
|
||||
|
@ -1 +1 @@
|
||||
MD5 (gd-2.0.1.tar.gz) = 43af994a97f3300a1165ca4888176ece
|
||||
MD5 (gd-2.0.11.tar.gz) = e2b6a14e7ac9781789e5d9f189af8475
|
||||
|
@ -1,8 +1,15 @@
|
||||
PROGS!= make -V BIN_PROGRAMS -f ${WRKSRC}/Makefile
|
||||
TESTS!= make -V TEST_PROGRAMS -f ${WRKSRC}/Makefile
|
||||
OBJS!= make -V LIBOBJS -f ${WRKSRC}/Makefile
|
||||
PROGS!= make -V BIN_PROGRAMS -f ${WRKSRC}/makefile.sample
|
||||
PROGS+= gd2togif gdcmpgif giftogd2
|
||||
PROGS+= annotate # new utility, not included in makefile.sample
|
||||
TESTS= gdtest gddemo gd2time gdtestft testac fontsizetest fontwheeltest
|
||||
SRCS= 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
|
||||
SRCS+= gd_gif_in.c gd_gif_out.c gd_biggif_out.c gd_lzw_out.c
|
||||
MAKEDIR=/usr/share/mk
|
||||
SRCS= ${OBJS:.o=.c}
|
||||
LIB=gd
|
||||
SHLIB_MAJOR=4
|
||||
SHLIB_MINOR=0
|
||||
@ -13,7 +20,7 @@ SHLIB_NAME!= make -V SHLIB_NAME LIB=${LIB} \
|
||||
|
||||
CFLAGS+=-I${.CURDIR} -I${LOCALBASE}/include/freetype2/ \
|
||||
-I${LOCALBASE}/include/freetype2/freetype -I${LOCALBASE}/include \
|
||||
-DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE
|
||||
-DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE -DHAVE_LIBZ
|
||||
LDADD= -L${LOCALBASE}/lib -lpng -lz -ljpeg -lfreetype -lm
|
||||
|
||||
.ifndef WITHOUT_XPM
|
||||
|
@ -12,7 +12,7 @@ void gdImageBigGif(gdImagePtr im, FILE *outFile)
|
||||
{
|
||||
gdIOCtx *out = gdNewFileCtx(outFile);
|
||||
gdImageBigGifCtx(im, out);
|
||||
out->free(out);
|
||||
out->gd_free(out);
|
||||
}
|
||||
|
||||
void* gdImageBigGifPtr(gdImagePtr im, int *size)
|
||||
@ -21,7 +21,7 @@ void* gdImageBigGifPtr(gdImagePtr im, int *size)
|
||||
gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
|
||||
gdImageBigGifCtx(im, out);
|
||||
rv = gdDPExtractData(out,size);
|
||||
out->free(out);
|
||||
out->gd_free(out);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ gdImagePtr gdImageCreateFromGifSource(gdSourcePtr inSource)
|
||||
|
||||
im = gdImageCreateFromGifCtx(in);
|
||||
|
||||
in->free(in);
|
||||
in->gd_free(in);
|
||||
|
||||
return im;
|
||||
}
|
||||
@ -96,7 +96,7 @@ gdImageCreateFromGif(FILE *fdFile)
|
||||
|
||||
im = gdImageCreateFromGifCtx(fd);
|
||||
|
||||
fd->free(fd);
|
||||
fd->gd_free(fd);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ void gdImageGifToSink(gdImagePtr im, gdSinkPtr outSink)
|
||||
{
|
||||
gdIOCtx *out = gdNewSSCtx(NULL,outSink);
|
||||
gdImageGifCtx(im, out);
|
||||
out->free(out);
|
||||
out->gd_free(out);
|
||||
}
|
||||
|
||||
void gdImageGifCtx(gdImagePtr im, gdIOCtx *out)
|
||||
|
@ -72,7 +72,7 @@ void gdImageLzw(gdImagePtr im, FILE *outFile)
|
||||
{
|
||||
gdIOCtx *out = gdNewFileCtx(outFile);
|
||||
gdImageLzwCtx(im, out);
|
||||
out->free(out);
|
||||
out->gd_free(out);
|
||||
}
|
||||
|
||||
void* gdImageLzwPtr(gdImagePtr im, int *size)
|
||||
@ -81,7 +81,7 @@ void* gdImageLzwPtr(gdImagePtr im, int *size)
|
||||
gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
|
||||
gdImageLzwCtx(im, out);
|
||||
rv = gdDPExtractData(out,size);
|
||||
out->free(out);
|
||||
out->gd_free(out);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
--- Makefile.orig Thu Apr 25 14:14:43 2002
|
||||
+++ Makefile Thu Apr 25 14:10:10 2002
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
PROGRAMS=$(BIN_PROGRAMS) $(TEST_PROGRAMS)
|
||||
|
||||
-BIN_PROGRAMS=pngtogd pngtogd2 gdtopng gd2topng gd2copypal gdparttopng webpng
|
||||
+BIN_PROGRAMS=pngtogd pngtogd2 gdtopng gd2topng gd2copypal gdparttopng webpng gd2togif gdcmpgif giftogd2
|
||||
TEST_PROGRAMS=gdtest gddemo gd2time gdtestft testac
|
||||
|
||||
default: instructions
|
||||
@@ -94,6 +94,9 @@
|
||||
sh ./install-item 755 gd2topng $(INSTALL_BIN)/gd2topng
|
||||
sh ./install-item 755 gd2copypal $(INSTALL_BIN)/gd2copypal
|
||||
sh ./install-item 755 gdparttopng $(INSTALL_BIN)/gdparttopng
|
||||
+ sh ./install-item 755 gd2togif $(INSTALL_BIN)/gd2togif
|
||||
+ sh ./install-item 755 gdcmpgif $(INSTALL_BIN)/gdcmpgif
|
||||
+ sh ./install-item 755 giftogd2 $(INSTALL_BIN)/giftogd2
|
||||
sh ./install-item 755 webpng $(INSTALL_BIN)/webpng
|
||||
sh ./install-item 755 bdftogd $(INSTALL_BIN)/bdftogd
|
||||
sh ./install-item 644 gd.h $(INSTALL_INCLUDE)/gd.h
|
||||
@@ -141,8 +144,18 @@
|
||||
gdtestft: gdtestft.o
|
||||
$(CC) --verbose gdtestft.o -o gdtestft $(LIBDIRS) $(LIBS)
|
||||
|
||||
+gd2togif: gd2togif.o libgd.a
|
||||
+ $(CC) --verbose gd2togif.o -o gd2togif $(LIBDIRS) $(LIBS)
|
||||
+
|
||||
+gdcmpgif: gdcmpgif.o libgd.a
|
||||
+ $(CC) --verbose gdcmpgif.o -o gdcmpgif $(LIBDIRS) $(LIBS)
|
||||
+
|
||||
+giftogd2: giftogd2.o libgd.a
|
||||
+ $(CC) --verbose giftogd2.o -o giftogd2 $(LIBDIRS) $(LIBS)
|
||||
+
|
||||
LIBOBJS=gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o \
|
||||
gd_io_file.o gd_ss.o gd_io_ss.o gd_png.o gd_jpeg.o gdxpm.o \
|
||||
+ gd_gif_in.o gd_gif_out.o gd_biggif_out.o gd_lzw_out.o \
|
||||
gdfontt.o gdfonts.o gdfontmb.o gdfontl.o gdfontg.o \
|
||||
gdtables.o gdft.o gdcache.o gdkanji.o wbmp.o \
|
||||
gd_wbmp.o gdhelpers.o gd_topal.o
|
||||
@@ -171,5 +184,4 @@
|
||||
-ranlib libgd.a
|
||||
|
||||
clean:
|
||||
- rm -f *.o *.a *.so ${PROGRAMS} test/gdtest.jpg test/gdtest.wbmp
|
||||
-
|
||||
+ rm -f *.o *.a *.so ${PROGRAMS} test/gdtest.jpg test/gdtest.wbmp demoout.png test/fttest.png
|
@ -1,69 +1,5 @@
|
||||
--- gd.c.orig Thu Apr 25 14:15:15 2002
|
||||
--- gd.c Thu Apr 25 14:15:15 2002
|
||||
+++ gd.c Thu Apr 25 12:43:55 2002
|
||||
@@ -1651,18 +1651,37 @@
|
||||
if (dst->trueColor)
|
||||
{
|
||||
/* 2.0: much easier when the destination is truecolor. */
|
||||
+
|
||||
+ if (src->trueColor) {
|
||||
for (y = 0; (y < h); y++)
|
||||
{
|
||||
for (x = 0; (x < w); x++)
|
||||
{
|
||||
int c = gdImageGetTrueColorPixel (src, srcX + x,
|
||||
srcY + y);
|
||||
+ gdImageSetPixel (dst,
|
||||
+ dstX + x,
|
||||
+ dstY + y,
|
||||
+ c);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ else {
|
||||
+ /* source is palette based */
|
||||
+ for (y = 0; (y < h); y++)
|
||||
+ {
|
||||
+ for (x = 0; (x < w); x++)
|
||||
+ {
|
||||
+ int c = gdImageGetPixel (src, srcX + x,
|
||||
+ srcY + y);
|
||||
if (c != src->transparent)
|
||||
{
|
||||
gdImageSetPixel (dst,
|
||||
dstX + x,
|
||||
dstY + y,
|
||||
- c);
|
||||
+ gdTrueColor(src->red[c], src->green[c], src->blue[c]));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1795,18 +1814,18 @@
|
||||
else
|
||||
{
|
||||
dc = gdImageGetPixel (dst, tox, toy);
|
||||
- g = 0.29900 * dst->red[dc]
|
||||
- + 0.58700 * dst->green[dc]
|
||||
- + 0.11400 * dst->blue[dc];
|
||||
+ g = 0.29900 * gdImageRed(dst,dc)
|
||||
+ + 0.58700 * gdImageGreen(dst,dc)
|
||||
+ + 0.11400 * gdImageBlue(dst, dc);
|
||||
|
||||
ncR = gdImageRed (src, c) * (pct / 100.0)
|
||||
- + gdImageRed (dst, dc) * g *
|
||||
+ + g *
|
||||
((100 - pct) / 100.0);
|
||||
ncG = gdImageGreen (src, c) * (pct / 100.0)
|
||||
- + gdImageGreen (dst, dc) * g *
|
||||
+ + g *
|
||||
((100 - pct) / 100.0);
|
||||
ncB = gdImageBlue (src, c) * (pct / 100.0)
|
||||
- + gdImageBlue (dst, dc) * g *
|
||||
+ + g *
|
||||
((100 - pct) / 100.0);
|
||||
|
||||
/* First look for an exact match */
|
||||
@@ -2211,7 +2230,17 @@
|
||||
}
|
||||
|
||||
|
@ -1,67 +1,41 @@
|
||||
--- gd.h.orig Thu Apr 25 14:15:24 2002
|
||||
+++ gd.h Thu Apr 25 12:43:55 2002
|
||||
@@ -201,6 +201,10 @@
|
||||
--- gd.h Thu Jan 16 11:28:09 2003
|
||||
+++ gd.h Mon Mar 24 16:26:14 2003
|
||||
@@ -209,4 +209,8 @@
|
||||
gdImagePtr gdImageCreateFromPngSource (gdSourcePtr in);
|
||||
|
||||
gdImagePtr gdImageCreateFromPngSource(gdSourcePtr in);
|
||||
|
||||
+gdImagePtr gdImageCreateFromGif(FILE *fd);
|
||||
+gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in);
|
||||
+gdImagePtr gdImageCreateFromGifSource(gdSourcePtr in);
|
||||
+ gdImagePtr gdImageCreateFromGif(FILE *fd);
|
||||
+ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in);
|
||||
+ gdImagePtr gdImageCreateFromGifSource(gdSourcePtr in);
|
||||
+
|
||||
gdImagePtr gdImageCreateFromGd(FILE *in);
|
||||
gdImagePtr gdImageCreateFromGdCtx(gdIOCtxPtr in);
|
||||
gdImagePtr gdImageCreateFromGd (FILE * in);
|
||||
gdImagePtr gdImageCreateFromGdCtx (gdIOCtxPtr in);
|
||||
@@ -300,4 +304,5 @@
|
||||
|
||||
@@ -251,12 +255,26 @@
|
||||
char *gdImageStringFT(gdImage *im, int *brect, int fg, char *fontlist,
|
||||
double ptsize, double angle, int x, int y, char *string);
|
||||
void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
+ void gdImageOpenPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
|
||||
+typedef struct {
|
||||
+ int flags; /* for future expansion logical OR of gdFTEX_ values */
|
||||
+ double linespacing; /* fine tune line spacing for '\n' */
|
||||
+} gdFTStringExtra, *gdFTStringExtraPtr;
|
||||
+#define gdFTEX_LINESPACE 1
|
||||
@@ -395,4 +400,13 @@
|
||||
void *gdImageJpegPtr (gdImagePtr im, int *size, int quality);
|
||||
|
||||
+ void gdImageLzw(gdImagePtr im, FILE *out);
|
||||
+ void* gdImageLzwPtr(gdImagePtr im, int *size);
|
||||
+ void gdImageLzwCtx(gdImagePtr im, gdIOCtxPtr out);
|
||||
+
|
||||
+/* FreeType 2 text output with fine tuning */
|
||||
+char *
|
||||
+gdImageStringFTEx(gdImage * im, int *brect, int fg, char * fontlist,
|
||||
+ double ptsize, double angle, int x, int y, char * string,
|
||||
+ gdFTStringExtraPtr strex);
|
||||
+ void gdImageBigGif(gdImagePtr im, FILE *out);
|
||||
+ void* gdImageBigGifPtr(gdImagePtr im, int *size);
|
||||
+ void gdImageBigGifCtx(gdImagePtr im, gdIOCtxPtr out);
|
||||
+
|
||||
+
|
||||
/* Point type for use in polygon drawing. */
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} gdPoint, *gdPointPtr;
|
||||
|
||||
void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
+void gdImageOpenPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
|
||||
|
||||
/* These functions still work with truecolor images,
|
||||
@@ -347,6 +365,14 @@
|
||||
/* Best to free this memory with gdFree(), not free() */
|
||||
void *gdImageJpegPtr(gdImagePtr im, int *size, int quality);
|
||||
|
||||
+void gdImageLzw(gdImagePtr im, FILE *out);
|
||||
+void* gdImageLzwPtr(gdImagePtr im, int *size);
|
||||
+void gdImageLzwCtx(gdImagePtr im, gdIOCtxPtr out);
|
||||
+
|
||||
+void gdImageBigGif(gdImagePtr im, FILE *out);
|
||||
+void* gdImageBigGifPtr(gdImagePtr im, int *size);
|
||||
+void gdImageBigGifCtx(gdImagePtr im, gdIOCtxPtr out);
|
||||
+
|
||||
/* A custom data sink. For backwards compatibility. Use
|
||||
gdIOCtx instead. */
|
||||
/* The sink function must return -1 on error, otherwise the number
|
||||
@@ -358,6 +384,11 @@
|
||||
} gdSink, *gdSinkPtr;
|
||||
@@ -408,4 +422,9 @@
|
||||
|
||||
void gdImagePngToSink(gdImagePtr im, gdSinkPtr out);
|
||||
void gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
|
||||
+
|
||||
+void gdImageGif(gdImagePtr im, FILE *out);
|
||||
+void* gdImageGifPtr(gdImagePtr im, int *size);
|
||||
+void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out);
|
||||
+void gdImageGifToSink(gdImagePtr im, gdSinkPtr out);
|
||||
+ void gdImageGif(gdImagePtr im, FILE *out);
|
||||
+ void* gdImageGifPtr(gdImagePtr im, int *size);
|
||||
+ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out);
|
||||
+ void gdImageGifToSink(gdImagePtr im, gdSinkPtr out);
|
||||
|
||||
void gdImageGd(gdImagePtr im, FILE *out);
|
||||
void gdImageGd2(gdImagePtr im, FILE *out, int cs, int fmt);
|
||||
void gdImageGd (gdImagePtr im, FILE * out);
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- gd_png.c.orig Thu Apr 25 14:15:42 2002
|
||||
+++ gd_png.c Thu Apr 25 12:43:55 2002
|
||||
@@ -225,7 +225,7 @@
|
||||
im->alpha[i] = gdAlphaMax - (trans[i] >> 1);
|
||||
if ((trans[i] == 0) && (firstZero))
|
||||
{
|
||||
- im->transparent = i;
|
||||
+ transparent = i;
|
||||
firstZero = 0;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
--- gdcache.h.orig Thu Apr 25 14:16:05 2002
|
||||
+++ gdcache.h Thu Apr 25 12:48:41 2002
|
||||
@@ -40,7 +40,7 @@
|
||||
/* header */
|
||||
/*********************************************************/
|
||||
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif
|
@ -1,166 +1,92 @@
|
||||
--- gdft.c.orig Thu Apr 25 14:16:21 2002
|
||||
+++ gdft.c Thu Apr 25 12:43:55 2002
|
||||
@@ -513,7 +513,8 @@
|
||||
gdTrueColorGetRed (fg),
|
||||
gdTrueColorGetGreen (fg),
|
||||
gdTrueColorGetBlue (fg),
|
||||
- gdAlphaMax - (gdTrueColorGetAlpha (fg) * pixel / NUMCOLORS));
|
||||
+ gdAlphaMax - ((gdAlphaMax - gdTrueColorGetAlpha (fg)) * pixel / NUMCOLORS)
|
||||
+ );
|
||||
--- gdft.c Thu Jan 16 13:29:32 2003
|
||||
+++ gdft.c Mon Mar 24 17:09:54 2003
|
||||
@@ -546,8 +546,8 @@
|
||||
a->tweencolor = gdTrueColorAlpha (gdTrueColorGetRed (fg),
|
||||
gdTrueColorGetGreen (fg),
|
||||
gdTrueColorGetBlue (fg),
|
||||
- gdAlphaMax -
|
||||
- (gdTrueColorGetAlpha (fg) *
|
||||
+ gdAlphaMax - ((gdAlphaMax -
|
||||
+ gdTrueColorGetAlpha (fg)) *
|
||||
pixel / NUMCOLORS));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -566,76 +567,53 @@
|
||||
@@ -680,10 +680,14 @@
|
||||
if (y >= im->sy || y < 0)
|
||||
continue;
|
||||
|
||||
for (col = 0; col < bitmap.width; col++, pc++)
|
||||
{
|
||||
- for (col = 0; col < bitmap.width; col++, pc++)
|
||||
- {
|
||||
- if (bitmap.pixel_mode == ft_pixel_mode_grays)
|
||||
- {
|
||||
+ x = pen_x + col;
|
||||
+ for (col = 0; col < bitmap.width; col++, pc++) {
|
||||
+ x = pen_x + col;
|
||||
+ /* clip if out of bounds */
|
||||
+ if (x >= im->sx || x < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ /* clip if out of bounds */
|
||||
+ if (x >= im->sx || x < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ switch(bitmap.pixel_mode) {
|
||||
+ case ft_pixel_mode_grays:
|
||||
+ switch(bitmap.pixel_mode) {
|
||||
+ case ft_pixel_mode_grays:
|
||||
/*
|
||||
* Round to NUMCOLORS levels of antialiasing for
|
||||
* index color images since only 256 colors are
|
||||
* available.
|
||||
*/
|
||||
+
|
||||
@@ -692,44 +696,38 @@
|
||||
tc_key.pixel = ((bitmap.buffer[pc] * NUMCOLORS)
|
||||
+ bitmap.num_grays / 2)
|
||||
/ (bitmap.num_grays - 1);
|
||||
- }
|
||||
- else if (bitmap.pixel_mode == ft_pixel_mode_mono)
|
||||
- {
|
||||
+ break;
|
||||
+ case ft_pixel_mode_mono:
|
||||
tc_key.pixel = ((bitmap.buffer[pc / 8]
|
||||
<< (pc % 8)) & 128) ? NUMCOLORS : 0;
|
||||
- tc_key.pixel = ((bitmap.buffer[pc / 8]
|
||||
- << (pc % 8)) & 128) ? NUMCOLORS : 0;
|
||||
+ break;
|
||||
+ case ft_pixel_mode_mono:
|
||||
/* 2.0.5: mode_mono fix from Giuliano Pochini */
|
||||
tc_key.pixel =
|
||||
((bitmap.
|
||||
buffer[(col >> 3) +
|
||||
pcr]) & (1 << (~col & 0x07))) ? NUMCOLORS : 0;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ default:
|
||||
return "Unsupported ft_pixel_mode";
|
||||
}
|
||||
|
||||
if (tc_key.pixel > 0)
|
||||
- { /* if not background */
|
||||
- }
|
||||
+ }
|
||||
+
|
||||
if (tc_key.pixel > 0) /* if not background */
|
||||
{
|
||||
- x = pen_x + col;
|
||||
-
|
||||
- /* clip if out of bounds */
|
||||
- if (x >= im->sx || x < 0)
|
||||
- continue;
|
||||
- /* get pixel location in gd buffer */
|
||||
- if (im->trueColor)
|
||||
{
|
||||
- tpixel = &im->tpixels[y][x];
|
||||
+
|
||||
+ if (im->trueColor) {
|
||||
+ tc_elem = (tweencolor_t *) gdCacheGet (
|
||||
+ tc_cache, &tc_key);
|
||||
+
|
||||
+ gdImageSetPixel(im, x, y, tc_elem->tweencolor);
|
||||
}
|
||||
- else
|
||||
- pixel = &im->pixels[y][x];
|
||||
- if (tc_key.pixel == NUMCOLORS)
|
||||
- {
|
||||
+ else {
|
||||
pixel = &im->pixels[y][x];
|
||||
- }
|
||||
if (tc_key.pixel == NUMCOLORS)
|
||||
- {
|
||||
- /* use fg color directly */
|
||||
- if (im->trueColor)
|
||||
- {
|
||||
- *tpixel = fg;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
*pixel = fg;
|
||||
- }
|
||||
+ if (im->trueColor) {
|
||||
+ tc_elem = (tweencolor_t *)gdCacheGet(tc_cache, &tc_key);
|
||||
+ gdImageSetPixel(im, x, y, tc_elem->tweencolor);
|
||||
+ } else {
|
||||
+ /* get pixel location in gd buffer */
|
||||
+ pixel = &im->pixels[y][x];
|
||||
+ if (tc_key.pixel == NUMCOLORS)
|
||||
/* use fg color directly. gd 2.0.2: watch out for
|
||||
negative indexes (thanks to David Marwood). */
|
||||
*pixel = (fg < 0) ? -fg : fg;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* find antialised color */
|
||||
- if (im->trueColor)
|
||||
- {
|
||||
- tc_key.bgcolor = *tpixel;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
+ else {
|
||||
tc_key.bgcolor = *pixel;
|
||||
- }
|
||||
tc_elem = (tweencolor_t *) gdCacheGet (
|
||||
tc_cache, &tc_key);
|
||||
- if (im->trueColor)
|
||||
- {
|
||||
- *tpixel = tc_elem->tweencolor;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
*pixel = tc_elem->tweencolor;
|
||||
+
|
||||
}
|
||||
+
|
||||
+ else {
|
||||
/* find antialised color */
|
||||
|
||||
tc_key.bgcolor = *pixel;
|
||||
tc_elem = (tweencolor_t *) gdCacheGet (tc_cache, &tc_key);
|
||||
*pixel = tc_elem->tweencolor;
|
||||
}
|
||||
+ }
|
||||
}
|
||||
}
|
||||
@@ -647,11 +625,18 @@
|
||||
|
||||
/********************************************************************/
|
||||
/* gdImageStringFT - render a utf8 string onto a gd image */
|
||||
-
|
||||
char *
|
||||
gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
|
||||
double ptsize, double angle, int x, int y, char *string)
|
||||
{
|
||||
+ return gdImageStringFTEx(im, brect, fg, fontlist, ptsize, angle, x, y, string, NULL);
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
|
||||
+ double ptsize, double angle, int x, int y, char *string,
|
||||
+ gdFTStringExtra * strex)
|
||||
+{
|
||||
FT_BBox bbox, glyph_bbox;
|
||||
FT_Matrix matrix;
|
||||
FT_Vector pen, delta, penf;
|
||||
@@ -672,6 +657,9 @@
|
||||
int render = (im && (im->trueColor || (fg <= 255 && fg >= -255)));
|
||||
FT_BitmapGlyph bm;
|
||||
|
||||
+ /* fine tuning */
|
||||
+ double linespace = LINESPACE;
|
||||
+
|
||||
/***** initialize font library and font cache on first call ******/
|
||||
static gdCache_head_t *fontCache;
|
||||
static FT_Library library;
|
||||
@@ -704,6 +692,14 @@
|
||||
return "Could not set character size";
|
||||
}
|
||||
|
||||
+ /* pull in supplied extended settings */
|
||||
+ if (strex) {
|
||||
+ if (strex->flags & gdFTEX_LINESPACE == gdFTEX_LINESPACE)
|
||||
+ linespace = strex->linespacing;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+
|
||||
matrix.xx = (FT_Fixed) (cos_a * (1 << 16));
|
||||
matrix.yx = (FT_Fixed) (sin_a * (1 << 16));
|
||||
matrix.xy = -matrix.yx;
|
||||
@@ -754,7 +750,7 @@
|
||||
/* newlines */
|
||||
if (ch == '\n')
|
||||
{
|
||||
- penf.y -= face->size->metrics.height * LINESPACE;
|
||||
+ penf.y -= face->size->metrics.height * linespace;
|
||||
penf.y = (penf.y - 32) & -64; /* round to next pixel row */
|
||||
x1 = (penf.x * cos_a - penf.y * sin_a + 32) / 64;
|
||||
y1 = (penf.x * sin_a + penf.y * cos_a + 32) / 64;
|
||||
|
@ -2,7 +2,7 @@
|
||||
+++ gdtest.c Tue Nov 6 15:53:38 2001
|
||||
@@ -84,6 +84,35 @@
|
||||
gdImageDestroy (im2);
|
||||
ctx->free (ctx);
|
||||
ctx->gd_free (ctx);
|
||||
|
||||
+ /* */
|
||||
+ /* Send to GIF File then Ptr */
|
||||
@ -32,7 +32,7 @@
|
||||
+ CompareImages("GD->GIF ptr->GD", ref, im2);
|
||||
+
|
||||
+ gdImageDestroy(im2);
|
||||
+ ctx->free(ctx);
|
||||
+ ctx->gd_free(ctx);
|
||||
|
||||
/* */
|
||||
/* Send to GD2 File then Ptr */
|
||||
|
@ -1,99 +0,0 @@
|
||||
--- gdtestft.c.orig Thu Apr 25 14:17:03 2002
|
||||
+++ gdtestft.c Wed Nov 7 00:43:02 2001
|
||||
@@ -18,6 +18,8 @@
|
||||
#define MAXY(x) MAX4(x[1],x[3],x[5],x[7])
|
||||
#define MINY(x) MIN4(x[1],x[3],x[5],x[7])
|
||||
|
||||
+void CompareImages(char *msg, gdImagePtr im1, gdImagePtr im2);
|
||||
+
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -28,13 +30,13 @@
|
||||
fprintf (stderr, "make clean, and type make again.\n");
|
||||
return 1;
|
||||
#else
|
||||
- gdImagePtr im;
|
||||
+ gdImagePtr im, ref;
|
||||
int black;
|
||||
int white;
|
||||
int brect[8];
|
||||
int x, y;
|
||||
char *err;
|
||||
- FILE *out;
|
||||
+ FILE *out, *in;
|
||||
#ifdef JISX0208
|
||||
char *s = "Hello. ‚±‚ñ‚É‚¿‚Í Qyjpqg,"; /* String to draw. */
|
||||
#else
|
||||
@@ -67,8 +69,8 @@
|
||||
/* create an image just big enough for the string */
|
||||
x = MAXX (brect) - MINX (brect) + 6;
|
||||
y = MAXY (brect) - MINY (brect) + 6;
|
||||
-#if 0
|
||||
- im = gdImageCreate (500, 500);
|
||||
+#if 0
|
||||
+ im = gdImageCreate (x, y);
|
||||
#else
|
||||
/* gd 2.0: true color images can use freetype too */
|
||||
im = gdImageCreateTrueColor (x, y);
|
||||
@@ -90,6 +92,16 @@
|
||||
fprintf (stderr, err);
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+ in = fopen("test/fttestref.png", "rb");
|
||||
+ if (!in) {
|
||||
+ fprintf(stderr, "Input file does not exist!\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ ref = gdImageCreateFromPng(in);
|
||||
+
|
||||
+ fclose(in);
|
||||
+
|
||||
/* TBB: Write img to test/fttest.png */
|
||||
out = fopen ("test/fttest.png", "wb");
|
||||
if (!out)
|
||||
@@ -100,9 +112,43 @@
|
||||
gdImagePng (im, out);
|
||||
fclose (out);
|
||||
fprintf (stderr, "Test image written to test/fttest.png\n");
|
||||
+
|
||||
+ CompareImages("FTTest Image", ref, im);
|
||||
+
|
||||
/* Destroy it */
|
||||
gdImageDestroy (im);
|
||||
+ gdImageDestroy(ref);
|
||||
|
||||
return 0;
|
||||
#endif /* HAVE_FREETYPE */
|
||||
}
|
||||
+
|
||||
+void CompareImages(char *msg, gdImagePtr im1, gdImagePtr im2)
|
||||
+{
|
||||
+ int cmpRes;
|
||||
+
|
||||
+ cmpRes = gdImageCompare(im1, im2);
|
||||
+
|
||||
+ if (cmpRes & GD_CMP_IMAGE) {
|
||||
+ printf("%%%s: ERROR images differ: BAD\n",msg);
|
||||
+ } else if (cmpRes != 0) {
|
||||
+ printf("%%%s: WARNING images differ: WARNING - Probably OK\n",msg);
|
||||
+ } else {
|
||||
+ printf("%%%s: OK\n",msg);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (cmpRes & (GD_CMP_SIZE_X + GD_CMP_SIZE_Y)) {
|
||||
+ printf("-%s: INFO image sizes differ\n",msg);
|
||||
+ }
|
||||
+
|
||||
+ if (cmpRes & GD_CMP_NUM_COLORS) {
|
||||
+ printf("-%s: INFO number of pallette entries differ %d Vs. %d\n",msg,
|
||||
+ im1->colorsTotal, im2->colorsTotal);
|
||||
+ }
|
||||
+
|
||||
+ if (cmpRes & GD_CMP_COLOR) {
|
||||
+ printf("-%s: INFO actual colours of pixels differ\n",msg);
|
||||
+ }
|
||||
+}
|
||||
+
|
@ -1,23 +1,20 @@
|
||||
--- index.html.orig Thu Apr 25 14:17:36 2002
|
||||
+++ index.html Tue Nov 6 23:31:10 2001
|
||||
@@ -24,7 +24,12 @@
|
||||
more compatible with the major Web browsers than even PNG is. WBMP is
|
||||
intended for wireless devices (not regular web browsers). Existing
|
||||
code will need modification to call gdImagePng or gdImageJpeg instead
|
||||
-of gdImageGif. <strong>Please do not ask us to send you the old GIF
|
||||
+of gdImageGif.
|
||||
+<p>
|
||||
+Note: The version at this site also supports GIF format, for those people
|
||||
+who have not yet managed to move away from GIFs.
|
||||
--- index.html Mon Nov 25 11:39:31 2002
|
||||
+++ index.html Wed Nov 27 12:47:38 2002
|
||||
@@ -35,4 +35,9 @@
|
||||
modern image formats such as PNG and JPEG as soon as possible.
|
||||
|
||||
+<p>Note, that the FreeBSD port of gd2 includes support for GIF files
|
||||
+ported from the earlier releases of gd. If the WITH_LZW was defined at
|
||||
+build time, the software will also use LZW-compression when creating
|
||||
+GIF files.
|
||||
+
|
||||
<p>
|
||||
gd 2.0.8 <strong>requires</strong> that the following libraries
|
||||
@@ -116,4 +121,18 @@
|
||||
Portions relating to WBMP copyright 2000, 2001, 2002 Maurice Szmurlo and Johan Van
|
||||
den Brande.
|
||||
+
|
||||
+<p>
|
||||
+<strong>Please do not ask the original author to send you the old GIF
|
||||
version of GD.</strong> Unisys holds a patent on the LZW compression
|
||||
algorithm, which is used in fully compressed GIF images. The best
|
||||
solution is to move to legally unencumbered, well-compressed,
|
||||
@@ -103,6 +108,18 @@
|
||||
<p>
|
||||
Portions relating to libttf copyright 1999, 2000 John Ellson (ellson@lucent.com).
|
||||
<p>
|
||||
+GIF decompression code copyright 1990, 1991, 1993, by David Koblas
|
||||
+(koblas@netcom.com).
|
||||
+<p>
|
||||
@ -29,63 +26,34 @@
|
||||
+Obtaining a license for the Unisys LZW compression patent is
|
||||
+entirely between the user and Unisys. The authors of gd can provide
|
||||
+NO assistance in this matter.
|
||||
+<p>
|
||||
Portions relating to JPEG and to color quantization copyright 2000, Doug
|
||||
Becker and copyright (C) 1994-1998, Thomas G. Lane. This software is based
|
||||
in part on the work of the Independent JPEG Group. See the file
|
||||
@@ -193,6 +210,26 @@
|
||||
<li><a href="http://s27w007.pswfs.gov/tgd/">tgd</a>, by Bradley K. Sherman
|
||||
<li><a href="http://www.unimelb.edu.au/fly/fly.html">fly</a>, by Martin Gleeson
|
||||
+
|
||||
<p>
|
||||
<strong>Permission has been granted to copy, distribute and modify gd in any
|
||||
@@ -192,5 +211,22 @@
|
||||
<li><a href="http://martin.gleeson.com/fly/">fly</a>, by Martin Gleeson
|
||||
</ul>
|
||||
-<P>
|
||||
+
|
||||
+<P><A NAME="gifpatch"><H3>What's new in the patched version?</H3></A>
|
||||
+<P><A NAME="gifpatch"><H3>What does the FreeBSD port add?</H3></A>
|
||||
+
|
||||
+This version reinstates GIF support. Specifically, the following functions are added:
|
||||
+<ul>
|
||||
+<li><a href=#gdImageOpenPolygon>gdImageOpenPolygon</a>. This is basically the same as
|
||||
+gdImagePolygon, but it does not join the start and end points. It is required by GD.pm.
|
||||
+<li><a href=#gdImageGif>gdImageGif</a>
|
||||
+<li><a href=#gdImageGifPtr>gdImageGifPtr</a>
|
||||
+<li><a href=#gdImageGifCtx>gdImageGifCtx</a>
|
||||
+<li><a href=#gdImageGifToSink>gdImageGifToSink</a>
|
||||
+<li><a href=#gdImageCreateFromGif>gdImageCreateFromGif</a>
|
||||
+<li><a href=#gdImageCreateFromGifCtx>gdImageCreateFromGifCtx</a>
|
||||
+<li>Other functions added, but not documented, are: gdImageLzw, gdImageLzwPtr,
|
||||
+gdImageLzwCtx, gdImageBigGif, gdImageBigGifPtr, gdImageBigGifCtx.
|
||||
+</ul>
|
||||
+<p>
|
||||
+Note: While every effort has been made to ensure that the _WinNT_ build works, it has not
|
||||
+been tested.
|
||||
+<p>This version reinstates GIF support. Specifically, the following
|
||||
+functions are added: gdImageGif, gdImageGifPtr, gdImageGifCtx,
|
||||
+gdImageGifToSink, gdImageCreateFromGif, gdImageCreateFromGifCtx,
|
||||
+gdImageCreateFromGifSource.
|
||||
+The can be used just like the corresponding functions for the other
|
||||
+image formats.
|
||||
+
|
||||
<P><A NAME="whatsnew2.0.1"><H3>What's new in version 2.0.1?</H3></A>
|
||||
<ul>
|
||||
<li>Workaround for a bug in gcc, apparently found in gcc 2.7.2 and up.
|
||||
@@ -311,6 +348,7 @@
|
||||
preprocessing them, this should not be a big problem. gd 2.0 should
|
||||
read old .gd and .gd2 files correctly.
|
||||
</ul>
|
||||
+<p>Other functions added, but not documented, are: gdImageLzw,
|
||||
+gdImageLzwPtr, gdImageLzwCtx, gdImageBigGif, gdImageBigGifPtr,
|
||||
+gdImageBigGifCtx.
|
||||
+
|
||||
<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)
|
||||
@@ -343,6 +381,7 @@
|
||||
corrected
|
||||
<li>Updated links to fast-moving, always dodging libpng and zlib web sites
|
||||
</ul>
|
||||
+<p>The <a href=#gdImageOpenPolygon>gdImageOpenPolygon</a> is added.
|
||||
+This is basically the same as <a href=#gdImagePolygon>gdImagePolygon</A>,
|
||||
+but it does not join the start and end points. It is required by GD.pm.
|
||||
+
|
||||
<P><A NAME="whatsnew1.8.1"><H3>What's new in version 1.8.1?</H3></A>
|
||||
<ul>
|
||||
<li>Optional components no longer built by default (following the
|
||||
@@ -420,6 +459,7 @@
|
||||
<a href="#gdImageCreateFromXpm"><code>gdImageCreateFromXpm</code></a>
|
||||
function, if the Xpm library is available. Thanks to Caolan McNamara.
|
||||
</ul>
|
||||
+
|
||||
<P><A NAME="whatsnew1.6.3"><H3>What's new in version 1.6.3?</H3></A>
|
||||
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
|
||||
@@ -911,7 +951,8 @@
|
||||
<DT><A NAME="gdPoint">gdPoint</A> <strong>(TYPE)</strong>
|
||||
<A NAME="whatsnew2.0.8"><H3>What's new in version 2.0.8?</H3></A>
|
||||
<P>
|
||||
@@ -1058,5 +1094,6 @@
|
||||
<DD>
|
||||
Represents a point in the coordinate space of the image; used
|
||||
-by <A HREF="#gdImagePolygon">gdImagePolygon</A> and
|
||||
@ -93,228 +61,11 @@
|
||||
+<A HREF="#gdImageOpenPolygon">gdImageOpenPolygon</A>, and
|
||||
<A HREF="#gdImageFilledPolygon">gdImageFilledPolygon</A>.
|
||||
<PRE>
|
||||
typedef struct {
|
||||
@@ -921,7 +962,8 @@
|
||||
<DT><A NAME="gdPointPtr">gdPointPtr</A> <strong>(TYPE)</strong>
|
||||
@@ -1068,5 +1105,6 @@
|
||||
<DD>
|
||||
A pointer to a <A HREF="#gdPoint">gdPoint</A> structure; passed
|
||||
-as an argument to <A HREF="#gdImagePolygon">gdImagePolygon</A>
|
||||
+as an argument to <A HREF="#gdImagePolygon">gdImagePolygon</A>,
|
||||
+<A HREF="#gdImageOpenPolygon">gdImageOpenPolygon</A>,
|
||||
+<A HREF="#gdImageOpenPolygon">gdImageOpenPolygon</A>,
|
||||
and <A HREF="#gdImageFilledPolygon">gdImageFilledPolygon</A>.
|
||||
</DL>
|
||||
<DT><A NAME="gdSource">gdSource</A> <strong>(TYPE)</strong>
|
||||
@@ -1024,6 +1066,75 @@
|
||||
/* ... Use the image ... */
|
||||
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
|
||||
</PRE>
|
||||
+
|
||||
+<DT><A NAME="gdImageCreateFromGif">gdImageCreateFromGif(FILE *in)</A>
|
||||
+<strong>(FUNCTION)</strong>
|
||||
+<BR><A NAME="gdImageCreateFromGifCtx">gdImageCreateFromGifCtx(<a href=#gdioctx>gdIOCtx</a> *in)</A>
|
||||
+<strong>(FUNCTION)</strong>
|
||||
+<p>
|
||||
+<DD>
|
||||
+gdImageCreateFromGif is called to load images from GIF format files.
|
||||
+Invoke gdImageCreateFromGif with an already opened pointer to a file
|
||||
+containing the desired image.
|
||||
+gdImageCreateFromGif
|
||||
+returns a <A HREF="#gdImagePtr">gdImagePtr</A> to the new image, or NULL
|
||||
+if unable to load the image (most often because the file is corrupt or
|
||||
+does not contain a GIF image). gdImageCreateFromGif does <em>not</em>
|
||||
+close the file. You can inspect the sx and sy members of the
|
||||
+image to determine its size. The image must eventually be destroyed
|
||||
+using <A HREF="#gdImageDestroy">gdImageDestroy()</A>.
|
||||
+<PRE>
|
||||
+<A HREF="#gdImagePtr">gdImagePtr</A> im;
|
||||
+... inside a function ...
|
||||
+FILE *in;
|
||||
+in = fopen("mygif.gif", "rb");
|
||||
+im = gdImageCreateFromGif(in);
|
||||
+fclose(in);
|
||||
+/* ... Use the image ... */
|
||||
+<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
|
||||
+</PRE>
|
||||
+<DT><A NAME="gdImageCreateFromGifSource">gdImageCreateFromGifSource(gdSourcePtr in)</A>
|
||||
+<strong>(FUNCTION)</strong>
|
||||
+<dd>
|
||||
+gdImageCreateFromGifSource is called to load a GIF from
|
||||
+a data source other than a file. Usage is very similar to
|
||||
+the <a href="#gdImageCreateFromGif">gdImageCreateFromGif</a> function,
|
||||
+except that the programmer provides a custom data source.
|
||||
+<p>
|
||||
+The programmer must write an input function which accepts
|
||||
+a context pointer, a buffer, and a number of bytes to be
|
||||
+read as arguments. This function must read the number of
|
||||
+bytes requested, unless the end of the file has been reached,
|
||||
+in which case the function should return zero, or an error
|
||||
+has occurred, in which case the function should return
|
||||
+<code>-1</code>. The programmer then creates a
|
||||
+<a href="#gdSource">gdSource</a> structure and sets
|
||||
+the <code>source</code> pointer to the input function and
|
||||
+the context pointer to any value which is useful to the
|
||||
+programmer.
|
||||
+<p>
|
||||
+The example below
|
||||
+implements <a href="#gdImageCreateFromGif">gdImageCreateFromGif</a>
|
||||
+by creating a custom data source and invoking gdImageCreateFromGifSource.
|
||||
+<pre>
|
||||
+static int freadWrapper(void *context, char *buf, int len);
|
||||
+
|
||||
+gdImagePtr gdImageCreateFromGif(FILE *in)
|
||||
+{
|
||||
+ gdSource s;
|
||||
+ s.source = freadWrapper;
|
||||
+ s.context = in;
|
||||
+ return gdImageCreateFromGifSource(&s);
|
||||
+}
|
||||
+
|
||||
+static int freadWrapper(void *context, char *buf, int len)
|
||||
+{
|
||||
+ int got = fread(buf, 1, len, (FILE *) context);
|
||||
+ return got;
|
||||
+}
|
||||
+</pre>
|
||||
+
|
||||
+
|
||||
<DT><A NAME="gdImageCreateFromPng">gdImageCreateFromPng(FILE *in)</A>
|
||||
<strong>(FUNCTION)</strong>
|
||||
<BR><A NAME="gdImageCreateFromPngCtx">gdImageCreateFromPngCtx(<a href=#gdioctx>gdIOCtx</a> *in)</A>
|
||||
@@ -1239,6 +1350,92 @@
|
||||
/* Now destroy it */
|
||||
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
|
||||
</PRE>
|
||||
+
|
||||
+<DT><A NAME="gdImageGif">
|
||||
+void gdImageGif(gdImagePtr im, FILE *out)</A>
|
||||
+<STRONG>(FUNCTION)</STRONG>
|
||||
+<DD>
|
||||
+gdImageGif outputs the specified image to the specified
|
||||
+file in GIF format. The file must be open for writing. Under MSDOS
|
||||
+and all versions of Windows, it is important to use "wb" as opposed
|
||||
+to simply "w" as the mode when opening the file, and under Unix there
|
||||
+is no penalty for doing so. gdImageGif does <em>not</em>
|
||||
+close the file; your code must do so.
|
||||
+<PRE>
|
||||
+... inside a function ...
|
||||
+<A HREF="#gdImagePtr">gdImagePtr</A> im;
|
||||
+int black, white;
|
||||
+FILE *out;
|
||||
+/* Create the image */
|
||||
+im = <A HREF="#gdImageCreate">gdImageCreate</A>(100, 100);
|
||||
+/* Allocate background */
|
||||
+white = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 255, 255, 255);
|
||||
+/* Allocate drawing color */
|
||||
+black = <A HREF="#gdImageColorAllocate">gdImageColorAllocate</A>(im, 0, 0, 0);
|
||||
+/* Draw rectangle */
|
||||
+<A HREF="#gdImageRectangle">gdImageRectangle</A>(im, 0, 0, 99, 99, black);
|
||||
+/* Open output file in binary mode */
|
||||
+out = fopen("rect.gif", "wb");
|
||||
+/* Write GIF */
|
||||
+gdImageGif(im, out);
|
||||
+/* Close file */
|
||||
+fclose(out);
|
||||
+/* Destroy image */
|
||||
+<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
|
||||
+</PRE>
|
||||
+
|
||||
+<DT><A NAME="gdImageGifCtx">
|
||||
+void* gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)</A>
|
||||
+<STRONG>(FUNCTION)</STRONG>
|
||||
+<DD>Identical to gdImageGif except that it writes the GIF to a
|
||||
+<a href=#gdIOCtx>gdIOCtx</a>.
|
||||
+<p>
|
||||
+<DT><A NAME="gdImageGifPtr">
|
||||
+void* gdImageGifPtr(gdImagePtr im, int *size)</A>
|
||||
+<STRONG>(FUNCTION)</STRONG>
|
||||
+<DD>Identical to gdImageGif except that it returns a pointer to a memory
|
||||
+area with the GIF data. This memory must be freed by the caller when it is
|
||||
+no longer needed. The 'size' parameter received the total size of the block
|
||||
+of memory.
|
||||
+<p>
|
||||
+
|
||||
+<DT><A NAME="gdImageGifToSink">gdImageGifToSink(gdImagePtr im, gdSinkPtr out)</A>
|
||||
+<strong>(FUNCTION)</strong>
|
||||
+<dd>
|
||||
+gdImageGifToSink is called to write a GIF to
|
||||
+a data "sink" (destination) other than a file. Usage is very similar to
|
||||
+the <a href="#gdImageGif">gdImageGif</a> function,
|
||||
+except that the programmer provides a custom data sink.
|
||||
+<p>
|
||||
+The programmer must write an output function which accepts
|
||||
+a context pointer, a buffer, and a number of bytes to be
|
||||
+written as arguments. This function must write the number of
|
||||
+bytes requested and return that number, unless an error
|
||||
+has occurred, in which case the function should return
|
||||
+<code>-1</code>. The programmer then creates a
|
||||
+<a href="#gdSink">gdSink</a> structure and sets
|
||||
+the <code>sink</code> pointer to the output function and
|
||||
+the context pointer to any value which is useful to the
|
||||
+programmer.
|
||||
+<p>
|
||||
+The example below
|
||||
+implements <a href="#gdImageGif">gdImageGif</a>
|
||||
+by creating a custom data source and invoking gdImageGifFromSink.
|
||||
+<pre>
|
||||
+static int stdioSink(void *context, char *buffer, int len)
|
||||
+{
|
||||
+ return fwrite(buffer, 1, len, (FILE *) context);
|
||||
+}
|
||||
+
|
||||
+void gdImageGif(gdImagePtr im, FILE *out)
|
||||
+{
|
||||
+ gdSink mySink;
|
||||
+ mySink.context = (void *) out;
|
||||
+ mySink.sink = stdioSink;
|
||||
+ gdImageGifToSink(im, &mySink);
|
||||
+}
|
||||
+</pre>
|
||||
+
|
||||
<DT><A NAME="gdImageJpeg">
|
||||
void gdImageJpeg(gdImagePtr im, FILE *out, int quality)</A>
|
||||
<STRONG>(FUNCTION)</STRONG><BR>
|
||||
@@ -1642,6 +1839,15 @@
|
||||
/* Destroy it */
|
||||
<A HREF="#gdImageDestroy">gdImageDestroy</A>(im);
|
||||
</PRE>
|
||||
+
|
||||
+<DT><A NAME="gdImageOpenPolygon">void gdImageOpenPolygon(gdImagePtr im, gdPointPtr points, int pointsTotal, int color)</A>
|
||||
+<STRONG>(FUNCTION)</STRONG>
|
||||
+<DD>
|
||||
+gdImageOpenPolygon is used to draw an open polygon (ie. series of line segments). It is almost identical
|
||||
+to <A HREF="#gdImagePolygon">gdImagePolygon</A>, except that it does not join the last point to the
|
||||
+first point.
|
||||
+<P>
|
||||
+
|
||||
<DT><A NAME="gdImageRectangle">void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color)</A>
|
||||
<STRONG>(FUNCTION)</STRONG>
|
||||
<DD>
|
||||
@@ -3552,6 +3758,9 @@
|
||||
<A HREF="#gdImageCreateFromGd">gdImageCreateFromGd</A> |
|
||||
<A HREF="#gdImageCreateFromGd2">gdImageCreateFromGd2</A> |
|
||||
<A HREF="#gdImageCreateFromGd2Part">gdImageCreateFromGd2Part</A> |
|
||||
+<A HREF="#gdImageCreateFromGif">gdImageCreateFromGif</A> |
|
||||
+<A HREF="#gdImageCreateFromGifCtx">gdImageCreateFromGifCtx</A> |
|
||||
+<A HREF="#gdImageCreateFromGifSource">gdImageCreateFromGifSource</A> |
|
||||
<A HREF="#gdImageCreateFromJpeg">gdImageCreateFromJpeg</A> |
|
||||
<A HREF="#gdImageCreateFromPng">gdImageCreateFromPng</A> |
|
||||
<A HREF="#gdImageCreateFromPngSource">gdImageCreateFromPngSource</A> |
|
||||
@@ -3569,6 +3778,10 @@
|
||||
<A HREF="#gdImageGetInterlaced">gdImageGetInterlaced</A> |
|
||||
<A HREF="#gdImageGetPixel">gdImageGetPixel</A> |
|
||||
<A HREF="#gdImageGetTransparent">gdImageGetTransparent</A> |
|
||||
+<A HREF="#gdImageGif">gdImageGif</A> |
|
||||
+<A HREF="#gdImageGifCtx">gdImageGifCtx</A> |
|
||||
+<A HREF="#gdImageGifPtr">gdImageGifPtr</A> |
|
||||
+<A HREF="#gdImageGifToSink">gdImageGifToSink</A> |
|
||||
<A HREF="#gdImageGreen">gdImageGreen</A> |
|
||||
<A HREF="#gdImageInterlace">gdImageInterlace</A> |
|
||||
<A HREF="#gdImageJpeg">gdImageJpeg</A> |
|
||||
@@ -3578,6 +3791,7 @@
|
||||
<A HREF="#gdImagePng">gdImagePng</A> |
|
||||
<A HREF="#gdImagePngToSink">gdImagePngToSink</A> |
|
||||
<A HREF="#gdImagePolygon">gdImagePolygon</A> |
|
||||
+<A HREF="#gdImageOpenPolygon">gdImageOpenPolygon</A> |
|
||||
<A HREF="#gdImagePtr">gdImagePtr</A> |
|
||||
<A HREF="#gdImageWBMP">gdImageWBMP</A> |
|
||||
<A HREF="#gdImageRectangle">gdImageRectangle</A> |
|
||||
|
@ -1,66 +0,0 @@
|
||||
--- webpng.c.orig Thu Apr 25 14:19:03 2002
|
||||
+++ webpng.c Thu Apr 25 12:43:55 2002
|
||||
@@ -168,12 +168,12 @@
|
||||
t = gdImageGetTransparent (im);
|
||||
if (t != (-1))
|
||||
{
|
||||
- printf ("First 100% transparent index: %d\n", t);
|
||||
+ printf ("First 100%% transparent index: %d\n", t);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* -1 means the image is not transparent. */
|
||||
- printf ("First 100% transparent index: none\n");
|
||||
+ printf ("First 100%% transparent index: none\n");
|
||||
}
|
||||
if (gdImageGetInterlaced (im))
|
||||
{
|
||||
@@ -185,6 +185,40 @@
|
||||
}
|
||||
no = 0;
|
||||
}
|
||||
+ else if (!strcmp(argv[i], "-a"))
|
||||
+ {
|
||||
+ int maxx, maxy, x, y, alpha, pix, nalpha = 0;
|
||||
+
|
||||
+ maxx = gdImageSX(im);
|
||||
+ maxy = gdImageSY(im);
|
||||
+
|
||||
+ printf("alpha channel information:\n");
|
||||
+
|
||||
+ if (im->trueColor) {
|
||||
+ for (y = 0; y < maxy; y++) {
|
||||
+ for (x = 0; x < maxx; x++) {
|
||||
+ pix = gdImageGetPixel(im, x, y);
|
||||
+ alpha = gdTrueColorGetAlpha(pix);
|
||||
+
|
||||
+ if (alpha > gdAlphaOpaque) {
|
||||
+ /* Use access macros to learn colors. */
|
||||
+ printf ("%d %d %d %d\n",
|
||||
+ gdTrueColorGetRed(pix),
|
||||
+ gdTrueColorGetGreen(pix),
|
||||
+ gdTrueColorGetBlue(pix),
|
||||
+ alpha);
|
||||
+ nalpha++;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ printf("NOT a true color image\n");
|
||||
+ no = 0;
|
||||
+ printf("%d alpha channels\n", nalpha);
|
||||
+
|
||||
+ }
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Unknown argument: %s\n", argv[i]);
|
||||
@@ -202,6 +236,7 @@
|
||||
" -l Prints the table of color indexes\n"
|
||||
" -t [index] Set the transparent color to the specified index (0-255 or \"none\")\n"
|
||||
" -d Reports the dimensions and other characteristics of the image.\n"
|
||||
+ " -a Prints all alpha channels that are not 100%% opaque.\n"
|
||||
"\n"
|
||||
"If you specify '-' as the input file, stdin/stdout will be used input/output.\n"
|
||||
);
|
@ -1,3 +1,4 @@
|
||||
bin/annotate
|
||||
bin/bdftogd
|
||||
bin/gd2copypal
|
||||
bin/gd2togif
|
||||
|
Loading…
Reference in New Issue
Block a user