lib/gifcodes.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gif_header
struct  gif_image

Defines

#define COLTAB   0x80
#define COLMASK   0x70
#define COLSHIFT   4
#define PIXMASK   7
#define COLPIXVGA13   (COLTAB | (5<<COLSHIFT) | 7)
#define ITLV_BIT   0x40
#define OUT_OF_MEMORY   -10
#define BAD_CODE_SIZE   -20
#define READ_ERROR   -1
#define WRITE_ERROR   -2
#define OPEN_ERROR   -3
#define CREATE_ERROR   -4
#define TOO_HIGH   -5

Functions

short gif_compress_data (int min_code_size, unsigned char *pt, long size, FILE *out)
int gif_decoder (int linewidth)


Define Documentation

#define BAD_CODE_SIZE   -20

Definition at line 40 of file gifcodes.h.

Referenced by decoder().

#define COLMASK   0x70

Definition at line 17 of file gifcodes.h.

#define COLPIXVGA13   (COLTAB | (5<<COLSHIFT) | 7)

Definition at line 20 of file gifcodes.h.

Referenced by mgSaveToGif().

#define COLSHIFT   4

Definition at line 18 of file gifcodes.h.

#define COLTAB   0x80

Definition at line 16 of file gifcodes.h.

Referenced by mgLoadGif().

#define CREATE_ERROR   -4

Definition at line 44 of file gifcodes.h.

#define ITLV_BIT   0x40

Definition at line 30 of file gifcodes.h.

Referenced by gif_out_line().

#define OPEN_ERROR   -3

Definition at line 43 of file gifcodes.h.

#define OUT_OF_MEMORY   -10

Definition at line 39 of file gifcodes.h.

Referenced by gif_decoder().

#define PIXMASK   7

Definition at line 19 of file gifcodes.h.

Referenced by mgLoadGif().

#define READ_ERROR   -1

Definition at line 41 of file gifcodes.h.

Referenced by mgLoadGif().

#define TOO_HIGH   -5

Definition at line 45 of file gifcodes.h.

#define WRITE_ERROR   -2

Definition at line 42 of file gifcodes.h.


Function Documentation

short gif_compress_data ( int  min_code_size,
unsigned char *  pt,
long  size,
FILE *  out 
)

Definition at line 268 of file gifcomp.c.

References added_chars, code_ids, compress_data(), gentleFree(), gif_file, gif_wcount, gif_wpt, needMem(), prior_codes, and TABLE_SIZE.

Referenced by mgSaveToGif().

00269 {
00270 int ret;
00271 
00272 /* Make sure min_code_size is reasonable. */
00273 if (min_code_size < 2 || min_code_size > 9)
00274     {
00275     if (min_code_size == 1)
00276         min_code_size = 2;
00277     else
00278         return -3;
00279     }
00280 
00281 /* Store input parameters where rest of routines can use. */
00282 gif_file = out;
00283 gif_wpt = pt;
00284 gif_wcount = size;
00285 
00286 ret = -2;       /* out of memory default */
00287 prior_codes = NULL;
00288 code_ids = NULL;
00289 added_chars = NULL;
00290 if ((prior_codes = (short*)needMem(TABLE_SIZE*sizeof(short))) == NULL)
00291         goto OUT;
00292 if ((code_ids = (short*)needMem(TABLE_SIZE*sizeof(short))) == NULL)
00293         goto OUT;
00294 if ((added_chars = (unsigned char*)needMem(TABLE_SIZE)) == NULL)
00295         goto OUT;
00296 
00297 ret = compress_data(min_code_size);
00298 
00299 OUT:
00300 gentleFree(prior_codes);
00301 gentleFree(code_ids);
00302 gentleFree(added_chars);
00303 return(ret);
00304 }

Here is the call graph for this function:

Here is the caller graph for this function:

int gif_decoder ( int  linewidth  ) 

Definition at line 363 of file gifdecomp.c.

References decoder(), freeMem(), MAX_CODES, needMem(), OUT_OF_MEMORY, UBYTE, and UWORD.

00364 {
00365 UBYTE *buf, *stack, *suffix;
00366 UWORD *prefix;
00367 int ret;
00368 
00369 ret = OUT_OF_MEMORY;
00370 stack = NULL;
00371 suffix = NULL;
00372 prefix = NULL;
00373 /* stack = suffix = (UBYTE *)prefix = NULL; */
00374 if ((buf = (UBYTE *)needMem(linewidth + 1)) == NULL)
00375         goto OUT;
00376 if ((stack = (UBYTE *)needMem(MAX_CODES+1)) == NULL)
00377         goto OUT;
00378 if ((suffix = (UBYTE *)needMem(MAX_CODES+1)) == NULL)
00379         goto OUT;
00380 if ((prefix = (UWORD *)needMem((MAX_CODES+1)*sizeof(UWORD) )) == NULL)
00381         goto OUT;
00382 ret = decoder(linewidth,buf,stack,suffix,prefix);
00383 OUT:
00384 freeMem(buf);
00385 freeMem(stack);
00386 freeMem(prefix);
00387 freeMem(suffix);
00388 return(ret);
00389 }

Here is the call graph for this function:


Generated on Tue Dec 25 19:52:06 2007 for blat by  doxygen 1.5.2