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
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::Size;
use glib::translate::*;

impl Size {
    #[doc(alias = "graphene_size_init")]
    pub fn new(width: f32, height: f32) -> Size {
        assert_initialized_main_thread!();
        unsafe {
            let alloc = ffi::graphene_size_alloc();
            ffi::graphene_size_init(alloc, width, height);
            from_glib_full(alloc)
        }
    }

    #[doc(alias = "graphene_size_init_from_size")]
    #[doc(alias = "new_from_size")]
    pub fn from_size(src: &Size) -> Size {
        assert_initialized_main_thread!();
        unsafe {
            let alloc = ffi::graphene_size_alloc();
            ffi::graphene_size_init_from_size(alloc, src.to_glib_none().0);
            from_glib_full(alloc)
        }
    }
}