Creation of TIM Tool #15

Merged
jaby merged 32 commits from topic/jb/tim_tool/slint-test into main 2025-02-16 21:26:32 +00:00
1 changed files with 5 additions and 5 deletions
Showing only changes of commit ac6a46134e - Show all commits

View File

@ -25,10 +25,6 @@ impl TIMInfo {
let mut image_data = SharedPixelBuffer::new(frame_info.width, frame_info.height);
let mut dst_pixels = image_data.make_mut_slice();
if bytes_per_pixel != 3 && bytes_per_pixel != 4 {
return Err(Error::from_text(format!("Image has {} bytes per pixel, but only 3 and 4 bytes per pixel are supported", bytes_per_pixel)));
}
if info.color_type == png::ColorType::Indexed {
let palette = info.palette.ok_or(Error::from_str("Found indexed PNG without palette"))?;
let mut palette_colors = Vec::new();
@ -56,6 +52,10 @@ impl TIMInfo {
}
else {
if bytes_per_pixel != 3 && bytes_per_pixel != 4 {
return Err(Error::from_text(format!("Image has {} bytes per pixel, but only 3 and 4 bytes per pixel are supported", bytes_per_pixel)));
}
let mut byte_iter = buffer.iter();
while let Some(color) = make_color(&mut byte_iter, bytes_per_pixel == 4) {
match bit_depth {