Base class for colour gradient paint servers.
Gradient stores the common state shared by all gradient paint servers. Concrete gradient classes such as GradientLinear, GradientRadial and GradientGouraud provide the fields that describe a specific gradient shape.
Gradient objects are definition objects and should normally be registered with a VectorScene via VectorScene⇒AddDef() before being referenced by vector fill or stroke attributes.
The Gradient class consists of the following fields:
Access | Name | Type | Comment | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Colour | struct FRGB | The default background colour to use when clipping is enabled. | |||||||||||||||||
The colour value in this field is applicable only when a gradient is in clip-mode by specifying the | |||||||||||||||||||
| ColourMap | STRING | Assigns a pre-defined colourmap to the gradient. | |||||||||||||||||
An alternative to defining colour Stops in a gradient is available in the form of named colourmaps. Declaring a colourmap in this field will automatically populate the gradient with the colours defined in the map. We currently support the following established colourmaps from the matplotlib and seaborn projects: The use of colourmaps and custom stops are mutually exclusive. | |||||||||||||||||||
| ColourSpace | VCS | Defines the colour space to use when interpolating gradient colours. | |||||||||||||||||
By default, gradients are rendered using the standard RGB colour space and alpha blending rules. Changing the colour space to
| |||||||||||||||||||
| Easing | GEZ | Selects the easing function for interpolation between gradient stops. | |||||||||||||||||
Easing modifies the interpolation position between each adjacent pair of Stops. For gradients sourced from ColourMap, it remaps the lookup position through the selected easing function before Gamma and Resolution are applied. The default
| |||||||||||||||||||
| Gamma | DOUBLE | Applies a gamma curve to the gradient ramp. | |||||||||||||||||
Gamma remaps the completed colour ramp before Resolution is applied. Values greater than | |||||||||||||||||||
| Matrices | kt::vector<VectorMatrix> | Applies one or more transforms to a gradient. | |||||||||||||||||
A transform can be applied to a gradient via one or more matrices. These will influence how gradient fills are rendered within their vector space. Each matrix is represented by a VectorMatrix structure, and the matrices are linked in the order in which they should be applied. | |||||||||||||||||||
| NumericID | INT | Numeric identifier for a vector. | |||||||||||||||||
The NumericID field is provided for internal use by the SVG and vector modules. If NumericID is set by the client, then any value in SID will be immediately cleared. | |||||||||||||||||||
| Resolution | DOUBLE | Affects the rate of change for colours in the gradient. | |||||||||||||||||
By default, the colours generated for a gradient will be spaced for a smooth transition between stops that maximise resolution. The resolution can be reduced by setting the Resolution value to a fraction between 0 and 1.0. This results in the colour values being averaged to a single value for every block of n colours, where n is the value Resolution is at its maximum when this value is set to 1 (the default). | |||||||||||||||||||
| SID | STRING | String identifier for a gradient. | |||||||||||||||||
The SID field is provided for the purpose of SVG support. Where possible, we recommend that you use the existing object name and automatically assigned ID's for identifiers. | |||||||||||||||||||
| SpreadMethod | VSPREAD | Determines the rendering behaviour to use when gradient colours are cycled. | |||||||||||||||||
SpreadMethod determines what happens when the first cycle of gradient colours is exhausted and needs to begin again. The default setting is
| |||||||||||||||||||
| Stops | kt::vector<GradientStop> | Defines the colours to use for the gradient. | |||||||||||||||||
The colours that will be used for drawing a gradient are defined by the Stops array. At least two stops are required to define a start and end point for interpolating the gradient colours. | |||||||||||||||||||
| Transform | STRING | Applies a transform to the gradient. | |||||||||||||||||
A transform can be applied to the gradient by setting this field with an SVG compliant transform string. | |||||||||||||||||||
| Units | VUNIT | Defines the coordinate system for gradient coordinates. | |||||||||||||||||
The default coordinate system for gradients is
| |||||||||||||||||||
| XMLDef | STRING | Returns an SVG compliant XML element string that describes the gradient type. | |||||||||||||||||
Derived gradient classes override this field to return the SVG element name and any shape-specific attributes. The returned string does not include angle brackets, common gradient attributes, stops or child elements. | |||||||||||||||||||
Gradient easing functions.
| Name | Description |
|---|---|
| GEZ::CUBIC_IN | Cubic ease-in. |
| GEZ::CUBIC_IN_OUT | Cubic ease-in and ease-out. |
| GEZ::CUBIC_OUT | Cubic ease-out. |
| GEZ::IN | Ease-in (slow start). |
| GEZ::IN_OUT | Smoothstep-style ease-in and ease-out. |
| GEZ::LINEAR | Linear interpolation (no easing) - the default. |
| GEZ::OUT | Ease-out (slow end). |
Colour space options.
| Name | Description |
|---|---|
| VCS::INHERIT | Inherit the colour space option from the parent vector. |
| VCS::LINEAR_RGB | Linear RGB is the default colour space for SVG and produces the best results. |
| VCS::SRGB | The default colour-space is sRGB, recommended for its speed. |
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. |
Describes a colour stop for the Gradient Stops field.
| Field | Type | Description |
|---|---|---|
| Offset | DOUBLE | An offset in the range of 0 - 1.0 |
| RGB | struct FRGB | A floating point RGB value. |
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 | INT | An optional tag value defined by the client for matrix identification. |