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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IconImage
impl RefUnwindSafe for IconImage
impl Send for IconImage
impl Sync for IconImage
impl Unpin for IconImage
impl UnwindSafe for IconImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more