Remove the definition of transparent colour from image

This commit is contained in:
Gwilym Kuiper 2022-10-08 16:44:26 +01:00
parent 89af366b7a
commit 1a51b3b502

View file

@ -28,7 +28,6 @@ pub(crate) trait Config {
pub(crate) trait Image {
fn filename(&self) -> String;
fn transparent_colour(&self) -> Option<Colour>;
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<Colour> {
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<Colour> {
self.transparent_colour
.as_ref()
.map(|colour| colour.parse().unwrap())
}
}
#[derive(Deserialize, Clone, Copy)]
pub enum TileSizeV1 {
#[serde(rename = "8x8")]