pub struct Icon { /* private fields */ }
Expand description
An icon used for the window titlebar, taskbar, etc.
Enabling the icon_loading
feature provides you with several convenience methods for creating
an Icon
from any format supported by the image
crate.
Implementations§
source§impl Icon
impl Icon
sourcepub fn from_rgba(
rgba: Vec<u8, Global>,
width: u32,
height: u32
) -> Result<Icon, BadIcon>
pub fn from_rgba( rgba: Vec<u8, Global>, width: u32, height: u32 ) -> Result<Icon, BadIcon>
Creates an Icon
from 32bpp RGBA data.
The length of rgba
must be divisible by 4, and width * height
must equal
rgba.len() / 4
. Otherwise, this will return a BadIcon
error.
sourcepub fn from_path<P>(path: P) -> Result<Icon, ImageError>where
P: AsRef<Path>,
pub fn from_path<P>(path: P) -> Result<Icon, ImageError>where P: AsRef<Path>,
Loads an Icon
from the path of an image on the filesystem.
Requires the icon_loading
feature.
sourcepub fn from_reader<R>(
reader: R,
format: ImageFormat
) -> Result<Icon, ImageError>where
R: BufRead + Seek,
pub fn from_reader<R>( reader: R, format: ImageFormat ) -> Result<Icon, ImageError>where R: BufRead + Seek,
Loads an Icon
from anything implementing BufRead
and Seek
.
Requires the icon_loading
feature.
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Icon, ImageError>
pub fn from_bytes(bytes: &[u8]) -> Result<Icon, ImageError>
Loads an Icon
from the unprocessed bytes of an image file.
Uses heuristics to determine format.
Requires the icon_loading
feature.
sourcepub fn from_bytes_with_format(
bytes: &[u8],
format: ImageFormat
) -> Result<Icon, ImageError>
pub fn from_bytes_with_format( bytes: &[u8], format: ImageFormat ) -> Result<Icon, ImageError>
Loads an Icon
from the unprocessed bytes of an image.
Requires the icon_loading
feature.