#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub enum ScaleMode {
#[default]
Fit,
Fill,
Stretch,
Center,
}
#[derive(Debug, Clone, Default)]
pub struct ImageDisplayOptions {
pub scale_mode: ScaleMode,
pub background_color: Option<[u8; 4]>,
pub maintain_aspect_ratio: bool,
}
impl ImageDisplayOptions {
pub fn new() -> Self {
Self { scale_mode: ScaleMode::Fit, background_color: None, maintain_aspect_ratio: true }
}
pub fn with_scale_mode(mut self, mode: ScaleMode) -> Self {
self.scale_mode = mode;
self
}
pub fn with_background(mut self, color: [u8; 4]) -> Self {
self.background_color = Some(color);
self
}
}