Prepare for user saving of anime sequences

This commit is contained in:
Luke D Jones
2021-04-05 21:06:53 +12:00
parent 6d746b21a5
commit d854f7da1b
49 changed files with 339 additions and 124 deletions

View File

@@ -1,5 +1,6 @@
use std::error::Error;
use std::fmt;
use gif::DecodingError;
use png_pong::decode::Error as PngError;
#[derive(Debug)]
@@ -7,6 +8,7 @@ pub enum AnimeError {
NoFrames,
Io(std::io::Error),
Png(PngError),
Gif(DecodingError),
Format
}
@@ -17,6 +19,7 @@ impl fmt::Display for AnimeError {
AnimeError::NoFrames => write!(f, "No frames in PNG"),
AnimeError::Io(e) => write!(f, "Could not open: {}", e),
AnimeError::Png(e) => write!(f, "PNG error: {}", e),
AnimeError::Gif(e) => write!(f, "GIF error: {}", e),
AnimeError::Format => write!(f, "PNG file is not 8bit greyscale"),
}
}
@@ -34,4 +37,10 @@ impl From<PngError> for AnimeError {
fn from(err: PngError) -> Self {
AnimeError::Png(err)
}
}
impl From<DecodingError> for AnimeError {
fn from(err: DecodingError) -> Self {
AnimeError::Gif(err)
}
}