1use skia_bindings as sb;
2
3use crate::{scalar, Rect};
4
5pub use sb::SkArc_Type as Type;
6variant_name!(Type::Wedge);
7
8#[repr(C)]
10#[derive(Debug, Copy, Clone, PartialEq, Default)]
11pub struct Arc {
12 pub oval: Rect,
14 pub start_angle: scalar,
16 pub sweep_angle: scalar,
18 pub ty: Type,
19}
20native_transmutable!(sb::SkArc, Arc, arc_layout);
21
22impl Arc {
23 pub fn new(
24 oval: impl AsRef<Rect>,
25 start_angle_degrees: scalar,
26 sweep_angle_degrees: scalar,
27 ty: Type,
28 ) -> Self {
29 Self {
30 oval: *oval.as_ref(),
31 start_angle: start_angle_degrees,
32 sweep_angle: sweep_angle_degrees,
33 ty,
34 }
35 }
36
37 pub fn is_wedge(&self) -> bool {
38 self.ty == Type::Wedge
39 }
40}