use crate::model::content_object::ContentObject;
use crate::model::image_object::ImageObject;
use crate::model::path_object::PathObject;
use crate::model::text_object::TextObject;
#[derive(Debug, Clone)]
pub struct OfdPage {
pub width: f64,
pub height: f64,
pub content: Vec<ContentObject>,
pub base_path: Option<String>,
}
impl OfdPage {
#[must_use]
pub fn new(width: f64, height: f64) -> Self {
Self {
width,
height,
content: Vec::new(),
base_path: None,
}
}
#[must_use]
pub fn with_base_path(mut self, path: impl Into<String>) -> Self {
self.base_path = Some(path.into());
self
}
pub fn add_text(&mut self, text: TextObject) {
self.content.push(ContentObject::Text(text));
}
pub fn add_image(&mut self, image: ImageObject) {
self.content.push(ContentObject::Image(image));
}
pub fn add_path(&mut self, path: PathObject) {
self.content.push(ContentObject::Path(path));
}
}