Skip to main content

paint_label

Function paint_label 

Source
pub fn paint_label(
    painter: &Painter,
    at: Pos2,
    anchor: Align2,
    text: impl Into<String>,
) -> Rect
Expand description

Draws text as a label over an image, through the kit’s viewport-label component: a translucent pill (its fill, radius, padding-x and padding-y) holding the text in its text colour, at its font-size (the Small text style’s when the kit gives none). anchor says which point of the label sits at at (points): LEFT_BOTTOM puts it above and right of at. An overlay’s label (Overlay::label) is drawn this way; so is a HUD’s readout over an image. Returns the rectangle the label covers.