mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 19:44:39 +03:00
chore(deps) Update Rust crate image to 0.23.1 (#419)
* chore(deps) Update Rust crate image to 0.23.1 * chore(bundler) updates for image v0.23.1 Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
parent
7278061e44
commit
f71a349907
@ -18,7 +18,7 @@ dirs = "2.0.2"
|
||||
error-chain = "0.12"
|
||||
glob = "0.3.0"
|
||||
icns = "0.3"
|
||||
image = "0.22.5"
|
||||
image = "0.23.1"
|
||||
libflate = "0.1"
|
||||
md5 = "0.7.0"
|
||||
msi = "0.2"
|
||||
|
@ -23,7 +23,7 @@ use crate::{ResultExt, Settings};
|
||||
|
||||
use ar;
|
||||
use icns;
|
||||
use image::png::{PNGDecoder, PNGEncoder};
|
||||
use image::png::{PngDecoder};
|
||||
use image::{self, GenericImageView, ImageDecoder};
|
||||
use libflate::gzip;
|
||||
use md5;
|
||||
@ -32,7 +32,6 @@ use tar;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::convert::TryInto;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Write};
|
||||
@ -298,9 +297,9 @@ fn generate_icon_files(settings: &Settings, data_dir: &PathBuf) -> crate::Result
|
||||
if icon_path.extension() != Some(OsStr::new("png")) {
|
||||
continue;
|
||||
}
|
||||
let decoder = PNGDecoder::new(File::open(&icon_path)?)?;
|
||||
let width = decoder.dimensions().0.try_into()?;
|
||||
let height = decoder.dimensions().1.try_into()?;
|
||||
let decoder = PngDecoder::new(File::open(&icon_path)?)?;
|
||||
let width = decoder.dimensions().0;
|
||||
let height = decoder.dimensions().1;
|
||||
let is_high_density = common::is_retina(&icon_path);
|
||||
if !sizes.contains(&(width, height, is_high_density)) {
|
||||
sizes.insert((width, height, is_high_density));
|
||||
@ -333,8 +332,10 @@ fn generate_icon_files(settings: &Settings, data_dir: &PathBuf) -> crate::Result
|
||||
if !sizes.contains(&(width, height, is_high_density)) {
|
||||
sizes.insert((width, height, is_high_density));
|
||||
let dest_path = get_dest_path(width, height, is_high_density);
|
||||
let encoder = PNGEncoder::new(common::create_file(&dest_path)?);
|
||||
encoder.encode(&icon.raw_pixels(), width, height, icon.color())?;
|
||||
icon.write_to(
|
||||
&mut common::create_file(&dest_path)?,
|
||||
image::ImageOutputFormat::Png
|
||||
)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ fn create_icns_file(
|
||||
}
|
||||
|
||||
for (icon, next_size_down, density) in images_to_resize {
|
||||
let icon = icon.resize_exact(next_size_down, next_size_down, image::Lanczos3);
|
||||
let icon = icon.resize_exact(next_size_down, next_size_down, image::imageops::FilterType::Lanczos3);
|
||||
add_icon_to_family(icon, density, &mut family)?;
|
||||
}
|
||||
|
||||
@ -395,14 +395,14 @@ fn create_icns_file(
|
||||
/// Converts an image::DynamicImage into an icns::Image.
|
||||
fn make_icns_image(img: image::DynamicImage) -> io::Result<icns::Image> {
|
||||
let pixel_format = match img.color() {
|
||||
image::ColorType::RGBA(8) => icns::PixelFormat::RGBA,
|
||||
image::ColorType::RGB(8) => icns::PixelFormat::RGB,
|
||||
image::ColorType::GrayA(8) => icns::PixelFormat::GrayAlpha,
|
||||
image::ColorType::Gray(8) => icns::PixelFormat::Gray,
|
||||
image::ColorType::Rgba8 => icns::PixelFormat::RGBA,
|
||||
image::ColorType::Rgb8 => icns::PixelFormat::RGB,
|
||||
image::ColorType::La8 => icns::PixelFormat::GrayAlpha,
|
||||
image::ColorType::L8 => icns::PixelFormat::Gray,
|
||||
_ => {
|
||||
let msg = format!("unsupported ColorType: {:?}", img.color());
|
||||
return Err(io::Error::new(io::ErrorKind::InvalidData, msg));
|
||||
}
|
||||
};
|
||||
icns::Image::from_data(pixel_format, img.width(), img.height(), img.raw_pixels())
|
||||
icns::Image::from_data(pixel_format, img.width(), img.height(), img.to_bytes())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user