Parameters for a linear gradient fill at the Geode drawing layer. More...
#include "donner/svg/renderer/geode/GeoEncoder.h"
Classes | |
| struct | Stop |
| A single gradient stop: normalized offset and STRAIGHT-alpha RGBA. Not premultiplied: the resolver writes r/g/b/a each divided by 255, and both gradient shaders interpolate stops in straight alpha and premultiply only at output (stop-opacity conformance depends on it). More... | |
Public Attributes | |
| Vector2d | startGrad = Vector2d::Zero() |
| Start point in gradient space. | |
| Vector2d | endGrad = Vector2d::Zero() |
| End point in gradient space. | |
| Transform2d | gradientFromPath |
| Affine transform that maps a path-space sample position to gradient space. The fragment shader uses this to recover the gradient parameter t per pixel. This is the inverse of pathFromGradient and already bakes in both gradientUnits and the gradientTransform attribute. | |
| uint32_t | spreadMode = 0 |
| Spread mode at the edges of the gradient range. 0 = pad, 1 = reflect, 2 = repeat. | |
| std::span< const Stop > | stops |
| Gradient stops, in order of non-decreasing offset. Colors are in straight alpha, 0..1 per channel - the shader interpolates in straight alpha and premultiplies at output. Offsets are in [0, 1]. Up to 16 stops travel inline in the draw's parameters; a gradient with more reads them from a stop ramp texture, which the draws of one encoder share by stop content and a resident draw keeps until its stops change. A draw with more than GeoEncoder::kMaxGradientRampStops stops is refused. | |
Parameters for a linear gradient fill at the Geode drawing layer.
All geometry fields are in the gradient's own coordinate system (after the caller has already folded gradientUnits + the gradientTransform attribute into gradientFromPath). The encoder uploads these verbatim into a per-draw uniform buffer consumed by donner/gpu/shader/programs/SlugGradientSource.h.
| struct donner::geode::LinearGradientParams::Stop |
A single gradient stop: normalized offset and STRAIGHT-alpha RGBA. Not premultiplied: the resolver writes r/g/b/a each divided by 255, and both gradient shaders interpolate stops in straight alpha and premultiply only at output (stop-opacity conformance depends on it).
| Class Members | ||
|---|---|---|
| float | offset = 0.0f | Stop offset in [0, 1]. |
| float | rgba[4] = {0.0f, 0.0f, 0.0f, 1.0f} | Straight-alpha RGBA color. |
| Vector2d donner::geode::LinearGradientParams::endGrad = Vector2d::Zero() |
End point in gradient space.
| Transform2d donner::geode::LinearGradientParams::gradientFromPath |
Affine transform that maps a path-space sample position to gradient space. The fragment shader uses this to recover the gradient parameter t per pixel. This is the inverse of pathFromGradient and already bakes in both gradientUnits and the gradientTransform attribute.
| uint32_t donner::geode::LinearGradientParams::spreadMode = 0 |
Spread mode at the edges of the gradient range. 0 = pad, 1 = reflect, 2 = repeat.
| Vector2d donner::geode::LinearGradientParams::startGrad = Vector2d::Zero() |
Start point in gradient space.
| std::span<const Stop> donner::geode::LinearGradientParams::stops |
Gradient stops, in order of non-decreasing offset. Colors are in straight alpha, 0..1 per channel - the shader interpolates in straight alpha and premultiplies at output. Offsets are in [0, 1]. Up to 16 stops travel inline in the draw's parameters; a gradient with more reads them from a stop ramp texture, which the draws of one encoder share by stop content and a resident draw keeps until its stops change. A draw with more than GeoEncoder::kMaxGradientRampStops stops is refused.