pub struct IconImage { /* private fields */ }
Expand description
A decoded image.
Implementations§
source§impl IconImage
impl IconImage
sourcepub fn from_rgba_data(width: u32, height: u32, rgba_data: Vec<u8>) -> IconImage
pub fn from_rgba_data(width: u32, height: u32, rgba_data: Vec<u8>) -> IconImage
Creates a new image with the given dimensions and RGBA data. The
width
and height
must be nonzero, and rgba_data
must have 4 * width * height
bytes and be in row-major order from top to bottom.
Panics if the dimensions are out of range or if rgba_data
is the
wrong length.
sourcepub fn read_png<R: Read>(reader: R) -> Result<IconImage>
pub fn read_png<R: Read>(reader: R) -> Result<IconImage>
Decodes an image from a PNG file. Returns an error if the PNG data is malformed or can’t be decoded.
sourcepub fn cursor_hotspot(&self) -> Option<(u16, u16)>
pub fn cursor_hotspot(&self) -> Option<(u16, u16)>
Returns the coordinates of the cursor hotspot (pixels right from the
left edge of the image, and pixels down from the top edge), or None
if this image is an icon rather than a cursor.
sourcepub fn set_cursor_hotspot(&mut self, hotspot: Option<(u16, u16)>)
pub fn set_cursor_hotspot(&mut self, hotspot: Option<(u16, u16)>)
Sets or clears the cursor hotspot coordinates.