skia_safe/modules/svg/types/length.rs
1use skia_bindings as sb;
2
3use crate::scalar;
4
5pub type LengthUnit = sb::SkSVGLength_Unit;
6variant_name!(LengthUnit::Number);
7
8#[repr(C)]
9#[derive(Copy, Clone, PartialEq, Debug)]
10pub struct Length {
11 pub value: scalar,
12 pub unit: LengthUnit,
13}
14
15native_transmutable!(sb::SkSVGLength, Length, svg_length_layout);
16
17impl Length {
18 pub fn new(value: scalar, unit: LengthUnit) -> Self {
19 Self { value, unit }
20 }
21}