clutter/auto/
color_node.rs

1use crate::{Color, PaintNode, PipelineNode};
2use glib::{object::Cast, translate::*};
3use std::fmt;
4
5glib_wrapper! {
6    pub struct ColorNode(Object<ffi::ClutterColorNode, ffi::ClutterColorNodeClass, ColorNodeClass>) @extends PipelineNode, PaintNode;
7
8    match fn {
9        get_type => || ffi::clutter_color_node_get_type(),
10    }
11}
12
13impl ColorNode {
14    /// Creates a new `PaintNode` that will paint a solid color
15    /// fill using `color`.
16    /// ## `color`
17    /// the color to paint, or `None`
18    ///
19    /// # Returns
20    ///
21    /// the newly created `PaintNode`. Use
22    ///  `PaintNodeExt::unref` when done
23    pub fn new(color: Option<&Color>) -> ColorNode {
24        unsafe {
25            PaintNode::from_glib_full(ffi::clutter_color_node_new(color.to_glib_none().0))
26                .unsafe_cast()
27        }
28    }
29}
30
31impl fmt::Display for ColorNode {
32    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33        write!(f, "ColorNode")
34    }
35}