librsvg_rebind/rectangle.rs
1use ::glib::translate::*;
2
3glib::wrapper! {
4 #[doc(alias = "GtkRectangle")]
5 #[derive(Debug)]
6 pub struct Rectangle(BoxedInline<ffi::RsvgRectangle>);
7}
8
9impl Rectangle {
10 #[inline]
11 pub fn new(x: f64, y: f64, width: f64, height: f64) -> Self {
12 assert_initialized_main_thread!();
13 unsafe {
14 Self::unsafe_from(ffi::RsvgRectangle {
15 x,
16 y,
17 width,
18 height,
19 })
20 }
21 }
22
23 #[inline]
24 pub fn x(&self) -> f64 {
25 self.inner.x
26 }
27
28 #[inline]
29 pub fn y(&self) -> f64 {
30 self.inner.y
31 }
32
33 #[inline]
34 pub fn width(&self) -> f64 {
35 self.inner.width
36 }
37
38 #[inline]
39 pub fn height(&self) -> f64 {
40 self.inner.height
41 }
42}