Drawing Commands
All drawing commands relate to an invisible point of reference
on the screen called the draw
pointer.
Originally, the draw
pointer is at position 0,0. You can change the position by using
the SetDPtr and RSetDPtr commands described in this chapter.
In addition, some draw commands automatically update the
draw pointer. For example, the LineM command draws a line
from the current draw pointer position to the specified end coor
dinates and moves the draw pointer to those end coordinates.
The Line command draws a line but does not move the pointer.
Also, note that all draw commands are affected by the pattern
and logic commands described in Chapter 3.
Do not confuse the draw pointer with the graphics cursor. The
graphics cursor is the graphic representation of the mouse/joy
stick position on the screen.
In this chapter, commands that use relative coordinates
(offsets)
are listed with their counterparts that use absolute coordinates.
For example, RSetDPtr is listed under SetDPtr.,
4-1
OS-9 Windowing System
Arc3P
Draw Arc
Function: Draws an arc with its midpoint at the current draw
pointer position. You specify the curve by both the X and Y
dimensions, as you do an ellipse. In this way, you can draw
either elliptical or circular arcs. The arc is clipped by a line
defined by the (XO1,Y01) - (X02,Y02) coordinates. These coor
dinates are signed 16 bit values and are relative to the center
of the ellipse. The draw pointer remains in its original
Code: 1B 52
Parameters:
HBRx LBRx HBRy LBRy HX01 LX01 HY01
Notes:
The resulting arc depends on the order in which you specify
the line coordinates. Arc3P first draws the line from Point
1 to Point 2 and then draws the ellipse in a clockwise
direction.
0
The coordinates of the screen are as follows:
4-2
Drawing Commands l 4
BarDraw Bar
Function:
Draws and fills a rectangle that is defined by the
diagonal line from the current draw pointer position to the
specified position. The box is drawn in the current foreground
color. The draw pointer returns to its original location.
Code: 1B 4A
Parameters:
HBX LBX HBY LBY
RBarRelative Draw Bar
Function: Draws and fills a rectangle that is defined by the
diagonal line from the current draw pointer position to the
point specified by the offsets. The box is drawn in the current
foreground color. The draw pointer returns to its original loca
tion. This is a relative command.
Code: 1B 4B
Parameters:
HBXo LBXo HBYo LBYo
4-3
OS-9 Windowing System
BOX
Draw Box
Function:
Draws a rectangle that is defined by the diagonal
line from the current draw pointer position to the specified
position. The box is drawn in the current foreground color.
The draw pointer returns to its original location.
Code:
1B 48
Parameters:
HBX LBX HBY LBY
RBOX
Relative Draw Box
Function:
Draws a rectangle that is defined by the diagonal
line from the current draw pointer position to the point speci
fied by the offsets. The box is drawn in the current foreground
color. The draw pointer returns to its original location. This is
a relative command.
Code: iB 49
Parameters:
HBXo LBXo HBYo LBYo
4-4
Drawing Commands l 4
Circle
Draw Circle
Function:
Draws a circle of the specified radius with the cen
ter of the circle at the current draw pointer position. The cir
cle is drawn in the current foreground color. The draw pointer
remains in its original location.
Code: 1B 50
Parameters: HBR LBR
r
4-5
OS-9 Windowing System
Ellipse
Draw Ellipse
Function: Draws an ellipse with its center at the current draw
pointer position. The X value specifies the horizontal radius,
and the Y value specifies the vertical radius. The ellipse is
drawn in the current foreground color. The draw pointer
remains in its original location. This is a relative command.
Code: 1B 51
Parameters:
HBRx LBRx HBRy LBRy
4-6
Drawing Commands l 4
FFiII
Flood Fill
Function:
Fills the area where the background is the same
color as the draw pointer. Filling starts at the current draw
pointer position, using the current foreground color. The draw
pointer returns to its original location. This is a relative
command.
Code:
1B 4F
Parameters:
None
4-7
OS-9 Windowing System
Line
Draw Line
Function: Draws a line from the current draw pointer position
to the specified point, using the current foreground color. The
draw pointer returns to its original location.
Code:
1B 44
Parameters:
HBX LBX HBY LBY
RLineRelative Draw Line
Function: Draws a line from the current draw pointer position
to the point specified by the x,y offsets, using the current fore
ground color. The draw pointer returns to its original location.
This is a relative command.
Code:
1B 45
Parameters:
HBXo LBXo HBYo LBYo
4-8
Drawing Commands / 4
Line M
Draw Line and Move
Function:
Draws a line from the current draw pointer position
to the specified point, using the current foreground color. The
draw pointer stays at the new location.
Code:
1B 46
Parameters:
HBX LBX HBY LBY
RLineMRelative Draw Line and Move
Function:
Draws a line from the current draw pointer position
to the point specified by the offsets, using the current fore
ground color. The draw pointer stays at the new location. This
is a relative command.
'' Code:
1B 47
Parameters:
HBXo LBXo HBYo LBYo
4-9
OS-9 Windowing System
Point Draw Point
Function:
Draws a pixel at the specified coordinates, using
the current foreground color.
Code: 1B 42
Parameters:
HBX LBX HBY LBY
RPointRelative Draw Point
Function: Draws a pixel
at the location specified by
the off
sets, using the current foreground color. This is a relative
command.
Code: 1B 43
Parameters:
HBXo LBXo HBYo LBYo
4-10
Drawing Commands / 4
PutGCPut
Graphics Cursor
Function: Puts and displays the graphics cursor at the speci
fied location. The coordinates passed to this command are not
window
relative. The horizontal range is 0 to 639. The vertical range
is 0 to 191. The default position is 0,0.
This command is useful for applications running under GrfTnt
so that you can display a graphics cursor under WindInt even
if you don't want mouse control of the cursor.
Code: iB 4E
Parameters: HBX LBX HBY LBY
4-11
OS-9 Windowing System
SetDPtrSet Draw Pointer
Function:
Sets the draw pointer to the specified coordinates.
The new draw pointer position is used as the beginning point
in the next draw command if other coordinates are not
specified.
Code: 1B 40
Parameters:
HBX LBX HBY LBY
RSetDPtrRelative Set Draw Pointer
Function:
Sets the draw pointer to the point specified by the
offsets. The new draw pointer position is used as the begin
ning point in the next draw command if other coordinates are
not specified. This is a relative command.
Code:
iB 41
Parameters:
HBXo LBXo HBYo LBYo
4-12