44.1 Overview

This library provides functions to deal with palettes. As the name implies, a palette is a palette (= set) of colors. The minimum number of colors in a palette is 2 and the maximum number of colors in a palette is 256. The individual colors in a palette are referred to as pens. Those pens are addressed through their indices within the palette, starting from 0. Thus, the first pen in a palette is pen 0, the second one is pen 1, and so on. There can be one pen in a palette that is marked as a transparent pen. Pixels that use this pen, e.g. in a palette brush, will appear transparent then. Typically, pen 0 is the transparent pen.

The number of colors in a palette is referred to as its depth and it is always expressed as a power of 2 exponent. The following depths are available:

1-bit:
2 colors.

2-bit:
4 colors.

3-bit:
8 colors.

4-bit:
16 colors.

5-bit:
32 colors.

6-bit:
64 colors.

7-bit:
128 colors.

8-bit:
256 colors.

Because of the limited number of colors that can be stored in a palette, palette graphics are no longer widely used today. However, using palette graphics does have some advantages over using RGB graphics in certain situations, for example:

Of course, in order to become useful, a palette always needs to be attached to another object that provides the actual pixel data that should be drawn using the colors taken from the palette. In Hollywood, the following object types support palettes:

For most object types, you can just set the LoadPalette tag to True in functions like LoadBrush() to make Hollywood create a palette brush for you. You can also convert RGB brushes to palette brushes using functions like QuantizeBrush() or RemapBrush(). Once you have a palette object, you can change its palette using the SetPalette() function.

Special care needs to be taken when putting a display in palette mode. This will have several implications that you need to be aware of in order to make the most out of a palette mode display. See Palette mode displays for details.


Show TOC