Closepath – AMT Datasouth PAL User Manual
Page 70

closepath
64
closepath
Description
Closes the current drawing sub-path by drawing a line from the current point to the initial point of
the sub-path.
Usage
closepath
Comments
Paths consist of a series of line segments. As the programmer adds additional line segments onto
the end of a path, PAL joins the lines in memory. By joining the lines, PAL can smooth the
transition between two line segments during drawing. However, even if the programmer makes the
end of the final line meet the start of the first line, PAL does not know if it should join together
these first and last line segments.
By using the closepath operator, the programmer instructs PAL to connect the end of the path to
the beginning of the path. This allows PAL to smooth the connection between the last and first line
segments of the path.
The example below shows what happens when using only the moveto, lineto, and stroke opera-
tors to draw a square with butt line caps. The solid line in the center shows the path specified by
the moveto and lineto operators. The gray area shows the line actually drawn based on the current
line width. The drawing sequence starts and ends in the upper left corner of the square. Since the
example does not use closepath, PAL draws the start and end of the path, both in the upper left
corner, using the default butt line caps. This results in a notch where the lines come together. The
size of the notch varies directly with the line width.
By replacing the final lineto operator with the closepath operator, the programmer instructs PAL
to smooth the connection at the start and end of the square. The example given below illustrates the
result of using the closepath operator instead of the final lineto operator necessary to close the
square.