Expand description
Raster pixels: the Offscreen table and its block data.
An offscreen is a grid of 256×256 blocks. Offscreen.Attribute says how
big it is and how a block’s bytes are laid out; Offscreen.BlockData is
the id of an external chunk holding the zlib-compressed blocks (spec:
docs/spec/04-raster.md).
Attribute (big endian): u32 16, u32 len(Parameter), u32 len(InitColor), u32 len(BlockSize), then three sections, each a UTF-16 name followed by
u32 values. The values of Parameter and InitColor are, in order, the
columns of the unused VOffscreen table in ParamScheme
(BlockDataChannelOrder, BlockDataPixelBytes, … InitColorDataAlphaValue).
A decompressed block is an alpha plane followed by an image plane:
channel_order | kind | block bytes | planes |
|---|---|---|---|
| 0x21 (33) | colour | 327 680 | alpha 256×256, then BGRA 256×256×4 (the 4th byte unused) |
| 0x11 (17), 2 bytes/pixel | gray | 131 072 | alpha, then gray |
| 0x11 (17), 1-bit | monochrome | 16 384 | alpha 1 bit/pixel, then 1 bit/pixel |
| 0x01 (1) | mask / alpha only | 65 536 | one plane |
The external payload (big endian): u64 length of the rest, one record
per block (u32 record length, name "BlockDataBeginChunk", u32 index, u32 decompressed size, u32 256, u32 256, u32 has data, [u32 4 + n, u32le n, n bytes of zlib], name "BlockDataEndChunk"), then the tail
sections BlockStatus and BlockCheckSum (name, u32 12, u32 count, u32 4, count × u32). The checksum is the Adler-32 of u32le n + the zlib
bytes, 0 for an empty block. CSP compresses with zlib level 1.
Structs§
- Attribute
Offscreen.Attribute, kept value for value so it can be written back.- Block
- One block record of the payload.
- Block
Data - The external payload of an offscreen.
- Init
Color InitColor: how blocks that are not stored start out.- Offscreen
- A decoded offscreen.
- Parameter
- The fields of the
Parametersection, named afterVOffscreen. - Section
- One named section of the attribute: its
u32values. - Table
- A tail table (
BlockStatus,BlockCheckSum).
Enums§
- Pixel
Kind - Pixel layout of an offscreen.
Constants§
- BLOCK_
PIXELS - Pixels per block.
- BLOCK_
SIZE - Width and height of a block in pixels.
- EMPTY_
RECORD_ SIZE - Size of a block record without data (the
BlockSizeentry of empty blocks). - RECORD_
OVERHEAD - What a stored block adds to its zlib length in its record.