graphene/auto/
box_.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, Point3D, Sphere, Vec3};
6use glib::translate::*;
7
8glib::wrapper! {
9    pub struct Box(BoxedInline<ffi::graphene_box_t>);
10
11    match fn {
12        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_box_get_type(), ptr as *mut _) as *mut ffi::graphene_box_t,
13        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_box_get_type(), ptr as *mut _),
14        type_ => || ffi::graphene_box_get_type(),
15    }
16}
17
18impl Box {
19    #[doc(alias = "graphene_box_contains_box")]
20    pub fn contains_box(&self, b: &Box) -> bool {
21        unsafe { ffi::graphene_box_contains_box(self.to_glib_none().0, b.to_glib_none().0) }
22    }
23
24    #[doc(alias = "graphene_box_contains_point")]
25    pub fn contains_point(&self, point: &Point3D) -> bool {
26        unsafe { ffi::graphene_box_contains_point(self.to_glib_none().0, point.to_glib_none().0) }
27    }
28
29    #[doc(alias = "graphene_box_equal")]
30    fn equal(&self, b: &Box) -> bool {
31        unsafe { ffi::graphene_box_equal(self.to_glib_none().0, b.to_glib_none().0) }
32    }
33
34    #[doc(alias = "graphene_box_expand")]
35    #[must_use]
36    pub fn expand(&self, point: &Point3D) -> Box {
37        unsafe {
38            let mut res = Box::uninitialized();
39            ffi::graphene_box_expand(
40                self.to_glib_none().0,
41                point.to_glib_none().0,
42                res.to_glib_none_mut().0,
43            );
44            res
45        }
46    }
47
48    #[doc(alias = "graphene_box_expand_scalar")]
49    #[must_use]
50    pub fn expand_scalar(&self, scalar: f32) -> Box {
51        unsafe {
52            let mut res = Box::uninitialized();
53            ffi::graphene_box_expand_scalar(
54                self.to_glib_none().0,
55                scalar,
56                res.to_glib_none_mut().0,
57            );
58            res
59        }
60    }
61
62    #[doc(alias = "graphene_box_expand_vec3")]
63    #[must_use]
64    pub fn expand_vec3(&self, vec: &Vec3) -> Box {
65        unsafe {
66            let mut res = Box::uninitialized();
67            ffi::graphene_box_expand_vec3(
68                self.to_glib_none().0,
69                vec.to_glib_none().0,
70                res.to_glib_none_mut().0,
71            );
72            res
73        }
74    }
75
76    #[doc(alias = "graphene_box_get_bounding_sphere")]
77    #[doc(alias = "get_bounding_sphere")]
78    pub fn bounding_sphere(&self) -> Sphere {
79        unsafe {
80            let mut sphere = Sphere::uninitialized();
81            ffi::graphene_box_get_bounding_sphere(
82                self.to_glib_none().0,
83                sphere.to_glib_none_mut().0,
84            );
85            sphere
86        }
87    }
88
89    #[doc(alias = "graphene_box_get_center")]
90    #[doc(alias = "get_center")]
91    pub fn center(&self) -> Point3D {
92        unsafe {
93            let mut center = Point3D::uninitialized();
94            ffi::graphene_box_get_center(self.to_glib_none().0, center.to_glib_none_mut().0);
95            center
96        }
97    }
98
99    #[doc(alias = "graphene_box_get_depth")]
100    #[doc(alias = "get_depth")]
101    pub fn depth(&self) -> f32 {
102        unsafe { ffi::graphene_box_get_depth(self.to_glib_none().0) }
103    }
104
105    #[doc(alias = "graphene_box_get_height")]
106    #[doc(alias = "get_height")]
107    pub fn height(&self) -> f32 {
108        unsafe { ffi::graphene_box_get_height(self.to_glib_none().0) }
109    }
110
111    #[doc(alias = "graphene_box_get_max")]
112    #[doc(alias = "get_max")]
113    pub fn max(&self) -> Point3D {
114        unsafe {
115            let mut max = Point3D::uninitialized();
116            ffi::graphene_box_get_max(self.to_glib_none().0, max.to_glib_none_mut().0);
117            max
118        }
119    }
120
121    #[doc(alias = "graphene_box_get_min")]
122    #[doc(alias = "get_min")]
123    pub fn min(&self) -> Point3D {
124        unsafe {
125            let mut min = Point3D::uninitialized();
126            ffi::graphene_box_get_min(self.to_glib_none().0, min.to_glib_none_mut().0);
127            min
128        }
129    }
130
131    #[doc(alias = "graphene_box_get_size")]
132    #[doc(alias = "get_size")]
133    pub fn size(&self) -> Vec3 {
134        unsafe {
135            let mut size = Vec3::uninitialized();
136            ffi::graphene_box_get_size(self.to_glib_none().0, size.to_glib_none_mut().0);
137            size
138        }
139    }
140
141    #[doc(alias = "graphene_box_get_width")]
142    #[doc(alias = "get_width")]
143    pub fn width(&self) -> f32 {
144        unsafe { ffi::graphene_box_get_width(self.to_glib_none().0) }
145    }
146
147    #[doc(alias = "graphene_box_intersection")]
148    pub fn intersection(&self, b: &Box) -> Option<Box> {
149        unsafe {
150            let mut res = Box::uninitialized();
151            let ret = ffi::graphene_box_intersection(
152                self.to_glib_none().0,
153                b.to_glib_none().0,
154                res.to_glib_none_mut().0,
155            );
156            if ret {
157                Some(res)
158            } else {
159                None
160            }
161        }
162    }
163
164    #[doc(alias = "graphene_box_union")]
165    #[must_use]
166    pub fn union(&self, b: &Box) -> Box {
167        unsafe {
168            let mut res = Box::uninitialized();
169            ffi::graphene_box_union(
170                self.to_glib_none().0,
171                b.to_glib_none().0,
172                res.to_glib_none_mut().0,
173            );
174            res
175        }
176    }
177
178    #[doc(alias = "graphene_box_empty")]
179    pub fn empty() -> Box {
180        assert_initialized_main_thread!();
181        unsafe { from_glib_none(ffi::graphene_box_empty()) }
182    }
183
184    #[doc(alias = "graphene_box_infinite")]
185    pub fn infinite() -> Box {
186        assert_initialized_main_thread!();
187        unsafe { from_glib_none(ffi::graphene_box_infinite()) }
188    }
189
190    #[doc(alias = "graphene_box_minus_one")]
191    pub fn minus_one() -> Box {
192        assert_initialized_main_thread!();
193        unsafe { from_glib_none(ffi::graphene_box_minus_one()) }
194    }
195
196    #[doc(alias = "graphene_box_one")]
197    pub fn one() -> Box {
198        assert_initialized_main_thread!();
199        unsafe { from_glib_none(ffi::graphene_box_one()) }
200    }
201
202    #[doc(alias = "graphene_box_one_minus_one")]
203    pub fn one_minus_one() -> Box {
204        assert_initialized_main_thread!();
205        unsafe { from_glib_none(ffi::graphene_box_one_minus_one()) }
206    }
207
208    #[doc(alias = "graphene_box_zero")]
209    pub fn zero() -> Box {
210        assert_initialized_main_thread!();
211        unsafe { from_glib_none(ffi::graphene_box_zero()) }
212    }
213}
214
215impl PartialEq for Box {
216    #[inline]
217    fn eq(&self, other: &Self) -> bool {
218        self.equal(other)
219    }
220}
221
222impl Eq for Box {}