diff --git a/src/decoder/formats/glycin_proxy.rs b/src/decoder/formats/glycin_proxy.rs index 86f3dec..78bc477 100644 --- a/src/decoder/formats/glycin_proxy.rs +++ b/src/decoder/formats/glycin_proxy.rs @@ -69,7 +69,7 @@ impl Glycin { let frame = image.next_frame().await?; let mut metadata: Metadata = Metadata::default(); - metadata.set_frame_info(frame.details().clone()); + metadata.set_frame_metadata(&frame); updater.send(DecoderUpdate::Metadata(Box::new(metadata))); tiles.set_original_dimensions((frame.width() as u32, frame.height() as u32)); diff --git a/src/metadata.rs b/src/metadata.rs index 10fa204..85858d6 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -25,6 +25,7 @@ mod file; mod gps; pub use file::FileInfo; +use glycin::{Frame, MemoryFormat}; use glycin::{FrameDetails, ImageInfoDetails}; pub use gps::GPSLocation; @@ -39,6 +40,7 @@ pub struct Metadata { file_info: Option, image_info: Option, frame_info: Option, + memory_format: Option, } impl std::fmt::Debug for Metadata { @@ -80,8 +82,9 @@ impl Metadata { self.image_info = Some(image_info); } - pub fn set_frame_info(&mut self, frame_info: FrameDetails) { - self.frame_info = Some(frame_info); + pub fn set_frame_metadata(&mut self, frame: &Frame) { + self.frame_info = Some(frame.details().clone()); + self.memory_format = Some(frame.memory_format()); } pub fn set_file_info(&mut self, file_info: FileInfo) { @@ -144,8 +147,7 @@ impl Metadata { } pub fn is_potentially_transparent(&self) -> bool { - // TODO: Implement again - true + self.memory_format.is_some_and(|x| x.has_alpha()) } pub fn transformations_applied(&self) -> bool {