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§
- clipped
- Paint
drawclipped toclip(undertransform), in a layer of its own, so a region drawn as a part of its own carries its clip with it. - fill_
rect - fill_
round - fill_
shape - Fill a rounded shape whose corners may differ.
- 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.- stroke_
line - Stroke
linewith a linewidthwide. - stroke_
rect - Stroke the outline of
rectwith a linewidthwide. - stroke_
round - Stroke the outline of
rect, corners rounded toradius, with a linewidthwide. - stroke_
shape - Stroke a rounded shape whose corners may differ.
- with_
alpha cwith its alpha replaced by the 8-bitalpha(0transparent,255opaque), keeping its 8-bit RGB.- with_
alpha_ scaled cwith its alpha multiplied byfactor(0.0 transparent, 1.0 unchanged), keeping its RGB. Unlikewith_alpha, this scales the alpha the theme already gave the colour instead of replacing it with an absolute value.