1 | use crate::{scalar, PathEffect}; |
2 | use skia_bindings as sb; |
3 | |
4 | pub use skia_bindings::SkTrimPathEffect_Mode as Mode; |
5 | variant_name!(Mode::Inverted); |
6 | |
7 | impl PathEffect { |
8 | pub fn trim( |
9 | start_t: scalar, |
10 | stop_t: scalar, |
11 | mode: impl Into<Option<Mode>>, |
12 | ) -> Option<PathEffect> { |
13 | new(start_t, stop_t, mode) |
14 | } |
15 | } |
16 | |
17 | pub fn new(start_t: scalar, stop_t: scalar, mode: impl Into<Option<Mode>>) -> Option<PathEffect> { |
18 | PathEffect::from_ptr(unsafe { |
19 | sb::C_SkTrimPathEffect_Make(startT:start_t, stopT:stop_t, mode:mode.into().unwrap_or(Mode::Normal)) |
20 | }) |
21 | } |
22 | |