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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use crate::prelude::*;
use crate::{scalar, Color, Color4f, ColorSpace, DrawLooper, Vector};
use skia_bindings as sb;
use skia_bindings::SkDrawLooper;
impl RCHandle<SkDrawLooper> {
pub fn blur(color: impl Into<Color>, sigma: scalar, delta: impl Into<Vector>) -> Option<Self> {
new(color, sigma, delta)
}
pub fn blur_with_color_space(
color: impl AsRef<Color4f>,
color_space: &ColorSpace,
sigma: scalar,
delta: impl Into<Vector>,
) -> Option<Self> {
new_with_color_space(color, color_space, sigma, delta)
}
}
pub fn new(color: impl Into<Color>, sigma: scalar, delta: impl Into<Vector>) -> Option<DrawLooper> {
let delta = delta.into();
DrawLooper::from_ptr(unsafe {
sb::C_SkBlurDrawLooper_Make(color.into().into_native(), sigma, delta.x, delta.y)
})
}
pub fn new_with_color_space(
color: impl AsRef<Color4f>,
color_space: &ColorSpace,
sigma: scalar,
delta: impl Into<Vector>,
) -> Option<DrawLooper> {
let delta = delta.into();
DrawLooper::from_ptr(unsafe {
sb::C_SkBlurDrawLooper_Make2(
*color.as_ref().native(),
color_space.native(),
sigma,
delta.x,
delta.y,
)
})
}