use lievisual::geometry::{Color, Point};
pub const DEFAULT_WIDTH: f64 = 800.0;
pub const DEFAULT_HEIGHT: f64 = 600.0;
#[derive(Debug, Clone)]
pub struct OutputConfig {
pub width: Option<f64>,
pub height: Option<f64>,
pub background: Color,
pub upscale: bool,
}
impl Default for OutputConfig {
fn default() -> Self {
Self {
width: Some(DEFAULT_WIDTH),
height: Some(DEFAULT_HEIGHT),
background: Color::new(255, 255, 255, 255),
upscale: false,
}
}
}
pub fn center_in_rect(
text_w: f64,
text_h: f64,
rect_x: f64,
rect_y: f64,
rect_w: f64,
rect_h: f64,
) -> Point {
Point::new(
rect_x + (rect_w - text_w) / 2.0,
rect_y + (rect_h - text_h) / 2.0,
)
}