gif.h

来自「LZW compression example with java」· C头文件 代码 · 共 41 行

H
41
字号
/*The GIF loader, Included as a part of the compression tutorial
 *Written By Martin Zolnieryk (c) 2004
 *This code is freeware, however if you use this some credit
 *be nice.
 *This code is based upon the GifAllegS Library
*/
#define GIF_EOI (1 << al_gif.cc) + 1   //Tells end of gif file 
#define GIF_CC  (1 << al_gif.cc)        //Tells to clear gif table
//The gif table
//:)
typedef struct GIF_STRUCT
{
BITMAP *image;
//The Signature
unsigned char id[6]; //Includes GIF + ver number
unsigned char buffer[255];
//Screen Descripter
unsigned short int s_width;  //2 Bytes each, the screen size
unsigned short int s_height;
unsigned char global_depth; //first 3 bits = pixel-1, 0, next 3 = bpp-1, next 1 = color map afterwards
unsigned char bpp;
unsigned char backround; //next byte
unsigned char reserved; //Not reserved, for 89a use.
long counter;
unsigned char cc;
//COLOUR TABLE HERE, how every big it is;
//rgb order
//Image descripter
//This  character  is defined as 0x2C hex or ',' Introduces image desc.
unsigned int  ileft, itop, iwidth, iheight; //Really only useful for animated gifs
unsigned char depth; //0-3bytes, pixel-1,0,0,0,1 byte interlaced, 1 byte local pal.
//  character 0x3B hex or ';'  gif terminater, finished, end of gif. goodbye :p
unsigned char code_size;
unsigned char block_byte;
}GIF;

BITMAP *load_gif(const char *filename, RGB *pal); //Loads gif
void draw_lzw_pixel(BITMAP *image,long counter,unsigned char first_code);  //renders pixel
int get_gif_lzw_code(FILE *fp,LZW *table, GIF *gif); //gets the gif cod

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?