skia_safe/modules/svg/shape/
ellipse.rs1use crate::{
2 impl_default_make,
3 prelude::*,
4 svg::{DebugAttributes, Length, NodeSubtype},
5};
6use skia_bindings as sb;
7
8pub type Ellipse = RCHandle<sb::SkSVGEllipse>;
9
10impl NodeSubtype for sb::SkSVGEllipse {
11 type Base = sb::SkSVGShape;
12}
13
14impl_default_make!(Ellipse, sb::C_SkSVGEllipse_Make);
15
16impl DebugAttributes for Ellipse {
17 const NAME: &'static str = "Ellipse";
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("rx", &self.rx())
25 .field("ry", &self.ry()),
26 );
27 }
28}
29
30impl Ellipse {
31 skia_svg_macros::attrs! {
32 SkSVGEllipse => {
33 cx: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
34 cy: Length [get(value) => Length::from_native_ref(value), set(value) => value.into_native()],
35 rx?: Length [get(value) => value.map(Length::from_native_ref), set(value) => value.into_native()],
36 ry?: Length [get(value) => value.map(Length::from_native_ref), set(value) => value.into_native()]
37 }
38 }
39}