use super::info;
use once_cell::sync::Lazy;
use strum_macros::{Display, EnumIter, EnumString};
#[non_exhaustive]
#[derive(Copy, Clone, PartialEq, Eq, Debug, Display, EnumIter, EnumString)]
#[strum(serialize_all = "PascalCase")]
pub enum Format {
Png,
Jpeg,
Gif,
WebP,
Pnm,
Tiff,
Tga,
Dds,
Bmp,
Ico,
Hdr,
OpenExr,
Farbfeld,
Avif,
Svg,
}
impl Format {
pub fn supported_formats() -> Vec<Self> {
use self::Format::*;
vec![
Png, Jpeg, Gif, WebP, Pnm, Tiff, Tga, Dds, Bmp, Ico, Hdr, OpenExr, Farbfeld, Avif,
]
}
pub fn info(&self) -> &Lazy<info::FormatInfo> {
match *self {
Format::Png => &info::PNG,
Format::Jpeg => &info::JPEG,
Format::Gif => &info::GIF,
Format::WebP => &info::WEBP,
Format::Pnm => &info::PNM,
Format::Tiff => &info::TIFF,
Format::Tga => &info::TGA,
Format::Dds => &info::DDS,
Format::Bmp => &info::BMP,
Format::Ico => &info::ICO,
Format::Hdr => &info::HDR,
Format::OpenExr => &info::OPENEXR,
Format::Farbfeld => &info::FARBFELD,
Format::Avif => &info::AVIF,
Format::Svg => &info::SVG,
}
}
}