Provides support for the filling and stroking of vectors with patterns.
The VectorPattern class is used by Vector painting algorithms to fill and stroke vectors with pre-rendered patterns. It is the most efficient way of rendering a common set of graphics multiple times.
The VectorPattern must be registered with a VectorScene via the AddDef() method. Any vector within the target scene will be able to utilise the pattern for filling or stroking by referencing its name through the Vector⇒Fill and Vector⇒Stroke fields. For instance url(#dots)
.
A special use case is made for patterns that are applied as a fill operation in VectorViewport objects. In this case the renderer will dynamically render the pattern as a background within the viewport. This ensures that the pattern is rendered at maximum fidelity whenever it is used, and not affected by bitmap clipping restrictions. It should be noted that this means the image caching feature will be disabled.
It is strongly recommended that the VectorPattern is owned by the VectorScene that is handling the definition. This will ensure that the VectorPattern is deallocated when the scene is destroyed.
The VectorPattern class consists of the following fields:
Access | Name | Type | Comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Dimensions | DMF | Dimension flags are stored here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Height | DOUBLE | Height of the pattern tile. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The (Width,Height) field values define the dimensions of the pattern tile. If the provided value is scaled, then the dimension is calculated relative to the bounding box or viewport applying the pattern, dependent on the Units setting. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Inherit | *VectorPattern | Inherit attributes from a VectorPattern referenced here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
Attributes can be inherited from another pattern by referencing it in this field. This feature is provided primarily for the purpose of simplifying SVG compatibility and its use may result in an unnecessary performance penalty. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Matrices | APTR | A linked list of transform matrices that have been applied to the pattern. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
All transforms that have been applied to the pattern can be read from the Matrices field. Each transform is represented by a VectorMatrix structure, and are linked in the order in which they were applied to the pattern.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Opacity | DOUBLE | The opacity of the pattern. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The opacity of the pattern is defined as a value between 0.0 and 1.0, with 1.0 being fully opaque. The default value is 1.0. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Scene | *VectorScene | Refers to the internal VectorScene that will contain the rendered pattern. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The VectorPattern class allocates a VectorScene in this field and inherits its functionality. In addition, a VectorViewport class will be assigned to the scene and is referenced in the Viewport field for managing the vectors that will be rendered. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SpreadMethod | VSPREAD | The behaviour to use when the pattern bounds do not match the vector path. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
Indicates what happens if the pattern starts or ends inside the bounds of the target vector. The default value is PAD.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Transform | STRING | Applies a transform to the pattern during the render process. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
A transform can be applied to the pattern by setting this field with an SVG compliant transform string. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Units | VUNIT | Defines the coordinate system for fields X, Y, Width and Height. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field declares the coordinate system that is used for values in the X and Y fields. The default setting is
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Viewport | OBJECTPTR | Refers to the viewport that contains the pattern. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The Viewport refers to a VectorViewport object that is created to host the vectors for the rendered pattern. If the Viewport does not contain at least one vector that renders an image, the pattern will be ineffective. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Width | DOUBLE | Width of the pattern tile. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The (Width,Height) field values define the dimensions of the pattern tile. If the provided value is scaled, the dimension is calculated relative to the bounding box or viewport applying the pattern, dependent on the Units setting. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
X | DOUBLE | X coordinate for the pattern. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The (X,Y) field values define the starting coordinate for mapping patterns. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Y | DOUBLE | Y coordinate for the pattern. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The (X,Y) field values define the starting coordinate for mapping patterns. |
Name | Description |
---|---|
DMF::FIXED_CENTER_X | The CenterX field is a fixed size. |
DMF::FIXED_CENTER_Y | The CenterY field is a fixed size. |
DMF::FIXED_DEPTH | The Depth field is a fixed size. |
DMF::FIXED_HEIGHT | The Height field is a fixed size. |
DMF::FIXED_RADIUS_X | The RadiusX field is a fixed size. |
DMF::FIXED_RADIUS_Y | The RadiusY field is a fixed size. |
DMF::FIXED_WIDTH | The Width field is a fixed suze. |
DMF::FIXED_X | The X field is a fixed coordinate. |
DMF::FIXED_X_OFFSET | The XOffset field is a fixed coordinate. |
DMF::FIXED_Y | The Y field is a fixed coordinate. |
DMF::FIXED_Y_OFFSET | The YOffset field is a fixed coordinate. |
DMF::FIXED_Z | The Z field is a fixed coordinate. |
DMF::SCALED_CENTER_X | The CenterX field is scaled to this object's parent. |
DMF::SCALED_CENTER_Y | The CenterY field is scaled to this object's parent. |
DMF::SCALED_DEPTH | The Depth field is scaled to this object's parent. |
DMF::SCALED_HEIGHT | The Height field is scaled to this object's parent. |
DMF::SCALED_RADIUS_X | The RadiusX field is scaled to this object's parent. |
DMF::SCALED_RADIUS_Y | The RadiusY field is a scaled size to this object's parent. |
DMF::SCALED_WIDTH | The Width field is scaled to this object's parent. |
DMF::SCALED_X | The X field is scaled to this object's parent. |
DMF::SCALED_X_OFFSET | The XOffset field is scaled to this object's parent. |
DMF::SCALED_Y | The Y field is scaled to this object's parent. |
DMF::SCALED_Y_OFFSET | The YOffset field is scaled to this object's parent. |
DMF::SCALED_Z | The Z field is a scaled coordinate to this object's parent. |
DMF::STATUS_CHANGE_H | |
DMF::STATUS_CHANGE_V |
Spread method options define the method to use for tiling filled graphics.
Name | Description |
---|---|
VSPREAD::CLIP | Do not scale the graphic. Clip it if it extends past imposed boundaries. |
VSPREAD::PAD | Scale the graphic to the object bounds. |
VSPREAD::REFLECT | Tile the graphic, reflecting the image alternately on the X and Y axis. |
VSPREAD::REFLECT_X | Tile the graphic, reflecting the image alternately on the X axis only. |
VSPREAD::REFLECT_Y | Tile the graphic, reflecting the image alternately on the Y axis only. |
VSPREAD::REPEAT | Tile the graphic repeatedly. |
VSPREAD::UNDEFINED | Either the default setting will be applied or the setting will be inherited from a parent object. |
Name | Description |
---|---|
VUNIT::BOUNDING_BOX | Coordinates are scaled to the object's bounding box. |
VUNIT::UNDEFINED | Either the default setting will be applied or the setting will be inherited from a parent object. |
VUNIT::USERSPACE | Coordinates are scaled to the current viewport. |
Vector transformation matrix.
Field | Type | Description |
---|---|---|
Next | struct VectorMatrix * | The next transform in the list. |
Vector | objVector * | The vector associated with the transform. |
ScaleX | DOUBLE | Matrix value A |
ShearY | DOUBLE | Matrix value B |
ShearX | DOUBLE | Matrix value C |
ScaleY | DOUBLE | Matrix value D |
TranslateX | DOUBLE | Matrix value E |
TranslateY | DOUBLE | Matrix value F |
Tag | LONG | An optional tag value defined by the client for matrix identification. |
Class Info | |
---|---|
ID | ID_VECTORPATTERN |
Category | Graphics |
Include | modules/vectorpattern.h |
Version | 1 |