// GIF File Format Header // Gif.h struct SGifHeader { // Header BYTE signature[3]; // Header Signature (always "GIF") BYTE version[3]; // GIF format version ("87a" or "89a") // Logical Screen Descriptor WORD width; // Width of Display Screen in Pixels WORD height; // Height of Display Screen in Pixels BYTE packed; // Screen and Color Map Information BYTE bgColor; // Background Color Index BYTE aspectRatio; // Pixel Aspect Ratio }; struct SGifColorTable { BYTE red; BYTE green; BYTE blue; }; struct SGifImageDesc { // BYTE separator; // Image Descriptor identifier (always 2Ch) WORD left; // X position of image on the display WORD top; // Y position of image on the display WORD width; // Width of the image in pixels WORD height; // Height of the image in pixels BYTE packed; // Image and Color Table Data Information }; struct SGifGraphicControlExt { // BYTE introducer; // Extension Introducer (always 21h) // BYTE label; // Graphic Control label (always F9h) // BYTE blockSize; // Size of remaining fields (always 04h) BYTE packed; // Method of graphics disposal to use WORD delayTime; // Hundredths of seconds to wait BYTE colorIndex; // Transparent Color Index // BYTE terminator; // Block Terminator (always 0) struct SGifGraphicControlExt *next; }; struct SGifPlainTextExt { // BYTE introducer; // Extension Introducer (always 21h) // BYTE label; // Extension Label (always 01h) // BYTE blockSize; // Size of Extension Block (always 0Ch) WORD left; // X position of text grid in pixels WORD top; // Y position of text grid in pixels WORD width; // Width of the text grid in pixels WORD height; // Height of the text grid in pixels BYTE cellWidth; // Width of a grid cell in pixels BYTE cellHeight; // Height of a grid cell in pixels BYTE fgColor; // Text foreground color index value BYTE bgColor; // Text background color index value BYTE dataSize; BYTE *plainTextData; // The Plain Text Data // BYTE terminator; // Block Terminator (always 0) struct SGifPlainTextExt *next; }; struct SGifApplicationExt { // BYTE introducer; // Extension Introducer (always 21h) // BYTE label; // Extension Label (always FFh) // BYTE blockSize; // Size of Extension Block (always 0Bh) char identifier[8]; // Application Identifier BYTE authentCode[3]; // Application Authentication Code BYTE dataSize; BYTE *applicationData; // Pointer to Application Data sub-blocks // BYTE terminator; // Block Terminator (always 0) struct SGifApplicationExt *next; }; struct SGifCommentExt { // BYTE introducer; // Extension Introducer (always 21h) // BYTE label; // Comment Label (always FEh) BYTE dataSize; BYTE *commentData; // Pointer to comment Data sub-blocks // BYTE terminator; // Block Terminator (always 0) struct SGifCommentExt *next; }; struct SGifImage { SGifImageDesc info; SGifColorTable *localColorTable; BYTE *image; unsigned long size; struct SGifImage *next; }; struct SLzwTable { BYTE bits; WORD previous; WORD next; };