gsk4/auto/
color_matrix_node.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, RenderNode};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GskColorMatrixNode")]
10    pub struct ColorMatrixNode(Shared<ffi::GskColorMatrixNode>);
11
12    match fn {
13        ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
14        unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
15    }
16}
17
18impl StaticType for ColorMatrixNode {
19    fn static_type() -> glib::Type {
20        unsafe { from_glib(ffi::gsk_color_matrix_node_get_type()) }
21    }
22}
23
24impl ColorMatrixNode {
25    #[doc(alias = "gsk_color_matrix_node_new")]
26    pub fn new(
27        child: impl AsRef<RenderNode>,
28        color_matrix: &graphene::Matrix,
29        color_offset: &graphene::Vec4,
30    ) -> ColorMatrixNode {
31        skip_assert_initialized!();
32        unsafe {
33            from_glib_full(ffi::gsk_color_matrix_node_new(
34                child.as_ref().to_glib_none().0,
35                color_matrix.to_glib_none().0,
36                color_offset.to_glib_none().0,
37            ))
38        }
39    }
40
41    #[doc(alias = "gsk_color_matrix_node_get_child")]
42    #[doc(alias = "get_child")]
43    pub fn child(&self) -> RenderNode {
44        unsafe { from_glib_none(ffi::gsk_color_matrix_node_get_child(self.to_glib_none().0)) }
45    }
46
47    #[doc(alias = "gsk_color_matrix_node_get_color_matrix")]
48    #[doc(alias = "get_color_matrix")]
49    pub fn color_matrix(&self) -> graphene::Matrix {
50        unsafe {
51            from_glib_none(ffi::gsk_color_matrix_node_get_color_matrix(
52                self.to_glib_none().0,
53            ))
54        }
55    }
56
57    #[doc(alias = "gsk_color_matrix_node_get_color_offset")]
58    #[doc(alias = "get_color_offset")]
59    pub fn color_offset(&self) -> graphene::Vec4 {
60        unsafe {
61            from_glib_none(ffi::gsk_color_matrix_node_get_color_offset(
62                self.to_glib_none().0,
63            ))
64        }
65    }
66}