about summary refs log tree commit diff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorGenny <gen@nyble.dev>2021-09-15 22:16:30 -0500
committerGenny <gen@nyble.dev>2021-09-15 22:16:30 -0500
commit7b8081a79fb3db4a76f9e4cca8f8a88e6e7f873c (patch)
tree5eab8cbf47698b031c12f8eadc4c55f674f70c01 /src/lib.rs
parentcdedae673268c372beb27c6d2f123cdf21f630f1 (diff)
downloadgifed-7b8081a79fb3db4a76f9e4cca8f8a88e6e7f873c.tar.gz
gifed-7b8081a79fb3db4a76f9e4cca8f8a88e6e7f873c.zip
Reading, fix writing, monocommit
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 83b0b77..6c0203c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,13 +3,20 @@ mod gif;
 mod lzw;
 
 pub mod block;
+pub mod reader;
 pub mod writer;
 
 pub use color::Color;
 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
\ No newline at end of file
+//bottom of page 24 in 89a