skia_safe/effects/
trim_path_effect.rs

1use crate::{scalar, PathEffect};
2use skia_bindings as sb;
3
4pub use skia_bindings::SkTrimPathEffect_Mode as Mode;
5variant_name!(Mode::Inverted);
6
7impl 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
17pub 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(start_t, stop_t, mode.into().unwrap_or(Mode::Normal))
20    })
21}