use osmic_core::error::OsmicResult;
use crate::scene::SceneGraph;
#[derive(Debug, Clone)]
pub struct RenderConfig {
pub width: u32,
pub height: u32,
pub background: osmic_core::Color,
pub pixel_ratio: f32,
}
impl Default for RenderConfig {
fn default() -> Self {
Self {
width: 1024,
height: 1024,
background: osmic_core::Color::from_hex("#f8f4f0").unwrap(),
pixel_ratio: 1.0,
}
}
}
pub trait RenderBackend {
fn init(config: &RenderConfig) -> OsmicResult<Self>
where
Self: Sized;
fn render(&mut self, scene: &SceneGraph) -> OsmicResult<()>;
fn read_pixels(&self) -> Option<Vec<u8>>;
fn resize(&mut self, width: u32, height: u32);
}