diff options
author | Genny <gen@nyble.dev> | 2021-11-21 18:35:57 -0600 |
---|---|---|
committer | Genny <gen@nyble.dev> | 2021-11-21 18:35:57 -0600 |
commit | 1de64a3818875947f7f1044b1d4cfdf271b04fd3 (patch) | |
tree | 3a5bfbb237d67832dfa1beeb3d28566173484b63 /src/lib.rs | |
parent | f35e18cb0531e7d6a3544560746d592aa47ed555 (diff) | |
download | gifed-1de64a3818875947f7f1044b1d4cfdf271b04fd3.tar.gz gifed-1de64a3818875947f7f1044b1d4cfdf271b04fd3.zip |
Bring gifprobe into this repository
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index 0a11fdc..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,51 +0,0 @@ -mod color; -mod colorimage; -mod gif; -mod lzw; - -pub mod block; -pub mod reader; -pub mod writer; - -use core::fmt; -use std::error::Error; - -pub use color::Color; -pub use colorimage::ColorImage; -pub use gif::Gif; -pub use lzw::LZW; - -/// Perform the algorithm to get the length of a color table from -/// the value of the packed field. The max value here is 256 -pub(crate) fn packed_to_color_table_length(packed: u8) -> usize { - 2usize.pow(packed as u32 + 1) -} - -//TODO: Be sure to check that fields in LSD and Img. Desc. that were reserved -//in 87a aren't set if version is 87a, or that we return a warning, etc. Just -//remember about this. -//bottom of page 24 in 89a - -#[derive(Clone, Copy, Debug)] -pub enum EncodingError { - TooManyColors, - NoColorTable, - IndicieSizeMismatch { expected: usize, got: usize }, -} - -impl fmt::Display for EncodingError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::TooManyColors => write!(f, "A palette is limited to 256 colors"), - Self::NoColorTable => write!( - f, - "Refusing to set the background color index when no color table is set!" - ), - Self::IndicieSizeMismatch { expected, got } => { - write!(f, "Expected to have {} indicies but got {}", expected, got) - } - } - } -} - -impl Error for EncodingError {} |