diff options
Diffstat (limited to 'src/actions.rs')
| -rw-r--r-- | src/actions.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/actions.rs b/src/actions.rs index 119df04..efb9f53 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -1,5 +1,27 @@ use std::path::PathBuf; +#[derive(Debug, Clone, Copy)] +pub enum ImageFormat { + Png, + Svg, +} + +impl ImageFormat { + pub fn extension(&self) -> &'static str { + match self { + ImageFormat::Png => "png", + ImageFormat::Svg => "svg", + } + } + + pub fn mime_type(&self) -> &'static str { + match self { + ImageFormat::Png => "image/png", + ImageFormat::Svg => "image/svg+xml", + } + } +} + #[derive(Debug)] pub enum Action { ChangeOrientation, @@ -9,6 +31,7 @@ pub enum Action { ZoomOut, ZoomIn, ExportImage, + ExportToFile { path: PathBuf, format: ImageFormat }, New, Open, Save { close_after: bool }, |