beautypg.com

Lineto – AMT Datasouth PAL User Manual

Page 132

background image

lineto

126

lineto

Description

Appends a line to the current path which extends from the current point to the specified point.

Usage

XNum YNum

lineto

XNum

Integer or fixed-point. Specifies the X component of the user coordinate to
which to extend the line.

YNum

Integer or fixed-point. Specifies the Y component of the user coordinate to
which to extend the line.

Comments

The lineto operator does not actually draw a line on the current page. Instead, PAL adds the line to
a drawing path which it keeps in memory. As the programmer specifies additional drawing
operations, PAL continues to append these operations to the end of the drawing path. Once the
programmer has specified the entire path for PAL to draw, the programmer uses the stroke
operator to instruct PAL to actually stroke the path onto the page. PAL also provides the
setlinewidth and setlinecap operators which influence the stroke operator.

In general, the programmer should not use lineto to finish a path around a closed object such as a
square. For a square, the drawing sequence should use lineto to draw the first three sides of the
square, but closepath for the final side. closepath instructs PAL to join the end of the closepath
line to the first point of the path. This allows PAL to smooth the transition from the last line to the
first line during the stroke operation.

After appending the lineto operation to the path, PAL updates the current point in the graphics
state to the specified XNum, YNum coordinate. This allows subsequent drawing orders to
automatically continue from the end of the line.

PAL currently restricts line drawing to horizontal and vertical lines. Therefore, in order to receive
expected results, either the XNum or YNum parameter should match the current point's X or Y
position.

Hints

The rlineto operator provides an easier means for drawing lines of a given length.