Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

Gradient Class

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.

Structure

The Gradient class consists of the following fields:

Access
NameTypeComment
 Colourstruct FRGBThe 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 VSPREAD::CLIP flag in SpreadMethod. By default, this field has an alpha value of zero to ensure that nothing is drawn outside the initial bounds of the gradient. Setting any other colour value will otherwise fill in those areas.

 ColourMapSTRINGAssigns 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: cmap:crest, cmap:flare, cmap:icefire, cmap:inferno, cmap:magma, cmap:mako, cmap:plasma, cmap:rocket, cmap:viridis.

The use of colourmaps and custom stops are mutually exclusive.

 ColourSpaceVCSDefines 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 LINEAR_RGB will force the renderer to automatically convert sRGB values to linear RGB when blending.

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.
 EasingGEZSelects 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 GEZ::LINEAR mode leaves the gradient unchanged.

NameDescription
GEZ::CUBIC_INCubic ease-in.
GEZ::CUBIC_IN_OUTCubic ease-in and ease-out.
GEZ::CUBIC_OUTCubic ease-out.
GEZ::INEase-in (slow start).
GEZ::IN_OUTSmoothstep-style ease-in and ease-out.
GEZ::LINEARLinear interpolation (no easing) - the default.
GEZ::OUTEase-out (slow end).
 GammaDOUBLEApplies a gamma curve to the gradient ramp.

Gamma remaps the completed colour ramp before Resolution is applied. Values greater than 1.0 bias the ramp toward the first colour, while values between 0.0 and 1.0 bias it toward the last colour. A value of 1.0 leaves the gradient unchanged.

 Matriceskt::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.

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

 ResolutionDOUBLEAffects 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 1 / (1 - Resolution).

Resolution is at its maximum when this value is set to 1 (the default).

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

 SpreadMethodVSPREADDetermines 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 VSPREAD::PAD.

NameDescription
VSPREAD::CLIPDo not scale the graphic. Clip it if it extends past imposed boundaries.
VSPREAD::PADScale the graphic to the object bounds.
VSPREAD::REFLECTTile the graphic, reflecting the image alternately on the X and Y axis.
VSPREAD::REFLECT_XTile the graphic, reflecting the image alternately on the X axis only.
VSPREAD::REFLECT_YTile the graphic, reflecting the image alternately on the Y axis only.
VSPREAD::REPEATTile the graphic repeatedly.
VSPREAD::UNDEFINEDEither the default setting will be applied or the setting will be inherited from a parent object.
 Stopskt::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.

 TransformSTRINGApplies a transform to the gradient.

A transform can be applied to the gradient by setting this field with an SVG compliant transform string.

 UnitsVUNITDefines the coordinate system for gradient coordinates.

The default coordinate system for gradients is BOUNDING_BOX, which positions the gradient around the vector that references it. The alternative is USERSPACE, which positions the gradient scaled to the current viewport.

NameDescription
VUNIT::BOUNDING_BOXCoordinates are scaled to the object's bounding box.
VUNIT::UNDEFINEDEither the default setting will be applied or the setting will be inherited from a parent object.
VUNIT::USERSPACECoordinates are scaled to the current viewport.
 XMLDefSTRINGReturns 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 class documentation © Paul Manias © 2010-2026

GEZ Type

Gradient easing functions.

NameDescription
GEZ::CUBIC_INCubic ease-in.
GEZ::CUBIC_IN_OUTCubic ease-in and ease-out.
GEZ::CUBIC_OUTCubic ease-out.
GEZ::INEase-in (slow start).
GEZ::IN_OUTSmoothstep-style ease-in and ease-out.
GEZ::LINEARLinear interpolation (no easing) - the default.
GEZ::OUTEase-out (slow end).
Gradient module documentation © Paul Manias © 2010-2026

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.
Gradient module documentation © Paul Manias © 2010-2026

VSPREAD Type

Spread method options define the method to use for tiling filled graphics.

NameDescription
VSPREAD::CLIPDo not scale the graphic. Clip it if it extends past imposed boundaries.
VSPREAD::PADScale the graphic to the object bounds.
VSPREAD::REFLECTTile the graphic, reflecting the image alternately on the X and Y axis.
VSPREAD::REFLECT_XTile the graphic, reflecting the image alternately on the X axis only.
VSPREAD::REFLECT_YTile the graphic, reflecting the image alternately on the Y axis only.
VSPREAD::REPEATTile the graphic repeatedly.
VSPREAD::UNDEFINEDEither the default setting will be applied or the setting will be inherited from a parent object.
Gradient module documentation © Paul Manias © 2010-2026

VUNIT Type

NameDescription
VUNIT::BOUNDING_BOXCoordinates are scaled to the object's bounding box.
VUNIT::UNDEFINEDEither the default setting will be applied or the setting will be inherited from a parent object.
VUNIT::USERSPACECoordinates are scaled to the current viewport.
Gradient module documentation © Paul Manias © 2010-2026

GradientStop Structure

Describes a colour stop for the Gradient Stops field.

FieldTypeDescription
OffsetDOUBLEAn offset in the range of 0 - 1.0
RGBstruct FRGBA floating point RGB value.
Gradient class documentation © Paul Manias © 2010-2026

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.
Gradient class documentation © Paul Manias © 2010-2026