source: trunk/tools/database/gd/gd.h@ 10367

Last change on this file since 10367 was 829, checked in by bird, 26 years ago

gifdraw (gd) v1.2 - initial checkin.

File size: 5.1 KB
Line 
1#ifndef GD_H
2#define GD_H 1
3
4/* gd.h: declarations file for the gifdraw module.
5
6 Written by Tom Boutell, 5/94.
7 Copyright 1994, Cold Spring Harbor Labs.
8 Permission granted to use this code in any fashion provided
9 that this notice is retained and any alterations are
10 labeled as such. It is requested, but not required, that
11 you share extensions to this module with us so that we
12 can incorporate them into new versions. */
13
14/* stdio is needed for file I/O. */
15#include <stdio.h>
16
17/* This can't be changed, it's part of the GIF specification. */
18
19#define gdMaxColors 256
20
21/* Image type. See functions below; you will not need to change
22 the elements directly. Use the provided macros to
23 access sx, sy, the color table, and colorsTotal for
24 read-only purposes. */
25
26typedef struct gdImageStruct {
27 unsigned char ** pixels;
28 int sx;
29 int sy;
30 int colorsTotal;
31 int red[gdMaxColors];
32 int green[gdMaxColors];
33 int blue[gdMaxColors];
34 int open[gdMaxColors];
35 int transparent;
36 int *polyInts;
37 int polyAllocated;
38 struct gdImageStruct *brush;
39 struct gdImageStruct *tile;
40 int brushColorMap[gdMaxColors];
41 int tileColorMap[gdMaxColors];
42 int styleLength;
43 int stylePos;
44 int *style;
45 int interlace;
46} gdImage;
47
48typedef gdImage * gdImagePtr;
49
50typedef struct {
51 /* # of characters in font */
52 int nchars;
53 /* First character is numbered... (usually 32 = space) */
54 int offset;
55 /* Character width and height */
56 int w;
57 int h;
58 /* Font data; array of characters, one row after another.
59 Easily included in code, also easily loaded from
60 data files. */
61 char *data;
62} gdFont;
63
64/* Text functions take these. */
65typedef gdFont *gdFontPtr;
66
67/* For backwards compatibility only. Use gdImageSetStyle()
68 for MUCH more flexible line drawing. Also see
69 gdImageSetBrush(). */
70#define gdDashSize 4
71
72/* Special colors. */
73
74#define gdStyled (-2)
75#define gdBrushed (-3)
76#define gdStyledBrushed (-4)
77#define gdTiled (-5)
78
79/* NOT the same as the transparent color index.
80 This is used in line styles only. */
81#define gdTransparent (-6)
82
83/* Functions to manipulate images. */
84
85gdImagePtr gdImageCreate(int sx, int sy);
86gdImagePtr gdImageCreateFromGif(FILE *fd);
87gdImagePtr gdImageCreateFromGd(FILE *in);
88gdImagePtr gdImageCreateFromXbm(FILE *fd);
89void gdImageDestroy(gdImagePtr im);
90void gdImageSetPixel(gdImagePtr im, int x, int y, int color);
91int gdImageGetPixel(gdImagePtr im, int x, int y);
92void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
93/* For backwards compatibility only. Use gdImageSetStyle()
94 for much more flexible line drawing. */
95void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
96/* Corners specified (not width and height). Upper left first, lower right
97 second. */
98void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
99/* Solid bar. Upper left corner first, lower right corner second. */
100void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
101int gdImageBoundsSafe(gdImagePtr im, int x, int y);
102void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color);
103void gdImageCharUp(gdImagePtr im, gdFontPtr f, int x, int y, char c, int color);
104void gdImageString(gdImagePtr im, gdFontPtr f, int x, int y, char *s, int color);
105void gdImageStringUp(gdImagePtr im, gdFontPtr f, int x, int y, char *s, int color);
106
107/* Point type for use in polygon drawing. */
108
109typedef struct {
110 int x, y;
111} gdPoint, *gdPointPtr;
112
113void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c);
114void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c);
115
116int gdImageColorAllocate(gdImagePtr im, int r, int g, int b);
117int gdImageColorClosest(gdImagePtr im, int r, int g, int b);
118int gdImageColorExact(gdImagePtr im, int r, int g, int b);
119void gdImageColorDeallocate(gdImagePtr im, int color);
120void gdImageColorTransparent(gdImagePtr im, int color);
121void gdImageGif(gdImagePtr im, FILE *out);
122void gdImageGd(gdImagePtr im, FILE *out);
123void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color);
124void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color);
125void gdImageFill(gdImagePtr im, int x, int y, int color);
126void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h);
127/* Stretches or shrinks to fit, as needed */
128void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH);
129void gdImageSetBrush(gdImagePtr im, gdImagePtr brush);
130void gdImageSetTile(gdImagePtr im, gdImagePtr tile);
131void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels);
132/* On or off (1 or 0) */
133void gdImageInterlace(gdImagePtr im, int interlaceArg);
134
135/* Macros to access information about images. READ ONLY. Changing
136 these values will NOT have the desired result. */
137#define gdImageSX(im) ((im)->sx)
138#define gdImageSY(im) ((im)->sy)
139#define gdImageColorsTotal(im) ((im)->colorsTotal)
140#define gdImageRed(im, c) ((im)->red[(c)])
141#define gdImageGreen(im, c) ((im)->green[(c)])
142#define gdImageBlue(im, c) ((im)->blue[(c)])
143#define gdImageGetTransparent(im) ((im)->transparent)
144#define gdImageGetInterlaced(im) ((im)->interlace)
145#endif
Note: See TracBrowser for help on using the repository browser.