skia_safe/modules/svg/
mask.rs

1use super::{BoundingBoxUnits, DebugAttributes, Length, NodeSubtype};
2use crate::{impl_default_make, prelude::*};
3use skia_bindings as sb;
4
5pub type Mask = RCHandle<sb::SkSVGMask>;
6
7impl NodeSubtype for sb::SkSVGMask {
8    type Base = sb::SkSVGContainer;
9}
10
11impl_default_make!(Mask, sb::C_SkSVGMask_Make);
12
13impl DebugAttributes for Mask {
14    const NAME: &'static str = "Mask";
15
16    fn _dbg(&self, builder: &mut std::fmt::DebugStruct) {
17        self.as_base()._dbg(
18            builder
19                .field("x", &self.x())
20                .field("y", &self.y())
21                .field("width", &self.width())
22                .field("height", &self.height())
23                .field("mask_units", self.mask_units())
24                .field("mask_content_units", self.mask_content_units()),
25        );
26    }
27}
28
29impl Mask {
30    skia_svg_macros::attrs! {
31        SkSVGMask => {
32            x: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
33            y: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
34            width: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
35            height: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
36            mask_units: BoundingBoxUnits [get(value) => &value.fType, set(value) => sb::SkSVGObjectBoundingBoxUnits { fType: value }],
37            mask_content_units: BoundingBoxUnits [get(value) => &value.fType, set(value) => sb::SkSVGObjectBoundingBoxUnits { fType: value }]
38        }
39    }
40}