SetDepth(depth[, t])
depth.
depth must be a bit depth ranging from 1 (= 2 colors) to 8 (= 256 colors). See Palette overview for details.
Note that if the specified depth is less than that of the pixel data attached to the palette, the
pixel data will be remapped to match the new depth.
By default, the current display's palette is the active palette but of course only in case the current display is a palette mode display. See Palette mode displays for details. A palette can be made the active one by using the SelectPalette() command.
Alternatively, the specified depth can also be set to a different palette object.
To do so, you need to pass the optional table argument to SetDepth() and specify
the Type and ID tags. See below for an example.
The following tags are supported by the optional table argument t:
Type:
#ANIM #BGPIC #BRUSH #DISPLAY #LAYER #PALETTE #SPRITE |
Note that if you use types #ANIM or #SPRITE, you also need to set the Frame
tag (see below) to indicate the frame whose depth you want to modify. If
you use #LAYER and the specified layer is an anim layer, you also need to
set the Frame tag.
Type defaults to the type of the currently active palette selected using
SelectPalette(). See SelectPalette for details.
ID:
Frame:
Remap:False, out-of-range pens will not be remapped to existing pens
but instead they will simply be set to the pen specified in the ClipPen tag (see below),
i.e. no remapping will take place. Note that Remap is only effective when reducing colors. If
the new depth has more pens than the old depth, Remap won't do anything. (V10.0)
ClipPen:Remap tag is set to False (see above). In that case,
out-of-range pens will not be remapped to existing pens but will simply be set to the
pen specified in the ClipPen tag, i.e. no remapping will take place. Note that ClipPen
is only effective when reducing colors. If the new depth has more pens than the old depth,
ClipPen won't do anything. (V10.0)
SetDepth(4, {Type = #BRUSH, ID = 2})
The code above sets the palette depth of brush 2 to 4 (= 16 colors).