Skip to main content

draw_fitted

Function draw_fitted 

Source
pub fn draw_fitted(
    buf: &mut GlyphBuffer,
    (x, y): (i32, i32),
    (w, h): (i32, i32),
    (image, size): (ImageId, ImageInfo),
    dim: f32,
    mirror: bool,
)
Expand description

Draws image (of size pixels) in the area of (w, h) cells whose top-left cell is (x, y), at the largest whole scale that fits it, centred, as one sprite under the glyphs: a transparent pixel shows the cells’ background, so clear the area first. dim (0 = full color, 1 = gone) fades it toward that background; mirror flips it left to right. Clipped to the buffer. Draws nothing if the picture is too big for the area even at 1×.