skia_safe/modules/svg/types/
length.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use skia_bindings as sb;

use crate::scalar;

pub type LengthUnit = sb::SkSVGLength_Unit;
variant_name!(LengthUnit::Number);

#[repr(C)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct Length {
    pub value: scalar,
    pub unit: LengthUnit,
}

native_transmutable!(sb::SkSVGLength, Length, svg_length_layout);

impl Length {
    pub fn new(value: scalar, unit: LengthUnit) -> Self {
        Self { value, unit }
    }
}