Paganitzu Graphics Format

From ModdingWiki
Jump to navigation Jump to search
Paganitzu Graphics Format
There is no example of an image in this format — upload one!
Format typeImage
HardwareCGA, EGA
Colour depth2-bit (CGA), 4-bit (EGA)
Minimum size (pixels)0×0
Maximum size (pixels)65535×65535
PaletteNone (default)
Plane count2 (CGA), 4 (EGA)
Transparent pixels?No
Hitmap pixels?No
Games

The Paganitzu Graphics Format is an image format used in Paganitzu that can contain EGA or CGA images.

File format

The file starts with a 7 byte long BASIC BSAVE/BLOAD header, detailing the amount of data and where in memory it was originally saved from. It is unknown whether the game loads the data back into this same memory location, or whether the destination is calculated by some other means.

Each episode uses 4 or more different graphics sets, like Ingame Menu, Sprites/Tiles, Digits and Event graphics. For each of these, there is an EGA version and a CGA version. The file with the EGA version seems to have the same header as the file with the CGA version. Other than that, the meaning of the header is unknown.

Image Blocks:

0 UINT16LE	iWidth
2 UINT16LE	iHeight
4 BYTE[size]	raw pixel data
x BYTE[6]	(padding?)

Though the basic structure of the image blocks is identical for both EGA and CGA graphics, the values are handled differently.

EGA Images

The iWidth and iHeight values store width and height of the image in pixels.

Let iWidth8 be (Width/8) rounded UP to the next integer (as an integer division that is (iWidth + 7) / 8). The size of the pixel data is 4*iHeight*iWidth8.

The pixel data is row-planar EGA data. Assume the image is 16 pixels wide. Then the byte order is as follows:

b0 b1 g0 g1 r0 r1 i0 i1	// first row
b2 b3 g2 g3 r2 r3 i2 i3	// 2nd row
...

CGA Images

The iWidth value must be divided by 2 to get the image width in pixels.

Let iWidth8 be (Width/8) rounded UP to the next integer. The size of the pixel data is 2*iHeight*iWidth8. Therefore the raw pixel data has the same size as in the EGA file, but only the first half of this block contains pixel data. The other half is empty.

Each byte in the pixel data contains colour information for 4 pixels. The two highest (leftmost) bits form the palette index for the leftmost pixel. Assume the byte value in the pixel data is 0xE4 which is 11100100 in binary. Divided amongst 4 pixels that is 11-10-01-00 in binary or 3-2-1-0 in decimal.

Credits

This file format was reverse engineered by K1n9_Duk3. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)