Vectortools

ILxVectorCanvas

class ILxVectorCanvas

The Vector Canvas interface is used to store all the vector data associated with a vector item. It is usually stored in a channel, and can contain multiple shapes, paths and knots. The server implementing the vector canvas interface will also present a ILxVectorShape interface representing a single shape that contains all of the vector data and any sub-shapes.

Public Functions

LxResult GetItem(LXtObjectID self, void **ppvObj)

The GetItem function returns the item that the vector canvas server is stored on. If the canvas is not associated with an item, the function will return NOTAVAILABLE.

LxResult BeginEditBatch(LXtObjectID self)

Editing canvas data can be expensive, as any change to the data can trigger events that other systems react to. The edit batch allows a group of similar changes to be combined, so the events will not be triggered until the edit is finished and the batch is closed.

LxResult EndEditBatch(LXtObjectID self)

LXsPKG_CANVAS_CHANNEL

Items declare that they can provide a vector canvas with a package tag giving the name of the vector canvas channel. Read in an evaluated context, this will be a ValueReference object channel holding the vector canvas object.

ILxVectorShape

class ILxVectorShape

The Vector Shape interface represents a single shape in the canvas. Each shape has some basic properties, a collection of paths that make up the shape, as well as any number of sub-shapes. The server can be queried for an ILxAttributes interface, allowing the style properties of the shape to be accessed and potentially manipulated.

Public Functions

LxResult ShapeCount(LXtObjectID self, unsigned int *count)

Shapes can contain multiple sub-shapes. This function returns the number of child shapes that a shape contains.

LxResult ShapeByIndex(LXtObjectID self, unsigned int index, void **ppvObj)

This allows a child shape to be accessed by index. The object returned can be queried for an ILxVectorShape interface.

LxResult Parent(LXtObjectID self, void **ppvObj)

A shape can be queried for it’s parent using the following function. If this shape is the top-most shape, the function will return NOTFOUND, however this shape can be queried for an ILxVectorCanvas interface.

LxResult PathCount(LXtObjectID self, unsigned int *count)

A shape can contain multiple paths. This function returns the number of paths stored on a shape.

LxResult PathByIndex(LXtObjectID self, unsigned int index, void **ppvObj)

This allows a path to be accessed by index. The object returned can be queried for an ILxVectorPath interface.

LxResult Transform(LXtObjectID self, const LXtMatrix matrix)

A shape can be transformed by passing a 3x3 matrix that encodes a 2D rotation, 2D transform, and 2D scale to be applied to the shape.

ILxVectorPath

class ILxVectorPath

The Vector Path interface provides access to some basic properties, such as if the path is closed or not, as well as providing an accessor to access path knots.

Public Functions

LxResult IsPathClosed(LXtObjectID self)

Paths can either be open or closed. This state can be queried and modified using the following functions.

LxResult SetPathClosed(LXtObjectID self, LxResult closed)
LxResult KnotCount(LXtObjectID self, unsigned int *count)

This function returns the number of knots that make up the path.

LxResult SelectKnotByIndex(LXtObjectID self, unsigned int index)

Knots can be “selected” by index. When a knot is selected, querying the properties of the knot will return information about this knot.

LxResult SelectKnot(LXtObjectID self, LXtVectorKnotID knot)

Knots can be “selected” directly. When a knot is selected, querying the properties of the knot will return information about this knot.

LxResult KnotEnumerate(LXtObjectID self, LXtObjectID visitor)

Knots can be enumerated using a visitor. For each knot, the visitor evaluate function will be called, and the path accessor will be updated to point at the new knot.

LXtVectorKnotID ID(LXtObjectID self)

This methods returns the ID of the curent knot or null if none.

LxResult Pos(LXtObjectID self, double *x, double *y)

This methods returns the position of the curent knot.

typedef void *LXtVectorKnotID

ILxVectorListener

class ILxVectorListener

The Vector Listener allows clients to be signalled whenever the canvas state changes. Clients can attach to a ListenerPort interface on the Canvas object, and be signaled about changes through the ILxVectorListener interface that they implement.

Public Functions

LxResult Destroy(LXtObjectID self)

This event is sent when the canvas is destroyed.

LxResult ShapeAdd(LXtObjectID self, LXtObjectID shape)

After a shape is added, this event will be called. The shape is passed as an argument.

LxResult ShapeRemove(LXtObjectID self, LXtObjectID shape)

Before a shape is removed, this event will be called. The shape is passed as an argument.

LxResult ShapeStyle(LXtObjectID self, LXtObjectID shape, const char *name)

This event is used to mark a shape style change. The shape and name of the style are passed as arguments.

LxResult PathAdd(LXtObjectID self, LXtObjectID shape, LXtObjectID path)

After a path is added, this event will be called. The shape and path are passed as arguments.

LxResult PathRemove(LXtObjectID self, LXtObjectID shape, LXtObjectID path)

Before a path is removed, this event will be called. The shape and path are passed as arguments.

LxResult KnotPosition(LXtObjectID self, LXtObjectID shape, LXtObjectID path)

When a knot changes position, this event will be called. The shape and path are provided as arguments, and the path accessor is pointing at the knot that has changed.