use crate::bridge::ffi;
use crate::path::Path;
use crate::PathOp;
use crate::rect::Rect;
pub fn path_op(path1: &Path, path2: &Path, op: PathOp) -> Option<Path> {
let mut result = Path::new();
let ok = ffi::boolean_path_op(
path1.as_raw(),
path2.as_raw(),
op,
result.as_raw_pin_mut(),
);
if ok {
Some(result)
} else {
None
}
}
pub fn simplify(path: &Path) -> Option<Path> {
let mut result = Path::new();
let ok = ffi::simplify_path(path.as_raw(), result.as_raw_pin_mut());
if ok {
Some(result)
} else {
None
}
}
pub fn pathops_tight_bounds(path: &Path) -> Option<Rect> {
let mut result = ffi::Rect {
fLeft: 0.0,
fTop: 0.0,
fRight: 0.0,
fBottom: 0.0,
};
let ok = ffi::pathops_tight_bounds(path.as_raw(), &mut result);
if ok {
Some(result.into())
} else {
None
}
}