pub struct Icon { /* private fields */ }
Expand description
An icon used for the window titlebar, taskbar, etc.
Implementations§
Source§impl Icon
impl Icon
Sourcepub fn from_rgba(
rgba: Vec<u8>,
width: u32,
height: u32,
) -> Result<Icon, BadIcon>
pub fn from_rgba( rgba: Vec<u8>, 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, size: Option<(u32, u32)>) -> Result<Icon, BadIcon>
pub fn from_path<P>(path: P, size: Option<(u32, u32)>) -> Result<Icon, BadIcon>
Create an icon from a file path.
Specify size
to load a specific icon size from the file, or None
to load the default
icon size from the file.
In cases where the specified size does not exist in the file, Windows may perform scaling to get an icon of the desired size.
Sourcepub fn from_resource(
ordinal: u16,
size: Option<(u32, u32)>,
) -> Result<Icon, BadIcon>
pub fn from_resource( ordinal: u16, size: Option<(u32, u32)>, ) -> Result<Icon, BadIcon>
Create an icon from a resource embedded in this executable or library.
Specify size
to load a specific icon size from the file, or None
to load the default
icon size from the file.
In cases where the specified size does not exist in the file, Windows may perform scaling to get an icon of the desired size.