Bilinear Coons patch mesh gradient paint server.
GradientMesh interpolates colour across a grid of curved patches. Each patch is bounded by four cubic Bezier edges and carries one colour at each corner. Rendering tessellates the patches into Gouraud triangles, so colour follows the patch geometry rather than a one-dimensional colour ramp. Corner colours are blended bilinearly by default; setting Mode to BICUBIC selects smooth bicubic colour interpolation across the patch grid instead.
The inherited colour-ramp fields Stops, ColourMap, SpreadMethod and Colour are not supported by this class. Patch geometry and corner colours are supplied through Patches.
When a mesh is exported to SVG, valid Rows and Columns metadata is preserved through the standard shared-edge meshrow syntax. A mesh without valid row metadata (e.g. a non-rectangular grid) is flattened to a single row on export; every patch survives intact, with patches that do not share an edge with their predecessor written as independent patches, but the original row structure is not retained.
The GradientMesh class consists of the following fields:
Access | Name | Type | Comment | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Columns | INT | The number of columns represented by the flat Patches array. | |||||||||
Columns stores the column count for the mesh grid while Patches remains a flat row-major array. The row and column counts must multiply to the number of patch records when both dimensions and patches are present. | |||||||||||
| Mode | GMT | Chooses the interpolation mode for the mesh gradient. | |||||||||
By default, corner colours are interpolated bilinearly across each patch, which can leave a visible star or cross artefact where patch corners meet. Opting for the The setting is a rendering mode and is retained when Patches is reassigned.
| |||||||||||
| Patches | kt::vector<MeshPatchRecord> | Defines the Coons patches for a mesh gradient. | |||||||||
The Patches array defines one or more bilinear Coons patches. Each MeshPatchRecord contains four cubic Bezier edges in clockwise order ( The coordinate system for patch positions is determined by Gradient⇒Units. Under Assigning an empty array clears the mesh entirely, including the Rows and Columns metadata. | |||||||||||
| Rows | INT | The number of rows represented by the flat Patches array. | |||||||||
Rows stores the row count for the mesh grid while Patches remains a flat row-major array. When valid row and column metadata is supplied, SVG export can preserve standard meshgradient shared-edge syntax across multiple rows. If no metadata is supplied, assigning Patches defaults to a single-row mesh for simple programmatic use. | |||||||||||
| XMLDef | STRING | Returns an SVG compliant XML string that describes the effect. | |||||||||
Available modes for the GradientMesh class.
| Name | Description |
|---|---|
| GMT::BICUBIC | Use bicubic interpolation for the patch colours. |
| GMT::LINEAR | Use linear interpolation for the patch colours. |
| GMT::UNDEFINED | Either the default setting will be applied or the setting will be inherited from a parent object. |
Describes one bilinear Coons patch for the GradientMesh Patches field.
| Field | Type | Description |
|---|---|---|
| Top | struct MeshControl | Top edge |
| Right | struct MeshControl | Right edge |
| Bottom | struct MeshControl | Bottom edge |
| Left | struct MeshControl | Left edge |
| TopLeft | struct FRGB | Colour assigned to the top-left patch corner. |
| TopRight | struct FRGB | Colour assigned to the top-right patch corner. |
| BottomRight | struct FRGB | Colour assigned to the bottom-right patch corner. |
| BottomLeft | struct FRGB | Colour assigned to the bottom-left patch corner. |