Call Box Commands
Version 2.0 15 Jan-90


CALL PN the PEN commands

There are 9 commands that control pens. Each graphics port has its own pen. This pen has several attributes that determine how it will behave. Any drawing, be it a line, rectangle, oval, text or whatever is done with a pen. For example let's say that you want to draw a framed rectangle using pattern number 7 and have the vertical lines of the rectangle 2 pixels wide and the horizontal 1 pixel high:

First set the pen size to 1 x 2:

CALL PN,2,1,2

Now make the pen visible ... (able to draw)

CALL PN,4,7

And draw the framed rectangle:

CALL RE,0,X,Y,W,H

This pen will keep these attributes until you change them to something else. If you draw to another graphics port then the attributes of that ports pen will be active which mayor may not have the same attributes as the previous ports pen.

All pens start up with defaults of pen size = 1 x 1 and pen mode = copy.

Note: Do not confuse a pen with a cursor, even if it looks like a little pen! Pens do not have a graphically visible counterpart like a cursor but are conceptual in nature. You only see the trail left by a pen and not the pen itself.

Pens have so many commands because they are at the heart of all graphic goings on in the toolbox and many variations are needed to create the effects seen in a IIgs application. The pen can draw in anyone of 8 different modes as shown in Figure 2.11. It is best to experiment with the different modes to get a feel for how they work.

COMMAND FUNCTION DESCRIPTION
CALL PN,0 HIDE PEN: makes the pen invisible.
CALL PN,1 SHOW PEN: makes the pen visible.
CALL PN,2,H, V MOVE PEN: moves the pen to the coordinates specified by V and H.
CALL PN,3,(color#) SET PEN TO COLOR: sets a color from 0-15 of the current palette.
CALL PN,4,(pattern#) SET PEN TO PATTERN: sets a pattern from 0- 15 of the current pattern.
CALL PN,5, WI,HT SET PEN SIZE: sets the pens width and height.
CALL PN,6,(mode) SET PEN MODE: sets the pen to any of the modes described in Figure 2.11.
CALL PN,7 RESET PEN: sets the pen to default attributes.
CALL PN,8,"pathname" LOAD PATTERN: loads a set of 16 patterns.


H
Horizontal pen position in global coordinates.

V
Vertical pen position in global coordinates.

(color#)
A number 0-15 that selects the solid color to use.

(pattern#)
A number 0-15 that selects the pattern to use.

WI
Width of pen in pixels.

HI
Height of pen in pixels.

(mode)
a number 0-7 that selects the pen mode (see Figure 2.11).

(parhname)
a ProDOS pathname of the pattern to load.


Figure 2.11
Figure 2.11 Pen modes