color = GetPen(pen[, t])
pen
from the currently active palette.
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, you can also use GetPen()
to get the pen color from a different palette object.
To do so, you need to pass the optional table argument t
to SetPen() 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 palette you want to query. 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:
@DISPLAY {Palette = #PALETTE_MONOCHROME} color0 = GetPen(0) color1 = GetPen(1)The code above creates a monochrome palette display and queries the colors of the first two pens.
color0
will be black and color1
will be white.
color = GetPen(4, {Type = #BRUSH, ID = 2})The code gets the color of pen 4 in brush 2.