Module paint
Expand description
Scene-painting shorthands for apps that draw their own surfaces.
Every hand-painted app needs the same handful of calls — fill a rect, fill
or stroke a rounded rect, fade a theme colour, set a line of text in a
role — and each used to carry its own copy. These take the colour
explicitly, so callers still read it from the crate::theme::Theme
passed to draw.
Structs§
- Paint
Ctx - The renderer state one immediate-mode paint pass threads through its helpers.
Functions§
- fill_
rect - Fill
rectwith a solid colour. - fill_
round - Fill
rectwith corners rounded toradius. - snap_
rect recton whole logical pixels. A crisp 1 px edge, a hairline or a separator stroked on a fractional rect covers two device pixels at half coverage and stops registering; layout may hand out fractions, the paint should not. Painted hosts snap a surface’s rect before edging it, assurface::carddoes.- stroke_
rect - Stroke the outline of
rectwith a linewidthwide. - stroke_
round - Stroke the outline of
rect, corners rounded toradius, with a linewidthwide. - with_
alpha cwith its alpha replaced by the 8-bitalpha(0transparent,255opaque), keeping its 8-bit RGB.