remove old svelte web source
This commit is contained in:
36
src/picture_generator/export_format.rs
Normal file
36
src/picture_generator/export_format.rs
Normal file
@ -0,0 +1,36 @@
|
||||
use image::ImageFormat;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
pub enum ExportFormat {
|
||||
Jpeg,
|
||||
Avif,
|
||||
Svg,
|
||||
Png,
|
||||
}
|
||||
|
||||
impl ExportFormat {
|
||||
pub fn get_extension(&self) -> &str {
|
||||
match self {
|
||||
ExportFormat::Jpeg => "jpg",
|
||||
ExportFormat::Avif => "avif",
|
||||
ExportFormat::Svg => "svg",
|
||||
ExportFormat::Png => "png",
|
||||
}
|
||||
}
|
||||
pub fn get_type(&self) -> &str {
|
||||
match self {
|
||||
ExportFormat::Jpeg => "image/jpeg",
|
||||
ExportFormat::Avif => "image/avif",
|
||||
ExportFormat::Svg => "image/svg+xml",
|
||||
ExportFormat::Png => "image/png",
|
||||
}
|
||||
}
|
||||
pub fn get_image_format(&self) -> ImageFormat {
|
||||
match self {
|
||||
ExportFormat::Jpeg => ImageFormat::Jpeg,
|
||||
ExportFormat::Avif => ImageFormat::Avif,
|
||||
ExportFormat::Svg => ImageFormat::Jpeg, // TODO what now?
|
||||
ExportFormat::Png => ImageFormat::Png,
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user