mln_style/layers/
background_layer_properties.rs1use crate::layer::LayerStyle;
5use crate::layers::Background;
6use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};
7
8crate::properties!(
9 #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
11 pub mod BackgroundPaintProperties: paint {
12 background_color: constant Color = Color::black(),
13 background_opacity: constant f32 = 1.0_f32,
14 background_pattern: cross_faded Image = Image::default(),
15 }
16 use crate::color::Color, crate::expression::Image;
17);
18
19pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
21 &[
22 PropertyInfo::paint("background-color"),
23 PropertyInfo::paint("background-opacity"),
24 PropertyInfo::paint("background-pattern"),
25 ],
26 &[0, 1, 2],
27);
28
29pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Background>>>(slot: usize, visitor: V) -> Option<V::Output> {
31 Some(match slot {
32 0 => visitor.paint(|s| &s.paint.background_color, |s| &mut s.paint.background_color),
33 1 => visitor.paint(|s| &s.paint.background_opacity, |s| &mut s.paint.background_opacity),
34 2 => visitor.paint(|s| &s.paint.background_pattern, |s| &mut s.paint.background_pattern),
35 _ => return None,
36 })
37}