diff options
author | Genny <gen@nyble.dev> | 2022-12-24 05:10:17 -0600 |
---|---|---|
committer | Genny <gen@nyble.dev> | 2022-12-24 05:10:17 -0600 |
commit | b3dd7aed22fd275ae61aaf5228051419ee6d1b56 (patch) | |
tree | a61f3b176024966f79b6ef7f81c73fa272715be8 | |
parent | 8b1da8513c7810e77fcaab5cf760222059250fd7 (diff) | |
download | gifed-b3dd7aed22fd275ae61aaf5228051419ee6d1b56.tar.gz gifed-b3dd7aed22fd275ae61aaf5228051419ee6d1b56.zip |
comment extension encoding
-rw-r--r-- | gifed/src/block/extension/graphiccontrol.rs | 2 | ||||
-rw-r--r-- | gifed/src/block/mod.rs | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gifed/src/block/extension/graphiccontrol.rs b/gifed/src/block/extension/graphiccontrol.rs index 5806884..31cc961 100644 --- a/gifed/src/block/extension/graphiccontrol.rs +++ b/gifed/src/block/extension/graphiccontrol.rs @@ -10,7 +10,7 @@ pub struct GraphicControl { } impl GraphicControl { - pub(crate) fn new( + pub fn new( disposal_method: DisposalMethod, user_input_flag: bool, transparency_flag: bool, diff --git a/gifed/src/block/mod.rs b/gifed/src/block/mod.rs index 5eb8a78..3a0f09f 100644 --- a/gifed/src/block/mod.rs +++ b/gifed/src/block/mod.rs @@ -69,7 +69,14 @@ fn encode_extension(block: &Block) -> Vec<u8> { vec.extend_from_slice(&gce.delay.to_le_bytes()); vec.push(gce.transparency_index); } - Block::CommentExtension(comment) => todo!(), + Block::CommentExtension(comment) => { + vec.push(0xFE); // Comment label + + for chnk in comment.chunks(255) { + vec.push(chnk.len() as u8); + vec.extend_from_slice(chnk); + } + } Block::ApplicationExtension(app) => { vec.push(0xFF); // Application extension label vec.push(0x0B); // 11 bytes, fixed, for the ident and auth |