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
// 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 glib::translate::*;

glib::wrapper! {
    pub struct Vec2(BoxedInline<ffi::graphene_vec2_t>);

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

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

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

    #[doc(alias = "graphene_vec2_dot")]
    pub fn dot(&self, b: &Vec2) -> f32 {
        unsafe { ffi::graphene_vec2_dot(self.to_glib_none().0, b.to_glib_none().0) }
    }

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

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

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

    #[doc(alias = "graphene_vec2_interpolate")]
    #[must_use]
    pub fn interpolate(&self, v2: &Vec2, factor: f64) -> Vec2 {
        unsafe {
            let mut res = Vec2::uninitialized();
            ffi::graphene_vec2_interpolate(
                self.to_glib_none().0,
                v2.to_glib_none().0,
                factor,
                res.to_glib_none_mut().0,
            );
            res
        }
    }

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

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

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

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

    #[doc(alias = "graphene_vec2_near")]
    pub fn near(&self, v2: &Vec2, epsilon: f32) -> bool {
        unsafe { ffi::graphene_vec2_near(self.to_glib_none().0, v2.to_glib_none().0, epsilon) }
    }

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

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

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

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

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

    #[doc(alias = "graphene_vec2_x_axis")]
    pub fn x_axis() -> Vec2 {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_vec2_x_axis()) }
    }

    #[doc(alias = "graphene_vec2_y_axis")]
    pub fn y_axis() -> Vec2 {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::graphene_vec2_y_axis()) }
    }

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

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

impl Eq for Vec2 {}