pub struct GradientRenderer;Expand description
Multi-layer gradient shadow renderer.
Renders shadows as multiple concentric layers with different colors, creating a visible falloff effect. Each layer is rendered slightly further from the element with a different color from the provided gradient.
Implementations§
Source§impl GradientRenderer
impl GradientRenderer
Sourcepub fn render_with_colors<G: Grid>(
grid: &mut G,
element_rect: Rect,
config: &ShadowConfig,
colors: &[Color],
progress: f64,
)
pub fn render_with_colors<G: Grid>( grid: &mut G, element_rect: Rect, config: &ShadowConfig, colors: &[Color], progress: f64, )
Render a gradient shadow using an array of colors.
§Arguments
grid- The grid to render intoelement_rect- The rect of the element casting the shadowconfig- Shadow configuration (offset and edges used, color ignored)colors- Gradient colors from lightest (outer) to darkest (inner)progress- Animation progress 0.0-1.0
§Example
ⓘ
// Use theme surface ladder for visible gradient
let colors = [
theme.surface.surface_container, // outer (lightest)
theme.surface.surface_container_low, // middle
theme.surface.surface_container_lowest, // inner (darkest)
];
GradientRenderer::render_with_colors(&mut grid, rect, &config, &colors, 1.0);Sourcepub fn render<G: Grid>(
grid: &mut G,
element_rect: Rect,
config: &ShadowConfig,
layers: u8,
progress: f64,
)
pub fn render<G: Grid>( grid: &mut G, element_rect: Rect, config: &ShadowConfig, layers: u8, progress: f64, )
Render a gradient shadow for the given element rect (legacy alpha-based).
Note: This uses alpha variation which may not be visible in terminals.
Prefer render_with_colors with theme colors for visible gradients.
§Arguments
grid- The grid to render intoelement_rect- The rect of the element casting the shadowconfig- Shadow configurationlayers- Number of gradient layers (1-4)progress- Animation progress 0.0-1.0
Auto Trait Implementations§
impl Freeze for GradientRenderer
impl RefUnwindSafe for GradientRenderer
impl Send for GradientRenderer
impl Sync for GradientRenderer
impl Unpin for GradientRenderer
impl UnsafeUnpin for GradientRenderer
impl UnwindSafe for GradientRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more