ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

PAL

From ModEnc
Revision as of 09:47, 16 June 2007 by Pd (talk | contribs) (enhanced)
Jump to: navigation, search

Format

The PAL file format is very simple. It is a series of 256 colours, each represented by 3 bytes in the RGB format:

struct PAL{
  unsigned char red;
  unsigned char green;
  unsigned char blue;
} colours[256];

Each colour value (red, green and blue) is represented by 6 bits only, which means 63 is the highest a colour value can get (rather than 255).
For example, pure red would be represented as 00111111 (63 in decimal) in the red byte.
The highest two bits are always zero, so that one colour value still takes 8 bits in the file.


SHP files refer to a colour index in a PAL file.
0 is the first colour (3 bytes), which is used as the transparent colour of the SHP image (i.e. it will not be copied to the screen when drawn).
In shadow frames, colour 1 is used for shadows.
In remapable SHP images, the colors 16 to 31 are the different remap stages.