Showing changes from revision #3 to #4:
Added | Removed | Changed
The number of entries in the palette and the format of the colour data supplied by RISC OS is dependent upon the palette type and the current colour depth.
Palette type | Colour depth | Range of indices | Format |
---|---|---|---|
0 (Normal) | 1bpp | 0-1 | &BBGGRRSS palette entry |
2bpp | 0-3 | ||
4bpp | 0-15 | ||
8bpp | 0-255 | ||
16bpp | See below | See below | |
32bpp | 0-255 | &BBGGRRSS gamma table entry | |
1 (Border) | – | 0 | &BBGGRRSS border colour |
2 (Pointer) | – | 0-3 | &BBGGRRSS pointer colour |
3 (TCK) | – | 0-1 | See below |
In 32bpp modes, the hardware gamma table is expected to be a set of four 8bit lookup tables which translate the red, green, blue and supremacy components of a pixel to new values. When receiving a request to update the gamma table, the palette index is used to indicate which table entry to write, for all four tables. The supremacy table entry should be updated with bits 0-7 of the colour, the red table entry should be updated with bits 8-15 of the colour, the green table entry with bits 16-23, and the blue table entry with bits 24-31.
On RISC OS 5.21 and above, 16bpp modes use exactly the same rules as 32bpp modes. Table indices are 0-255 and the data is in &BBGGRRSS format.
Prior to RISC OS 5.21, GraphicsV drivers were supplied the 16bpp gamma data in a format that was directly usable by VIDC20 hardware but required manipulation to be used elsewhere. Ignoring supremacy, the VIDC20 data can be converted to a set of three red, green and blue table indices (from 0-31) and data values (from 0-31) using the following code:
red_idx = idx & 0x1f; green_idx = (idx>>1) & 0x1f; blue_idx = (idx>>2) & 0x1f; red_val = (val>>11) & 0x1f; green_val = (val>>19) & 0x1f; blue_val = (val>>27) & 0x1f;
Palette type 3 is used for transparency colour key (TCK).
Drivers can implement these as read-only values if the values can’t be changed. Drivers should ignore the call if TCK isn’t in use (e.g. alpha blending is being used instead).