about summary refs log tree commit diff
path: root/src/writer/imagebuilder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer/imagebuilder.rs')
-rw-r--r--src/writer/imagebuilder.rs112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/writer/imagebuilder.rs b/src/writer/imagebuilder.rs
index f2156ac..d38687e 100644
--- a/src/writer/imagebuilder.rs
+++ b/src/writer/imagebuilder.rs
@@ -1,71 +1,71 @@
-use crate::block::{ColorTable, IndexedImage, ImageDescriptor};
+use crate::block::{ColorTable, ImageDescriptor, IndexedImage};
 
 pub struct ImageBuilder {
-	left_offset: u16,
-	top_offset: u16,
-	width: u16,
-	height: u16,
-	color_table: Option<ColorTable>,
-	indicies: Vec<u8>
+    left_offset: u16,
+    top_offset: u16,
+    width: u16,
+    height: u16,
+    color_table: Option<ColorTable>,
+    indicies: Vec<u8>,
 }
 
 impl ImageBuilder {
-	pub fn new(width: u16, height: u16) -> Self {
-		Self {
-			left_offset: 0,
-			top_offset: 0,
-			width,
-			height,
-			color_table: None,
-			indicies: vec![]
-		}
-	}
+    pub fn new(width: u16, height: u16) -> Self {
+        Self {
+            left_offset: 0,
+            top_offset: 0,
+            width,
+            height,
+            color_table: None,
+            indicies: vec![],
+        }
+    }
 
-	pub fn offsets(mut self, left_offset: u16, top_offset: u16) -> Self {
-		self.left_offset = left_offset;
-		self.top_offset = top_offset;
-		self
-	}
+    pub fn offsets(mut self, left_offset: u16, top_offset: u16) -> Self {
+        self.left_offset = left_offset;
+        self.top_offset = top_offset;
+        self
+    }
 
-	pub fn left_offset(mut self, offset: u16) -> Self {
-		self.left_offset = offset;
-		self
-	}
+    pub fn left_offset(mut self, offset: u16) -> Self {
+        self.left_offset = offset;
+        self
+    }
 
-	pub fn top_offset(mut self, offset: u16) -> Self {
-		self.top_offset = offset;
-		self
-	}
+    pub fn top_offset(mut self, offset: u16) -> Self {
+        self.top_offset = offset;
+        self
+    }
 
-	pub fn color_table(mut self, table: ColorTable) -> Self {
-		self.color_table = Some(table);
+    pub fn color_table(mut self, table: ColorTable) -> Self {
+        self.color_table = Some(table);
 
-		self
-	}
+        self
+    }
 
-	pub fn indicies(mut self, vec: Vec<u8>) -> Self {
-		self.indicies = vec;
-		self
-	}
+    pub fn indicies(mut self, vec: Vec<u8>) -> Self {
+        self.indicies = vec;
+        self
+    }
 
-	pub fn build(self) -> IndexedImage {
-		let mut imgdesc = ImageDescriptor {
-			left: self.left_offset,
-			top: self.top_offset,
-			width: self.width,
-			height: self.height,
-			packed: 0 // Set later
-		};
+    pub fn build(self) -> IndexedImage {
+        let mut imgdesc = ImageDescriptor {
+            left: self.left_offset,
+            top: self.top_offset,
+            width: self.width,
+            height: self.height,
+            packed: 0, // Set later
+        };
 
-		if let Some(lct) = &self.color_table {
-			imgdesc.color_table_present(true);
-			imgdesc.color_table_size(lct.packed_len());
-		}
+        if let Some(lct) = &self.color_table {
+            imgdesc.set_color_table_present(true);
+            imgdesc.set_color_table_size(lct.packed_len());
+        }
 
-		IndexedImage {
-			image_descriptor: imgdesc,
-			local_color_table: self.color_table,
-			indicies: self.indicies
-		}
-	}
+        IndexedImage {
+            image_descriptor: imgdesc,
+            local_color_table: self.color_table,
+            indicies: self.indicies,
+        }
+    }
 }