Skip to main content

gsk4/
clip_node.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::{ClipNode, RenderNodeType};
4
5define_render_node!(ClipNode, crate::ffi::GskClipNode, RenderNodeType::ClipNode);
6
7impl ClipNode {
8    /// Retrieves the snap value for this node
9    ///
10    /// # Returns
11    ///
12    /// the snap value
13    #[cfg(feature = "v4_24")]
14    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
15    #[doc(alias = "gsk_clip_node_get_snap")]
16    #[doc(alias = "get_snap")]
17    pub fn snap(&self) -> crate::RectSnap {
18        unsafe {
19            glib::translate::from_glib(crate::ffi::gsk_clip_node_get_snap(
20                glib::translate::ToGlibPtr::to_glib_none(self).0,
21            ))
22        }
23    }
24}
25
26impl std::fmt::Debug for ClipNode {
27    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
28        f.debug_struct("ClipNode")
29            .field("child", &self.child())
30            .field("clip", &self.clip())
31            .finish()
32    }
33}