Skip to main content

gsk4/
conic_gradient_node.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::{ConicGradientNode, RenderNodeType};
4
5define_render_node!(
6    ConicGradientNode,
7    crate::ffi::GskConicGradientNode,
8    RenderNodeType::ConicGradientNode
9);
10
11impl ConicGradientNode {
12    /// Retrieves the snap value for this node
13    ///
14    /// # Returns
15    ///
16    /// the snap value
17    #[cfg(feature = "v4_24")]
18    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
19    #[doc(alias = "gsk_conic_gradient_node_get_snap")]
20    #[doc(alias = "get_snap")]
21    pub fn snap(&self) -> crate::RectSnap {
22        unsafe {
23            glib::translate::from_glib(crate::ffi::gsk_conic_gradient_node_get_snap(
24                glib::translate::ToGlibPtr::to_glib_none(self).0,
25            ))
26        }
27    }
28}
29
30impl std::fmt::Debug for ConicGradientNode {
31    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
32        #[cfg(feature = "v4_2")]
33        {
34            f.debug_struct("ConicGradientNode")
35                .field("angle", &self.angle())
36                .field("center", &self.center())
37                .field("color_stops", &self.color_stops())
38                .field("n_color_stops", &self.n_color_stops())
39                .field("rotation", &self.rotation())
40                .finish()
41        }
42        #[cfg(not(feature = "v4_2"))]
43        {
44            f.debug_struct("ConicGradientNode")
45                .field("center", &self.center())
46                .field("color_stops", &self.color_stops())
47                .field("n_color_stops", &self.n_color_stops())
48                .field("rotation", &self.rotation())
49                .finish()
50        }
51    }
52}