Skip to main content

draw_icon

Function draw_icon 

pub fn draw_icon(
    scene: &mut Scene,
    transform: Affine,
    rect: Rect,
    icon: Icon,
    color: AlphaColor<Srgb>,
    stroke_px: f64,
)
Expand description

Paint icon stroked in color into scene, centred within rect. The icon is scaled from rect.size().min() / LUCIDE_VIEWBOX so it always fits the shorter dimension, padding the longer axis.

stroke_px is the output width in pixels — lucide renders at 2 px on a 24-unit viewBox, trimmed here to 1.5 px by default (LUCIDE_DEFAULT_STROKE_PX); it’s divided by the icon’s scale before handing to vello so stroke width stays consistent across sizes.