graphene/auto/quad.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, Point, Rect};
6use glib::translate::*;
7
8glib::wrapper! {
9 /// A 4 vertex quadrilateral, as represented by four [`Point`][crate::Point].
10 ///
11 /// The contents of a [`Quad`][crate::Quad] are private and should never be
12 /// accessed directly.
13 pub struct Quad(BoxedInline<ffi::graphene_quad_t>);
14
15 match fn {
16 copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_quad_get_type(), ptr as *mut _) as *mut ffi::graphene_quad_t,
17 free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_quad_get_type(), ptr as *mut _),
18 type_ => || ffi::graphene_quad_get_type(),
19 }
20}
21
22impl Quad {
23 /// Computes the bounding rectangle of `self` and places it into `r`.
24 ///
25 /// # Returns
26 ///
27 ///
28 /// ## `r`
29 /// return location for a [`Rect`][crate::Rect]
30 #[doc(alias = "graphene_quad_bounds")]
31 pub fn bounds(&self) -> Rect {
32 unsafe {
33 let mut r = Rect::uninitialized();
34 ffi::graphene_quad_bounds(self.to_glib_none().0, r.to_glib_none_mut().0);
35 r
36 }
37 }
38
39 /// Checks if the given [`Quad`][crate::Quad] contains the given [`Point`][crate::Point].
40 /// ## `p`
41 /// a [`Point`][crate::Point]
42 ///
43 /// # Returns
44 ///
45 /// `true` if the point is inside the [`Quad`][crate::Quad]
46 #[doc(alias = "graphene_quad_contains")]
47 pub fn contains(&self, p: &Point) -> bool {
48 unsafe { ffi::graphene_quad_contains(self.to_glib_none().0, p.to_glib_none().0) }
49 }
50}