about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGenny <gen@nyble.dev>2023-02-09 19:27:05 -0600
committerGenny <gen@nyble.dev>2023-02-09 19:27:05 -0600
commit404b21ff31c9babb3b7472d29392334bb949943b (patch)
tree43177fbec7acb944200f074f0c58c06da17dc2f4
parent45be9439fe9296e44d37551b6f2e1edf46c6faee (diff)
downloadgifed-404b21ff31c9babb3b7472d29392334bb949943b.tar.gz
gifed-404b21ff31c9babb3b7472d29392334bb949943b.zip
add palette functions to images; close #11
-rw-r--r--gifed/src/block/indexedimage.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/gifed/src/block/indexedimage.rs b/gifed/src/block/indexedimage.rs
index ea99914..8742901 100644
--- a/gifed/src/block/indexedimage.rs
+++ b/gifed/src/block/indexedimage.rs
@@ -28,6 +28,10 @@ impl IndexedImage {
 		self.image_descriptor.height
 	}
 
+	pub fn palette(&self) -> Option<&Palette> {
+		self.local_color_table.as_ref()
+	}
+
 	/// The `lzw_code_size` should be None if there is a local color table present. If
 	/// this image is using the Global Color Table, you must provide an
 	/// LZW Minimum Code Size here. It is equal to the value of [Palette::packed_len], but
@@ -77,6 +81,26 @@ pub struct CompressedImage {
 }
 
 impl CompressedImage {
+	pub fn left(&self) -> u16 {
+		self.image_descriptor.left
+	}
+
+	pub fn top(&self) -> u16 {
+		self.image_descriptor.left
+	}
+
+	pub fn width(&self) -> u16 {
+		self.image_descriptor.width
+	}
+
+	pub fn height(&self) -> u16 {
+		self.image_descriptor.height
+	}
+
+	pub fn palette(&self) -> Option<&Palette> {
+		self.local_color_table.as_ref()
+	}
+
 	pub fn as_bytes(&self) -> Vec<u8> {
 		let mut ret = vec![];