pub enum PaintProp {
Solid(ColorProp),
Linear {
stops: Vec<GradientStopProp>,
angle_deg: f32,
},
Radial {
stops: Vec<GradientStopProp>,
center: (f32, f32),
radius: f32,
},
}Expand description
A fill that resolves to a canvas Paint — flat or gradient.
Variants§
Solid(ColorProp)
Flat fill — delegates to ColorProp (the common case; fully
reactive via a bound color or role).
Linear
Linear gradient. angle_deg: 0° = top→bottom, 90° =
leading→trailing.
Radial
Radial gradient. center is normalized (0.0..=1.0) within the
rect; radius is normalized to the rect’s longer side.
Implementations§
Source§impl PaintProp
impl PaintProp
Sourcepub fn from_fill(fill: &FillRecipe, colors: &ColorTokens) -> Self
pub fn from_fill(fill: &FillRecipe, colors: &ColorTokens) -> Self
Build a PaintProp from a FillRecipe. Flat variants
(Solid/StateLayer/None) become a Solid ColorProp;
gradients map their RecipeColor stops to ColorProp stops.
StateLayer can’t be a single role, so it resolves to a frozen
composited color (still re-resolved on theme swap only if the
caller rebuilds — recipe styles instead fold state layers into a
reactive Solid via their own state signal).
Sourcepub fn resolve(&self, theme: &Theme, enabled: bool, size: Size) -> Paint
pub fn resolve(&self, theme: &Theme, enabled: bool, size: Size) -> Paint
Resolve to a canvas Paint. size is the filled rect’s size;
gradient endpoints are rect-local ((0,0) = top-left).
Sourcepub fn register_if_bound(
&self,
widget_id: WidgetId,
registry: &BindingRegistry,
level: BindingLevel,
)
pub fn register_if_bound( &self, widget_id: WidgetId, registry: &BindingRegistry, level: BindingLevel, )
Register dirty-tracking for any signal-bearing color (the solid color or each gradient stop).