--- 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. Please do not ask us to send you the old GIF +of gdImageGif. +

+Note: The version at this site also supports GIF format, for those people +who have not yet managed to move away from GIFs. +

+Please do not ask the original author to send you the old GIF version of GD. 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 @@

Portions relating to libttf copyright 1999, 2000 John Ellson (ellson@lucent.com).

+GIF decompression code copyright 1990, 1991, 1993, by David Koblas +(koblas@netcom.com). +

+Non-LZW-based GIF compression code copyright 1998, by Hutchison Avenue +Software Corporation (http://www.hasc.com/, +info@hasc.com). +

+LZW-based GIF compression code David Rowley. +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. +

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 @@

  • tgd, by Bradley K. Sherman
  • fly, by Martin Gleeson + +

    What's new in the patched version?

    + +This version reinstates GIF support. Specifically, the following functions are added: + +

    +Note: While every effort has been made to ensure that the _WinNT_ build works, it has not +been tested. +

    What's new in version 2.0.1?

    +

    What's new in version 1.8.4?

    +

    What's new in version 1.8.1?

    +

    What's new in version 1.6.3?

    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 @@
    gdPoint (TYPE)
    Represents a point in the coordinate space of the image; used -by gdImagePolygon and +by gdImagePolygon, +gdImageOpenPolygon, and gdImageFilledPolygon.
     typedef struct {
    @@ -921,7 +962,8 @@
     
    gdPointPtr (TYPE)
    A pointer to a gdPoint structure; passed -as an argument to gdImagePolygon +as an argument to gdImagePolygon, +gdImageOpenPolygon, and gdImageFilledPolygon.
    gdSource (TYPE) @@ -1024,6 +1066,75 @@ /* ... Use the image ... */ gdImageDestroy(im);
    + +
    gdImageCreateFromGif(FILE *in) +(FUNCTION) +
    gdImageCreateFromGifCtx(gdIOCtx *in) +(FUNCTION) +

    +

    +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 gdImagePtr 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 not +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 gdImageDestroy(). +
    +gdImagePtr im;
    +... inside a function ...
    +FILE *in;
    +in = fopen("mygif.gif", "rb");
    +im = gdImageCreateFromGif(in);
    +fclose(in);
    +/* ... Use the image ... */
    +gdImageDestroy(im);
    +
    +
    gdImageCreateFromGifSource(gdSourcePtr in) +(FUNCTION) +
    +gdImageCreateFromGifSource is called to load a GIF from +a data source other than a file. Usage is very similar to +the gdImageCreateFromGif function, +except that the programmer provides a custom data source. +

    +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 +-1. The programmer then creates a +gdSource structure and sets +the source pointer to the input function and +the context pointer to any value which is useful to the +programmer. +

    +The example below +implements gdImageCreateFromGif +by creating a custom data source and invoking gdImageCreateFromGifSource. +

    +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;
    +}
    +
    + +
    gdImageCreateFromPng(FILE *in) (FUNCTION)
    gdImageCreateFromPngCtx(gdIOCtx *in) @@ -1239,6 +1350,92 @@ /* Now destroy it */ gdImageDestroy(im); + +
    +void gdImageGif(gdImagePtr im, FILE *out) +(FUNCTION) +
    +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 not +close the file; your code must do so. +
    +... inside a function ...
    +gdImagePtr im;
    +int black, white;
    +FILE *out;
    +/* Create the image */
    +im = gdImageCreate(100, 100);
    +/* Allocate background */
    +white = gdImageColorAllocate(im, 255, 255, 255);
    +/* Allocate drawing color */
    +black = gdImageColorAllocate(im, 0, 0, 0);
    +/* Draw rectangle */
    +gdImageRectangle(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 */
    +gdImageDestroy(im);
    +
    + +
    +void* gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) +(FUNCTION) +
    Identical to gdImageGif except that it writes the GIF to a +gdIOCtx. +

    +

    +void* gdImageGifPtr(gdImagePtr im, int *size) +(FUNCTION) +
    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. +

    + +

    gdImageGifToSink(gdImagePtr im, gdSinkPtr out) +(FUNCTION) +
    +gdImageGifToSink is called to write a GIF to +a data "sink" (destination) other than a file. Usage is very similar to +the gdImageGif function, +except that the programmer provides a custom data sink. +

    +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 +-1. The programmer then creates a +gdSink structure and sets +the sink pointer to the output function and +the context pointer to any value which is useful to the +programmer. +

    +The example below +implements gdImageGif +by creating a custom data source and invoking gdImageGifFromSink. +

    +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);
    +}
    +
    +
    void gdImageJpeg(gdImagePtr im, FILE *out, int quality) (FUNCTION)
    @@ -1642,6 +1839,15 @@ /* Destroy it */ gdImageDestroy(im); + +
    void gdImageOpenPolygon(gdImagePtr im, gdPointPtr points, int pointsTotal, int color) +(FUNCTION) +
    +gdImageOpenPolygon is used to draw an open polygon (ie. series of line segments). It is almost identical +to gdImagePolygon, except that it does not join the last point to the +first point. +

    +

    void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color) (FUNCTION)
    @@ -3552,6 +3758,9 @@ gdImageCreateFromGd | gdImageCreateFromGd2 | gdImageCreateFromGd2Part | +gdImageCreateFromGif | +gdImageCreateFromGifCtx | +gdImageCreateFromGifSource | gdImageCreateFromJpeg | gdImageCreateFromPng | gdImageCreateFromPngSource | @@ -3569,6 +3778,10 @@ gdImageGetInterlaced | gdImageGetPixel | gdImageGetTransparent | +gdImageGif | +gdImageGifCtx | +gdImageGifPtr | +gdImageGifToSink | gdImageGreen | gdImageInterlace | gdImageJpeg | @@ -3578,6 +3791,7 @@ gdImagePng | gdImagePngToSink | gdImagePolygon | +gdImageOpenPolygon | gdImagePtr | gdImageWBMP | gdImageRectangle |