skia_safe/modules/svg/gradient/
radial.rs1use crate::{
2 impl_default_make,
3 prelude::*,
4 svg::{DebugAttributes, Length, NodeSubtype},
5};
6use skia_bindings as sb;
7
8pub type Radial = RCHandle<sb::SkSVGRadialGradient>;
9
10impl NodeSubtype for sb::SkSVGRadialGradient {
11 type Base = sb::SkSVGGradient;
12}
13
14impl_default_make!(Radial, sb::C_SkSVGRadialGradient_Make);
15
16impl DebugAttributes for Radial {
17 const NAME: &'static str = "RadialGradient";
18
19 fn _dbg(&self, builder: &mut std::fmt::DebugStruct) {
20 self.as_base()._dbg(
21 builder
22 .field("cx", &self.cx())
23 .field("cy", &self.cy())
24 .field("r", &self.r())
25 .field("fx", &self.fx())
26 .field("fy", &self.fy()),
27 );
28 }
29}
30
31impl Radial {
32 skia_svg_macros::attrs! {
33 SkSVGRadialGradient => {
34 cx: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
35 cy: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
36 r: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
37 fx?: Length [get(value) => value.map(Length::from_native_ref), set(value) => value.into_native()],
38 fy?: Length [get(value) => value.map(Length::from_native_ref), set(value) => value.into_native()]
39 }
40 }
41}