about summary refs log tree commit diff
path: root/src/colorimage.rs
diff options
context:
space:
mode:
authorGenny <gen@nyble.dev>2021-10-11 03:36:38 -0500
committerGenny <gen@nyble.dev>2021-10-11 03:36:38 -0500
commit757eab88d67a425728b87286c763387f52367196 (patch)
treef1d61edb0a838787f6984accdd92df68a69d567a /src/colorimage.rs
parent9b7bd5696a21496fa0c38a17e69c5c0658acfe73 (diff)
downloadgifed-757eab88d67a425728b87286c763387f52367196.tar.gz
gifed-757eab88d67a425728b87286c763387f52367196.zip
Run rustfmt
Diffstat (limited to 'src/colorimage.rs')
-rw-r--r--src/colorimage.rs90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/colorimage.rs b/src/colorimage.rs
index 1bdb273..69dac1e 100644
--- a/src/colorimage.rs
+++ b/src/colorimage.rs
@@ -3,59 +3,59 @@ use std::convert::TryFrom;
 use crate::{block::ColorTable, gif::Image, reader::DecodingError, Color};
 
 pub struct ColorImage {
-    width: u16,
-    height: u16,
-    data: Vec<Pixel>,
+	width: u16,
+	height: u16,
+	data: Vec<Pixel>,
 }
 
 impl ColorImage {
-    pub(crate) fn from_indicies(
-        width: u16,
-        height: u16,
-        indicies: &[u8],
-        table: &ColorTable,
-        transindex: Option<u8>,
-    ) -> Result<Self, DecodingError> {
-        let mut data = vec![Pixel::Transparent; (width * height) as usize];
-
-        for (image_index, color_index) in indicies.into_iter().enumerate() {
-            if let Some(trans) = transindex {
-                if trans == *color_index {
-                    data[image_index] = Pixel::Transparent;
-                }
-            } else {
-                data[image_index] = Pixel::Color(
-                    table
-                        .get(*color_index)
-                        .ok_or(DecodingError::ColorIndexOutOfBounds)?,
-                );
-            }
-        }
-
-        Ok(ColorImage {
-            width,
-            height,
-            data,
-        })
-    }
+	pub(crate) fn from_indicies(
+		width: u16,
+		height: u16,
+		indicies: &[u8],
+		table: &ColorTable,
+		transindex: Option<u8>,
+	) -> Result<Self, DecodingError> {
+		let mut data = vec![Pixel::Transparent; (width * height) as usize];
+
+		for (image_index, color_index) in indicies.into_iter().enumerate() {
+			if let Some(trans) = transindex {
+				if trans == *color_index {
+					data[image_index] = Pixel::Transparent;
+				}
+			} else {
+				data[image_index] = Pixel::Color(
+					table
+						.get(*color_index)
+						.ok_or(DecodingError::ColorIndexOutOfBounds)?,
+				);
+			}
+		}
+
+		Ok(ColorImage {
+			width,
+			height,
+			data,
+		})
+	}
 }
 
 impl<'a> TryFrom<Image<'a>> for ColorImage {
-    type Error = DecodingError;
-
-    fn try_from(img: Image<'a>) -> Result<Self, Self::Error> {
-        ColorImage::from_indicies(
-            img.width,
-            img.height,
-            img.indicies,
-            img.palette,
-            img.transparent_index,
-        )
-    }
+	type Error = DecodingError;
+
+	fn try_from(img: Image<'a>) -> Result<Self, Self::Error> {
+		ColorImage::from_indicies(
+			img.width,
+			img.height,
+			img.indicies,
+			img.palette,
+			img.transparent_index,
+		)
+	}
 }
 
 #[derive(Copy, Clone, Debug, PartialEq)]
 pub enum Pixel {
-    Color(Color),
-    Transparent,
+	Color(Color),
+	Transparent,
 }