about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gifed/src/block/extension/graphiccontrol.rs2
-rw-r--r--gifed/src/block/mod.rs9
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