// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{Point, ffi};
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct Path(Boxed<ffi::PopplerPath>);

    match fn {
        copy => |ptr| ffi::poppler_path_copy(mut_override(ptr)),
        free => |ptr| ffi::poppler_path_free(ptr),
        type_ => || ffi::poppler_path_get_type(),
    }
}

impl Path {
    #[doc(alias = "poppler_path_new_from_array")]
    #[doc(alias = "new_from_array")]
    pub fn from_array(points: &Point, n_points: usize) -> Path {
        unsafe {
            from_glib_full(ffi::poppler_path_new_from_array(
                mut_override(points.to_glib_none().0),
                n_points,
            ))
        }
    }

    #[doc(alias = "poppler_path_get_points")]
    #[doc(alias = "get_points")]
    pub fn points(&self) -> Vec<Point> {
        unsafe {
            let mut n_points = std::mem::MaybeUninit::uninit();
            let ret = FromGlibContainer::from_glib_none_num(
                ffi::poppler_path_get_points(
                    mut_override(self.to_glib_none().0),
                    n_points.as_mut_ptr(),
                ),
                n_points.assume_init() as _,
            );
            ret
        }
    }
}
