gsk4/
path_point.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, Path, PathDirection, PathPoint};
6
7impl PathPoint {
8    #[doc(alias = "gsk_path_point_get_curvature")]
9    #[doc(alias = "get_curvature")]
10    pub fn curvature(
11        &self,
12        path: &Path,
13        direction: PathDirection,
14    ) -> (f32, Option<graphene::Point>) {
15        unsafe {
16            let mut center = graphene::Point::uninitialized();
17            let ret = ffi::gsk_path_point_get_curvature(
18                self.to_glib_none().0,
19                path.to_glib_none().0,
20                direction.into_glib(),
21                center.to_glib_none_mut().0,
22            );
23
24            if ret == 0.0 {
25                (ret, None)
26            } else {
27                (ret, Some(center))
28            }
29        }
30    }
31}