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 {
00051
00052 int nchars;
00053
00054 int offset;
00055
00056 int w;
00057 int h;
00058
00059
00060
00061 char *data;
00062 } gdFont;
00063
00064
00065 typedef gdFont *gdFontPtr;
00066
00067
00068
00069
00070 #define gdDashSize 4
00071
00072
00073
00074 #define gdStyled (-2)
00075 #define gdBrushed (-3)
00076 #define gdStyledBrushed (-4)
00077 #define gdTiled (-5)
00078
00079
00080
00081 #define gdTransparent (-6)
00082
00083
00084
00085 gdImagePtr gdImageCreate(int sx, int sy);
00086 gdImagePtr gdImageCreateFromGif(FILE *fd);
00087 gdImagePtr gdImageCreateFromGd(FILE *in);
00088 gdImagePtr gdImageCreateFromXbm(FILE *fd);
00089 void gdImageDestroy(gdImagePtr im);
00090 void gdImageSetPixel(gdImagePtr im, int x, int y, int color);
00091 int gdImageGetPixel(gdImagePtr im, int x, int y);
00092 void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00093
00094
00095 void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00096
00097
00098 void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00099
00100 void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
00101 int gdImageBoundsSafe(gdImagePtr im, int x, int y);
00102 void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
00103 void gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
00104 void gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
00105 void gdImageStringUp(gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color);
00106 void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
00107 void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color);
00108
00109
00110
00111 typedef struct {
00112 int x, y;
00113 } gdPoint, *gdPointPtr;
00114
00115 void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
00116 void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
00117
00118 int gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
00119 int gdImageColorClosest(gdImagePtr im, int r, int g, int b);
00120 int gdImageColorExact(gdImagePtr im, int r, int g, int b);
00121 void gdImageColorDeallocate(gdImagePtr im, int color);
00122 void gdImageColorTransparent(gdImagePtr im, int color);
00123 void gdImageGif(gdImagePtr im, FILE *out);
00124 void gdImageGd(gdImagePtr im, FILE *out);
00125 void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color);
00126 void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
00127 void gdImageFill(gdImagePtr im, int x, int y, int color);
00128 void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h);
00129
00130 void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
00131 void gdImageSetBrush(gdImagePtr im, gdImagePtr brush);
00132 void gdImageSetTile(gdImagePtr im, gdImagePtr tile);
00133 void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
00134
00135 void gdImageInterlace(gdImagePtr im, int interlaceArg);
00136
00137
00138
00139 #define gdImageSX(im) ((im)->sx)
00140 #define gdImageSY(im) ((im)->sy)
00141 #define gdImageColorsTotal(im) ((im)->colorsTotal)
00142 #define gdImageRed(im, c) ((im)->red[(c)])
00143 #define gdImageGreen(im, c) ((im)->green[(c)])
00144 #define gdImageBlue(im, c) ((im)->blue[(c)])
00145 #define gdImageGetTransparent(im) ((im)->transparent)
00146 #define gdImageGetInterlaced(im) ((im)->interlace)
00147 #endif