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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::Point3D;
use crate::Sphere;
use crate::Vec3;
use glib::translate::*;

glib::wrapper! {
    pub struct Box(BoxedInline<ffi::graphene_box_t>);

    match fn {
        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_box_get_type(), ptr as *mut _) as *mut ffi::graphene_box_t,
        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_box_get_type(), ptr as *mut _),
        type_ => || ffi::graphene_box_get_type(),
    }
}

impl Box {
    #[doc(alias = "graphene_box_contains_box")]
    pub fn contains_box(&self, b: &Box) -> bool {
        unsafe { ffi::graphene_box_contains_box(self.to_glib_none().0, b.to_glib_none().0) }
    }

    #[doc(alias = "graphene_box_contains_point")]
    pub fn contains_point(&self, point: &Point3D) -> bool {
        unsafe { ffi::graphene_box_contains_point(self.to_glib_none().0, point.to_glib_none().0) }
    }

    #[doc(alias = "graphene_box_equal")]
    fn equal(&self, b: &Box) -> bool {
        unsafe { ffi::graphene_box_equal(self.to_glib_none().0, b.to_glib_none().0) }
    }

    #[doc(alias = "graphene_box_expand")]
    #[must_use]
    pub fn expand(&self, point: &Point3D) -> Box {
        unsafe {
            let mut res = Box::uninitialized();
            ffi::graphene_box_expand(
                self.to_glib_none().0,
                point.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_box_expand_scalar")]
    #[must_use]
    pub fn expand_scalar(&self, scalar: f32) -> Box {
        unsafe {
            let mut res = Box::uninitialized();
            ffi::graphene_box_expand_scalar(
                self.to_glib_none().0,
                scalar,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_box_expand_vec3")]
    #[must_use]
    pub fn expand_vec3(&self, vec: &Vec3) -> Box {
        unsafe {
            let mut res = Box::uninitialized();
            ffi::graphene_box_expand_vec3(
                self.to_glib_none().0,
                vec.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_box_get_bounding_sphere")]
    #[doc(alias = "get_bounding_sphere")]
    pub fn bounding_sphere(&self) -> Sphere {
        unsafe {
            let mut sphere = Sphere::uninitialized();
            ffi::graphene_box_get_bounding_sphere(
                self.to_glib_none().0,
                sphere.to_glib_none_mut().0,
            );
            sphere
        }
    }

    #[doc(alias = "graphene_box_get_center")]
    #[doc(alias = "get_center")]
    pub fn center(&self) -> Point3D {
        unsafe {
            let mut center = Point3D::uninitialized();
            ffi::graphene_box_get_center(self.to_glib_none().0, center.to_glib_none_mut().0);
            center
        }
    }

    #[doc(alias = "graphene_box_get_depth")]
    #[doc(alias = "get_depth")]
    pub fn depth(&self) -> f32 {
        unsafe { ffi::graphene_box_get_depth(self.to_glib_none().0) }
    }

    #[doc(alias = "graphene_box_get_height")]
    #[doc(alias = "get_height")]
    pub fn height(&self) -> f32 {
        unsafe { ffi::graphene_box_get_height(self.to_glib_none().0) }
    }

    #[doc(alias = "graphene_box_get_max")]
    #[doc(alias = "get_max")]
    pub fn max(&self) -> Point3D {
        unsafe {
            let mut max = Point3D::uninitialized();
            ffi::graphene_box_get_max(self.to_glib_none().0, max.to_glib_none_mut().0);
            max
        }
    }

    #[doc(alias = "graphene_box_get_min")]
    #[doc(alias = "get_min")]
    pub fn min(&self) -> Point3D {
        unsafe {
            let mut min = Point3D::uninitialized();
            ffi::graphene_box_get_min(self.to_glib_none().0, min.to_glib_none_mut().0);
            min
        }
    }

    #[doc(alias = "graphene_box_get_size")]
    #[doc(alias = "get_size")]
    pub fn size(&self) -> Vec3 {
        unsafe {
            let mut size = Vec3::uninitialized();
            ffi::graphene_box_get_size(self.to_glib_none().0, size.to_glib_none_mut().0);
            size
        }
    }

    #[doc(alias = "graphene_box_get_width")]
    #[doc(alias = "get_width")]
    pub fn width(&self) -> f32 {
        unsafe { ffi::graphene_box_get_width(self.to_glib_none().0) }
    }

    #[doc(alias = "graphene_box_intersection")]
    pub fn intersection(&self, b: &Box) -> Option<Box> {
        unsafe {
            let mut res = Box::uninitialized();
            let ret = ffi::graphene_box_intersection(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            if ret {
                Some(res)
            } else {
                None
            }
        }
    }

    #[doc(alias = "graphene_box_union")]
    #[must_use]
    pub fn union(&self, b: &Box) -> Box {
        unsafe {
            let mut res = Box::uninitialized();
            ffi::graphene_box_union(
                self.to_glib_none().0,
                b.to_glib_none().0,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

    #[doc(alias = "graphene_box_empty")]
    pub fn empty() -> Box {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_box_empty()) }
    }

    #[doc(alias = "graphene_box_infinite")]
    pub fn infinite() -> Box {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_box_infinite()) }
    }

    #[doc(alias = "graphene_box_minus_one")]
    pub fn minus_one() -> Box {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_box_minus_one()) }
    }

    #[doc(alias = "graphene_box_one")]
    pub fn one() -> Box {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_box_one()) }
    }

    #[doc(alias = "graphene_box_one_minus_one")]
    pub fn one_minus_one() -> Box {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_box_one_minus_one()) }
    }

    #[doc(alias = "graphene_box_zero")]
    pub fn zero() -> Box {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_box_zero()) }
    }
}

impl PartialEq for Box {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.equal(other)
    }
}

impl Eq for Box {}