pub enum FillRecipe {
Solid(RecipeColor),
StateLayer {
base: RecipeColor,
overlay: RecipeColor,
alpha: f32,
},
LinearGradient {
stops: Vec<GradientStop>,
angle_deg: f32,
},
RadialGradient {
stops: Vec<GradientStop>,
center: (f32, f32),
radius: f32,
},
None,
}Expand description
What the inside of the ShapeRecipe is filled with.
Solid and StateLayer both resolve to a flat Color (the latter
by compositing an overlay over a base at a given alpha — the
Material-3 / Fluent “state layer” model). LinearGradient /
RadialGradient describe true gradients; the renderer paints them via
the SDF gradient pipeline once a PaintProp carries them (see
resolve_fill_to_paint).
Variants§
Solid(RecipeColor)
Single flat color.
StateLayer
overlay composited over base at alpha — a translucent
“state layer” (M3 hover = 8 %, pressed = 12 % on-color over the
base fill). Resolves to a flat Color, so it flows through the
solid paint path with no gradient support required.
LinearGradient
Linear gradient at angle_deg (0° = top→bottom, 90° = leading→trailing).
RadialGradient
Radial gradient with normalized center (0.0..=1.0) and radius
in normalized units of the bounding rect’s longer side.
None
No fill (transparent).
Implementations§
Source§impl FillRecipe
impl FillRecipe
pub fn solid(color: impl Into<RecipeColor>) -> Self
Sourcepub fn state_layer(
base: impl Into<RecipeColor>,
overlay: impl Into<RecipeColor>,
alpha: f32,
) -> Self
pub fn state_layer( base: impl Into<RecipeColor>, overlay: impl Into<RecipeColor>, alpha: f32, ) -> Self
A translucent state layer: overlay composited over base at
alpha (clamped to 0.0..=1.0). Resolves to a flat Color.
Sourcepub fn resolve_flat(&self, colors: &ColorTokens) -> Option<Color>
pub fn resolve_flat(&self, colors: &ColorTokens) -> Option<Color>
Resolve the flat-color variants (Solid, StateLayer, None)
against colors. Gradient variants return None here — they are
resolved to a Paint by resolve_fill_to_paint, not to a flat
color. FillRecipe::None maps to Some(Color::TRANSPARENT).
Trait Implementations§
Source§impl Clone for FillRecipe
impl Clone for FillRecipe
Source§fn clone(&self) -> FillRecipe
fn clone(&self) -> FillRecipe
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more