|
| 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 | + |
| 5 | +use crate::{ffi, Point, Rect, Vec2}; |
| 6 | +use glib::translate::*; |
| 7 | + |
| 8 | +glib::wrapper! { |
| 9 | + pub struct Box2D(BoxedInline<ffi::graphene_box2d_t>); |
| 10 | + |
| 11 | + match fn { |
| 12 | + copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_box2d_get_type(), ptr as *mut _) as *mut ffi::graphene_box2d_t, |
| 13 | + free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_box2d_get_type(), ptr as *mut _), |
| 14 | + type_ => || ffi::graphene_box2d_get_type(), |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +impl Box2D { |
| 19 | + #[doc(alias = "graphene_box2d_contains_box")] |
| 20 | + pub fn contains_box(&self, b: &Box2D) -> bool { |
| 21 | + unsafe { ffi::graphene_box2d_contains_box(self.to_glib_none().0, b.to_glib_none().0) } |
| 22 | + } |
| 23 | + |
| 24 | + #[doc(alias = "graphene_box2d_contains_point")] |
| 25 | + pub fn contains_point(&self, point: &Point) -> bool { |
| 26 | + unsafe { ffi::graphene_box2d_contains_point(self.to_glib_none().0, point.to_glib_none().0) } |
| 27 | + } |
| 28 | + |
| 29 | + #[doc(alias = "graphene_box2d_contains_rect")] |
| 30 | + pub fn contains_rect(&self, rect: &Rect) -> bool { |
| 31 | + unsafe { ffi::graphene_box2d_contains_rect(self.to_glib_none().0, rect.to_glib_none().0) } |
| 32 | + } |
| 33 | + |
| 34 | + #[doc(alias = "graphene_box2d_equal")] |
| 35 | + fn equal(&self, b: &Box2D) -> bool { |
| 36 | + unsafe { ffi::graphene_box2d_equal(self.to_glib_none().0, b.to_glib_none().0) } |
| 37 | + } |
| 38 | + |
| 39 | + #[doc(alias = "graphene_box2d_expand")] |
| 40 | + #[must_use] |
| 41 | + pub fn expand(&self, point: &Point) -> Box2D { |
| 42 | + unsafe { |
| 43 | + let mut res = Box2D::uninitialized(); |
| 44 | + ffi::graphene_box2d_expand( |
| 45 | + self.to_glib_none().0, |
| 46 | + point.to_glib_none().0, |
| 47 | + res.to_glib_none_mut().0, |
| 48 | + ); |
| 49 | + res |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + #[doc(alias = "graphene_box2d_expand_scalar")] |
| 54 | + #[must_use] |
| 55 | + pub fn expand_scalar(&self, scalar: f32) -> Box2D { |
| 56 | + unsafe { |
| 57 | + let mut res = Box2D::uninitialized(); |
| 58 | + ffi::graphene_box2d_expand_scalar( |
| 59 | + self.to_glib_none().0, |
| 60 | + scalar, |
| 61 | + res.to_glib_none_mut().0, |
| 62 | + ); |
| 63 | + res |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + #[doc(alias = "graphene_box2d_expand_vec2")] |
| 68 | + #[must_use] |
| 69 | + pub fn expand_vec2(&self, vec: &Vec2) -> Box2D { |
| 70 | + unsafe { |
| 71 | + let mut res = Box2D::uninitialized(); |
| 72 | + ffi::graphene_box2d_expand_vec2( |
| 73 | + self.to_glib_none().0, |
| 74 | + vec.to_glib_none().0, |
| 75 | + res.to_glib_none_mut().0, |
| 76 | + ); |
| 77 | + res |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + #[doc(alias = "graphene_box2d_get_center")] |
| 82 | + #[doc(alias = "get_center")] |
| 83 | + pub fn center(&self) -> Point { |
| 84 | + unsafe { |
| 85 | + let mut center = Point::uninitialized(); |
| 86 | + ffi::graphene_box2d_get_center(self.to_glib_none().0, center.to_glib_none_mut().0); |
| 87 | + center |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + #[doc(alias = "graphene_box2d_get_height")] |
| 92 | + #[doc(alias = "get_height")] |
| 93 | + pub fn height(&self) -> f32 { |
| 94 | + unsafe { ffi::graphene_box2d_get_height(self.to_glib_none().0) } |
| 95 | + } |
| 96 | + |
| 97 | + #[doc(alias = "graphene_box2d_get_max")] |
| 98 | + #[doc(alias = "get_max")] |
| 99 | + pub fn max(&self) -> Point { |
| 100 | + unsafe { |
| 101 | + let mut max = Point::uninitialized(); |
| 102 | + ffi::graphene_box2d_get_max(self.to_glib_none().0, max.to_glib_none_mut().0); |
| 103 | + max |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + #[doc(alias = "graphene_box2d_get_min")] |
| 108 | + #[doc(alias = "get_min")] |
| 109 | + pub fn min(&self) -> Point { |
| 110 | + unsafe { |
| 111 | + let mut min = Point::uninitialized(); |
| 112 | + ffi::graphene_box2d_get_min(self.to_glib_none().0, min.to_glib_none_mut().0); |
| 113 | + min |
| 114 | + } |
| 115 | + } |
| 116 | + |
| 117 | + #[doc(alias = "graphene_box2d_get_minmax")] |
| 118 | + #[doc(alias = "get_minmax")] |
| 119 | + pub fn minmax(&self) -> (Point, Point) { |
| 120 | + unsafe { |
| 121 | + let mut min = Point::uninitialized(); |
| 122 | + let mut max = Point::uninitialized(); |
| 123 | + ffi::graphene_box2d_get_minmax( |
| 124 | + self.to_glib_none().0, |
| 125 | + min.to_glib_none_mut().0, |
| 126 | + max.to_glib_none_mut().0, |
| 127 | + ); |
| 128 | + (min, max) |
| 129 | + } |
| 130 | + } |
| 131 | + |
| 132 | + #[doc(alias = "graphene_box2d_get_size")] |
| 133 | + #[doc(alias = "get_size")] |
| 134 | + pub fn size(&self) -> Vec2 { |
| 135 | + unsafe { |
| 136 | + let mut size = Vec2::uninitialized(); |
| 137 | + ffi::graphene_box2d_get_size(self.to_glib_none().0, size.to_glib_none_mut().0); |
| 138 | + size |
| 139 | + } |
| 140 | + } |
| 141 | + |
| 142 | + #[doc(alias = "graphene_box2d_get_width")] |
| 143 | + #[doc(alias = "get_width")] |
| 144 | + pub fn width(&self) -> f32 { |
| 145 | + unsafe { ffi::graphene_box2d_get_width(self.to_glib_none().0) } |
| 146 | + } |
| 147 | + |
| 148 | + #[doc(alias = "graphene_box2d_intersection")] |
| 149 | + pub fn intersection(&self, b: &Box2D) -> Option<Box2D> { |
| 150 | + unsafe { |
| 151 | + let mut res = Box2D::uninitialized(); |
| 152 | + let ret = ffi::graphene_box2d_intersection( |
| 153 | + self.to_glib_none().0, |
| 154 | + b.to_glib_none().0, |
| 155 | + res.to_glib_none_mut().0, |
| 156 | + ); |
| 157 | + if ret { |
| 158 | + Some(res) |
| 159 | + } else { |
| 160 | + None |
| 161 | + } |
| 162 | + } |
| 163 | + } |
| 164 | + |
| 165 | + #[doc(alias = "graphene_box2d_intersects")] |
| 166 | + pub fn intersects(&self, b: &Box2D) -> bool { |
| 167 | + unsafe { ffi::graphene_box2d_intersects(self.to_glib_none().0, b.to_glib_none().0) } |
| 168 | + } |
| 169 | + |
| 170 | + #[doc(alias = "graphene_box2d_scale_offset")] |
| 171 | + #[must_use] |
| 172 | + pub fn scale_offset(&self, scale: Option<&Vec2>, offset: Option<&Point>) -> Box2D { |
| 173 | + unsafe { |
| 174 | + let mut res = Box2D::uninitialized(); |
| 175 | + ffi::graphene_box2d_scale_offset( |
| 176 | + self.to_glib_none().0, |
| 177 | + scale.to_glib_none().0, |
| 178 | + offset.to_glib_none().0, |
| 179 | + res.to_glib_none_mut().0, |
| 180 | + ); |
| 181 | + res |
| 182 | + } |
| 183 | + } |
| 184 | + |
| 185 | + #[doc(alias = "graphene_box2d_to_rect")] |
| 186 | + pub fn to_rect(&self) -> Rect { |
| 187 | + unsafe { |
| 188 | + let mut rect = Rect::uninitialized(); |
| 189 | + ffi::graphene_box2d_to_rect(self.to_glib_none().0, rect.to_glib_none_mut().0); |
| 190 | + rect |
| 191 | + } |
| 192 | + } |
| 193 | + |
| 194 | + #[doc(alias = "graphene_box2d_union")] |
| 195 | + #[must_use] |
| 196 | + pub fn union(&self, b: &Box2D) -> Box2D { |
| 197 | + unsafe { |
| 198 | + let mut res = Box2D::uninitialized(); |
| 199 | + ffi::graphene_box2d_union( |
| 200 | + self.to_glib_none().0, |
| 201 | + b.to_glib_none().0, |
| 202 | + res.to_glib_none_mut().0, |
| 203 | + ); |
| 204 | + res |
| 205 | + } |
| 206 | + } |
| 207 | + |
| 208 | + #[doc(alias = "graphene_box2d_empty")] |
| 209 | + pub fn empty() -> Box2D { |
| 210 | + assert_initialized_main_thread!(); |
| 211 | + unsafe { from_glib_none(ffi::graphene_box2d_empty()) } |
| 212 | + } |
| 213 | + |
| 214 | + #[doc(alias = "graphene_box2d_infinite")] |
| 215 | + pub fn infinite() -> Box2D { |
| 216 | + assert_initialized_main_thread!(); |
| 217 | + unsafe { from_glib_none(ffi::graphene_box2d_infinite()) } |
| 218 | + } |
| 219 | + |
| 220 | + #[doc(alias = "graphene_box2d_minus_one")] |
| 221 | + pub fn minus_one() -> Box2D { |
| 222 | + assert_initialized_main_thread!(); |
| 223 | + unsafe { from_glib_none(ffi::graphene_box2d_minus_one()) } |
| 224 | + } |
| 225 | + |
| 226 | + #[doc(alias = "graphene_box2d_one")] |
| 227 | + pub fn one() -> Box2D { |
| 228 | + assert_initialized_main_thread!(); |
| 229 | + unsafe { from_glib_none(ffi::graphene_box2d_one()) } |
| 230 | + } |
| 231 | + |
| 232 | + #[doc(alias = "graphene_box2d_one_minus_one")] |
| 233 | + pub fn one_minus_one() -> Box2D { |
| 234 | + assert_initialized_main_thread!(); |
| 235 | + unsafe { from_glib_none(ffi::graphene_box2d_one_minus_one()) } |
| 236 | + } |
| 237 | + |
| 238 | + #[doc(alias = "graphene_box2d_zero")] |
| 239 | + pub fn zero() -> Box2D { |
| 240 | + assert_initialized_main_thread!(); |
| 241 | + unsafe { from_glib_none(ffi::graphene_box2d_zero()) } |
| 242 | + } |
| 243 | +} |
| 244 | + |
| 245 | +impl PartialEq for Box2D { |
| 246 | + #[inline] |
| 247 | + fn eq(&self, other: &Self) -> bool { |
| 248 | + self.equal(other) |
| 249 | + } |
| 250 | +} |
| 251 | + |
| 252 | +impl Eq for Box2D {} |
0 commit comments