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§

clipped
Paint draw clipped to clip (under transform), 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
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.
stroke_line
Stroke line with a line width wide.
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.
stroke_shape
Stroke a rounded shape whose corners may differ.
with_alpha
c with its alpha replaced by the 8-bit alpha (0 transparent, 255 opaque), keeping its 8-bit RGB.
with_alpha_scaled
c with its alpha multiplied by factor (0.0 transparent, 1.0 unchanged), keeping its RGB. Unlike with_alpha, this scales the alpha the theme already gave the colour instead of replacing it with an absolute value.