animate/legacy/
clip_node.rs

1use crate::PaintNode;
2use glib::{object::Cast, translate::*};
3use std::fmt;
4
5glib_wrapper! {
6    pub struct ClipNode(Object<ffi::ClutterClipNode, ffi::ClutterClipNodeClass, ClipNodeClass>) @extends PaintNode;
7
8    match fn {
9        get_type => || ffi::clutter_clip_node_get_type(),
10    }
11}
12
13impl ClipNode {
14    /// Creates a new `PaintNode` that will clip its child
15    /// nodes to the 2D regions added to it.
16    ///
17    /// # Returns
18    ///
19    /// the newly created `PaintNode`.
20    ///  Use `PaintNodeExt::unref` when done.
21    pub fn new() -> ClipNode {
22        unsafe { PaintNode::from_glib_full(ffi::clutter_clip_node_new()).unsafe_cast() }
23    }
24}
25
26impl Default for ClipNode {
27    fn default() -> Self {
28        Self::new()
29    }
30}
31
32impl fmt::Display for ClipNode {
33    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
34        write!(f, "ClipNode")
35    }
36}