1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::prelude::*;
use crate::{scalar, Matrix, Path, PathEffect};
use skia_bindings::SkPathEffect;

impl RCHandle<SkPathEffect> {
    pub fn line_2d(width: scalar, matrix: &Matrix) -> Option<PathEffect> {
        line_2d_path_effect::new(width, matrix)
    }

    pub fn path_2d(matrix: &Matrix, path: &Path) -> PathEffect {
        path_2d_path_effect::new(matrix, path)
    }
}

pub mod line_2d_path_effect {
    use crate::prelude::*;
    use crate::{scalar, Matrix, PathEffect};
    use skia_bindings as sb;

    pub fn new(width: scalar, matrix: &Matrix) -> Option<PathEffect> {
        PathEffect::from_ptr(unsafe { sb::C_SkLine2DPathEffect_Make(width, matrix.native()) })
    }
}

pub mod path_2d_path_effect {
    use crate::prelude::*;
    use crate::{Matrix, Path, PathEffect};
    use skia_bindings as sb;

    pub fn new(matrix: &Matrix, path: &Path) -> PathEffect {
        PathEffect::from_ptr(unsafe {
            sb::C_SkPath2DPathEffect_Make(matrix.native(), path.native())
        })
        .unwrap()
    }
}