Skip to main content

Module paint

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§

PaintCtx
The renderer state one immediate-mode paint pass threads through its helpers.

Functions§

fill_rect
Fill rect with a solid colour.
fill_round
Fill rect with corners rounded to radius.
snap_rect
rect on 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, as surface::card does.
stroke_rect
Stroke the outline of rect with a line width wide.
stroke_round
Stroke the outline of rect, corners rounded to radius, with a line width wide.
with_alpha
c with its alpha replaced by the 8-bit alpha (0 transparent, 255 opaque), keeping its 8-bit RGB.