Struct ico::IconImage
[−]
[src]
pub struct IconImage { /* fields omitted */ }
A decoded image.
Methods
impl IconImage
[src]
fn from_rgba_data(width: u32, height: u32, rgba_data: Vec<u8>) -> IconImage
[src]
Creates a new image with the given dimensions and RGBA data. The
width
and height
must each be between 1 and 256 inclusive, 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.
fn read_png<R: Read>(reader: R) -> Result<IconImage>
[src]
Decodes an image from a PNG file. The width and height of the image must each be between 1 and 256 inclusive. Returns an error if the PNG data is malformed or can't be decoded, or if the size of the PNG image is out of range.
fn write_png<W: Write>(&self, writer: W) -> Result<()>
[src]
Encodes the image as a PNG file.
fn width(&self) -> u32
[src]
Returns the width of the image, in pixels.
fn height(&self) -> u32
[src]
Returns the height of the image, in pixels.
fn cursor_hotspot(&self) -> Option<(u16, u16)>
[src]
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.
fn set_cursor_hotspot(&mut self, hotspot: Option<(u16, u16)>)
[src]
Sets or clears the cursor hotspot coordinates.
fn rgba_data(&self) -> &[u8]
[src]
Returns the RGBA data for this image, in row-major order from top to bottom.