#ifndef GD_H #define GD_H 1 /* gd.h: declarations file for the graphic-draw module. * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. This software is provided "AS IS." Thomas Boutell and * Boutell.Com, Inc. disclaim all warranties, either express or implied, * including but not limited to implied warranties of merchantability and * fitness for a particular purpose, with respect to this code and accompanying * documentation. */ /* stdio is needed for file I/O. */ #include #include "gd_io.h" /* This can't be changed in the current palette-only version of gd. */ #define gdMaxColors 256 /* Image type. See functions below; you will not need to change the elements directly. Use the provided macros to access sx, sy, the color table, and colorsTotal for read-only purposes. */ typedef struct gdImageStruct { unsigned char ** pixels; int sx; int sy; int colorsTotal; int red[gdMaxColors]; int green[gdMaxColors]; int blue[gdMaxColors]; int open[gdMaxColors]; int transparent; int *polyInts; int polyAllocated; struct gdImageStruct *brush; struct gdImageStruct *tile; int brushColorMap[gdMaxColors]; int tileColorMap[gdMaxColors]; int styleLength; int stylePos; int *style; int interlace; } gdImage; typedef gdImage * gdImagePtr; void gdImageSetPixel(gdImagePtr im, int x, int y, int color); int gdImageGetPixel(gdImagePtr im, int x, int y); void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color); void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color); int gdImageBoundsSafe(gdImagePtr im, int x, int y); gdImagePtr gdImageCreate(int sx, int sy); int gdImageColorAllocate(gdImagePtr im, int r, int g, int b); void gdImageColorTransparent(gdImagePtr im, int color); void gdImagePng(gdImagePtr im, FILE *out); void gdImagePngCtx(gdImagePtr im, gdIOCtx *out); void gdImageGif(gdImagePtr im, FILE *out); void* gdImagePngPtr(gdImagePtr im, int *size); void* gdImageGifPtr(gdImagePtr im, int *size); /* Macros to access information about images. READ ONLY. Changing these values will NOT have the desired result. */ #define gdImageSX(im) ((im)->sx) #define gdImageSY(im) ((im)->sy) #define gdImageColorsTotal(im) ((im)->colorsTotal) #define gdImageRed(im, c) ((im)->red[(c)]) #define gdImageGreen(im, c) ((im)->green[(c)]) #define gdImageBlue(im, c) ((im)->blue[(c)]) #define gdImageGetTransparent(im) ((im)->transparent) #define gdImageGetInterlaced(im) ((im)->interlace) /* I/O Support routines. */ gdIOCtx* gdNewFileCtx(FILE*); gdIOCtx* gdNewDynamicCtx(int, void*); void* gdDPExtractData(struct gdIOCtx* ctx, int *size); #endif