Skip to main content

mln_style/layers/
raster_layer_properties.rs

1// This file is generated by //tools/style-codegen from the style spec
2// (tools/style-codegen/v8.json). Do not edit.
3
4use crate::layer::LayerStyle;
5use crate::layers::Raster;
6use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};
7
8crate::properties!(
9    /// The paint properties of a raster layer.
10    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
11    pub mod RasterPaintProperties: paint {
12        raster_brightness_max: constant f32 = 1.0_f32,
13        raster_brightness_min: constant f32 = 0.0_f32,
14        raster_contrast: constant f32 = 0.0_f32,
15        raster_fade_duration: constant f32 = 300.0_f32,
16        raster_hue_rotate: constant f32 = 0.0_f32,
17        raster_layer_blend: constant LayerBlendType = LayerBlendType::Normal,
18        raster_opacity: constant f32 = 1.0_f32,
19        raster_resampling: constant RasterResamplingType = RasterResamplingType::Linear,
20        raster_saturation: constant f32 = 0.0_f32,
21        resampling: constant ResamplingType = ResamplingType::Linear,
22    }
23    use crate::types::LayerBlendType, crate::types::RasterResamplingType, crate::types::ResamplingType;
24);
25
26/// The properties, by slot.
27pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
28    &[
29        PropertyInfo::paint("raster-brightness-max"),
30        PropertyInfo::paint("raster-brightness-min"),
31        PropertyInfo::paint("raster-contrast"),
32        PropertyInfo::paint("raster-fade-duration"),
33        PropertyInfo::paint("raster-hue-rotate"),
34        PropertyInfo::paint("raster-layer-blend"),
35        PropertyInfo::paint("raster-opacity"),
36        PropertyInfo::paint("raster-resampling"),
37        PropertyInfo::paint("raster-saturation"),
38        PropertyInfo::paint("resampling"),
39    ],
40    &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
41);
42
43/// Calls `visitor` with the field of the property in `slot`.
44pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Raster>>>(slot: usize, visitor: V) -> Option<V::Output> {
45    Some(match slot {
46        0 => visitor.paint(|s| &s.paint.raster_brightness_max, |s| &mut s.paint.raster_brightness_max),
47        1 => visitor.paint(|s| &s.paint.raster_brightness_min, |s| &mut s.paint.raster_brightness_min),
48        2 => visitor.paint(|s| &s.paint.raster_contrast, |s| &mut s.paint.raster_contrast),
49        3 => visitor.paint(|s| &s.paint.raster_fade_duration, |s| &mut s.paint.raster_fade_duration),
50        4 => visitor.paint(|s| &s.paint.raster_hue_rotate, |s| &mut s.paint.raster_hue_rotate),
51        5 => visitor.paint(|s| &s.paint.raster_layer_blend, |s| &mut s.paint.raster_layer_blend),
52        6 => visitor.paint(|s| &s.paint.raster_opacity, |s| &mut s.paint.raster_opacity),
53        7 => visitor.paint(|s| &s.paint.raster_resampling, |s| &mut s.paint.raster_resampling),
54        8 => visitor.paint(|s| &s.paint.raster_saturation, |s| &mut s.paint.raster_saturation),
55        9 => visitor.paint(|s| &s.paint.resampling, |s| &mut s.paint.resampling),
56        _ => return None,
57    })
58}