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/block/extension/mod.rs | |
parent | f35e18cb0531e7d6a3544560746d592aa47ed555 (diff) | |
download | gifed-1de64a3818875947f7f1044b1d4cfdf271b04fd3.tar.gz gifed-1de64a3818875947f7f1044b1d4cfdf271b04fd3.zip |
Bring gifprobe into this repository
Diffstat (limited to 'src/block/extension/mod.rs')
-rw-r--r-- | src/block/extension/mod.rs | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/block/extension/mod.rs b/src/block/extension/mod.rs deleted file mode 100644 index fb5eb20..0000000 --- a/src/block/extension/mod.rs +++ /dev/null @@ -1,49 +0,0 @@ -mod application; -mod graphiccontrol; - -pub use graphiccontrol::{DisposalMethod, GraphicControl}; - -pub use self::application::Application; - -pub enum Extension { - GraphicControl(GraphicControl), - Looping(u16), - Comment(Vec<u8>), // Plain Text - Application(Application), -} - -impl From<&Extension> for Box<[u8]> { - fn from(ext: &Extension) -> Self { - let mut vec = vec![]; - vec.push(0x21); // Push the extension introducer - - match ext { - Extension::GraphicControl(gc) => { - vec.push(0xF9); // Graphic control label - vec.push(0x04); // Block size for this extension is always 4 - vec.push(gc.packed); - vec.extend_from_slice(&gc.delay_time.to_le_bytes()); - vec.push(gc.transparency_index); - } - Extension::Looping(count) => { - vec.push(0xFF); // Application extension label - vec.push(0x0B); // 11 bytes in this block - vec.extend_from_slice(b"NETSCAPE2.0"); // App. ident. and "auth code" - vec.push(0x03); // Sub-block length - vec.push(0x01); // Identifies netscape looping extension - vec.extend_from_slice(&count.to_le_bytes()); - } - Extension::Comment(_) => todo!(), - Extension::Application(_) => todo!(), - } - - vec.push(0x00); // Zero-length data block indicates end of extension - vec.into_boxed_slice() - } -} - -impl From<GraphicControl> for Extension { - fn from(gce: GraphicControl) -> Self { - Extension::GraphicControl(gce) - } -} |