pango/
attr_shape.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, AttrType, Rectangle};
6
7define_attribute_struct!(AttrShape, ffi::PangoAttrShape, &[AttrType::Shape]);
8
9impl AttrShape {
10    #[doc(alias = "pango_attr_shape_new")]
11    pub fn new(ink_rect: &Rectangle, logical_rect: &Rectangle) -> Self {
12        unsafe {
13            from_glib_full(ffi::pango_attr_shape_new(
14                ink_rect.to_glib_none().0,
15                logical_rect.to_glib_none().0,
16            ))
17        }
18    }
19
20    pub fn ink_rect(&self) -> Rectangle {
21        unsafe { from_glib_none(&self.inner.ink_rect as *const _) }
22    }
23
24    pub fn logical_rect(&self) -> Rectangle {
25        unsafe { from_glib_none(&self.inner.logical_rect as *const _) }
26    }
27}