Message-ID: <331D21B2.2715@eik.bme.hu> Date: Wed, 05 Mar 1997 08:33:06 +0100 From: "DR. Andras Solyom" Reply-To: solyom AT eik DOT bme DOT hu Organization: Technical University of Budapest MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: fli/flc files.. References: <9702271202 DOT AA11514 AT syntegra DOT bt DOT co DOT uk> <8waMLRALkeFzEw4B AT talula DOT demon DOT co DOT uk> <5f4vf7$m9s AT news DOT ox DOT ac DOT uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit David Jenkins wrote: > > In article <5f4vf7$m9s AT news DOT ox DOT ac DOT uk>, George Foot > writes > >Or write a FLI reverser, i.e. make a routine which creates the animation > >in reverse. In this way, to step back a frame you would display the > >changes from the reversed file, and to step forward a frame you would > >use the normal file. This could perhaps be done internally, in memory, > >rather than on disk. > > > >It's just an idea - I don't know anything about FLI, so maybe it's not > >possible. > > > How hard would it be to add an FLI writer function??? > The FLI file format is documented in the book Graphics File Formats, (1995 Windcrest) Chapter 29 FLI/FLIC Animation. Just a little information about it: The FLI and FLC headers are 128 bytes long, with contents as shown in Tables 1 and 2. Table 1: FLI file header ------------------------- Offset Size Name Description 0 4 Size Integer, byte length of file 4 2 "magic" Magic number Hex AF11, FLI identifier 6 2 Size Number of frames in file; 4000 max 8 2 Width Screen width (320 pixels) 10 2 Height Screen height (200 pixels) 12 2 none blank 14 2 Flags Set to 0 16 2 Speed Number of video ticks per frame @ 70 ticks/sec 18 4 Next Set to 0 22 4 Frit Set to 0 26 102 Expansion All zeroes--for future expansion Table 2: FLC file header --------------------------- Offset Size Name Description 0 4 Size Integer, byte length of file 4 2 "magic" Magic number Hex AF12, FLC identifier 6 2 Size Number of frames in file; 4000 max 8 2 Width Screen width (pixels) 10 2 Height Screen height (pixels) 12 2 Bits/primary 8 14 2 Flags3 Indicating file properly closed 16 4 Speed Milliseconds delay per frame 20 4 unused 0 22 4 Created Creation date, MS-DOS format 26 4 Creator Serial # of Animator Pro program used to create animation If not Animator Pro, then ASCII "FLIB" (hex 464C4942) 30 4 Updated Most recent update date, MS-DOS format 34 4 Updater Like Creator, but for most recent update 38 2 AspectX X portion of aspect ratio X:Y 40 2 AspectY Y portion of aspect ratio X:Y 42 38 reserved all zeroes 80 4 Offset1 Offset from beginning of file to first frame chunk 84 4 Offset2 Offset to second frame chunk, used for looping 88 40 reserved All zeroes FLC files are generally found in the following resolutions: 320 x 200, 640 x 480, 800 x 600, 1280 x 1024. In FLC files, a prefix chunk may follow. This data structure contains no information useful for playback and may be omitted or skipped. Its presence may be detected and the prefix skipped by reading the 16 bytes following the file header. Normally, these next 16 bytes are a frame header, as shown in Table 3. If a prefix is present, the first four bytes give the prefix size in bytes (including the 16 bytes); the next two bytes contain the code Hex F100. Table 3: FLI/FLC frame header ----------------------------- Offset Size Name Description 0 4 Size Bytes in frame, including header (< 64K for FLI) 4 2 ID Hex F1FA, identifying this as a frame 6 2 Chunks Number of "chunks" in frame; 0 indicates identical frame 8 8 reserved All zeroes FLC files may sometimes have an ID code of Hex 00A1 in the header, signifying that the frame does not contain pixel data, but other Animator Pro data. Such a frame may be skipped by using the frame length given by Size, the 4-byte integer preceding the ID code. Chunks follow the frame header. Each starts with a chunk header. The chunk header is outlined in Table 4. Table 4: Chunk header Offset Size Name Description 0 4 Size Bytes in chunk, including header 4 2 Type code Type of chunk Chunk types are given by Tables 29-5 and 29-6. FLC files will generally use FLI_COLOR_256 instead of FLI_COLOR, and FLI_WORD_LCinstead of FLI_LC. Table 29-5: FLI Chunk codes & interpretation Code Name Type of chunk indicated by code 11 FLI_COLOR Compressed data for 64-color palette 12 FLI_LC Line compressed (RLE pixel data) 13 FLI_BLACK Set whole screen to color 0 (appears in first frame only) 15 FLI_BRUN Bytewise run-length compression--first frame only 16 FLI_COPY Uncompressed data (64K bytes) Table 29-6: FLC Chunk codes & interpretation Code Name Type of chunk indicated by code 4 FLI_COLOR_256 Data for 8-bit/primary palette 7 FLI_WORD_LC 2-byte RLE compressed pixel data 11 FLI_COLOR Data for 6-bit/primary palette 12 FLI_LC Line compressed (not generally used in FLC) 13 FLI_BLACK Set whole screen to color 0 (appears in first frame only) 15 FLI_BRUN Bytewise run-length compression--first frame only 16 FLI_COPY Uncompressed data (64K bytes) 18 FLI_PREVIEW "Thumbnail" image data Bear in mind that all chunks are preceded by the chunk header. I hope I do not violate the copyright by enclosing this info... Andras