Function fill_scrim
pub fn fill_scrim(
scene: &mut Scene,
transform: Affine,
rect: Rect,
strength: f32,
theme: &Theme,
)Expand description
Paint a scrim over rect at strength, in the theme’s own scrim hue.
A flat wash dims by an amount that depends on the ground’s own
lightness: measured on a real frame, a flat 0.45 wash took 39.6 L* off
a bg-white page (252→143) and 1.5 L* off the desktop beside it
(20→16) — the page read as blanked out and nothing else read as dimmed
— and flattened the 12 code values between the page and a rule on it
down to 7.
So this is two fills instead of one: a soft-light tone stage (Cb²
against black, a proportional move that dims the middle/bottom without
flattening the top) and a flat level stage in the theme’s scrim hue
at SCRIM_LEVEL_SHARE of strength. Together they take a uniform
21-23 L* off every ground from #ffffff to mid grey. Blend modes need
a backdrop, so call this after whatever it dims is already drawn into
the same Scene.