Diffusion curves paint server [BETA].
This class is in beta and is not yet fully supported. It is available for experimentation and feedback.
GradientDiffusion implements diffusion curves, a vector representation for smooth-shaded images (Orzan et al., SIGGRAPH 2008). The client supplies a sparse set of cubic Bezier curves through Curves, with an independent colour assigned to each side of every curve. The colours diffuse outward from the curves until they meet, producing smooth, organic shading across the fill region; each curve acts simultaneously as a colour source and as a barrier that prevents the colours of other curves from bleeding across it.
"Left" and "right" are relative to the direction of travel from the curve's start point to its end point, i.e. the left side is the side pointed to by the normal (-dy, dx). Colours are interpolated linearly along the length of each curve from its start colour to its end colour. Multi-segment curves are expressed as consecutive records that share endpoints and colours.
The diffusion is evaluated by relaxing a Laplace equation over a cached raster grid. The grid is re-solved only when the curve set or solve parameters change, so static gradients render at full speed after the first frame. The Gradient⇒Resolution field scales the solve grid's resolution: at 0 the longest axis receives 128 texels, rising to 512 texels at 1.0.
The inherited colour-ramp fields Stops, ColourMap, SpreadMethod and Colour are not supported by this class. All colour information is supplied through Curves.
The GradientDiffusion class consists of the following fields:
Access | Name | Type | Comment |
|---|---|---|---|
| Curves | kt::vector<DiffusionCurveRecord> | Defines the diffusion curves and their per-side colours. | |
The Curves array defines one or more diffusion curves. Each DiffusionCurveRecord carries the cubic Bezier geometry of one curve segment in its The coordinate system for curve positions is determined by Gradient⇒Units. Under Colour components are clamped to the range | |||
| XMLDef | STRING | Returns an SVG compliant XML string that describes the effect. | |
Describes one curve for the GradientDiffusion Curves field.
| Field | Type | Description |
|---|---|---|
| Curve | struct MeshControl | Cubic Bezier geometry for this curve segment. |
| LeftStart | struct FRGB | Colour on the left side at the start of the curve. |
| LeftEnd | struct FRGB | Colour on the left side at the end of the curve. |
| RightStart | struct FRGB | Colour on the right side at the start of the curve. |
| RightEnd | struct FRGB | Colour on the right side at the end of the curve. |