-
Notifications
You must be signed in to change notification settings - Fork 5
Path
Drawing segments that define the outline of a shape, consisting of a starting point followed by a series of one or more lines, arcs or curves. Each segment will automatically start where the previous one ends. The final result may produce an open or closed shape.
Path definitions must be defined in a separate named option, which you then reference immediately following the Path type on the ImageN option line.
Path PathName
Image = Path MyPath | StrokeColor 0,255,0
MyPath = 100,100 | LineTo 500,0 | ClosePath 1
Parameter:
AntiAlias IsAntiAlias
Set IsAntiAlias
to 0 to turn off border smoothing.
Parameter:
Canvas Width, Height
Define path region. Any pixel exceeds this region is cutoff.
Note: Default Path's canvas is calculated based on largest end points position. Although, curve's boundaries might be larger than their end points position. If you're working with curves, always define this modifier to make sure image does not missing any segment when rendering.
Image = Path CustomPath | Canvas 800,1000
Parameter:
Color ColorValue
Fill shape color. Check out Color formats.
Parameter:
Offset X, Y
Change origin coordinate.
Parameter:
Rotate Degree
Rotate coordinate.
Parameter:
StrokeAlign AlignType
Change Stroke alignment. Valid AlignType values:
Center
Outside
Inside
Parameter:
StrokeColor ColorValue
Define stroke color. Check out Color formats.
Parameter:
StrokeWidth Width
Define stroke width.
StartX, StartY | SegmentType SegmentParameters | SegmentType SegmentParameters
StartX
, StartY
: Coordinate of the starting point of the path.
Followed a pipe |
character, and at least one, up to unlimited, of the following segment types, separated by a pipe |
character.
Segment types:
An line between two points.
Parameters:
LineTo EndX, EndY
An arc between two points.
Parameters:
ArcTo EndX, EndY, RadiusX, RadiusY, RotationAngle, SweepDirection, ArcSize
The first 2 parameters are required. The rest are optional, but in order. When you use an optional parameter later in the order, an asterisk * symbol can be used to indicate "default" in earlier optional parameters.
Examples:
MyPath = 0,0 | ArcTo 3,200,203,200,100,100,0,0,0,0
MyPath2 = 0,0 | ArcTo 10,15,110,215,*,*,*,*,*,1
Notes:
SweepDirection
and ArcSize
: An arc describes two virtual ellipses intersecting the starting and ending points. One Clockwise and one Counter-clockwise. If the radius of the arc is greater than 1/2 distance between the starting and ending points, this actually creates 4 possible arcs:
- Clockwise small
- Clockwise large
- Counter-clockwise small
- Counter-clockwise large
RotationAngle
: If the RadiusX and RadiusY of the arc are not the same, then RotationAngle will rotate the two ellipses around a center point defined on and at 1/2 the distance between the starting and ending points.
An quadratic or cubic bézier curve between two points.
A quadratic bézier curve is a single set of X and Y control points between starting and ending points.
A cubic bézier curve is two sets of X and Y control points between starting and ending points.
Parameters:
CurveTo EndX, EndY, ControlX1, ControlY1, ControlX2, ControlY2
Examples:
MyPath = 0,0 | CurveTo 200,225,400,115
MyPath2 = 0,0 | CurveTo 215,120,40,130,160,15
A special way to draw a quadratic or cubic bézier curve segment with less parameters but still maintains the smoothness at segment joint. SmoothCurveTo controlling the curvedness bases on previous type of segment:
- If the earlier segment is quadratic bézier (
CurveTo
with 1 control point set,SmoothCurveTo
with 0 control point set), this segment only requires end point position. The control point is assumed to be the reflection of the control point on the previous defined segment.
Parameters:
SmoothCurveTo EndX, EndY
- If the earlier segment is cubic bézier (
CurveTo
with 2 control point sets,SmoothCurveTo
with 1 control point set), this segment requires end point position and 1 control point set as curve's second control point. Curve's first control point is assumed to be the reflection of the control point on the previous defined segment.
Parameters:
SmoothCurveTo EndX, EndY, ConstrolX, ControlY
- If the earlier segment is not a curve (LineTo, ArcTo) or its type does not match with SmoothCurveTo type, a line segment will be drawn instead.
Examples:
MyPath = 0,0 | CurveTo 200,225,400,115 | SmoothCurveTo 410,265
MyPath2 = 0,0 | CurveTo 215,120,40,130,160,15 | SmoothCurveTo 300,200,280,420
Following the final definition of the path segments, a path may or may not create a fully enclosed shape. This can be controlled by optionally ending the definition with:
Parameters:
ClosePath Value
Value
can be 0 or 1. Leave the shape open (0 - default) or automatically close (1) the shape by drawing a line segment from the final ending point to the starting point.