Skip to main content

compose

Function compose 

Source
pub fn compose(
    frame: &Frame,
    rotation: Rotation,
    dst: &mut [u32],
    dst_w: u32,
    dst_h: u32,
    stride_px: usize,
) -> Placement
Expand description

Compose frame into a cursor plane buffer, and say where it landed.

The buffer is wiped first. A frame smaller than the buffer must not leave the previous frame showing around its edges, and a rotation can move the sprite off its own former footprint entirely – either would ghost on screen.

A frame larger than the buffer on either axis is shrunk, both axes by the same ratio so it stays proportional. That is not a rare path: a theme picks the nearest size it ships, not the nearest size at or below what was asked for, so a 64-pixel plane routinely gets a 72-pixel sprite.

§Panics

If dst is too small for dst_h rows of stride_px, which is a caller error rather than anything a cursor file can cause.