metadata: Move file info and format to metadata
This commit is contained in:
parent
c36e7f4eb6
commit
c0f435386d
16 changed files with 327 additions and 339 deletions
|
|
@ -23,35 +23,6 @@ pub use svg::{Svg, RSVG_MAX_SIZE};
|
|||
|
||||
use super::{DecoderUpdate, UpdateSender};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ImageFormat {
|
||||
mime_type: glycin::MimeType,
|
||||
name: String,
|
||||
}
|
||||
|
||||
impl ImageFormat {
|
||||
pub fn new(mime_type: glycin::MimeType, name: String) -> Self {
|
||||
Self { mime_type, name }
|
||||
}
|
||||
|
||||
pub fn is_svg(&self) -> bool {
|
||||
matches!(
|
||||
self.mime_type.as_str(),
|
||||
"image/svg+xml" | "image/svg+xml-compressed"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_potentially_transparent(&self) -> bool {
|
||||
!matches!(self.mime_type.as_str(), "image/bmp" | "image/jpeg")
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ImageFormat {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
write!(f, "{}", self.name)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub enum ImageDimensionDetails {
|
||||
Svg(String),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue