summaryrefslogtreecommitdiffstats
path: root/src/window
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-10 00:34:21 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-10 00:34:21 +0200
commitb8e5693a3089d728b4f8d4b3b0b7197202ebd732 (patch)
tree79a9f84f9920525657fbe03d53ce33bab09053d7 /src/window
parent956512338905bac0b156fdaf16fe3c3e07e97a84 (diff)
parenta3489e4af960388e9f73988b88df361022a654a4 (diff)
downloadiced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.gz
iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.bz2
iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.zip
Merge branch 'master' into explicit-text-caching
Diffstat (limited to 'src/window')
-rw-r--r--src/window/icon.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/window/icon.rs b/src/window/icon.rs
index 0fe010ca..ef71c228 100644
--- a/src/window/icon.rs
+++ b/src/window/icon.rs
@@ -10,10 +10,10 @@ use std::path::Path;
/// Creates an icon from an image file.
///
-/// This will return an error in case the file is missing at run-time. You may prefer [`Self::from_file_data`] instead.
+/// This will return an error in case the file is missing at run-time. You may prefer [`from_file_data`] instead.
#[cfg(feature = "image")]
pub fn from_file<P: AsRef<Path>>(icon_path: P) -> Result<Icon, Error> {
- let icon = image_rs::io::Reader::open(icon_path)?.decode()?.to_rgba8();
+ let icon = image::io::Reader::open(icon_path)?.decode()?.to_rgba8();
Ok(icon::from_rgba(icon.to_vec(), icon.width(), icon.height())?)
}
@@ -25,9 +25,10 @@ pub fn from_file<P: AsRef<Path>>(icon_path: P) -> Result<Icon, Error> {
#[cfg(feature = "image")]
pub fn from_file_data(
data: &[u8],
- explicit_format: Option<image_rs::ImageFormat>,
+ explicit_format: Option<image::ImageFormat>,
) -> Result<Icon, Error> {
- let mut icon = image_rs::io::Reader::new(std::io::Cursor::new(data));
+ let mut icon = image::io::Reader::new(std::io::Cursor::new(data));
+
let icon_with_format = match explicit_format {
Some(format) => {
icon.set_format(format);
@@ -59,5 +60,5 @@ pub enum Error {
/// The `image` crate reported an error.
#[cfg(feature = "image")]
#[error("Unable to create icon from a file: {0}")]
- ImageError(#[from] image_rs::error::ImageError),
+ ImageError(#[from] image::error::ImageError),
}