animate/legacy/
color_node.rs1use crate::{Color, InternalColor, PaintNode, PipelineNode, RgbaColor};
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 pub fn new(color: Option<Color>) -> ColorNode {
24 let color = match color {
25 Some(value) => {
26 let RgbaColor {
27 red,
28 green,
29 blue,
30 alpha,
31 } = value.into();
32 Some(InternalColor::new(red, green, blue, alpha))
33 }
34 None => None,
35 };
36 unsafe {
37 PaintNode::from_glib_full(ffi::clutter_color_node_new(color.to_glib_none().0))
38 .unsafe_cast()
39 }
40 }
41}
42
43impl fmt::Display for ColorNode {
44 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
45 write!(f, "ColorNode")
46 }
47}