#[derive(Debug, Clone, Copy)]
pub struct PageDimensions {
pub width_pts: f32,
pub height_pts: f32,
}
impl PageDimensions {
pub fn aspect_ratio(&self) -> f32 {
self.width_pts / self.height_pts
}
pub fn is_widescreen(&self) -> bool {
(self.aspect_ratio() - 16.0 / 9.0).abs() < 0.05
}
pub fn is_standard(&self) -> bool {
(self.aspect_ratio() - 4.0 / 3.0).abs() < 0.05
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct RenderSize {
pub width: u32,
pub height: u32,
}
#[derive(Debug, Clone)]
pub struct RenderedPage {
pub data: Vec<u8>,
pub width: u32,
pub height: u32,
}