From 1a51b3b50252e4d190340936f09dabb75303fcec Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 8 Oct 2022 16:44:26 +0100 Subject: [PATCH] Remove the definition of transparent colour from image --- agb-image-converter/src/config.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/agb-image-converter/src/config.rs b/agb-image-converter/src/config.rs index 075a9f7d..7379a6d5 100644 --- a/agb-image-converter/src/config.rs +++ b/agb-image-converter/src/config.rs @@ -28,7 +28,6 @@ pub(crate) trait Config { pub(crate) trait Image { fn filename(&self) -> String; - fn transparent_colour(&self) -> Option; fn tilesize(&self) -> TileSize; fn colours(&self) -> Colours; } @@ -65,7 +64,7 @@ impl Config for ConfigV1 { return Some(*colour); } - self.images() + self.image .values() .flat_map(|image| image.transparent_colour()) .next() @@ -85,12 +84,6 @@ impl Image for ImageV1 { self.filename.clone() } - fn transparent_colour(&self) -> Option { - self.transparent_colour - .as_ref() - .map(|colour| colour.parse().unwrap()) - } - fn tilesize(&self) -> TileSize { self.tile_size.into() } @@ -104,6 +97,14 @@ impl Image for ImageV1 { } } +impl ImageV1 { + fn transparent_colour(&self) -> Option { + self.transparent_colour + .as_ref() + .map(|colour| colour.parse().unwrap()) + } +} + #[derive(Deserialize, Clone, Copy)] pub enum TileSizeV1 { #[serde(rename = "8x8")]