FGI File Format

In the context of a Fastgraph/Image FGI library, an index is a block of pointers containing (among other things) offsets to each file in the FGI library. Every FGI file has at least one index. When an FGI file requires more than one index, the indexes are distributed throughout the FGI file, with the last entry of each index pointing to the next index. Each index entry is 24 bytes long and is structured as shown here (all integer values are stored low-order byte first).

offset

size

description

0

12

File name (zero-filled if necessary)

12

4

Byte offset within FGI file to start of file

16

4

File size in bytes

20

1

Image type (1=PCX, 3=SPR, 4=PPR, 5=FLI, 6=FLC, 7=FGF, 8=BMP, 9=JPEG, 10=AVI, 0=other)

21

1

Reserved, must be zero

22

2

Image width in pixels (for PPR and SPR files only)

If the first byte of an index entry is FF hex, the entry is instead a pointer to the next index. In this case, the byte offset field (four bytes starting at offset 12) points to the start of the next index; if it is zero, it means this is the last index in the FGI file.

Note that the index size (which defaults to 32, but may be changed with the FGILIB utility's /N option) does not include the entry pointing to the next index. For example, a 32-entry index actually contains 33 entries -- the first 32 entries point to files, and the last entry points to the next index.

To illustrate the FGI file format, suppose we have a library containing two PCX files, DOG.PCX (2,000 bytes) and MOOSE.PCX (6,000 bytes), plus one PPR file, COWS.PPR (3,000 bytes). If we created the FGI library with the command

FGILIB ANIMALS.FGI +DOG.PCX +MOOSE.PCX +COWS.PPR /W:640

then the FGI file's index entries would be set up as shown here.

(DOG.PCX,792,2000,1,0,0)

(MOOSE.PCX,2792,6000,1,0,0)

(COWS.PPR,8792,3000,4,0,640)

Note that we've used the default index size of 32, meaning each index is 792 bytes long (768 bytes for the 32 entries, plus 24 bytes for the pointer to the next index). The files themselves occupy 11,000 bytes, meaning the FGI file size is 11,792 bytes. Because our FGI library contains just three files, we could specify /N:3 when creating or packing the library to eliminate unused index entries. The index would then require just 96 bytes, so the FGI file size would be 11,096 bytes.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.