1 #define GIF_MAXCOLORS 256 2 3 typedef enum { 4 gif_image, gif_comment, gif_text 5 } GIFStreamType; 6 7 typedef enum { 8 gif_no_disposal = 0, gif_keep_disposal = 1, 9 gif_color_restore = 2, gif_image_restore = 3 10 } GIFDisposalType; 11 12 typedef struct { 13 int transparent; /* transparency index */ 14 int delayTime; /* Time in 1/100 of a second */ 15 int inputFlag; /* wait for input after display */ 16 GIFDisposalType disposal; 17 } GIF89info; 18 19 typedef struct GIFData { 20 GIF89info info; 21 int x, y; 22 int width, height; 23 GIFStreamType type; 24 union { 25 struct { 26 int cmapSize; 27 unsigned char cmapData[GIF_MAXCOLORS][3]; 28 unsigned char *data; 29 int interlaced; 30 } image; 31 struct { 32 int fg, bg; 33 int cellWidth, cellHeight; 34 int len; 35 char *text; 36 } text; 37 struct { 38 int len; 39 char *text; 40 } comment; 41 } data; 42 43 struct GIFData *next; 44 } GIFData; 45 46 typedef struct { 47 int width, height; 48 49 int colorResolution; 50 int colorMapSize; 51 int cmapSize; 52 unsigned char cmapData[GIF_MAXCOLORS][3]; 53 54 int background; 55 int aspectRatio; 56 57 GIFData *data; 58 } GIFStream; 59 60 GIFStream* GIFRead(char *), *GIFReadFP(FILE *); 61 int GIFTest(char *); 62 int GIFWrite(char *, GIFStream *, int); 63 int GIFWriteFP(FILE *, GIFStream *, int); 64