gd.h

Go to the documentation of this file.
00001 #ifndef GD_H
00002 #define GD_H 1
00003 
00004 /* gd.h: declarations file for the gifdraw module.
00005 
00006         Written by Tom Boutell, 5/94.
00007         Copyright 1994, Cold Spring Harbor Labs.
00008         Permission granted to use this code in any fashion provided
00009         that this notice is retained and any alterations are
00010         labeled as such. It is requested, but not required, that
00011         you share extensions to this module with us so that we
00012         can incorporate them into new versions. */
00013 
00014 /* stdio is needed for file I/O. */
00015 #include <stdio.h>
00016 #include "../../../core/includes/machine.h"
00017 
00018 /* This can't be changed, it's part of the GIF specification. */
00019 
00020 #define gdMaxColors 256
00021 
00022 /* Image type. See functions below; you will not need to change
00023         the elements directly. Use the provided macros to
00024         access sx, sy, the color table, and colorsTotal for 
00025         read-only purposes. */
00026 
00027 typedef struct  gdImageStruct { 
00028         unsigned char ** pixels;
00029         int sx;
00030         int sy;
00031         int colorsTotal;
00032         int red[gdMaxColors];
00033         int green[gdMaxColors];
00034         int blue[gdMaxColors]; 
00035         int open[gdMaxColors];
00036         int transparent;
00037         int *polyInts;
00038         int polyAllocated;
00039         struct gdImageStruct *brush;
00040         struct gdImageStruct *tile;      
00041         int brushColorMap[gdMaxColors];
00042         int tileColorMap[gdMaxColors];
00043         int styleLength;
00044         int stylePos;
00045         int *style;
00046         int interlace;
00047         int alu;
00048         int clipping;
00049         int cliprect[4];
00050         int background;
00051 } gdImage;
00052 
00053 typedef gdImage * gdImagePtr;
00054 
00055 typedef struct {
00056         /* # of characters in font */
00057         int nchars;
00058         /* First character is numbered... (usually 32 = space) */
00059         int offset;
00060         /* Character width and height */
00061         int w;
00062         int h;
00063         int fixed;
00064         /* Font data; array of characters, one row after another.
00065                 Easily included in code, also easily loaded from
00066                 data files. */
00067         char *data;
00068 } gdFont;
00069 
00070 /* Text functions take these. */
00071 typedef gdFont *gdFontPtr;
00072 
00073 /* For backwards compatibility only. Use gdImageSetStyle()
00074         for MUCH more flexible line drawing. Also see
00075         gdImageSetBrush(). */
00076 #define gdDashSize 4
00077 
00078 /* Special colors. */
00079 
00080 #define gdStyled (-2)
00081 #define gdBrushed (-3)
00082 #define gdStyledBrushed (-4)
00083 #define gdTiled (-5)
00084 
00085 /* NOT the same as the transparent color index.
00086         This is used in line styles only. */
00087 #define gdTransparent (-6)
00088 
00089 /* functions to handle alu modes and clipping */
00090 void gdSetClipping __PARAMS((gdImagePtr im , int xmin, int ymin, int xmax, int ymax));
00091 void gdUnsetClipping  __PARAMS((gdImagePtr im)); 
00092 void gdSetAlu __PARAMS((gdImagePtr im, int alu));
00093 
00094 /* functions to handle dashes */
00095 void gdResetDash();
00096 /* Functions to manipulate images. */
00097 
00098 gdImagePtr gdImageCreate __PARAMS((int sx, int sy));
00099 gdImagePtr gdImageCreateFromGif __PARAMS((FILE *fd));
00100 gdImagePtr gdImageCreateFromGd __PARAMS((FILE *in));
00101 gdImagePtr gdImageCreateFromXbm __PARAMS((FILE *fd));
00102 void gdImageDestroy __PARAMS((gdImagePtr im));
00103 void gdImageSetPixel __PARAMS((gdImagePtr im, int x, int y, int color));
00104 int gdImageGetPixel __PARAMS((gdImagePtr im, int x, int y));
00105 void gdImageLine __PARAMS((gdImagePtr im, int x1, int y1, int x2, int y2, int color));
00106 /* For backwards compatibility only. Use gdImageSetStyle()
00107         for much more flexible line drawing. */
00108 
00109 /* Corners specified (not width and height). Upper left first, lower right
00110         second. */
00111 void gdImageRectangle __PARAMS((gdImagePtr im, int x1, int y1, int x2, int y2, int color));
00112 void gdImageThickRectangle __PARAMS((gdImagePtr im, int x1, int y1, int x2, int y2, int color, int thick));
00113 
00114 /* Solid bar. Upper left corner first, lower right corner second. */
00115 void gdImageFilledRectangle __PARAMS((gdImagePtr im, int x1, int y1, int x2, int y2, int color));
00116 int gdImageBoundsSafe __PARAMS((gdImagePtr im, int x, int y));
00117 int gdImageChar __PARAMS((gdImagePtr im, gdFontPtr f, int x, int y, int c, int color));
00118 void gdImageCharUp __PARAMS((gdImagePtr im, gdFontPtr f, int x, int y, int c, int color));
00119 void gdImageString __PARAMS((gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color));
00120 void gdImageStringUp __PARAMS((gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color));
00121 void gdImageString16 __PARAMS((gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color));
00122 void gdImageStringUp16 __PARAMS((gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color));
00123 
00124 /* Point type for use in polygon drawing. */
00125 
00126 typedef struct {
00127         int x, y;
00128 } gdPoint, *gdPointPtr;
00129 
00130 void gdImagePolygon __PARAMS((gdImagePtr im, gdPointPtr p, int n, int c));
00131 void gdImageFilledPolygon __PARAMS((gdImagePtr im, gdPointPtr p, int n, int c));
00132 
00133 int gdImageColorAllocate __PARAMS((gdImagePtr im, int r, int g, int b));
00134 int gdImageColorClosest __PARAMS((gdImagePtr im, int r, int g, int b));
00135 int gdImageColorExact __PARAMS((gdImagePtr im, int r, int g, int b));
00136 void gdImageColorDeallocate __PARAMS((gdImagePtr im, int color));
00137 void gdImageColorTransparent __PARAMS((gdImagePtr im, int color));
00138 void gdImageGif __PARAMS((gdImagePtr im, FILE *out));
00139 void gdImagePPM __PARAMS((gdImagePtr im, FILE *out));
00140 void gdImageGd __PARAMS((gdImagePtr im, FILE *out));
00141 void gdImageArc __PARAMS((gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color));
00142 void gdImageFillToBorder __PARAMS((gdImagePtr im, int x, int y, int border, int color));
00143 void gdImageFill __PARAMS((gdImagePtr im, int x, int y, int color));
00144 void gdImageCopy __PARAMS((gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h));
00145 /* Stretches or shrinks to fit, as needed */
00146 void gdImageCopyResized __PARAMS((gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH));
00147 void gdImageSetBrush __PARAMS((gdImagePtr im, gdImagePtr brush));
00148 void gdImageSetTile __PARAMS((gdImagePtr im, gdImagePtr tile));
00149 void gdImageSetStyle __PARAMS((gdImagePtr im, int *style, int noOfPixels));
00150 /* On or off (1 or 0) */
00151 void gdImageInterlace __PARAMS((gdImagePtr im, int interlaceArg));
00152 void gdImageChangeColor __PARAMS((gdImagePtr im, int old, int new));
00153 void gdSetBackground __PARAMS((gdImagePtr im, int background));
00154 int gdCharWidth __PARAMS((gdFontPtr f, int c));
00155 void gdImageThickLine __PARAMS((gdImagePtr im, int x1, int y1, int x2, int y2, int color, int thick));
00156 void gdImagePolyLine __PARAMS((gdImagePtr im, int *X, int *Y, int n, int color, int thick, int close));
00157 
00158 /* Macros to access information about images. READ ONLY. Changing
00159         these values will NOT have the desired result. */
00160 #define gdImageSX(im) ((im)->sx)
00161 #define gdImageSY(im) ((im)->sy)
00162 #define gdImageColorsTotal(im) ((im)->colorsTotal)
00163 #define gdImageRed(im, c) ((im)->red[(c)])
00164 #define gdImageGreen(im, c) ((im)->green[(c)])
00165 #define gdImageBlue(im, c) ((im)->blue[(c)])
00166 #define gdImageGetTransparent(im) ((im)->transparent)
00167 #define gdImageGetInterlaced(im) ((im)->interlace)
00168 #endif

Generated on Sun Mar 4 15:03:54 2007 for Scilab [trunk] by  doxygen 1.5.1