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

Difference between revisions of "PAL"

From ModEnc
Jump to: navigation, search
(enhanced)
Line 1: Line 1:
 
== Format ==
 
== Format ==
 
The PAL file format is very simple.  
 
The PAL file format is very simple.  
It is a series of colours, represented by 3 bytes each in the format
+
It is a series of 256 colours, each represented by 3 bytes in the RGB format:
    struct colour{
+
struct PAL{
        Uint8 red;
+
  unsigned char red;
        Uint8 green;
+
  unsigned char green;
        Uint8 blue;
+
  unsigned char blue;
    };
+
} colours[256];
  
SHP files refer to an index in this file. 0 is the first colour (3 bytes), which is used as the transparent colour in the SHP file.<br>
+
Each colour value (red, green and blue) is represented by 6 bits only, which means {{tt|63}} is the highest a colour value can get (rather than 255).<br>
Index 1 of a palet file would be bytes 4, 5 and 6.
+
For example, pure red would be represented as {{tt|00111111}} ({{tt|63}} in decimal) in the red byte.<br>
 +
The highest two bits are always zero, so that one colour value still takes 8 bits in the file.
  
Each byte only stores 6 bits of data, for example pure red would be represented as "00111111" (in binary) in the red byte.
+
 
 +
SHP files refer to a colour index in a PAL file.<br>
 +
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).<br>
 +
In shadow frames, colour 1 is used for shadows.<br>
 +
In remapable SHP images, the colors 16 to 31 are the different remap stages.
  
 
[[Category:General_Editing_Information]]
 
[[Category:General_Editing_Information]]
 
[[Category:File Formats]]
 
[[Category:File Formats]]

Revision as of 09:47, 16 June 2007

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.