graphene/auto/
size.rs
1use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9 pub struct Size(BoxedInline<ffi::graphene_size_t>);
11
12 match fn {
13 copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_size_get_type(), ptr as *mut _) as *mut ffi::graphene_size_t,
14 free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_size_get_type(), ptr as *mut _),
15 type_ => || ffi::graphene_size_get_type(),
16 }
17}
18
19impl Size {
20 #[doc(alias = "graphene_size_equal")]
21 fn equal(&self, b: &Size) -> bool {
22 unsafe { ffi::graphene_size_equal(self.to_glib_none().0, b.to_glib_none().0) }
23 }
24
25 #[doc(alias = "graphene_size_interpolate")]
38 #[must_use]
39 pub fn interpolate(&self, b: &Size, factor: f64) -> Size {
40 unsafe {
41 let mut res = Size::uninitialized();
42 ffi::graphene_size_interpolate(
43 self.to_glib_none().0,
44 b.to_glib_none().0,
45 factor,
46 res.to_glib_none_mut().0,
47 );
48 res
49 }
50 }
51
52 #[doc(alias = "graphene_size_scale")]
62 #[must_use]
63 pub fn scale(&self, factor: f32) -> Size {
64 unsafe {
65 let mut res = Size::uninitialized();
66 ffi::graphene_size_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0);
67 res
68 }
69 }
70
71 #[doc(alias = "graphene_size_zero")]
78 pub fn zero() -> Size {
79 assert_initialized_main_thread!();
80 unsafe { from_glib_none(ffi::graphene_size_zero()) }
81 }
82}
83
84impl PartialEq for Size {
85 #[inline]
86 fn eq(&self, other: &Self) -> bool {
87 self.equal(other)
88 }
89}
90
91impl Eq for Size {}