gsk4/auto/blur_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 /// A render node applying a blur effect to its single child.
10 #[doc(alias = "GskBlurNode")]
11 pub struct BlurNode(Shared<ffi::GskBlurNode>);
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 BlurNode {
20 fn static_type() -> glib::Type {
21 unsafe { from_glib(ffi::gsk_blur_node_get_type()) }
22 }
23}
24
25impl BlurNode {
26 /// Creates a render node that blurs the child.
27 /// ## `child`
28 /// the child node to blur
29 /// ## `radius`
30 /// the blur radius. Must be positive
31 ///
32 /// # Returns
33 ///
34 /// a new [`RenderNode`][crate::RenderNode]
35 #[doc(alias = "gsk_blur_node_new")]
36 pub fn new(child: impl AsRef<RenderNode>, radius: f32) -> BlurNode {
37 skip_assert_initialized!();
38 unsafe {
39 from_glib_full(ffi::gsk_blur_node_new(
40 child.as_ref().to_glib_none().0,
41 radius,
42 ))
43 }
44 }
45
46 /// Retrieves the child [`RenderNode`][crate::RenderNode] of the blur @self.
47 ///
48 /// # Returns
49 ///
50 /// the blurred child node
51 #[doc(alias = "gsk_blur_node_get_child")]
52 #[doc(alias = "get_child")]
53 pub fn child(&self) -> RenderNode {
54 unsafe { from_glib_none(ffi::gsk_blur_node_get_child(self.to_glib_none().0)) }
55 }
56
57 /// Retrieves the blur radius of the @self.
58 ///
59 /// # Returns
60 ///
61 /// the blur radius
62 #[doc(alias = "gsk_blur_node_get_radius")]
63 #[doc(alias = "get_radius")]
64 pub fn radius(&self) -> f32 {
65 unsafe { ffi::gsk_blur_node_get_radius(self.to_glib_none().0) }
66 }
67}