00001 #ifndef GD_H
00002 #define GD_H 1
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <stdio.h>
00016
00017
00018
00019 #define gdMaxColors 256
00020
00021
00022
00023
00024
00025
00026 typedef struct gdImageStruct {
00027 unsigned char **pixels;
00028 int sx;
00029 int sy;
00030 int colorsTotal;
00031 int red[gdMaxColors];
00032 int green[gdMaxColors];
00033 int blue[gdMaxColors];
00034 int open[gdMaxColors];
00035 int transparent;
00036 int *polyInts;
00037 int polyAllocated;
00038 struct gdImageStruct *brush;
00039 struct gdImageStruct *tile;
00040 int brushColorMap[gdMaxColors];
00041 int tileColorMap[gdMaxColors];
00042 int styleLength;
00043 int stylePos;
00044 int *style;
00045 int interlace;
00046 } gdImage;
00047
00048 typedef gdImage *gdImagePtr;
00049
00050 typedef struct gdGifBufferStruct {
00051 char *data;
00052 int size;
00053 } gdGifBuffer;
00054
00055 typedef struct {
00056
00057 int nchars;
00058
00059 int offset;
00060
00061 int w;
00062 int h;
00063
00064
00065
00066 int *data;
00067 } gdFont;
00068
00069
00070 typedef gdFont *gdFontPtr;
00071
00072
00073 extern gdFontPtr gdFontMediumBold;
00074 extern gdFontPtr gdFontGiant;
00075 extern gdFontPtr gdFontSmall;
00076
00077
00078
00079
00080 #define gdDashSize 4
00081
00082
00083
00084 #define gdStyled (-2)
00085 #define gdBrushed (-3)
00086 #define gdStyledBrushed (-4)
00087 #define gdTiled (-5)
00088
00089
00090
00091 #define gdTransparent (-6)
00092
00093
00094
00095 gdImagePtr gdImageCreate(int sx, int sy);
00096 gdImagePtr gdImageCreateFromGif(FILE * fd);
00097 void gdImageDestroy(gdImagePtr im);
00098 void gdImageSetPixel(gdImagePtr im, int x, int y, int color);
00099 int gdImageGetPixel(gdImagePtr im, int x, int y);
00100 void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00101
00102
00103 void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00104
00105
00106 void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00107
00108 void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00109 int gdImageBoundsSafe(gdImagePtr im, int x, int y);
00110 void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
00111 void gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, char c, int color);
00112 void gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, char *s, int color);
00113 void gdImageStringUp(gdImagePtr im, gdFontPtr f, int x, int y, char *s, int color);
00114
00115
00116
00117 typedef struct {
00118 int x, y;
00119 } gdPoint, *gdPointPtr;
00120
00121 void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
00122 void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
00123
00124 int gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
00125 int gdImageColorClosest(gdImagePtr im, int r, int g, int b);
00126 int gdImageColorExact(gdImagePtr im, int r, int g, int b);
00127 void gdImageColorDeallocate(gdImagePtr im, int color);
00128 void gdImageColorTransparent(gdImagePtr im, int color);
00129 void gdImageGif(gdImagePtr im, gdGifBuffer * buffer);
00130 void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
00131 void gdImageFill(gdImagePtr im, int x, int y, int color);
00132 void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY,
00133 int w, int h);
00134
00135 void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX,
00136 int srcY, int dstW, int dstH, int srcW, int srcH);
00137 void gdImageSetBrush(gdImagePtr im, gdImagePtr brush);
00138 void gdImageSetTile(gdImagePtr im, gdImagePtr tile);
00139 void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
00140
00141 void gdImageInterlace(gdImagePtr im, int interlaceArg);
00142
00143
00144
00145 #define gdImageSX(im) ((im)->sx)
00146 #define gdImageSY(im) ((im)->sy)
00147 #define gdImageColorsTotal(im) ((im)->colorsTotal)
00148 #define gdImageRed(im, c) ((im)->red[(c)])
00149 #define gdImageGreen(im, c) ((im)->green[(c)])
00150 #define gdImageBlue(im, c) ((im)->blue[(c)])
00151 #define gdImageGetTransparent(im) ((im)->transparent)
00152 #define gdImageGetInterlaced(im) ((im)->interlace)
00153 #endif