gsk4/
gl_shader_node.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, GLShaderNode, RenderNode, RenderNodeType};
6
7define_render_node!(
8    GLShaderNode,
9    ffi::GskGLShaderNode,
10    RenderNodeType::GlShaderNode
11);
12
13impl GLShaderNode {
14    /// Gets one of the children.
15    ///
16    /// # Deprecated since 4.16
17    ///
18    /// GTK's new Vulkan-focused rendering
19    ///   does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
20    ///   for OpenGL rendering.
21    /// ## `idx`
22    /// the position of the child to get
23    ///
24    /// # Returns
25    ///
26    /// the @idx'th child of @self
27    #[doc(alias = "gsk_gl_shader_node_get_child")]
28    #[doc(alias = "get_child")]
29    pub fn child(&self, idx: u32) -> RenderNode {
30        assert!(idx < self.n_children());
31        unsafe {
32            from_glib_none(ffi::gsk_gl_shader_node_get_child(
33                self.to_glib_none().0,
34                idx,
35            ))
36        }
37    }
38}
39
40impl std::fmt::Debug for GLShaderNode {
41    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
42        f.debug_struct("GLShaderNode")
43            .field("args", &self.args())
44            .field("n_children", &self.n_children())
45            .field("shader", &self.shader())
46            .finish()
47    }
48}