Extends the Vector class with support for generating custom paths.
VectorPath provides support for parsing SVG styled path strings.
The VectorPath class consists of the following fields:
Access | Name | Type | Comment |
---|---|---|---|
Commands | STRUCT [] | 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. | |||
PathLength | INT | Calibrates 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. | |||
Sequence | STRING | A 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 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 | |||
TotalCommands | INT | The 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. |
The following actions are currently supported:
Name | Comment | |
---|---|---|
Clear | Clears an object's data. | |
Flush | Flush buffered data from an object. |
The following methods are currently supported:
Name | Comment | ||||||||
---|---|---|---|---|---|---|---|---|---|
AddCommand | Add one or more commands to the end of the path sequence. | ||||||||
ERR vp::AddCommand(OBJECTPTR Object, struct PathCommand * Commands, LONG Size)
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. | |||||||||
GetCommand | Retrieve a specific command from the path sequence. | ||||||||
ERR vp::GetCommand(OBJECTPTR Object, LONG Index, struct PathCommand ** Command)
Calling GetCommand() will return a direct pointer to the command identified at | |||||||||
RemoveCommand | Remove at least one command from the path sequence. | ||||||||
ERR vp::RemoveCommand(OBJECTPTR Object, LONG Index, LONG Total)
This method will remove a series of commands from the current path, starting at the given | |||||||||
SetCommand | Copies one or more commands into an existing path. | ||||||||
ERR vp::SetCommand(OBJECTPTR Object, LONG Index, struct PathCommand * Command, LONG Size)
Use SetCommand() to copy one or more commands into an existing path. | |||||||||
SetCommandList | The fastest available mechanism for setting a series of path instructions. | ||||||||
ERR vp::SetCommandList(OBJECTPTR Object, APTR Commands, LONG Size)
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. |
Base structure for path commands.
Field | Type | Description |
---|---|---|
Type | PE | The command type |
LargeArc | UBYTE | Equivalent to the large-arc-flag in SVG, it ensures that the arc follows the longest drawing path when TRUE . |
Sweep | UBYTE | Equivalent to the sweep-flag in SVG, it inverts the default behaviour in generating arc paths. |
Pad1 | UBYTE | Private |
X | DOUBLE | The targeted X coordinate (absolute or scaled) for the command |
Y | DOUBLE | The targeted Y coordinate (absolute or scaled) for the command |
AbsX | DOUBLE | Private |
AbsY | DOUBLE | Private |
X2 | DOUBLE | The X2 coordinate for curve commands, or RX for arcs |
Y2 | DOUBLE | The Y2 coordinate for curve commands, or RY for arcs |
X3 | DOUBLE | The X3 coordinate for curve-to or smooth-curve-to |
Y3 | DOUBLE | The Y3 coordinate for curve-to or smooth-curve-to |
Angle | DOUBLE | Arc angle |
Class Info | |
---|---|
ID | ID_VECTORPATH |
Category | Graphics |
Include | modules/vectorpath.h |
Version | 1 |