Name
DrawPath -- draw vector path (V5.0)
Synopsis
DrawPath(id, x, y[, color, table])
Function
This draws the vector path specified in id to the position specified in x and y using the color that is passed in argument 4. The vector path will be drawn using the form style specified using SetFormStyle() and it will be filled according to the configuration selected using SetFillStyle() and SetFillRule(). If you are drawing the vector path in outline mode (i.e. fill style is set to #FILLNONE), then DrawPath() will also take the settings of SetLineJoin(), SetLineCap(), and SetDash() into account. Color can either be an RGB value or an ARGB value for alpha-blended drawing.

The optional table argument can be used to specify one or more of the standard tags for all drawing commands. See Standard drawing tags for more information about the standard tags that nearly all Hollywood drawing commands support.

If layers are enabled, this command will add a new layer of the type #VECTORPATH to the layer stack.

Note that DrawPath() only allows you to use a single color for per path. If you want to use multi-colored paths, you can use the PathToBrush() function to combine multiple paths inside a single vector brush object. See PathToBrush for details.

Inputs
id
identifier of path object to draw
x
destination x offset
y
destination y offset
color
optional: RGB or ARGB color (defaults to #BLACK) color is optional because it is not required when you draw to a mask or alpha channel
table
optional: table containing further arguments; can be any from the ones listed above and from the standard tags
Example
SetFillStyle(#FILLNONE)
SetFormStyle(#ANTIALIAS)
x=25.6 y=128.0
x1=102.4 y1=230.4
x2=153.6 y2=25.6
x3=230.4 y3=128.0

StartPath(1)
MoveTo(1, x, y)
CurveTo(1, x1, y1, x2, y2, x3, y3)
SetLineWidth(10)
DrawPath(1, 0, 0, #BLACK)

ClearPath(1)
MoveTo(1, x, y)
LineTo(1, x1, y1)
MoveTo(1, x2, y2)
LineTo(1, x3, y3)
SetLineWidth(6)
DrawPath(1, 0, 0, ARGB(128, #RED))
The code above draws a curve and two lines that illustrate the control points of the curve.


EnableLayers
SetFillStyle(#FILLCOLOR)
SetFormStyle(#ANTIALIAS)
StartPath(1)
AddBoxToPath(1, 0, 0, 100, 100)
AddBoxToPath(1, 150, 0, 100, 100)
AddBoxToPath(1, 0, 150, 100, 100)
AddBoxToPath(1, 150, 150, 100, 100)
DrawPath(1, #CENTER, #CENTER, #RED, {Border = True, bordersize = 5})
The code above draws a vector path that looks a little bit like the flag of Switzerland.

Show TOC