Skip to content

DRAW_PATH ​

Draws the last defined path.

Syntax ​

leo-grammar
DRAW_PATH [ mode:DrawPathMode ] .

DrawPathMode : stroke | fill | stroke-and-fill .

Parameters ​

  • mode (modifier, optional) - Specifies how the path should be drawn: only the outline, only by filling it or both. Default is stroke-and-fill.

Details ​

The style of this command is defined by the PEN command for the outline and the FILL command to fill the shape.

The command draws the last path that has been defined between BEGIN_PATH and END_PATH. How the path is drawn is specified through the mode parameter:

  • stroke-and-fill (default) will draw both the outline and fill the shape. This also closes the path if necessary by connecting the last point with the first point through a straight line.
  • stroke will only draw the outline.
  • fill will only fill the shape. This also closes the path if necessary by connecting the last point with the first point through a straight line.

Each path can only be used once. To draw or clip on the same path again it is necessary to define the path once more.

See Also ​

Examples ​

Draw a simple diagonal line with a thickness of 3pt.
Diagonal black line

leo
GRAPHREP
SHADOW off

# Define the path.
BEGIN_PATH
MOVE_TO x:0cm y:0cm
LINE_TO x:1cm y:1cm
END_PATH

# Draw the path.
PEN w:3pt
DRAW_PATH

Draw a blue document symbol with an exaggerated wavy line at the bottom using a dashed line.
Document symbol with straight lines on the left, top and right and an exaggerated wavy line at the bottom

leo
GRAPHREP
# Note: SHADOW is on by default.

# Define the path.
BEGIN_PATH
MOVE_TO x:-1cm y:-1cm
LINE_TO x:-1cm y:0cm
BEZIER_TO 3
    x1:-0.25cm y1:-1cm x2:0.5cm y2:2.5cm x3:1cm y3:0cm
LINE_TO x:1cm y:-1cm
END_PATH

# Draw the path as a shape.
PEN style:dash
FILL color:"lightblue"
DRAW_PATH

Draw two vertical lines that are connected at the bottom with an exaggerated wavy line.
Two parallel vertical lines connected with an exaggerated wavy line at the bottom

leo
GRAPHREP
# Note: SHADOW is on by default.

# Define the path.
BEGIN_PATH
MOVE_TO x:-1cm y:-1cm
LINE_TO x:-1cm y:0cm
BEZIER_TO {-0.25cm, -1cm, 0.5cm, 2.5cm, 1cm, 0cm}
LINE_TO x:1cm y:-1cm
END_PATH

# Draw the path only as an outline.
PEN w:3pt
DRAW_PATH mode:stroke

Versions and Changes ​

Available since ADOxx 1.3