Theme Package File Specification

Manju stores theme meta-data and pixel data in a single binary file that is suitable for mmap(P) and optimized for little endian machines. The theme files are created atomically (by using file moves) and in read-only mode. Installation scripts should also use file moves/renames to retain atomicity of theme file modifications.

The first part of a theme file contains magics and all the meta-data, the later part contains pixel data. This organization is used to allow quick access to all meta data like sizing information and should be retained in future file format modifications.

All content fields including offsets into the actualy pixel data are generally 4-byte aligned. Objects can be adressed through an offset index table and are sorted by lexical order of the object names to allow binary searches via the index table.

Strings are encoded in UTF-8 format, prefixed with the string length and padded up to the next 4-byte boundary.

Theme Package Format
	ManjuThemePkg0\r\n	// magic
	llll ThemeName		// plain string
	nnnn			// number of objects, offset fixpoint
	jjj1 jjj2 ... jjjn	// index of object 1..n
	jjjT			// pixdata index, points after last object
	[ __PIXELOBJECT__ ]+
	[ __PIXELDATA__ ]+
Pixel Object Format
	llll ObjectName		// plain string
	kkkk			// number of aux entries
	[ llll AuxEntry ]*	// kkkk times aux entry strings
	tttt			// rowstride
	wwww			// width
	hhhh			// height
	pppp			// offset into pixel data
Pixel Data Format
	[ BGRA ]{length}	// length = rowstride * height

Here, 'BGRA' represents an unsigned 32 bit ARGB integer in little endian format. The RGB and Alpha channels are stored in premultiplied form.

Aux Strings

General format: KEY '=' STRING Where KEY consists of simple alphanumerics, and STRING is UTF-8 encoded, not embedding 0s.

Coordinate Range:

	'(' OFFSET ',' EXTEND ')'

Coordinate Rectangle:

	'(' X ',' Y ',' WIDTH ',' HEIGHT ')'

Numbers should be simple floats and may be surrounded by whitespaces.