Name
SetLayerDepth -- set layer palette depth (V9.0)
Synopsis
SetLayerDepth(id, depth[, t])
Function
This function sets the depth of the palette of the layer specified by id to the depth specified in 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.

The following tags are supported by the optional table argument t:

Frame:
If the layer is an anim layer, you can set this tag to specify the frame whose depth should be set. Frames are counted from 1. Defaults to the anim layer's current frame.

Remap:
If this tag is set to 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:
This is only used in case the 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)

You need to enable layers before you can use this function. See Layers introduction for details.

Inputs
id
identifier of layer to modify
depth
desired new palette depth (ranging from 1 to 8)
t
optional: table argument containing further options (see above)
Example
SetLayerDepth(1, 8)
The code above changes the depth of layer 1's palette to 8 (= 256 colors).

Show TOC