[Index] [<< Previous section: Pen and Background Control] [Next section: Arcs and Shapes >>]
beginpath
- Description: begins a new path, or resets the current path.
cancelpath
- Description: deletes/cancels the current path.
strokepath
- Description: strokes/draws the current path with the current line/stroke color (default black).
fillpath
- Description: fills the current path with the current filling color (default white).
setfillcolor color
setfc color
- Description: sets the filling color (default: white). The
color
can be set using standard color codes or html HEX values.- Examples:
setfillcolor "red
setfillcolor "4
setfillcolor "#ff0000- Standard color codes: 0: "black" (), 1: "blue" (), 2: "lime" (), 3: "cyan" (), 4: "red" (), 5: "magenta" (),
6: "yellow" (), 7: "white" (), 8: "brown" (), 9: "tan" (), 10: "green" (), 11: "aquamarine" (), 12: "salmon" (),
13: "purple" (), 14: "orange" (), 15: "gray" (). - Examples:
About paths. A path consists of a list of zero or more subpaths. Each subpath is a list of one or more points that are connected by straight or curved lines. Each subpath also contains a flag that indicates whether the subpath is closed. If a subpath is closed, the last point of the subpath is connected to the first point by a straight line. Subpaths that have fewer than two points are ignored when the path is painted.
Example 1. The code bellow draws a triangle:
beginpath
fd 100
left 90
fd 100
strokepath
Example 2. The code bellow fills a rectangle:
beginpath
fd 100
left 90
fd 150
left 90
fd 100
setfillcolor "blue
fillpath
Example 3. The code bellow draws and fills a nice flower:
repeat 8 [
make "c (random 16)
setfillcolor :c
beginpath
repeat 2
[ repeat 100 [fd 3 rt 1]
rt 80 ]
rt 45
fillpath
]
Note:
• While drawing paths, the drawing mode is automatically set to "window".
[Index] [<< Previous section: Pen and Background Control] [Next section: Arcs and Shapes >>]