pub struct GradientPaint {
pub angle_deg: f64,
pub stops: Vec<GradientStop>,
pub radial: bool,
pub center_x: Option<f64>,
pub center_y: Option<f64>,
pub radius_frac: Option<f64>,
}Expand description
A gradient fill paint — either linear (default) or radial.
For linear gradients, angle_deg controls the gradient line.
For radial gradients, radial=true is set and center_x/center_y/radius_frac
control the radial geometry (all as fractions of the bounding box).
The radial field and the three radial-geometry fields are omitted from
JSON when they hold their zero/none defaults, so existing linear GradientPaint
values serialize byte-identically.
Fields§
§angle_deg: f64Gradient-line angle in degrees, clockwise from +x. Ignored for radial.
stops: Vec<GradientStop>Ordered color stops (at least two).
radial: booltrue when this is a radial gradient. Omitted (default false) for linear.
center_x: Option<f64>Radial center X as a fraction of bounding-box width. None → 0.5.
center_y: Option<f64>Radial center Y as a fraction of bounding-box height. None → 0.5.
radius_frac: Option<f64>Radial radius as a fraction of hypot(w, h) / 2. None → 1.0.
Trait Implementations§
Source§impl Clone for GradientPaint
impl Clone for GradientPaint
Source§fn clone(&self) -> GradientPaint
fn clone(&self) -> GradientPaint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GradientPaint
impl Debug for GradientPaint
Source§impl PartialEq for GradientPaint
impl PartialEq for GradientPaint
Source§fn eq(&self, other: &GradientPaint) -> bool
fn eq(&self, other: &GradientPaint) -> bool
self and other values to be equal, and is used by ==.