The SIF file format is intended to be an encapsulated sprite data and image storage for generic use. SIF files contain all of the image data required by the sprite along with metadata describing what sequence the images need to be displayed to create animations, including delays, sizes and X/Y position adjustments for each rectangular frame image.
The basic file is divided into three portions:
-A very minimal header segment (16 bytes)
-A structure segment defining data for recreating the animation sequences
-An image segment which contains a list of compressed bitmap frames (compression optional)
-An optional list of palettes that are referenced by images with either 16 or 256 colors
File Format
WORD "SF" (Denotes file type).This value is -21677 (signed) or 21676 (unsigned). BYTE Version number. The contents of this document only apply to version "2". BYTE Flags. As of version 1 there are no flags. This value should be 0. DWORD Offset to the Animation Segment. This allows for an arbitrary amount of additional header to be added at a later date, or as a means to include application-specific data within the file. DWORD Offset to the Image segment. If all you're interested is loading the image data, jump to this offset to skip the structure segment. DWORD Offset to the Palette Segment, if any. A value of 0 indicates no Palette segment.
WORD Number_of_actions_defined - 1 (eg: Actions 0 to this_value) WORD Number_of_directions_defined - 1 (for Action 0) WORD Number of frames defined (For Action 0, Direction 0) WORD Frame ID for Action 0, Direction 0, Image 0 WORD Just temp storage for internal use. Should be 0 WORD Frame lag value DWORD Hotspot X relative to upper left corner DWORD Hotspot Y relative to upper left corner WORD Frame ID for Action 0, Direction 0, Image 1 WORD Just temp storage for internal use. Should be 0 WORD Frame lag value DWORD Hotspot X relative to upper left corner DWORD Hotspot Y relative to upper left corner (More images as required) WORD Number of frames defined (For Action 0, Direction 1) (Images as described above) (More directions as required) WORD Number_of_directions_defined - 1 (for Action 1) (Directions as described above) (Images as described above) (More actions as required)
WORD Number of frames in list For each frame: WORD Flags (See below) WORD Pointer to Alpha Channel mask image (Only used if flag bit 3 set) WORD Default Palette to use (if 4bpp or 8bpp) BYTE Color Depth (Bits per pixel) DWORD 24-bit color to be treated as "Transparent" DWORD Height of frame DWORD Width of frame DWORD Length of bitmap data OR compressed stream STRING Bitmap data or compressed streamFLAGS has the following values and meanings:
Bit Meaning --- ----------- 0 Image has transparency 1 Auto-Generate transparency mask 2 Image has Alpha transparency 3 Use seperate Alpha mask (See note 1) 4 Custom Palette appears after bitmap data (Ignore palette index, use custom) 5 RESERVED 6 RESERVED 7 RESERVED Flag's High Byte is a value 0 to 255 indicating what type of compression, if any, has been applied to the data stream: 0 No compression. Data stream is raw Bitmap data. 1 Image is RLE compressed (Size matches color depth) 2 Image is Huffman compressed 3 Image is LZW (GIF) compressed (See Note 2) 4 Image is PNG compressed (Additional image/compression formats may be added later)Note 1: Bit 3 is only relevant if bit 2 is set. If 2 is set but 3 is not, then the progam should assume that the 4th byte in the 32bpp image is a 8-bit alpha channel. If the image is not 32bpp but bit 2 is set and bit 3 clear, then the program should ignore request for alpha channel support.
1bpp (Monochrome) 4bpp (16 color palette) 8bpp (256 color palette) 16bpp (RGB565) 24bpp (RGB888) 32bpp (ARGB8888)
WORD Number of Palettes in collection For each Palette: BYTE Color depth for each palette entry (only 16, 24 or 32 allowed, but no alpha with 32) BYTE Number of colors defined STRING List of WORD or DWORD colorsCredits