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
28
29
30
31
32
33
34
35
use crate::{Color, PaintNode, PipelineNode};
use glib::{object::Cast, translate::*};
use std::fmt;

glib_wrapper! {
    pub struct ColorNode(Object<ffi::ClutterColorNode, ffi::ClutterColorNodeClass, ColorNodeClass>) @extends PipelineNode, PaintNode;

    match fn {
        get_type => || ffi::clutter_color_node_get_type(),
    }
}

impl ColorNode {
    /// Creates a new `PaintNode` that will paint a solid color
    /// fill using `color`.
    /// ## `color`
    /// the color to paint, or `None`
    ///
    /// # Returns
    ///
    /// the newly created `PaintNode`. Use
    ///  `PaintNodeExt::unref` when done
    pub fn new(color: Option<&Color>) -> ColorNode {
        unsafe {
            PaintNode::from_glib_full(ffi::clutter_color_node_new(color.to_glib_none().0))
                .unsafe_cast()
        }
    }
}

impl fmt::Display for ColorNode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "ColorNode")
    }
}