graphene/auto/
vec4.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, Vec2, Vec3};
6use glib::translate::*;
7
8glib::wrapper! {
9    pub struct Vec4(BoxedInline<ffi::graphene_vec4_t>);
10
11    match fn {
12        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_vec4_get_type(), ptr as *mut _) as *mut ffi::graphene_vec4_t,
13        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_vec4_get_type(), ptr as *mut _),
14        type_ => || ffi::graphene_vec4_get_type(),
15    }
16}
17
18impl Vec4 {
19    #[doc(alias = "graphene_vec4_add")]
20    #[must_use]
21    pub fn add(&self, b: &Vec4) -> Vec4 {
22        unsafe {
23            let mut res = Vec4::uninitialized();
24            ffi::graphene_vec4_add(
25                self.to_glib_none().0,
26                b.to_glib_none().0,
27                res.to_glib_none_mut().0,
28            );
29            res
30        }
31    }
32
33    #[doc(alias = "graphene_vec4_divide")]
34    #[must_use]
35    pub fn divide(&self, b: &Vec4) -> Vec4 {
36        unsafe {
37            let mut res = Vec4::uninitialized();
38            ffi::graphene_vec4_divide(
39                self.to_glib_none().0,
40                b.to_glib_none().0,
41                res.to_glib_none_mut().0,
42            );
43            res
44        }
45    }
46
47    #[doc(alias = "graphene_vec4_dot")]
48    pub fn dot(&self, b: &Vec4) -> f32 {
49        unsafe { ffi::graphene_vec4_dot(self.to_glib_none().0, b.to_glib_none().0) }
50    }
51
52    #[doc(alias = "graphene_vec4_equal")]
53    fn equal(&self, v2: &Vec4) -> bool {
54        unsafe { ffi::graphene_vec4_equal(self.to_glib_none().0, v2.to_glib_none().0) }
55    }
56
57    #[doc(alias = "graphene_vec4_get_w")]
58    #[doc(alias = "get_w")]
59    pub fn w(&self) -> f32 {
60        unsafe { ffi::graphene_vec4_get_w(self.to_glib_none().0) }
61    }
62
63    #[doc(alias = "graphene_vec4_get_x")]
64    #[doc(alias = "get_x")]
65    pub fn x(&self) -> f32 {
66        unsafe { ffi::graphene_vec4_get_x(self.to_glib_none().0) }
67    }
68
69    #[doc(alias = "graphene_vec4_get_xy")]
70    #[doc(alias = "get_xy")]
71    pub fn xy(&self) -> Vec2 {
72        unsafe {
73            let mut res = Vec2::uninitialized();
74            ffi::graphene_vec4_get_xy(self.to_glib_none().0, res.to_glib_none_mut().0);
75            res
76        }
77    }
78
79    #[doc(alias = "graphene_vec4_get_xyz")]
80    #[doc(alias = "get_xyz")]
81    pub fn xyz(&self) -> Vec3 {
82        unsafe {
83            let mut res = Vec3::uninitialized();
84            ffi::graphene_vec4_get_xyz(self.to_glib_none().0, res.to_glib_none_mut().0);
85            res
86        }
87    }
88
89    #[doc(alias = "graphene_vec4_get_y")]
90    #[doc(alias = "get_y")]
91    pub fn y(&self) -> f32 {
92        unsafe { ffi::graphene_vec4_get_y(self.to_glib_none().0) }
93    }
94
95    #[doc(alias = "graphene_vec4_get_z")]
96    #[doc(alias = "get_z")]
97    pub fn z(&self) -> f32 {
98        unsafe { ffi::graphene_vec4_get_z(self.to_glib_none().0) }
99    }
100
101    #[doc(alias = "graphene_vec4_interpolate")]
102    #[must_use]
103    pub fn interpolate(&self, v2: &Vec4, factor: f64) -> Vec4 {
104        unsafe {
105            let mut res = Vec4::uninitialized();
106            ffi::graphene_vec4_interpolate(
107                self.to_glib_none().0,
108                v2.to_glib_none().0,
109                factor,
110                res.to_glib_none_mut().0,
111            );
112            res
113        }
114    }
115
116    #[doc(alias = "graphene_vec4_length")]
117    pub fn length(&self) -> f32 {
118        unsafe { ffi::graphene_vec4_length(self.to_glib_none().0) }
119    }
120
121    #[doc(alias = "graphene_vec4_max")]
122    #[must_use]
123    pub fn max(&self, b: &Vec4) -> Vec4 {
124        unsafe {
125            let mut res = Vec4::uninitialized();
126            ffi::graphene_vec4_max(
127                self.to_glib_none().0,
128                b.to_glib_none().0,
129                res.to_glib_none_mut().0,
130            );
131            res
132        }
133    }
134
135    #[doc(alias = "graphene_vec4_min")]
136    #[must_use]
137    pub fn min(&self, b: &Vec4) -> Vec4 {
138        unsafe {
139            let mut res = Vec4::uninitialized();
140            ffi::graphene_vec4_min(
141                self.to_glib_none().0,
142                b.to_glib_none().0,
143                res.to_glib_none_mut().0,
144            );
145            res
146        }
147    }
148
149    #[doc(alias = "graphene_vec4_multiply")]
150    #[must_use]
151    pub fn multiply(&self, b: &Vec4) -> Vec4 {
152        unsafe {
153            let mut res = Vec4::uninitialized();
154            ffi::graphene_vec4_multiply(
155                self.to_glib_none().0,
156                b.to_glib_none().0,
157                res.to_glib_none_mut().0,
158            );
159            res
160        }
161    }
162
163    #[doc(alias = "graphene_vec4_near")]
164    pub fn near(&self, v2: &Vec4, epsilon: f32) -> bool {
165        unsafe { ffi::graphene_vec4_near(self.to_glib_none().0, v2.to_glib_none().0, epsilon) }
166    }
167
168    #[doc(alias = "graphene_vec4_negate")]
169    #[must_use]
170    pub fn negate(&self) -> Vec4 {
171        unsafe {
172            let mut res = Vec4::uninitialized();
173            ffi::graphene_vec4_negate(self.to_glib_none().0, res.to_glib_none_mut().0);
174            res
175        }
176    }
177
178    #[doc(alias = "graphene_vec4_normalize")]
179    #[must_use]
180    pub fn normalize(&self) -> Vec4 {
181        unsafe {
182            let mut res = Vec4::uninitialized();
183            ffi::graphene_vec4_normalize(self.to_glib_none().0, res.to_glib_none_mut().0);
184            res
185        }
186    }
187
188    #[doc(alias = "graphene_vec4_scale")]
189    #[must_use]
190    pub fn scale(&self, factor: f32) -> Vec4 {
191        unsafe {
192            let mut res = Vec4::uninitialized();
193            ffi::graphene_vec4_scale(self.to_glib_none().0, factor, res.to_glib_none_mut().0);
194            res
195        }
196    }
197
198    #[doc(alias = "graphene_vec4_subtract")]
199    #[must_use]
200    pub fn subtract(&self, b: &Vec4) -> Vec4 {
201        unsafe {
202            let mut res = Vec4::uninitialized();
203            ffi::graphene_vec4_subtract(
204                self.to_glib_none().0,
205                b.to_glib_none().0,
206                res.to_glib_none_mut().0,
207            );
208            res
209        }
210    }
211
212    #[doc(alias = "graphene_vec4_one")]
213    pub fn one() -> Vec4 {
214        assert_initialized_main_thread!();
215        unsafe { from_glib_none(ffi::graphene_vec4_one()) }
216    }
217
218    #[doc(alias = "graphene_vec4_w_axis")]
219    pub fn w_axis() -> Vec4 {
220        assert_initialized_main_thread!();
221        unsafe { from_glib_none(ffi::graphene_vec4_w_axis()) }
222    }
223
224    #[doc(alias = "graphene_vec4_x_axis")]
225    pub fn x_axis() -> Vec4 {
226        assert_initialized_main_thread!();
227        unsafe { from_glib_none(ffi::graphene_vec4_x_axis()) }
228    }
229
230    #[doc(alias = "graphene_vec4_y_axis")]
231    pub fn y_axis() -> Vec4 {
232        assert_initialized_main_thread!();
233        unsafe { from_glib_none(ffi::graphene_vec4_y_axis()) }
234    }
235
236    #[doc(alias = "graphene_vec4_z_axis")]
237    pub fn z_axis() -> Vec4 {
238        assert_initialized_main_thread!();
239        unsafe { from_glib_none(ffi::graphene_vec4_z_axis()) }
240    }
241
242    #[doc(alias = "graphene_vec4_zero")]
243    pub fn zero() -> Vec4 {
244        assert_initialized_main_thread!();
245        unsafe { from_glib_none(ffi::graphene_vec4_zero()) }
246    }
247}
248
249impl PartialEq for Vec4 {
250    #[inline]
251    fn eq(&self, other: &Self) -> bool {
252        self.equal(other)
253    }
254}
255
256impl Eq for Vec4 {}