1use crate::{Point, ffi};
7use glib::translate::*;
8
9glib::wrapper! {
10 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11 pub struct Path(Boxed<ffi::PopplerPath>);
12
13 match fn {
14 copy => |ptr| ffi::poppler_path_copy(mut_override(ptr)),
15 free => |ptr| ffi::poppler_path_free(ptr),
16 type_ => || ffi::poppler_path_get_type(),
17 }
18}
19
20impl Path {
21 #[doc(alias = "poppler_path_new_from_array")]
22 #[doc(alias = "new_from_array")]
23 pub fn from_array(points: &Point, n_points: usize) -> Path {
24 unsafe {
25 from_glib_full(ffi::poppler_path_new_from_array(
26 mut_override(points.to_glib_none().0),
27 n_points,
28 ))
29 }
30 }
31
32 #[doc(alias = "poppler_path_get_points")]
33 #[doc(alias = "get_points")]
34 pub fn points(&self) -> Vec<Point> {
35 unsafe {
36 let mut n_points = std::mem::MaybeUninit::uninit();
37 let ret = FromGlibContainer::from_glib_none_num(
38 ffi::poppler_path_get_points(
39 mut_override(self.to_glib_none().0),
40 n_points.as_mut_ptr(),
41 ),
42 n_points.assume_init() as _,
43 );
44 ret
45 }
46 }
47}