skia_safe/modules/svg/shape/
line.rs1use crate::{
2 impl_default_make,
3 prelude::*,
4 svg::{DebugAttributes, Length, NodeSubtype},
5};
6use skia_bindings as sb;
7
8pub type Line = RCHandle<sb::SkSVGLine>;
9
10impl NodeSubtype for sb::SkSVGLine {
11 type Base = sb::SkSVGShape;
12}
13
14impl_default_make!(Line, sb::C_SkSVGLine_Make);
15
16impl DebugAttributes for Line {
17 const NAME: &'static str = "Line";
18
19 fn _dbg(&self, builder: &mut std::fmt::DebugStruct) {
20 self.as_base()._dbg(
21 builder
22 .field("x1", &self.x1())
23 .field("y1", &self.y1())
24 .field("x2", &self.x2())
25 .field("y2", &self.y2()),
26 );
27 }
28}
29
30impl Line {
31 skia_svg_macros::attrs! {
32 SkSVGLine => {
33 x1: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
34 y1: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
35 x2: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
36 y2: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()]
37 }
38 }
39}