gsk4/auto/
stroke_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, Path, RenderNode, Stroke};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// A render node that will fill the area determined by stroking the the given
10    /// [`Path`][crate::Path] using the [`Stroke`][crate::Stroke] attributes.
11    #[doc(alias = "GskStrokeNode")]
12    pub struct StrokeNode(Shared<ffi::GskStrokeNode>);
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 StrokeNode {
21    fn static_type() -> glib::Type {
22        unsafe { from_glib(ffi::gsk_stroke_node_get_type()) }
23    }
24}
25
26impl StrokeNode {
27    /// Creates a #GskRenderNode that will fill the outline generated by stroking
28    /// the given @path using the attributes defined in @stroke.
29    ///
30    /// The area is filled with @child.
31    /// ## `child`
32    /// The node to stroke the area with
33    /// ## `path`
34    /// The path describing the area to stroke
35    /// ## `stroke`
36    /// The stroke attributes to use
37    ///
38    /// # Returns
39    ///
40    /// A new #GskRenderNode
41    #[doc(alias = "gsk_stroke_node_new")]
42    pub fn new(child: impl AsRef<RenderNode>, path: &Path, stroke: &Stroke) -> StrokeNode {
43        skip_assert_initialized!();
44        unsafe {
45            from_glib_none(ffi::gsk_stroke_node_new(
46                child.as_ref().to_glib_none().0,
47                path.to_glib_none().0,
48                stroke.to_glib_none().0,
49            ))
50        }
51    }
52
53    /// Gets the child node that is getting drawn by the given @self.
54    ///
55    /// # Returns
56    ///
57    /// The child that is getting drawn
58    #[doc(alias = "gsk_stroke_node_get_child")]
59    #[doc(alias = "get_child")]
60    pub fn child(&self) -> RenderNode {
61        unsafe { from_glib_none(ffi::gsk_stroke_node_get_child(self.to_glib_none().0)) }
62    }
63
64    /// Retrieves the path that will be stroked with the contents of
65    /// the @self.
66    ///
67    /// # Returns
68    ///
69    /// a #GskPath
70    #[doc(alias = "gsk_stroke_node_get_path")]
71    #[doc(alias = "get_path")]
72    pub fn path(&self) -> Path {
73        unsafe { from_glib_none(ffi::gsk_stroke_node_get_path(self.to_glib_none().0)) }
74    }
75
76    /// Retrieves the stroke attributes used in this @self.
77    ///
78    /// # Returns
79    ///
80    /// a #GskStroke
81    #[doc(alias = "gsk_stroke_node_get_stroke")]
82    #[doc(alias = "get_stroke")]
83    pub fn stroke(&self) -> Stroke {
84        unsafe { from_glib_none(ffi::gsk_stroke_node_get_stroke(self.to_glib_none().0)) }
85    }
86}