gsk4/auto/
color_matrix_node.rs
1use crate::{ffi, RenderNode};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 #[doc(alias = "GskColorMatrixNode")]
11 pub struct ColorMatrixNode(Shared<ffi::GskColorMatrixNode>);
12
13 match fn {
14 ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
15 unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
16 }
17}
18
19impl StaticType for ColorMatrixNode {
20 fn static_type() -> glib::Type {
21 unsafe { from_glib(ffi::gsk_color_matrix_node_get_type()) }
22 }
23}
24
25impl ColorMatrixNode {
26 #[doc(alias = "gsk_color_matrix_node_new")]
46 pub fn new(
47 child: impl AsRef<RenderNode>,
48 color_matrix: &graphene::Matrix,
49 color_offset: &graphene::Vec4,
50 ) -> ColorMatrixNode {
51 skip_assert_initialized!();
52 unsafe {
53 from_glib_full(ffi::gsk_color_matrix_node_new(
54 child.as_ref().to_glib_none().0,
55 color_matrix.to_glib_none().0,
56 color_offset.to_glib_none().0,
57 ))
58 }
59 }
60
61 #[doc(alias = "gsk_color_matrix_node_get_child")]
67 #[doc(alias = "get_child")]
68 pub fn child(&self) -> RenderNode {
69 unsafe { from_glib_none(ffi::gsk_color_matrix_node_get_child(self.to_glib_none().0)) }
70 }
71
72 #[doc(alias = "gsk_color_matrix_node_get_color_matrix")]
78 #[doc(alias = "get_color_matrix")]
79 pub fn color_matrix(&self) -> graphene::Matrix {
80 unsafe {
81 from_glib_none(ffi::gsk_color_matrix_node_get_color_matrix(
82 self.to_glib_none().0,
83 ))
84 }
85 }
86
87 #[doc(alias = "gsk_color_matrix_node_get_color_offset")]
93 #[doc(alias = "get_color_offset")]
94 pub fn color_offset(&self) -> graphene::Vec4 {
95 unsafe {
96 from_glib_none(ffi::gsk_color_matrix_node_get_color_offset(
97 self.to_glib_none().0,
98 ))
99 }
100 }
101}