Drawing lines
Three methods are used to draw lines. Lines provided in the argument list are drawn using the attributes (such as color, line style, line width) contained in the GC provided in the argument list.
drawLine:x1:y1:x2:y2:
Draws a single line.
drawLines:points:mode:
Draws a polyline, consisting of multiple connected lines specified as an Array of Points.
drawSegments:segments:
Draws multiple, unconnected lines.
The following example draws a single line from 20@20 to 50@50 on the default root window using the default GC.
CgWindow default
drawLine: CgGC default
x1: 20
y1: 20
x2: 50
y2: 50.
 
sp006060
 
The following example draws a series of lines on the root window beginning with the first point and ending at the last point in the array.
| points |
(points := Array new: 6)
at: 1 put: 89 @ 100;
at: 2 put: 12 @ 45;
at: 3 put: 108 @ 45;
at: 4 put: 31 @ 100;
at: 5 put: 60 @ 10;
at: 6 put: 89 @ 100.
CgWindow default
drawLines: CgGC default
points: points
mode: CoordModeOrigin
 
sp006065
 
 
Last modified date: 04/18/2020