Unit GifCode

Classes

EGifException -
TGif -
TGifImage - Writes out the header info writes out the pallet in correct order.

Functions

Register - ------------------------------------------------------------------------------

Types

GraphicLine
PBmLine
PCodeItem
PGif
TBmpLinesStruct
TCodeItem
TColorItem
TColorTable
TDataSubBlock
TExtensionBlock
THeader
TImageDescriptor
TLogicalScreenDescriptor

Constants

BlockTerminator
CodeMask
ErrName
ExtensionIntroducer
geBadCode
geBadCodeSize
geBitSizeOverflow
geEmptyBlock
geImagePreceded
geNoBMP
geNoError
geNoFile
geNoGlobalColor
geNotGIF
geUnExpectedEOF
idColorTableSize
idInterlaced
idLocalColorTable
idReserved
idSort
ImageSeparator
lsdColorResolution
lsdColorTableSize
lsdGlobalColorTable
lsdSort
MAXCODES
MAXSCREENWIDTH
Trailer

Variables


Functions


procedure Register;

------------------------------------------------------------------------------

Types


GraphicLine = array [0..2048] of byte;
===============================================================} { Bitmap File Structs } {===============================================================
PBmLine = ^TBmpLinesStruct

PCodeItem = ^TCodeItem

PGif = ^TGif
This is the actual gif object
TBmpLinesStruct = record
LineData : GraphicLine;
LineNo : Integer;
end;

TCodeItem = record
Code1 : byte;
Code2 : byte;
end;

TColorItem = record
Red : byte;
Green : byte;
Blue : byte;
end;
actual ratio = (AspectRatio + 15) / 64
TColorTable = array[0..255] of TColorItem;

TDataSubBlock = record
Size : byte;
Data : array[1..255] of byte;
end;
bit masks for use with Next code
TExtensionBlock = record
Introducer : byte;
ExtensionLabel : byte;
BlockSize : byte;
end;
other extension blocks not currently supported by this unit - Graphic Control extension - Comment extension I'm not sure what will happen if these blocks - Plain text extension are encountered but it'll be interesting - application extension
THeader = record
Signature : array[0..2] of char;
Version : array[0..2] of char;
end;
the data
TImageDescriptor = record
Separator : byte;
ImageLeftPos : word;
ImageTopPos : word;
ImageWidth : word;
ImageHeight : word;
PackedFields : byte;
end;
the color table
TLogicalScreenDescriptor = record
ScreenWidth : word;
ScreenHeight : word;
PackedFields : byte;
BackGroundColorIndex : byte;
AspectRatio : byte;
end;
'87a' or '89a'

Constants

BlockTerminator = 0

size of global color table - 3 bits } { Actual size = 2^value+1 - value is 3 bits

CodeMask = ( { bit masks for use with Next code } 0, $0001, $0003, $0007, $000F, $001F, $003F, $007F, $00FF, $01FF, $03FF, $07FF, $0FFF)

ErrName = ( 'GIF file not found', 'Not a GIF file', 'Missing color table', 'Bad data', 'No data', 'Unexpected EOF', 'Bad code size', 'Bad code', 'Bad bit size', 'Bad bitmap')

Could not make BMP file

ExtensionIntroducer = $21

indicates the end of the GIF data stream

geBadCode = 8

bad code size

geBadCodeSize = 7

unexpected EOF

geBitSizeOverflow = 9

Bad code was found

geEmptyBlock = 5

image descriptor preceeded by other unknown data

geImagePreceded = 4

no Global Color table found

geNoBMP = 10

bit size went beyond 12 bits

geNoError = 0

the maximum number of different codes 0 inclusive } { error constants

geNoFile = 1

no errors found

geNoGlobalColor = 3

file is not a gif file

geNotGIF = 2

gif file not found

geUnExpectedEOF = 6

Block has no data

idColorTableSize = $07

reserved - must be set to $00

idInterlaced = $40

set if a local color table follows

idLocalColorTable = $80

image descriptor bit masks

idReserved = $0C

set if color table is sorted

idSort = $20

set if image is interlaced

ImageSeparator = $2C

lsdColorResolution = $70

set if global color table follows L.S.D.

lsdColorTableSize = $07

set if global color table is sorted - 1 bit

lsdGlobalColorTable = $80

logical screen descriptor packed field masks

lsdSort = $08

Color resolution - 3 bits

MAXCODES = 4095

terminates stream of data blocks

MAXSCREENWIDTH = 800

Trailer = $3B

size of color table as above

Variables