use crate::layer::LayerStyle;
use crate::layers::Background;
use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};
crate::properties!(
#[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
pub mod BackgroundPaintProperties: paint {
background_color: constant Color = Color::black(),
background_opacity: constant f32 = 1.0_f32,
background_pattern: cross_faded Image = Image::default(),
}
use crate::color::Color, crate::expression::Image;
);
pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
&[
PropertyInfo::paint("background-color"),
PropertyInfo::paint("background-opacity"),
PropertyInfo::paint("background-pattern"),
],
&[0, 1, 2],
);
pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Background>>>(slot: usize, visitor: V) -> Option<V::Output> {
Some(match slot {
0 => visitor.paint(|s| &s.paint.background_color, |s| &mut s.paint.background_color),
1 => visitor.paint(|s| &s.paint.background_opacity, |s| &mut s.paint.background_opacity),
2 => visitor.paint(|s| &s.paint.background_pattern, |s| &mut s.paint.background_pattern),
_ => return None,
})
}