gsk4/auto/repeating_radial_gradient_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::{ColorStop, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// A render node for a repeating radial gradient.
10 #[doc(alias = "GskRepeatingRadialGradientNode")]
11 pub struct RepeatingRadialGradientNode(Shared<ffi::GskRepeatingRadialGradientNode>);
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 RepeatingRadialGradientNode {
20 fn static_type() -> glib::Type {
21 unsafe { from_glib(ffi::gsk_repeating_radial_gradient_node_get_type()) }
22 }
23}
24
25impl RepeatingRadialGradientNode {
26 /// Creates a [`RenderNode`][crate::RenderNode] that draws a repeating radial gradient.
27 ///
28 /// The radial gradient starts around @center. The size of the gradient
29 /// is dictated by @hradius in horizontal orientation and by @vradius
30 /// in vertical orientation.
31 /// ## `bounds`
32 /// the bounds of the node
33 /// ## `center`
34 /// the center of the gradient
35 /// ## `hradius`
36 /// the horizontal radius
37 /// ## `vradius`
38 /// the vertical radius
39 /// ## `start`
40 /// = 0 that defines the start of the gradient around @center
41 /// ## `end`
42 /// = 0 that defines the end of the gradient around @center
43 /// ## `color_stops`
44 /// = 1.
45 ///
46 /// # Returns
47 ///
48 /// A new [`RenderNode`][crate::RenderNode]
49 #[doc(alias = "gsk_repeating_radial_gradient_node_new")]
50 pub fn new(
51 bounds: &graphene::Rect,
52 center: &graphene::Point,
53 hradius: f32,
54 vradius: f32,
55 start: f32,
56 end: f32,
57 color_stops: &[ColorStop],
58 ) -> RepeatingRadialGradientNode {
59 assert_initialized_main_thread!();
60 let n_color_stops = color_stops.len() as _;
61 unsafe {
62 from_glib_full(ffi::gsk_repeating_radial_gradient_node_new(
63 bounds.to_glib_none().0,
64 center.to_glib_none().0,
65 hradius,
66 vradius,
67 start,
68 end,
69 color_stops.to_glib_none().0,
70 n_color_stops,
71 ))
72 }
73 }
74}