pub mod arc_to;
pub mod cubic_bezier_curve_to;
pub mod line_to;
pub mod move_to;
pub mod path_fill_mode;
pub mod path_shade_values;
pub mod path_type;
pub mod quad_bezier_curve_to;
use path_fill_mode::PathFillModeValues;
use path_type::PathTypeValues;
#[cfg(feature = "serde")]
use serde::Serialize;
use crate::raw::drawing::{
shape::{path::XlsxPath, shape_guide::XlsxShapeGuide},
st_types::emu_to_pt,
};
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct Path {
paths: Vec<PathTypeValues>,
pub fill: PathFillModeValues,
pub width: f64,
pub height: f64,
pub stroke: bool,
pub extrusion_allowed: bool,
}
impl Path {
pub(crate) fn from_raw(raw: XlsxPath, guide_list: Option<Vec<XlsxShapeGuide>>) -> Self {
let paths: Vec<PathTypeValues> = raw
.paths
.unwrap_or(vec![])
.into_iter()
.map(|raw| PathTypeValues::from_raw(raw, guide_list.clone()))
.collect();
return Self {
paths,
fill: PathFillModeValues::from_string(raw.fill),
width: emu_to_pt(raw.width.unwrap_or(0) as i64),
height: emu_to_pt(raw.height.unwrap_or(0) as i64),
stroke: raw.stroke.unwrap_or(true),
extrusion_allowed: raw.extrusion_allowed.unwrap_or(false),
};
}
}