PXL (Pixel Image Data)
Indexed-color image data of the sprite editor.
| Extension | .PXL |
|---|---|
| ID | 0x11 |
Overview
The PXL format stores 4-bit or 8-bit indexed-color images created and edited by the PlayStation sprite editor. Palette information is not included, because it is held in a CLT file that is used together with the PXL file. The format has a simple header with an ID field and a FLAG field, which is followed by the raw pixel data.1
All values are stored in little-endian format. The bytes of a 16-bit or 32-bit value are therefore stored in ascending order, so a 32-bit value is stored as byte 0, byte 1, byte 2 and then byte 3.1
ID
The ID field is a 32-bit value with the following bit definition:1
| Bits | Field | Value |
|---|---|---|
| 0..7 | ID | 0x11 |
| 8..15 | Version No. | 0x00 |
| 16..31 | Reserved | All zero |
FLAG
The FLAG field is a 32-bit value that describes the pixel data format. Bit 0 (PMODE) is the pixel mode, 0 for 4-bit CLUT and 1 for 8-bit CLUT. The other bits are reserved and zero.2
Pixel Data
The pixel data section has a short header followed by raw image data that is ready to be copied to the VRAM of the PlayStation:2
| Field | Contents |
|---|---|
| bnum | Length of the pixel data in bytes, including the 4 bytes of bnum |
| DX | Frame buffer x coordinate |
| DY | Frame buffer y coordinate |
| W | Size of the data in the horizontal direction |
| H | Size of the data in the vertical direction |
| DATA | VRAM data (16 bits) |
The structure of one 16-bit item depends on the mode. In 4-bit mode it holds pix0 to pix3 from the LSB, and in 8-bit mode it holds pix0 and pix1. The pixels appear on the screen in that order starting from the left. In 16-bit mode an item holds R, G and B in 5 bits each and the STP bit in bit 15.3
The VRAM coordinate system is based on 16 bits per pixel, so care is needed with the coordinate and size values. In the X direction one VRAM pixel holds 4 pixels in 4-bit mode and 2 pixels in 8-bit mode. Consequently the image width must be a multiple of 4 in 4-bit mode and an even number in 8-bit mode.3