Name
WritePen -- write pen to palette object (V9.0)
Synopsis
WritePen(x, y, pen[, t])
Function
This function writes the pen specified by pen to the position specified by x and y in the currently active palette object. By default, the current display is the active palette object but of course only in case the current display is a palette mode display. See Palette mode displays for details. You can set the active palette object using the SelectPalette() command.

Alternatively, you can also use WritePen() to write a pen to a different palette object. To do so, you need to pass the optional table argument t to WritePen() and specify the Type and ID tags. See below for an example.

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

Type:
Set this to the type identifier of the object from whose pixel data you want to write to. This can be one of the following object types:

 
#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 pixel data should be used. 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 object selected using SelectPalette(). See SelectPalette for details.

ID:
Set this tag to the identifier of the object whose pixel data should be used. The default is the identifier of the currently active palette object set using SelectPalette(). See SelectPalette for details.

Frame:
If the target type is an animation, sprite, or anim layer, you need to set this tag to specify the frame whose pixel data should be used. Frames are counted from 1. Defaults to 1 when used with anims and sprites and to the current frame when used with anim layers.

Inputs
x
x position to write to
y
y position to write to
pen
the pen to write
t
optional: table for specifying further options (see above)
Example
WritePen(0, 0, 10, {Type = #BRUSH, ID = 2})
The code plots a pixel that uses pen 10 to the top-left corner in brush 2.

Show TOC