~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/file/gif/gif.h

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* gif header
  2 
  3         sam. 24.7.1995
  4 */
  5 
  6 
  7 #ifndef GIF_H
  8 #define GIF_H
  9 
 10 #include <tina/all_tina.h>
 11 #include <sys/types.h>
 12 #include <ctype.h>
 13 #include <stdio.h>
 14 /*
 15 #include <strings.h>
 16 */
 17 
 18 #include <string.h>
 19 
 20 /*
 21 a.lacey 4.8.97
 22 
 23 extern long random();
 24 extern int atoi();
 25 extern void exit();
 26 extern void srandom();
 27 extern long time();
 28 extern int write();
 29 #include <malloc.h>
 30 extern char* malloc();
 31 extern char* realloc();
 32 extern char* calloc();
 33 */
 34 
 35 /* Definitions to make PBMPLUS work with either ANSI C or C Classic. */
 36 
 37 #if __STDC__
 38 #define ARGS(alist) alist
 39 #else /*__STDC__*/
 40 #define ARGS(alist) ()
 41 #define const
 42 #endif /*__STDC__*/
 43 
 44 
 45 /* Initialization. */
 46 
 47 void pm_init ARGS(( int* argcP, char* argv[] ));
 48 
 49 
 50 /* Variable-sized arrays definitions. */
 51 
 52 char** pm_allocarray ARGS(( int cols, int rows, int size ));
 53 char* pm_allocrow ARGS(( int cols, int size ));
 54 void pm_freearray ARGS(( char** its, int rows ));
 55 void pm_freerow ARGS(( char* itrow ));
 56 
 57 
 58 /* Case-insensitive keyword matcher. */
 59 
 60 int pm_keymatch ARGS(( char* str, char* keyword, int minchars ));
 61 
 62 
 63 /* Log base two hacks. */
 64 
 65 int pm_maxvaltobits ARGS(( int maxval ));
 66 int pm_bitstomaxval ARGS(( int bits ));
 67 
 68 
 69 /* Error handling definitions. */
 70 
 71 void pm_perror ARGS(( char* reason ));                  /* doesn't return */
 72 
 73 
 74 /* File open/close that handles "-" as stdin and checks errors. */
 75 
 76 FILE* pm_openr ARGS(( char* name ));
 77 FILE* pm_openw ARGS(( char* name ));
 78 void pm_close ARGS(( FILE* f ));
 79 
 80 
 81 /* Endian I/O. */
 82 
 83 int pm_readbigshort ARGS(( FILE* in, short* sP ));
 84 int pm_writebigshort ARGS(( FILE* out, short s ));
 85 int pm_readbiglong ARGS(( FILE* in, long* lP ));
 86 int pm_writebiglong ARGS(( FILE* out, long l ));
 87 int pm_readlittleshort ARGS(( FILE* in, short* sP ));
 88 int pm_writelittleshort ARGS(( FILE* out, short s ));
 89 int pm_readlittlelong ARGS(( FILE* in, long* lP ));
 90 int pm_writelittlelong ARGS(( FILE* out, long l ));
 91 
 92 typedef unsigned char bit;
 93 
 94 
 95 void pbm_init ARGS(( int* argcP, char* argv[] ));
 96 
 97 #define pbm_allocarray( cols, rows ) ((bit**) pm_allocarray( cols, rows, sizeof(bit) ))
 98 #define pbm_allocrow( cols ) ((bit*) pm_allocrow( cols, sizeof(bit) ))
 99 #define pbm_freearray( bits, rows ) pm_freearray( (char**) bits, rows )
100 #define pbm_freerow( bitrow ) pm_freerow( (char*) bitrow )
101 
102 bit** pbm_readpbm ARGS(( FILE* file, int* colsP, int* rowsP ));
103 void pbm_readpbminit ARGS(( FILE* file, int* colsP, int* rowsP, int* formatP ));
104 void pbm_readpbmrow ARGS(( FILE* file, bit* bitrow, int cols, int format ));
105 
106 void pbm_writepbm ARGS(( FILE* file, bit** bits, int cols, int rows, int forceplain ));
107 void pbm_writepbminit ARGS(( FILE* file, int cols, int rows, int forceplain ));
108 void pbm_writepbmrow ARGS(( FILE* file, bit* bitrow, int cols, int forceplain ));
109 
110 
111 #define ppm_allocarray( cols, rows ) ((pixel**) pm_allocarray( cols, rows, sizeof(pixel) ))
112 #define ppm_allocrow( cols ) ((pixel*) pm_allocrow( cols, sizeof(pixel) ))
113 #define ppm_freearray( pixels, rows ) pm_freearray( (char**) pixels, rows )
114 #define ppm_freerow( pixelrow ) pm_freerow( (char*) pixelrow )
115 
116 #define MAXCOLORMAPSIZE         256
117 #define MAXCOLORS                       256
118 
119 #define TRUE    1
120 #define FALSE   0
121 
122 #define CM_RED          0
123 #define CM_GREEN        1
124 #define CM_BLUE         2
125 
126 #define MAX_LWZ_BITS            12
127 
128 #define INTERLACE               0x40
129 #define LOCALCOLORMAP   0x80
130 #define BitSet(byte, bit)       (((byte) & (bit)) == (bit))
131 
132 #define ReadOK(file,buffer,len) (fread(buffer, len, 1, file) != 0)
133 
134 #define LM_to_uint(a,b)                 (((b)<<8)|(a))
135 
136 typedef unsigned char gray;
137 #define PGM_MAXMAXVAL 255
138 typedef gray pixval;
139 
140 
141 struct {
142         unsigned int    Width;
143         unsigned int    Height;
144         unsigned char   ColorMap[3][MAXCOLORMAPSIZE];
145         unsigned int    BitPixel;
146         unsigned int    ColorResolution;
147         unsigned int    Background;
148         unsigned int    AspectRatio;
149 } GifScreen;
150 
151 struct {
152         int     transparent;
153         int     delayTime;
154         int     inputFlag;
155         int     disposal;
156 } Gif89 = { -1, -1, -1, 0 };
157 
158 
159 #define PPM_MAXMAXVAL PGM_MAXMAXVAL
160 typedef struct
161     {
162     pixval r, g, b;
163     } pixel;
164 #define PPM_GETR(p) ((p).r)
165 #define PPM_GETG(p) ((p).g)
166 #define PPM_GETB(p) ((p).b)
167 #define PPM_ASSIGN(p,red,grn,blu) do { (p).r = (red); (p).g = (grn); (p).b = (blu); } while ( 0 )
168 #define PPM_EQUAL(p,q) ( (p).r == (q).r && (p).g == (q).g && (p).b == (q).b )
169 
170 
171 extern Imrect *ReadGIF(char *fn, int imageNumber);
172 extern int      ReadColorMap(FILE *fd,int number,unsigned char buffer[3][MAXCOLORMAPSIZE] );
173 extern int DoExtension(FILE *fd, int label);
174 extern int GetDataBlock(FILE *fd, unsigned char *buf);
175 extern int GetCode(FILE *fd, int code_size, int flag);
176 extern int LWZReadByte(FILE *fd, int flag, int input_code_size);
177 extern Imrect *ReadImage(FILE *fd, int len, int height, 
178                         unsigned char cmap[3][MAXCOLORMAPSIZE], int interlace,
179                                                 int ignore);
180 extern Imrect  *PixelToImrect( pixel **image, int width, int height);
181 extern void pm_message(char *m);
182 extern FILE *pm_openr(char *name);
183 extern void    pm_close(FILE *fn);
184 extern char** pm_allocarray( int cols, int rows, int size );
185 extern int pm_keymatch( char* str, char* keyword, int minchars );
186 
187 /* now all the stuff from ppmtogif
188  */
189 
190 typedef int (* ifunptr)();
191 
192 extern void GIFEncode( FILE *fp, int GWidth, int GHeight, int GInterlace, int 
193                                                 Background, int BitsPerPixel, int Red[], int Green[],
194                                                 int Blue[], ifunptr GetPixel );
195 extern  void Putword( int w, FILE *fp );
196 typedef int             code_int;
197 #ifdef SIGNED_COMPARE_SLOW
198 typedef unsigned long int count_int;
199 typedef unsigned short int count_short;
200 #else /*SIGNED_COMPARE_SLOW*/
201 typedef long int          count_int;
202 #endif /*SIGNED_COMPARE_SLOW*/
203 
204 
205 #endif
206 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.