skia_safe/modules/svg/fe/
light_source.rs

1use crate::{
2    impl_default_make,
3    prelude::*,
4    scalar,
5    svg::{DebugAttributes, NodeSubtype},
6};
7use skia_bindings as sb;
8
9pub type DistantLight = RCHandle<sb::SkSVGFeDistantLight>;
10
11impl NodeSubtype for sb::SkSVGFeDistantLight {
12    type Base = sb::SkSVGContainer;
13}
14
15impl_default_make!(DistantLight, sb::C_SkSVGFeDistantLight_Make);
16
17impl DebugAttributes for DistantLight {
18    const NAME: &'static str = "FeDistantLight";
19
20    fn _dbg(&self, builder: &mut std::fmt::DebugStruct) {
21        self.as_base()._dbg(
22            builder
23                .field("azimuth", &self.azimuth())
24                .field("elevation", &self.elevation()),
25        );
26    }
27}
28
29impl DistantLight {
30    skia_svg_macros::attrs! {
31        SkSVGFeDistantLight => {
32            *azimuth: scalar [get(value) => value, set(value) => value],
33            *elevation: scalar [get(value) => value, set(value) => value]
34        }
35    }
36}
37
38pub type PointLight = RCHandle<sb::SkSVGFePointLight>;
39
40impl NodeSubtype for sb::SkSVGFePointLight {
41    type Base = sb::SkSVGContainer;
42}
43
44impl_default_make!(PointLight, sb::C_SkSVGFePointLight_Make);
45
46impl DebugAttributes for PointLight {
47    const NAME: &'static str = "FePointLight";
48
49    fn _dbg(&self, builder: &mut std::fmt::DebugStruct) {
50        self.as_base()._dbg(
51            builder
52                .field("x", &self.x())
53                .field("y", &self.y())
54                .field("z", &self.z()),
55        );
56    }
57}
58
59impl PointLight {
60    skia_svg_macros::attrs! {
61        SkSVGFePointLight => {
62            *x: scalar [get(value) => value, set(value) => value],
63            *y: scalar [get(value) => value, set(value) => value],
64            *z: scalar [get(value) => value, set(value) => value]
65        }
66    }
67}
68
69pub type SpotLight = RCHandle<sb::SkSVGFeSpotLight>;
70
71impl NodeSubtype for sb::SkSVGFeSpotLight {
72    type Base = sb::SkSVGContainer;
73}
74
75impl_default_make!(SpotLight, sb::C_SkSVGFeSpotLight_Make);
76
77impl DebugAttributes for SpotLight {
78    const NAME: &'static str = "FeSpotLight";
79
80    fn _dbg(&self, builder: &mut std::fmt::DebugStruct) {
81        self.as_base()._dbg(
82            builder
83                .field("x", &self.x())
84                .field("y", &self.y())
85                .field("z", &self.z())
86                .field("points_at_x", &self.points_at_x())
87                .field("points_at_y", &self.points_at_y())
88                .field("points_at_z", &self.points_at_z())
89                .field("specular_exponent", &self.specular_exponent())
90                .field("limiting_cone_angle", &self.limiting_cone_angle()),
91        );
92    }
93}
94
95impl SpotLight {
96    skia_svg_macros::attrs! {
97        SkSVGFeSpotLight => {
98            *x: scalar [get(value) => value, set(value) => value],
99            *y: scalar [get(value) => value, set(value) => value],
100            *z: scalar [get(value) => value, set(value) => value],
101            *points_at_x: scalar [get(value) => value, set(value) => value],
102            *points_at_y: scalar [get(value) => value, set(value) => value],
103            *points_at_z: scalar [get(value) => value, set(value) => value],
104            *specular_exponent: scalar [get(value) => value, set(value) => value],
105            *limiting_cone_angle?: scalar [get(value) => value, set(value) => value]
106        }
107    }
108}