pub struct CursorImage {
pub width: i32,
pub height: i32,
pub hotspot: Point,
pub mask: &'static [u8],
}Expand description
A cursor bitmap: three levels, drawn in two theme colours.
mask is one ASCII byte per pixel in row-major order, which keeps the shape
readable in the source instead of being a wall of hex:
.transparent#fill, painted inRole::BaseContent+outline, painted inRole::Base100
Both colours come from the theme, so the pointer inverts with it and stays visible on a light panel and a dark one without a second asset.
Fields§
§width: i32Width in pixels.
height: i32Height in pixels.
hotspot: PointThe pixel that sits on the pointer position.
mask: &'static [u8]width * height ASCII bytes.
Implementations§
Source§impl CursorImage
impl CursorImage
Sourcepub const fn is_well_formed(&self) -> bool
pub const fn is_well_formed(&self) -> bool
Returns true if mask matches the declared geometry.
Sourcepub fn rasterise(&self, theme: &Theme, out: &mut [u32]) -> usize
pub fn rasterise(&self, theme: &Theme, out: &mut [u32]) -> usize
Writes the sprite into out as 0xAARRGGBB words, for a hardware cursor
plane.
Returns the number of words written, which is width * height. The two
colours are the theme’s, exactly as the software composite uses them, so a
panel that switches to the plane does not also change appearance —
transparent pixels come out as a fully zero word rather than as black,
because a cursor plane composites during scanout and an opaque pad would
draw a rectangle around the pointer.
Re-run this when the theme changes: the sprite is resolved to concrete colours here, so the plane holds pixels rather than roles.
Trait Implementations§
Source§impl Clone for CursorImage
impl Clone for CursorImage
Source§fn clone(&self) -> CursorImage
fn clone(&self) -> CursorImage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more