use crate::theme::Color;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct ImageId(pub u32);
impl ImageId {
pub const INVALID: Self = Self(u32::MAX);
}
pub trait RenderBackend {
fn clear(&mut self, color: Color);
fn fill_rect(&mut self, x: f32, y: f32, w: f32, h: f32, color: Color);
fn fill_circle(&mut self, cx: f32, cy: f32, radius: f32, color: Color);
fn stroke_circle(&mut self, cx: f32, cy: f32, radius: f32, color: Color, width: f32);
fn stroke_arc(
&mut self,
cx: f32,
cy: f32,
radius: f32,
start_angle: f32,
end_angle: f32,
color: Color,
width: f32,
);
fn draw_line(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, color: Color, width: f32);
fn draw_text(&mut self, text: &str, x: f32, y: f32, size: f32, color: Color);
fn text_width(&self, text: &str, size: f32) -> f32;
fn present(&mut self) {}
fn register_image(&mut self, _rgba: &[u8], _width: u32, _height: u32) -> ImageId {
ImageId::INVALID
}
fn unregister_image(&mut self, _id: ImageId) {}
fn draw_image(&mut self, _id: ImageId, x: f32, y: f32, w: f32, h: f32) {
self.fill_rect(x, y, w, h, Color::rgb(1.0, 0.0, 1.0));
}
}