skia_safe/modules/svg/fe/
gaussian_blur.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use super::{DebugAttributes, NodeSubtype};
use crate::{impl_default_make, prelude::*, scalar};
use skia_bindings as sb;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct StdDeviation {
    pub x: scalar,
    pub y: scalar,
}

impl StdDeviation {
    pub fn new(x: scalar, y: scalar) -> Self {
        Self { x, y }
    }

    pub fn new_all(value: scalar) -> Self {
        Self { x: value, y: value }
    }
}

native_transmutable!(
    sb::SkSVGFeGaussianBlur_StdDeviation,
    StdDeviation,
    std_deviation_layout
);

pub type GaussianBlur = RCHandle<sb::SkSVGFeGaussianBlur>;

impl NodeSubtype for sb::SkSVGFeGaussianBlur {
    type Base = sb::SkSVGFe;
}

impl_default_make!(GaussianBlur, sb::C_SkSVGFeGaussianBlur_Make);

impl DebugAttributes for GaussianBlur {
    const NAME: &'static str = "FeGaussianBlur";

    fn _dbg(&self, builder: &mut std::fmt::DebugStruct) {
        self.as_base()
            ._dbg(builder.field("std_deviation", self.std_deviation()));
    }
}

impl GaussianBlur {
    skia_svg_macros::attrs! {
        SkSVGFeGaussianBlur => {
            std_deviation: StdDeviation [get(value) => StdDeviation::from_native_ref(value), set(value) => value.into_native()]
        }
    }
}