Parasol Framework
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Core
    • Display
    • Fluid
    • Font
    • Network
    • Vector
    • Audio
    • Sound
    • File
    • MetaClass
    • Module
    • StorageDevice
    • Task
    • Thread
    • Time
    • Compression
    • Config
    • Script
    • XML
    • Controller
    • BlurFX
    • ColourFX
    • CompositeFX
    • ConvolveFX
    • DisplacementFX
    • FilterEffect
    • FloodFX
    • ImageFX
    • LightingFX
    • MergeFX
    • MorphologyFX
    • OffsetFX
    • RemapFX
    • SourceFX
    • TurbulenceFX
    • WaveFunctionFX
    • Scintilla
    • ScintillaSearch
    • Bitmap
    • Clipboard
    • Display
    • Document
    • Font
    • Picture
    • Pointer
    • Surface
    • SVG
    • ClientSocket
    • HTTP
    • NetSocket
    • Proxy
    • Vector
    • VectorClip
    • VectorColour
    • VectorEllipse
    • VectorFilter
    • VectorGradient
    • VectorGroup
    • VectorImage
    • VectorPath
    • VectorPattern
    • VectorPolygon
    • VectorRectangle
    • VectorScene
    • VectorShape
    • VectorSpiral
    • VectorText
    • VectorTransition
    • VectorViewport
    • VectorWave

VectorPath Class

Extends the Vector class with support for generating custom paths.

VectorPath provides support for parsing SVG styled path strings.

Structure

The VectorPath class consists of the following fields:

Access
NameTypeComment
  CommandsSTRUCT []Direct pointer to the PathCommand array.

Read the Commands field to obtain a direct pointer to the PathCommand array. This will allow the control points of the path to be modified directly, but it is not possible to resize the path. After making changes to the path, call Flush() to register the changes for the next redraw.

This field can also be written at any time with a new array of PathCommand structures. Doing so will clear the existing path, if any.

  PathLengthINTCalibrates the user agent's distance-along-a-path calculations with that of the author.

The author's computation of the total length of the path, in user units. This value is used to calibrate the user agent's own distance-along-a-path calculations with that of the author. The user agent will scale all distance-along-a-path computations by the ratio of PathLength to the user agent's own computed value for total path length. This feature potentially affects calculations for text on a path, motion animation and various stroke operations.

  SequenceSTRINGA sequence of points and instructions that will define the path.

The Sequence is a string of points and instructions that define the path. It is based on the SVG standard for the path element d attribute, but also provides some additional features that are present in the vector engine. Commands are case insensitive.

The following commands are supported:

M: Move To
L: Line To
V: Vertical Line To
H: Horizontal Line To
Q: Quadratic Curve To
T: Quadratic Smooth Curve To
C: Curve To
S: Smooth Curve To
A: Arc
Z: Close Path

The use of lower case characters will indicate that the provided coordinates are relative (based on the coordinate of the previous command).

To terminate a path without joining it to the first coordinate, omit the Z from the end of the sequence.

  TotalCommandsINTThe total number of points defined in the path sequence.

The total number of points defined in the path Sequence is reflected in this field. Modifying the total directly is permitted, although this should be used for shrinking the list because expansion will create uninitialised command entries.

Actions

The following actions are currently supported:

ClearClears an object's data.
FlushFlush buffered data from an object.

Methods

The following methods are currently supported:

AddCommandAdd one or more commands to the end of the path sequence.
ERR vp::AddCommand(OBJECTPTR Object, struct PathCommand * Commands, INT Size)
ParameterDescription
CommandsArray of commands to add to the path.
SizeThe size of the Commands buffer, in bytes.

This method will add a series of commands to the end of a Vector's existing path sequence. The commands must be provided as a sequential array. No checks will be performed to confirm the validity of the sequence.

Calling this method will also result in the path being recomputed for the next redraw.

GetCommandRetrieve a specific command from the path sequence.
ERR vp::GetCommand(OBJECTPTR Object, INT Index, struct PathCommand ** Command)
ParameterDescription
IndexThe index of the command to retrieve.
CommandThe requested command will be returned in this parameter.

Calling GetCommand() will return a direct pointer to the command identified at Index. The pointer will remain valid for as long as the VectorPath is not modified.

RemoveCommandRemove at least one command from the path sequence.
ERR vp::RemoveCommand(OBJECTPTR Object, INT Index, INT Total)
ParameterDescription
IndexThe index of the command to remove.
TotalThe total number of commands to remove, starting from the given Index.

This method will remove a series of commands from the current path, starting at the given Index. The total number of commands to remove is indicated by the Total parameter.

SetCommandCopies one or more commands into an existing path.
ERR vp::SetCommand(OBJECTPTR Object, INT Index, struct PathCommand * Command, INT Size)
ParameterDescription
IndexThe index of the command that is to be set.
CommandAn array of commands to set in the path.
SizeThe size of the Command buffer, in bytes.

Use SetCommand() to copy one or more commands into an existing path.

SetCommandListThe fastest available mechanism for setting a series of path instructions.
ERR vp::SetCommandList(OBJECTPTR Object, APTR Commands, INT Size)
ParameterDescription
CommandsAn array of PathCommand structures.
SizeThe byte size of the Commands buffer.

Use SetCommandList() to copy a series of path commands to a VectorPath object. All existing commands will be cleared as a result of this process.

NOTE: This method is not compatible with Fluid calls.

VectorPath class documentation © Paul Manias © 2010-2025

PathCommand Structure

Base structure for path commands.

FieldTypeDescription
TypePEThe command type
LargeArcUBYTEEquivalent to the large-arc-flag in SVG, it ensures that the arc follows the longest drawing path when TRUE.
SweepUBYTEEquivalent to the sweep-flag in SVG, it inverts the default behaviour in generating arc paths.
Pad1UBYTEPrivate
XDOUBLEThe targeted X coordinate (absolute or scaled) for the command
YDOUBLEThe targeted Y coordinate (absolute or scaled) for the command
AbsXDOUBLEPrivate
AbsYDOUBLEPrivate
X2DOUBLEThe X2 coordinate for curve commands, or RX for arcs
Y2DOUBLEThe Y2 coordinate for curve commands, or RY for arcs
X3DOUBLEThe X3 coordinate for curve-to or smooth-curve-to
Y3DOUBLEThe Y3 coordinate for curve-to or smooth-curve-to
AngleDOUBLEArc angle
VectorPath class documentation © Paul Manias © 2010-2025