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

Vector Class

An abstract class for supporting vector graphics objects and functionality.

Vector is an abstract class that is used as a blueprint for other vector classes that provide specific functionality for a vector scene. At this time the classes are VectorClip, VectorEllipse, VectorGroup, VectorPath, VectorPolygon, VectorRectangle, VectorSpiral, VectorText, VectorViewport and VectorWave.

The majority of sub-classes support all of the functionality provided by Vector. The general exception is that graphics functions will not be supported by non-graphical classes, for instance VectorGroup and VectorViewport do not produce a vector path and therefore cannot be rendered.

To simplify the creation of complex vector graphics and maximise compatibility, we have designed the vector management code to use data structures that closely match SVG definitions. For this reason we do not provide exhaustive documentation on the properties that can be applied to each vector type. Instead, please refer to the SVG reference manuals from the W3C. In cases where we are missing support for an SVG feature, assume that future support is intended unless otherwise documented.

Structure

The Vector class consists of the following fields:

Access
NameTypeComment
  AppendPathOBJECTPTRExperimental. Append the path of the referenced vector during path generation.

The path of an external Vector can be appended to the base path in real-time by making a reference to that vector here. The operation is completed immediately after the generation of the client vector's base path, prior to any transforms.

It is strongly recommended that the appended vector has its Visibility set to HIDDEN. Any direct transform that is applied to the vector will be utilised, but inherited transforms and placement information will be ignored.

If it is necessary for the two paths to flow from one to the other, set VF::JOIN_PATHS in the Flags field.

Note: Appended paths are not compliant with SVG and this feature is considered experimental.

  Child*VectorThe first child vector, or NULL.

The Child value refers to the first vector that forms a branch under this object. This field cannot be set directly as it is managed internally. Instead, use object ownership when a vector needs to be associated with a new parent.

  ClipRuleINTDetermines the algorithm to use when clipping the shape.

The ClipRule attribute only applies to vector shapes when they are contained within a VectorClip object. In terms of outcome, the ClipRule works similarly to FillRule.

NameDescription
VFR::EVEN_ODDThis rule determines the 'insideness' of a point on the canvas by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside.
VFR::INHERITThe rule is inherited from the parent vector(s).
VFR::NON_ZEROThis is the default. This rule determines the 'insideness' of a point on the canvas by drawing a ray from that point to infinity in any direction and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time a path segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the path. Otherwise, it is inside.
  ColourSpaceVCSDefines the colour space to use when blending the vector with a target bitmap's content.

By default, vectors are rendered using the standard RGB colour space and alpha blending rules. Changing the colour space to LINEAR_RGB will tell the renderer to automatically convert sRGB values to linear RGB when blending on the fly.

NameDescription
VCS::INHERITInherit the colour space option from the parent vector.
VCS::LINEAR_RGBLinear RGB is the default colour space for SVG and produces the best results.
VCS::SRGBThe default colour-space is sRGB, recommended for its speed.
  CursorPTCThe mouse cursor to display when the pointer is within the vector's boundary.

The Cursor field declares the pointer's cursor image to display within the vector's boundary. The cursor will automatically switch to the specified image when it enters the boundary defined by the vector's path. This effect lasts until the cursor vacates the area.

It is a pre-requisite that the associated VectorScene has been linked to a Surface.

NameDescription
  DashArrayDOUBLE []Controls the pattern of dashes and gaps used to stroke paths.

The DashArray is a list of lengths that alternate between dashes and gaps. If an odd number of values is provided, then the list of values is repeated to yield an even number of values. Thus 5,3,2 is equivalent to 5,3,2,5,3,2.

  DashOffsetDOUBLEThe distance into the dash pattern to start the dash. Can be a negative number.

The DashOffset can be set in conjunction with the DashArray to shift the dash pattern to the left. If the offset is negative then the shift will be to the right.

  DisplayScaleDOUBLEReturns the scale of the vector as it appears on the display.

The DisplayScale field will return the scale factor of the vector's path as it appears in the final rendering. For instance if the vector is the child of a viewport scaled down to 50%, the resulting value would be 0.5.

  FillSTRINGDefines the fill painter using SVG's IRI format.

The painter used for filling a vector path can be defined through this field using SVG compatible formatting. The string is parsed through the ReadPainter() function. Please refer to it for further details on valid formatting.

It is possible to enable dual-fill painting via this field, whereby a second fill operation can follow the first by separating them with a semi-colon ; character. This feature makes it easy to use a common background fill and follow it with an independent foreground, alleviating the need for additional vector objects. Be aware that this feature is intended for programmed use-cases and is not SVG compliant.

  FillColourFLOAT []Defines a solid colour for filling the vector path.

Set the FillColour field to define a solid colour for filling the vector path. The colour is defined as an array of four 32-bit floating point values between 0 and 1.0. The array elements consist of Red, Green, Blue and Alpha values in that order.

If the Alpha component is set to zero then the FillColour will be ignored by the renderer.

  FillOpacityDOUBLEThe opacity to use when filling the vector.

The FillOpacity value is used by the painting algorithm when it is rendering a filled vector. It is multiplied with the Opacity to determine a final opacity value for the render.

  FillRuleINTDetermines the algorithm to use when filling the shape.

The FillRule field indicates the algorithm which is to be used to determine what parts of the canvas are included when filling the shape. For a simple, non-intersecting path, it is intuitively clear what region lies "inside"; however, for a more complex path, such as a path that intersects itself or where one sub-path encloses another, the interpretation of "inside" is not so obvious.

  FilterSTRINGAssign a post-effects filter to a vector.

This field assigns a graphics filter to the rendering pipeline of the vector. The filter must initially be created using the VectorFilter class and added to a VectorScene using VectorScene⇒AddDef(). The filter can then be referenced by ID in the Filter field of any vector object. Please refer to the VectorFilter class for further details on filter configuration.

The Filter value can be in the format ID or url(ID) according to client preference.

  FlagsVFOptional flags.
NameDescription
VF::DISABLEDThe vector is disabled and user input should be ignored.
VF::HAS_FOCUSThe vector holds the user's input focus.
VF::ISOLATEDEnables isolation mode, which results in a bitmap buffer being allocated for the vector and its children while drawing.
VF::JOIN_PATHSWhen appending a new path, use a join operation to connect the tail end to the head.
  IDSTRINGString identifier for a vector.

The ID field is provided for the purpose of SVG support. Where possible we would recommend that you use the existing object name and automatically assigned ID's for identifiers.

  InnerJoinINTAdjusts the handling of thickly stroked paths that cross back at the join.

The InnerJoin value is used to make very technical adjustments to the way that paths are stroked when they form corners. Visually, the impact of this setting is only noticeable when a path forms an awkward corner that crosses over itself - usually due to the placement of bezier control points.

The available settings are MITER, ROUND, BEVEL, JAG and INHERIT. The default of MITER is recommended as it is the fastest, but ROUND produces the best results in ensuring that the stroked path is filled correctly. The most optimal approach is to use the default setting and switch to ROUND if issues are noted near the corners of the path.

NameDescription
VIJ::BEVELBlunts the edge of the join.
VIJ::INHERITInherit the parent's join value.
VIJ::JAGA special non-SVG option.
VIJ::MITERForms a sharp point at the join. Typically not the best looking option.
VIJ::ROUNDRounds the edge of the join to produce the best looking results.
  LineCapINTThe shape to be used at the start and end of a stroked path.

LineCap is the equivalent of SVG's stroke-linecap attribute. It defines the shape to be used at the start and end of a stroked path.

NameDescription
VLC::BUTTThe default. The line is sharply squared off at its exact end point.
VLC::INHERITThe cap type is inherited from the parent (defaults to butt if unspecified).
VLC::ROUNDThe line cap is a half-circle and the line's end-point forms the center point.
VLC::SQUARESimilar to butt, the line is sharply squared off but will extend past the end point by StrokeWidth / 2.
  LineJoinINTThe shape to be used at path corners that are stroked.

LineJoin is the equivalent of SVG's stroke-linejoin attribute. It defines the shape to be used at path corners that are being stroked.

NameDescription
VLJ::BEVELThe join is blunted, eliminating overly sharp edges.
VLJ::INHERITInherit the join option from the parent.
VLJ::MITERThe default. A sharp corner is used to join path segments. The corner is formed by extending the outer edges of the stroke at the tangents of the path segments until they intersect. If the ‘stroke-miterlimit’ is exceeded, the line join falls back to BEVEL.
VLJ::MITER_ROUNDDefault to MITER, but switch to ROUND if the miter limit is exceeded.
VLJ::MITER_SMARTAn alternative form of MITER that extends beyond the intersection point, similarly to the miter-clip SVG rules.
VLJ::ROUNDThe join is rounded.
  MaskOBJECTPTRReference a VectorClip object here to apply a clipping mask to the rendered vector.

A mask can be applied to a vector by setting the Mask field with a reference to a VectorClip object. Please refer to the VectorClip class for further information.

  Matricesstruct VectorMatrix *A linked list of transform matrices that have been applied to the vector.

All transforms that have been allocated via NewMatrix() can be read from the Matrices field. Each transform is represented by the VectorMatrix structure, and are linked in the order in which they are added to the vector.

FieldTypeDescription
Nextstruct VectorMatrix *The next transform in the list.
VectorobjVector *The vector associated with the transform.
ScaleXDOUBLEMatrix value A
ShearYDOUBLEMatrix value B
ShearXDOUBLEMatrix value C
ScaleYDOUBLEMatrix value D
TranslateXDOUBLEMatrix value E
TranslateYDOUBLEMatrix value F
TagINTAn optional tag value defined by the client for matrix identification.
  MiterLimitDOUBLEImposes a limit on the ratio of the miter length to the StrokeWidth.

When two line segments meet at a sharp angle and miter joins have been specified in LineJoin, it is possible for the miter to extend far beyond the thickness of the line stroking the path. The MiterLimit imposes a limit on the ratio of the miter length to the StrokeWidth. When the limit is exceeded, the join is converted from a miter to a bevel.

The ratio of miter length (distance between the outer tip and the inner corner of the miter) to StrokeWidth is directly related to the angle (theta) between the segments in user space by the formula: MiterLength / StrokeWidth = 1 / sin ( theta / 2 ).

For example, a miter limit of 1.414 converts miters to bevels for theta less than 90 degrees, a limit of 4.0 converts them for theta less than approximately 29 degrees, and a limit of 10.0 converts them for theta less than approximately 11.5 degrees.

  MorphOBJECTPTREnables morphing of the vector to a target path.

If the Morph field is set to a Vector object that generates a path, the vector will be morphed to follow the target vector's path shape. This works particularly well for text and shapes that follow a horizontal path that is much wider than it is tall.

Squat shapes will fare poorly if morphed, so experimentation may be necessary to understand how the morph feature is best utilised.

  MorphFlagsINTOptional flags that affect morphing.
  Next*VectorThe next vector in the branch, or NULL.

The Next value refers to the next vector in the branch. If the value is NULL, the vector is positioned at the end of the branch.

The Next value can be set to another vector at any time, on the condition that both vectors share the same owner. If this is not true, change the current owner before setting the Next field. Changing the Next value will result in updates to the Parent and Prev fields.

  NumericIDINTA unique identifier for the vector.

This field assigns a numeric ID to a vector. Alternatively it can also reflect a case-sensitive hash of the ID field if that has been defined previously.

If NumericID is set by the client, then any value in ID will be immediately cleared.

  OpacityDOUBLEDefines an overall opacity for the vector's graphics.

The overall opacity of a vector can be defined here using a value between 0 and 1.0. The value will be multiplied with other opacity settings as required during rendering. For instance, when filling a vector the opacity will be calculated as FillOpacity * Opacity.

  ParentOBJECTPTRThe parent of the vector, or NULL if this is the top-most vector.

The Parent value will refer to the owner of the vector within its respective branch. To check if the vector is at the top or bottom of its branch, please refer to the Prev and Next fields.

  PathQualityRQDefines the quality of a path when it is rendered.

Adjusting the render quality allows for fine adjustment of the paths produced by the rendering algorithms. Although the default option of AUTO is recommended, it is optimal to lower the rendering quality to CRISP if the path is composed of lines at 45 degree increments and FAST if points are aligned to whole numbers when rendered to a bitmap.

NameDescription
RQ::AUTOThe default option is chosen by the system.
RQ::BESTUse the best quality renderer available and without concerns for computational time taken.
RQ::CRISPUse a good quality renderer that produces crisp outlines (no anti-aliasing).
RQ::FASTUse the fastest renderer available and allow accuracy to be compromised in favour of speed. Recommended for normalised paths that are known to be rectangular.
RQ::PRECISEUse a high quality renderer to produce accurate results. Anti-aliasing will be enabled.
  PathTimestampINTThis counter is modified each time the path is regenerated.

The PathTimestamp can be used as a basic means of recording the state of the vector's path, and checking that state for changes at a later time. For more active monitoring and response, clients should subscribe to the PATH_CHANGED event.

  Prev*VectorThe previous vector in the branch, or NULL.

The Prev value refers to the previous vector in the branch. If the value is NULL, then the vector is positioned at the top of the branch.

The Prev value can be set to another vector at any time, on the condition that both vectors share the same owner. If this is not true, change the current owner before setting the Prev field. Changing the value will result in updates to the Parent and Next values.

  ResizeEventFUNCTIONA callback to trigger when the host viewport is resized.

Use ResizeEvent to receive feedback when the viewport that hosts the vector is resized. The function prototype is void callback(*VectorViewport, *Vector, DOUBLE X, DOUBLE Y, DOUBLE Width, DOUBLE Height, APTR Meta)

The dimension values refer to the current location and size of the viewport.

Note that this callback feature is provided for convenience. Only one subscription to the viewport is possible at any time. The conventional means for monitoring the size and position of any vector is to subscribe to the PATH_CHANGED event.

  Scene*VectorSceneShort-cut to the top-level VectorScene.

All vectors are required to be grouped within the hierarchy of a VectorScene. This requirement is enforced on initialisation and a reference to the top-level VectorScene is recorded in this field.

  SequenceSTRINGConvert the vector's path to the equivalent SVG path string.

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).

  StrokeSTRINGDefines the stroke of a path using SVG's IRI format.

The stroker used for rendering a vector path can be defined through this field. The string is parsed through the ReadPainter() function in the Vector module. Please refer to it for further details on valid formatting.

  StrokeColourFLOAT []Defines the colour of the path stroke in RGB float format.

This field defines the colour that will be used in stroking a path, and is comprised of floating point RGBA values. The intensity of each component is measured from 0 - 1.0. Stroking is disabled if the alpha value is 0.

This field is complemented by the StrokeOpacity and Stroke fields.

  StrokeOpacityDOUBLEDefines the opacity of the path stroke.

The StrokeOpacity value expresses the opacity of a path stroke as a value between 0 and 1.0. A value of zero would render the stroke invisible and the maximum value of one would render it opaque.

Please note that thinly stroked paths may not be able to appear as fully opaque in some cases due to anti-aliased rendering.

  StrokeWidthDOUBLEThe width to use when stroking the path.

The StrokeWidth defines the pixel width of a path when it is stroked. The path will not be stroked if the value is zero. A percentage can be used to define the stroke width if it should be scaled to the size of the viewbox (along its diagonal). Note that this incurs a slight computational penalty when drawing.

The size of the stroke is also affected by scaling factors imposed by transforms and viewports.

  TabOrderINTDefines the priority of this vector within the tab order.

If a vector maintains a keyboard subscription then it can define its priority within the tab order (the order in which vectors receive the focus when the user presses the tab key). The highest priority is 1, the lowest is 255 (the default). When two vectors share the same priority, preference is given to the older of the two objects.

  TransitionOBJECTPTRReference a VectorTransition object here to apply multiple transforms over the vector's path.

A transition can be applied by setting this field with a reference to a VectorTransition object. Please refer to the VectorTransition class for further information.

Not all vector types are well-suited or adapted to the use of transitions. At the time of writing, only VectorText and VectorWave are able to take full advantage of this feature.

  VisibilityVISControls the visibility of a vector and its children.
NameDescription
VIS::COLLAPSEHide the vector and its children. Do not use - provided for SVG compatibility only.
VIS::HIDDENHide the vector and its children.
VIS::INHERITInherit the visibility state from the parent.
VIS::VISIBLEThe default. Ensures that the vector is visible.

Actions

The following actions are currently supported:

DisableDisabling a vector can be used to trigger style changes and prevent user input.
DrawDraws the surface associated with the vector.
ERR acDraw(*Object, DOUBLE X, DOUBLE Y, DOUBLE Width, DOUBLE Height)
ParameterDescription
XThe X position of the region to be drawn.
YThe Y position of the region to be drawn.
WidthThe width of the region to be drawn.
HeightThe height of the region to be drawn.

Calling the Draw action on a vector will schedule a redraw of the scene graph if it is associated with a Surface. Internally, drawing is scheduled for the next frame and is not immediate.

EnableReverses the effects of disabling the vector.
HideChanges the vector's visibility setting to hidden.
MoveToBackMove a vector to the back of its stack.
MoveToFrontMove a vector to the front of its stack.
ShowChanges the vector's visibility setting to visible.

Methods

The following methods are currently supported:

DebugInternal functionality for debugging.
ERR vec::Debug(OBJECTPTR Object)

This internal method prints comprehensive debugging information to the log.

Error Codes
OkayOperation successful.
FreeMatrixRemove an allocated VectorMatrix structure.
ERR vec::FreeMatrix(OBJECTPTR Object, struct VectorMatrix * Matrix)
ParameterDescription
MatrixReference to the structure that requires removal.

Transformations allocated from NewMatrix() can be removed with this method. If multiple transforms are attached to the vector then it should be noted that this will affect downstream transformations.

Error Codes
OkayOperation successful.
NullArgsFunction call missing argument value(s)
GetBoundaryReturns the graphical boundary of a vector.
ERR vec::GetBoundary(OBJECTPTR Object, VBF Flags, DOUBLE * X, DOUBLE * Y, DOUBLE * Width, DOUBLE * Height)
ParameterDescription
FlagsOptional flags.
XThe left-most position of the boundary is returned here.
YThe top-most position of the boundary is returned here.
WidthThe width of the boundary is returned here.
HeightThe height of the boundary is returned here.

This method will return the boundary of a vector's path in terms of its top-left position, width and height. All transformations and position information that applies to the vector will be taken into account when computing the boundary.

If the VBF::INCLUSIVE flag is used, the result will include an analysis of all paths that belong to children of the target vector, including transforms.

If the VBF::NO_TRANSFORM flag is used, the transformation step is not applied to the vector's path.

It is recommended that this method is not called until at least one rendering pass has been made, as some vector dimensions may not be computed before then.

Error Codes
OkayOperation successful.
NoDataThe vector does not have a computable path.
NullArgsFunction call missing argument value(s)
NotPossibleThe vector does not support path generation.
NewMatrixReturns a VectorMatrix structure that allows transformations to be applied to the vector.
ERR vec::NewMatrix(OBJECTPTR Object, struct VectorMatrix ** Transform, INT End)
ParameterDescription
TransformA reference to the new transform structure is returned here.
EndIf true, the matrix priority is lowered by inserting it at the end of the transform list.

Call NewMatrix() to allocate a transformation matrix that allows transforms to be applied to a vector. Manipulating the transformation matrix is supported by functions in the Vector module, such as Scale() and Rotate().

Note that if multiple matrices are allocated by the client, they will be applied to the vector in the order of their creation.

The structure will be owned by the Vector object and is automatically terminated when the Vector is destroyed. If the transform is no longer required before then, it can be manually removed with FreeMatrix().

Error Codes
OkayOperation successful.
NullArgsFunction call missing argument value(s)
PointInPathChecks if point at (X,Y) is within a vector's path.
ERR vec::PointInPath(OBJECTPTR Object, DOUBLE X, DOUBLE Y)
ParameterDescription
XThe X coordinate of the point.
YThe Y coordinate of the point.

This method provides an accurate means of determining if a specific coordinate is inside the path of a vector. Transforms are taken into account, as are clip masks.

Error Codes
OkayThe point is in the path.
FalseThe point is not in the path.
NoDataThe vector is unable to generate a path based on its current values.
NoSupportThe vector type does not support path generation.
NullArgsFunction call missing argument value(s)
PushPush a vector to a new position within its area of the vector stack.
ERR vec::Push(OBJECTPTR Object, INT Position)
ParameterDescription
PositionSpecify a relative position index here (-ve to move backwards, +ve to move forwards)

This method moves the position of a vector within its branch of the vector stack. Repositioning is relative to the current position of the vector. Every unit specified in the Position parameter will move the vector by one index in the stack frame. Negative values will move the vector backwards; positive values move it forward.

It is not possible for an vector to move outside of its branch, i.e. it cannot change its parent. If the vector reaches the edge of its branch with excess units remaining, the method will return immediately with an ERR::Okay error code.

Error Codes
OkayOperation successful.
NullArgsFunction call missing argument value(s)
SubscribeFeedbackSubscribe to events that relate to the vector.
ERR vec::SubscribeFeedback(OBJECTPTR Object, FM Mask, FUNCTION * Callback)
ParameterDescription
MaskDefines the feedback events required by the client. Set to 0xffffffff if all messages are required.
CallbackThe function that will receive feedback events.

Use this method to receive feedback for events that have affected the state of a vector.

To remove an existing subscription, call this method again with the same Callback and an empty Mask. Alternatively have the callback function return ERR::Terminate.

The prototype for the Callback is ERR callback(*Vector, FM Event)

Error Codes
OkayOperation successful.
NullArgsFunction call missing argument value(s)
SubscribeInputCreate a subscription for input events that relate to the vector.
ERR vec::SubscribeInput(OBJECTPTR Object, JTYPE Mask, FUNCTION * Callback)
ParameterDescription
MaskCombine JTYPE flags to define the input messages required by the client. Set to zero to remove an existing subscription.
CallbackReference to a function that will receive input messages.

The SubscribeInput method filters events from SubscribeInput() by limiting their relevance to that of the target vector. The original events are transferred with some modifications - X, Y, AbsX and AbsY are converted to the vector's coordinate system, and CROSSED_IN and CROSSED_OUT events are triggered during passage through the clipping area.

It is a pre-requisite that the associated VectorScene has been linked to a Surface.

To remove an existing subscription, call this method again with the same Callback and an empty Mask. Alternatively have the function return ERR::Terminate.

Please refer to SubscribeInput() for further information on event management and message handling.

The prototype for the Callback is ERR callback(*Vector, *InputEvent)

Error Codes
OkayOperation successful.
FieldNotSetThe VectorScene has no reference to a Surface.
AllocMemoryA call to AllocMemory() failed to create a new memory block.
NullArgsFunction call missing argument value(s)
FunctionA call to SubscribeInput() failed.
SubscribeKeyboardCreate a subscription for input events that relate to the vector.
ERR vec::SubscribeKeyboard(OBJECTPTR Object, FUNCTION * Callback)
ParameterDescription
CallbackReference to a callback function that will receive input messages.

The SubscribeKeyboard() method provides a callback mechanism for handling keyboard events. Events are reported when the vector or one of its children has the user focus. It is a pre-requisite that the associated VectorScene has been linked to a Surface.

The prototype for the callback is as follows, whereby Qualifers are KQ flags and the Code is a K constant representing the raw key value. The Unicode value is the resulting character when the qualifier and code are translated through the user's keymap.

ERR callback(*Viewport, LONG Qualifiers, LONG Code, LONG Unicode);

If the callback returns ERR::Terminate then the subscription will be ended. All other error codes are ignored.

Error Codes
OkayOperation successful.
FieldNotSetThe VectorScene⇒Surface field has not been defined.
AllocMemoryA call to AllocMemory() failed to create a new memory block.
NullArgsFunction call missing argument value(s)
FunctionA call to SubscribeInput() failed.
TraceReturns the coordinates for a vector path, using callbacks.
ERR vec::Trace(OBJECTPTR Object, FUNCTION * Callback, DOUBLE Scale, INT Transform)
ParameterDescription
CallbackA function to call with the path coordinates.
ScaleSet to 1.0 (recommended) to trace the path at a scale of 1 to 1.
TransformSet to true if all transforms applicable to the vector should be applied to the path.

Any vector that generates a path can be traced by calling this method. Tracing allows the caller to follow the path from point-to-point if the path were to be rendered with a stroke. The prototype of the callback function is ERR Function(OBJECTPTR Vector, LONG Index, LONG Command, DOUBLE X, DOUBLE Y, APTR Meta).

The Vector parameter refers to the vector targeted by the method. The Index is an incrementing counter that reflects the currently plotted point. The X and Y parameters reflect the coordinate of a point on the path.

If the Callback returns ERR::Terminate, then no further coordinates will be processed.

Error Codes
OkayOperation successful.
NoDataThe vector does not define a path.
NullArgsFunction call missing argument value(s)
Vector class documentation © Paul Manias © 2010-2025

FM Type

Mask for controlling feedback events that are received.

NameDescription
FM::CHILD_HAS_FOCUSA child of the vector has gained the user focus.
FM::HAS_FOCUSThe vector has gained the user focus.
FM::LOST_FOCUSThe vector has lost the user focus.
FM::PATH_CHANGEDThe vector path has been modified or affected by a transform.
Vector module documentation © Paul Manias © 2010-2025

RQ Type

NameDescription
RQ::AUTOThe default option is chosen by the system.
RQ::BESTUse the best quality renderer available and without concerns for computational time taken.
RQ::CRISPUse a good quality renderer that produces crisp outlines (no anti-aliasing).
RQ::FASTUse the fastest renderer available and allow accuracy to be compromised in favour of speed. Recommended for normalised paths that are known to be rectangular.
RQ::PRECISEUse a high quality renderer to produce accurate results. Anti-aliasing will be enabled.
Vector module documentation © Paul Manias © 2010-2025

VBF Type

Options for vecGetBoundary().

NameDescription
VBF::INCLUSIVEThe result will be inclusive of all paths that belong to children of the queried vector.
VBF::NO_TRANSFORMThe transformation step will not be applied to the vector's path.
Vector module documentation © Paul Manias © 2010-2025

VCS Type

Colour space options.

NameDescription
VCS::INHERITInherit the colour space option from the parent vector.
VCS::LINEAR_RGBLinear RGB is the default colour space for SVG and produces the best results.
VCS::SRGBThe default colour-space is sRGB, recommended for its speed.
Vector module documentation © Paul Manias © 2010-2025

VF Type

Optional flags and indicators for the Vector class.

NameDescription
VF::DISABLEDThe vector is disabled and user input should be ignored.
VF::HAS_FOCUSThe vector holds the user's input focus.
VF::ISOLATEDEnables isolation mode, which results in a bitmap buffer being allocated for the vector and its children while drawing.
VF::JOIN_PATHSWhen appending a new path, use a join operation to connect the tail end to the head.
Vector module documentation © Paul Manias © 2010-2025

VFR Type

Vector fill rules for the FillRule field in the Vector class.

NameDescription
VFR::EVEN_ODDThis rule determines the 'insideness' of a point on the canvas by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside.
VFR::INHERITThe rule is inherited from the parent vector(s).
VFR::NON_ZEROThis is the default. This rule determines the 'insideness' of a point on the canvas by drawing a ray from that point to infinity in any direction and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time a path segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the path. Otherwise, it is inside.
Vector module documentation © Paul Manias © 2010-2025

VIJ Type

Inner join options for angled lines.

NameDescription
VIJ::BEVELBlunts the edge of the join.
VIJ::INHERITInherit the parent's join value.
VIJ::JAGA special non-SVG option.
VIJ::MITERForms a sharp point at the join. Typically not the best looking option.
VIJ::ROUNDRounds the edge of the join to produce the best looking results.
Vector module documentation © Paul Manias © 2010-2025

VIS Type

Options for the Vector class' Visibility field.

NameDescription
VIS::COLLAPSEHide the vector and its children. Do not use - provided for SVG compatibility only.
VIS::HIDDENHide the vector and its children.
VIS::INHERITInherit the visibility state from the parent.
VIS::VISIBLEThe default. Ensures that the vector is visible.
Vector module documentation © Paul Manias © 2010-2025

VLC Type

Line-cap options.

NameDescription
VLC::BUTTThe default. The line is sharply squared off at its exact end point.
VLC::INHERITThe cap type is inherited from the parent (defaults to butt if unspecified).
VLC::ROUNDThe line cap is a half-circle and the line's end-point forms the center point.
VLC::SQUARESimilar to butt, the line is sharply squared off but will extend past the end point by StrokeWidth / 2.
Vector module documentation © Paul Manias © 2010-2025

VLJ Type

Options for the look of line joins.

NameDescription
VLJ::BEVELThe join is blunted, eliminating overly sharp edges.
VLJ::INHERITInherit the join option from the parent.
VLJ::MITERThe default. A sharp corner is used to join path segments. The corner is formed by extending the outer edges of the stroke at the tangents of the path segments until they intersect. If the ‘stroke-miterlimit’ is exceeded, the line join falls back to BEVEL.
VLJ::MITER_ROUNDDefault to MITER, but switch to ROUND if the miter limit is exceeded.
VLJ::MITER_SMARTAn alternative form of MITER that extends beyond the intersection point, similarly to the miter-clip SVG rules.
VLJ::ROUNDThe join is rounded.
Vector module documentation © Paul Manias © 2010-2025

VectorMatrix Structure

Vector transformation matrix.

FieldTypeDescription
Nextstruct VectorMatrix *The next transform in the list.
VectorobjVector *The vector associated with the transform.
ScaleXDOUBLEMatrix value A
ShearYDOUBLEMatrix value B
ShearXDOUBLEMatrix value C
ScaleYDOUBLEMatrix value D
TranslateXDOUBLEMatrix value E
TranslateYDOUBLEMatrix value F
TagINTAn optional tag value defined by the client for matrix identification.
Vector class documentation © Paul Manias © 2010-2025