About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

giftopnm.c File Reference
#include <string.h>
#include "pnm.h"
Include dependency graph for giftopnm.c:

Go to the source code of this file.


#define TRUE   1
#define FALSE   0
#define CM_RED   0
#define CM_GREEN   1
#define CM_BLUE   2
#define MAX_LWZ_BITS   12
#define INTERLACE   0x40
#define LOCALCOLORMAP   0x80
#define BitSet(byte, bit)   (((byte) & (bit)) == (bit))
#define ReadOK(file, buffer, len)   (fread(buffer, len, 1, file) != 0)
#define LM_to_uint(a, b)   (((b)<<8)|(a))


static void ReadGIF ()
static int ReadColorMap ()
static int DoExtension ()
static int GetDataBlock ()
static int GetCode ()
static int LWZReadByte ()
static void ReadImage ()
int main (int argc, char **argv)
static void ReadGIF (FILE *fd, int imageNumber)
static int ReadColorMap (FILE *fd, int number, buffer, int *pbm_format)
static int DoExtension (FILE *fd, int label)
static int GetDataBlock (FILE *fd, unsigned char *buf)
static int GetCode (FILE *fd, int code_size, int flag)
static int LWZReadByte (FILE *fd, int flag, int input_code_size)
static void ReadImage (FILE *fd, int len, int height, cmap, int pbm_format, int interlace, int ignore)


struct {
   unsigned int   Width
   unsigned int   Height
   unsigned char   ColorMap [3][256]
   unsigned int   BitPixel
   unsigned int   ColorResolution
   unsigned int   Background
   unsigned int   AspectRatio
   int   GrayScale
struct {
   int   transparent
   int   delayTime
   int   inputFlag
   int   disposal
Gif89 = { -1, -1, -1, 0 }
pixelImage = NULL
static int verbose
int showComment
static char usage [] = "[-verbose] [-comments] [-image N] [GIFfile]"
int ZeroDataBlock = ((bool)0)

Macro Definition Documentation

◆ BitSet

#define BitSet (   byte,
)    (((byte) & (bit)) == (bit))

Definition at line 28 of file giftopnm.c.


#define CM_BLUE   2

Definition at line 22 of file giftopnm.c.


#define CM_GREEN   1

Definition at line 21 of file giftopnm.c.


#define CM_RED   0

Definition at line 20 of file giftopnm.c.


#define FALSE   0

Definition at line 18 of file giftopnm.c.


#define INTERLACE   0x40

Definition at line 26 of file giftopnm.c.

◆ LM_to_uint

#define LM_to_uint (   a,
)    (((b)<<8)|(a))

Definition at line 32 of file giftopnm.c.


#define LOCALCOLORMAP   0x80

Definition at line 27 of file giftopnm.c.


#define MAX_LWZ_BITS   12

Definition at line 24 of file giftopnm.c.



Definition at line 15 of file giftopnm.c.

◆ ReadOK

#define ReadOK (   file,
)    (fread(buffer, len, 1, file) != 0)

Definition at line 30 of file giftopnm.c.


#define TRUE   1

Definition at line 17 of file giftopnm.c.

Function Documentation

◆ DoExtension() [1/2]

static int DoExtension ( )

Referenced by ReadGIF().

◆ DoExtension() [2/2]

static int DoExtension ( FILE fd,
int  label 

◆ GetCode() [1/2]

static int GetCode ( )

Referenced by LWZReadByte().

◆ GetCode() [2/2]

static int GetCode ( FILE fd,
int  code_size,
int  flag 

Definition at line 344 of file giftopnm.c.

References buf, code_size, count, FALSE, GetDataBlock(), i, j, pm_error, ret, and TRUE.

◆ GetDataBlock() [1/2]

static int GetDataBlock ( )

Referenced by DoExtension(), GetCode(), and LWZReadByte().

◆ GetDataBlock() [2/2]

static int GetDataBlock ( FILE fd,
unsigned char *  buf 

Definition at line 322 of file giftopnm.c.

References buf, count, pm_message, ReadOK, and ZeroDataBlock.

◆ LWZReadByte() [1/2]

static int LWZReadByte ( )

Referenced by ReadImage().

◆ LWZReadByte() [2/2]

static int LWZReadByte ( FILE fd,
int  flag,
int  input_code_size 

◆ main()

int main ( int  argc,
char **  argv 

◆ ReadColorMap() [1/2]

static int ReadColorMap ( )

Referenced by ReadGIF().

◆ ReadColorMap() [2/2]

static int ReadColorMap ( FILE fd,
int  number,
buffer  ,
int pbm_format 

Definition at line 216 of file giftopnm.c.

References CM_BLUE, CM_GREEN, CM_RED, FALSE, flag, i, number, PBM_TYPE, PGM_TYPE, pm_error, PPM_TYPE, ReadOK, and TRUE.

◆ ReadGIF() [1/2]

static void ReadGIF ( )

Referenced by main().

◆ ReadGIF() [2/2]

static void ReadGIF ( FILE fd,
int  imageNumber 

◆ ReadImage() [1/2]

static void ReadImage ( )

Referenced by ReadGIF().

◆ ReadImage() [2/2]

static void ReadImage ( FILE fd,
int  len,
int  height,
cmap  ,
int  pbm_format,
int  interlace,
int  ignore 

Variable Documentation

◆ AspectRatio

unsigned int AspectRatio

Definition at line 41 of file giftopnm.c.

Referenced by gdImageCreateFromGifCtx().

◆ Background

unsigned int Background

Definition at line 40 of file giftopnm.c.

Referenced by gdImageCreateFromGifCtx(), gdImageGifAnimBeginCtx(), and GIFEncode().

◆ BitPixel

unsigned int BitPixel

Definition at line 38 of file giftopnm.c.

Referenced by gdImageCreateFromGifCtx().

◆ ColorMap

unsigned char ColorMap[3][256]

Definition at line 37 of file giftopnm.c.

Referenced by gdImageCreateFromGifCtx(), MakeMapObject(), and PrelinOpt16alloc().

◆ ColorResolution

unsigned int ColorResolution

Definition at line 39 of file giftopnm.c.

Referenced by gdImageCreateFromGifCtx().

◆ delayTime

int delayTime

Definition at line 50 of file giftopnm.c.

◆ disposal

int disposal

Definition at line 52 of file giftopnm.c.


Gif89 { ... } struct

Referenced by DoExtension().


GifScreen { ... } struct

Referenced by ReadGIF().

◆ GrayScale

int GrayScale

Definition at line 45 of file giftopnm.c.

Referenced by _visual_for_xrender_format(), convert_row(), DoSpecial(), and print_debug_info().

◆ Height

unsigned int Height

Definition at line 36 of file giftopnm.c.

◆ Image

Definition at line 55 of file giftopnm.c.

Referenced by _cairo_qt_surface_map_to_image(), and DGifGetImageDesc().

◆ inputFlag

int inputFlag

Definition at line 51 of file giftopnm.c.

◆ showComment

int showComment

Definition at line 57 of file giftopnm.c.

Referenced by DoExtension(), and main().

◆ transparent

◆ usage

◆ verbose

int verbose

Definition at line 56 of file giftopnm.c.

Referenced by main(), and ReadImage().

◆ Width

unsigned int Width

Definition at line 35 of file giftopnm.c.

◆ ZeroDataBlock

int ZeroDataBlock = ((bool)0)

Definition at line 319 of file giftopnm.c.

Referenced by gdImageCreateFromGifCtx(), GetDataBlock(), and LWZReadByte().