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
sourceimpl Icon
impl Icon
sourcepub fn from_rgba(rgba: Vec<u8>, width: u32, height: u32) -> Result<Self, BadIcon>
pub fn from_rgba(rgba: Vec<u8>, width: u32, height: u32) -> Result<Self, 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: AsRef<Path>>(path: P) -> ImageResult<Self>
pub fn from_path<P: AsRef<Path>>(path: P) -> ImageResult<Self>
Loads an Icon
from the path of an image on the filesystem.
Requires the icon_loading
feature.
sourcepub fn from_reader<R: BufRead + Seek>(
reader: R,
format: ImageFormat
) -> ImageResult<Self>
pub fn from_reader<R: BufRead + Seek>(
reader: R,
format: ImageFormat
) -> ImageResult<Self>
Loads an Icon
from anything implementing BufRead
and Seek
.
Requires the icon_loading
feature.
sourcepub fn from_bytes(bytes: &[u8]) -> ImageResult<Self>
pub fn from_bytes(bytes: &[u8]) -> ImageResult<Self>
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
) -> ImageResult<Self>
pub fn from_bytes_with_format(
bytes: &[u8],
format: ImageFormat
) -> ImageResult<Self>
Loads an Icon
from the unprocessed bytes of an image.
Requires the icon_loading
feature.
Trait Implementations
sourceimpl From<DynamicImage> for Icon
impl From<DynamicImage> for Icon
Requires the icon_loading
feature.
sourcefn from(image: DynamicImage) -> Self
fn from(image: DynamicImage) -> Self
impl Eq for Icon
impl StructuralEq for Icon
impl StructuralPartialEq for Icon
Auto Trait Implementations
impl RefUnwindSafe for Icon
impl Send for Icon
impl Sync for Icon
impl Unpin for Icon
impl UnwindSafe for Icon
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
value
as a parameter of self
.