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

impl RCHandle<SkPathEffect> {
    pub fn discrete(
        seg_length: scalar,
        dev: scalar,
        seed_assist: impl Into<Option<u32>>,
    ) -> Option<Self> {
        new(seg_length, dev, seed_assist)
    }
}

pub fn new(
    seg_length: scalar,
    dev: scalar,
    seed_assist: impl Into<Option<u32>>,
) -> Option<PathEffect> {
    PathEffect::from_ptr(unsafe {
        sb::C_SkDiscretePathEffect_Make(seg_length, dev, seed_assist.into().unwrap_or(0))
    })
}