formats:frm16
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
formats:frm16 [2010-09-26 10:30] – edheldil | formats:frm16 [2011-11-21 22:36] (current) – [Scanline Lookup Table, LUT] edheldil | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== FRM16 ==== | ==== FRM16 ==== | ||
- | *.frm16 files are static | + | *.frm16 files are simple bitmap |
- | Allegedly | + | Supposedly |
- | [FIXME: quotes on FRM/FRM16 and JPEG-like compression] | + | FRM16 file consists of a header |
- | [FIXME: links to convertors by Balder, Miloch, ...] | + | |
+ | Depending on a file type, pixels are either uncompressed (type 64), or RLE-compressed (file type 68). Only the type 68 allows transparency. | ||
- | There are at least two types - 64 and 68 | + | In the older incarnations of the format, layers were probably a way to encode alpha (transparency) in FRM16 files - the first layer would be opaque (possibly with fully transparent pixels in type 68), the second layer would be 80% opacity and so on with the fifth one being 20% opacity. |
- | Type 64 is a simple uncompressed bitmap with some indices | + | However |
- | Type 68 is some encoded format - RLE and possibly some JPEG compression [FIXME: add quote] | + | Perhaps the 2nd and 3rd layers, unused in Lionheart, could be reused for height and normal maps for fake 3D effect (2.5D). |
+ | ==== Header ==== | ||
Header (36 bytes) | Header (36 bytes) | ||
^ Offset ^ Size ^ Description | ^ Offset ^ Size ^ Description | ||
| 0x00 | 2 | Signature (0x1032) | | | 0x00 | 2 | Signature (0x1032) | | ||
- | | 0x02 | 2 | Anchor X ? | | + | | 0x02 | 2 | Anchor X | |
- | | 0x04 | 2 | Anchor Y ? | | + | | 0x04 | 2 | Anchor Y | |
| 0x06 | 2 | Width in pixels (portraits = 90, areas = 779) | | | 0x06 | 2 | Width in pixels (portraits = 90, areas = 779) | | ||
| 0x08 | 2 | Height in pixels (portraits = 111, areas = 330) | | | 0x08 | 2 | Height in pixels (portraits = 111, areas = 330) | | ||
| 0x0a | 2 | Flags? Either 0 (normal) or 107 (immediate) | | | 0x0a | 2 | Flags? Either 0 (normal) or 107 (immediate) | | ||
| 0x0c | 2 | Type (64 or 68) | | | 0x0c | 2 | Type (64 or 68) | | ||
- | | 0x0e | 2 | Unknown, possibly padding, always 0 | | + | | 0x0e | 2 | Unknown, possibly padding, always 0 in standalone files | |
- | | 0x10 | 4 | Data size for opaque layer | | + | | 0x10 | 4 | Bitmap |
- | | 0x14 | 4 | Data size for % layer | | + | | 0x14 | 4 | Bitmap |
- | | 0x18 | 4 | Data size for % layer | | + | | 0x18 | 4 | Bitmap |
- | | 0x1c | 4 | Data size for % layer | | + | | 0x1c | 4 | Bitmap |
- | | 0x20 | 4 | Data size for % layer | | + | | 0x20 | 4 | Bitmap |
==== Layers ==== | ==== Layers ==== | ||
- | Layer | + | Each layer consists of a bitmap and a scanline lookup table (LUT). |
- | ^ Offset ^ Size ^ Description | + | |
- | ==== Pixel Encoding, RLE ==== | ||
- | Type 64 files do not use any compression. Each pixel in encoded in a 16bit word, probably with a common | + | ==== Bitmap ==== |
- | Type 68 FRM16 files use Run Length Encoding, RLE. Each image line consists of a series of pixel runs. The scheme uses two highest bits in the first bytes of each run. If bit 7 is set, lower bits contain number of pixels to skip. If bit 7 is clear and bit 6 is set, lower bits contain number of 16bit pixels which follow. If both bits 7 and 6 are cleared, the lower bit contain a number of repetion of the following 16 bit word. | + | Pixel color is encoded as a 16bit word, with a 5-6-5 RGB encoding. FIXME: How are fully transparent pixels encoded? |
+ | Type 64 files do not use any compression. Each bitmap consists of width x height pixels of 2 bytes each. | ||
- | ==== Color Encoding | + | Type 68 FRM16 files use Run Length |
- | Pixels' | + | For example: |
+ | 81 42 ff fe ff fc 05 00 00 | ||
+ | would result in | ||
+ | __ __ ff fe ff fc 00 00 00 00 00 00 00 00 00 00 | ||
+ | (First one pixel (0x81 & 0x7f) is skipped, then two (0x42 & 0x3f) whitish pixels are copied, then a black pixel is copied | ||
+ | |||
+ | In type 68 files, the first 4 bytes in a bitmap is a DWORD containing bitmap' | ||
+ | |||
+ | |||
+ | |||
+ | ==== Scanline Lookup Table, LUT ==== | ||
+ | |||
+ | Array of 32bit indices into bitmap pointing to beginnings of each bitmap scanline. The first index is 0 in type 64 files, 4 in type 68 files. | ||
+ | |||
+ | ^ Offset ^ Size ^ Description ^ | ||
+ | | 0x00 | 4 | Offset of the 1st scanline (0 in type 64 files, 4 in type 68 files) | | ||
+ | | 0x04 | 4 | Offset of the 2nd scanline | | ||
+ | | ...||| | ||
+ | | height * 4 - 4 | 4 | Offset of the last scanline | | ||
+ | |||
+ | ==== References ==== | ||
+ | |||
+ | [FIXME: quotes on FRM/FRM16 and JPEG-like compression] | ||
+ | [FIXME: links to convertors by Balder, Miloch, | ||
formats/frm16.1285497018.txt.gz · Last modified: 2010-09-26 10:30 by edheldil