mln_style/layers/
raster_layer_properties.rs1use crate::layer::LayerStyle;
5use crate::layers::Raster;
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 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
26pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
28 &[
29 PropertyInfo::paint("raster-brightness-max").interpolated(),
30 PropertyInfo::paint("raster-brightness-min").interpolated(),
31 PropertyInfo::paint("raster-contrast").interpolated(),
32 PropertyInfo::paint("raster-fade-duration").interpolated(),
33 PropertyInfo::paint("raster-hue-rotate").interpolated(),
34 PropertyInfo::paint("raster-layer-blend"),
35 PropertyInfo::paint("raster-opacity").interpolated(),
36 PropertyInfo::paint("raster-resampling"),
37 PropertyInfo::paint("raster-saturation").interpolated(),
38 PropertyInfo::paint("resampling"),
39 ],
40 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
41);
42
43pub(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}