1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use crate::prelude::*;
use crate::{scalar, PathEffect};
use skia_bindings as sb;
use skia_bindings::SkPathEffect;

impl RCHandle<SkPathEffect> {
    pub fn dash(intervals: &[scalar], phase: scalar) -> Option<Self> {
        new(intervals, phase)
    }
}

pub fn new(intervals: &[scalar], phase: scalar) -> Option<PathEffect> {
    PathEffect::from_ptr(unsafe {
        sb::C_SkDashPathEffect_Make(
            intervals.as_ptr(),
            intervals.len().try_into().unwrap(),
            phase,
        )
    })
}