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
52
use gdk::RGBA;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
#[doc(alias = "GskShadow")]
pub struct Shadow(BoxedInline<ffi::GskShadow>);
}
impl Shadow {
pub fn new(color: RGBA, dx: f32, dy: f32, radius: f32) -> Self {
assert_initialized_main_thread!();
unsafe {
Self::unsafe_from(ffi::GskShadow {
color: *color.to_glib_none().0,
dx,
dy,
radius,
})
}
}
pub fn color(&self) -> &RGBA {
unsafe { &*(&self.inner.color as *const gdk::ffi::GdkRGBA as *const RGBA) }
}
pub fn dx(&self) -> f32 {
self.inner.dx
}
pub fn dy(&self) -> f32 {
self.inner.dy
}
pub fn radius(&self) -> f32 {
self.inner.radius
}
}
impl fmt::Debug for Shadow {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Shadow")
.field("color", &self.color())
.field("dx", &self.dx())
.field("dy", &self.dy())
.field("radius", &self.radius())
.finish()
}
}