Skip to main content

Crate mirx

Crate mirx 

Source

Modules§

chunk_type

Structs§

ChunkEntry
ChunkFile
Borrows the chunk table and IMAGE chunk pixel data from the input buffer.
ChunkFileHeader
FileHeader
FlatHeader
FlatImage
Borrows pixel data from the input buffer; no allocations.
FlatImageInput
ImageChunk
Only raw (compress = 0) IMAGE chunks are decoded; compressed chunks surface as ParseError::UnsupportedCompression.
ImageChunkHeader
ImageChunkInput

Enums§

ColorFormat
On-disk discriminants are byte-stable once shipped. Naming and byte-order match mirui::ColorFormat so reader output is zero-copy on the mirui side. Discriminants are partitioned by family: byte >> 4 identifies the family (1 = indexed, 2 = alpha-only, 3 = luma, 4 = RGB565, 5 = RGB888, 6 = 32-bit), leaving the rest of each 16-byte run open for same-family extensions.
Layout
MirxFile
ParseError

Constants§

CHUNK_FILE_HEADER_LEN
CHUNK_TABLE_ENTRY_LEN
FILE_HEADER_LEN
FLAT_HEADER_LEN
MAGIC
PRIMARY_FORMAT_NONE
Sentinel byte stored in the CHUNK header primary_color_format slot when the chunk has no fixed pixel format (e.g. a VECTOR chunk).
VERSION_MAJOR
Reader rejects files whose major differs (cross-major is breaking).
VERSION_MINOR
Higher minors are tolerated as long as they only add chunks/fields the reader can skip.

Functions§

crc32
encode_chunk_generic
Single-chunk file with an arbitrary chunk_type and a raw payload. FONT / VECTOR / custom critical chunks all wrap their format-specific header inside payload. The primary header fields (color_format, width, height, stride) are zeroed because they don’t apply.
encode_chunk_image
Emits one raw IMAGE chunk; multi-chunk files need a different writer.
encode_chunks
Multi-chunk file: writes chunks (each (chunk_type, flags, payload)) into one CHUNK-layout buffer, table then payloads. The reader resolves them via ChunkFile::chunk_payload / ChunkFile::chunk_payloads. Primary header fields stay zeroed — a multi-chunk file (e.g. several FONT representations) has no single primary. encode_chunk_generic is the one-chunk special case.
encode_flat
parse
parse_chunk
parse_flat
peek_header
Only validates the common prefix; layout-specific bytes are untouched.