gsk4/auto/
fill_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, FillRule, Path, RenderNode};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// A render node filling the area given by [`Path`][crate::Path]
10    /// and [`FillRule`][crate::FillRule] with the child node.
11    #[doc(alias = "GskFillNode")]
12    pub struct FillNode(Shared<ffi::GskFillNode>);
13
14    match fn {
15        ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
16        unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
17    }
18}
19
20impl StaticType for FillNode {
21    fn static_type() -> glib::Type {
22        unsafe { from_glib(ffi::gsk_fill_node_get_type()) }
23    }
24}
25
26impl FillNode {
27    /// Creates a [`RenderNode`][crate::RenderNode] that will fill the @child in the area
28    /// given by @path and @fill_rule.
29    /// ## `child`
30    /// The node to fill the area with
31    /// ## `path`
32    /// The path describing the area to fill
33    /// ## `fill_rule`
34    /// The fill rule to use
35    ///
36    /// # Returns
37    ///
38    /// A new [`RenderNode`][crate::RenderNode]
39    #[doc(alias = "gsk_fill_node_new")]
40    pub fn new(child: impl AsRef<RenderNode>, path: &Path, fill_rule: FillRule) -> FillNode {
41        skip_assert_initialized!();
42        unsafe {
43            from_glib_none(ffi::gsk_fill_node_new(
44                child.as_ref().to_glib_none().0,
45                path.to_glib_none().0,
46                fill_rule.into_glib(),
47            ))
48        }
49    }
50
51    /// Gets the child node that is getting drawn by the given @self.
52    ///
53    /// # Returns
54    ///
55    /// The child that is getting drawn
56    #[doc(alias = "gsk_fill_node_get_child")]
57    #[doc(alias = "get_child")]
58    pub fn child(&self) -> RenderNode {
59        unsafe { from_glib_none(ffi::gsk_fill_node_get_child(self.to_glib_none().0)) }
60    }
61
62    /// Retrieves the fill rule used to determine how the path is filled.
63    ///
64    /// # Returns
65    ///
66    /// a [`FillRule`][crate::FillRule]
67    #[doc(alias = "gsk_fill_node_get_fill_rule")]
68    #[doc(alias = "get_fill_rule")]
69    pub fn fill_rule(&self) -> FillRule {
70        unsafe { from_glib(ffi::gsk_fill_node_get_fill_rule(self.to_glib_none().0)) }
71    }
72
73    /// Retrieves the path used to describe the area filled with the contents of
74    /// the @self.
75    ///
76    /// # Returns
77    ///
78    /// a [`Path`][crate::Path]
79    #[doc(alias = "gsk_fill_node_get_path")]
80    #[doc(alias = "get_path")]
81    pub fn path(&self) -> Path {
82        unsafe { from_glib_none(ffi::gsk_fill_node_get_path(self.to_glib_none().0)) }
83    }
84}