use crate::core::style::TextStyle;
use crate::core::{Color, Position, Rect, Size};
pub trait Painter {
fn fill_rect(&mut self, rect: Rect, color: Color, corner_radius: f32);
fn stroke_rect(&mut self, rect: Rect, color: Color, width: f32, corner_radius: f32);
fn fill_circle(&mut self, center: Position, radius: f32, color: Color);
fn stroke_circle(&mut self, center: Position, radius: f32, color: Color, width: f32);
fn line(&mut self, from: Position, to: Position, color: Color, width: f32);
fn text(&mut self, pos: Position, text: &str, style: &TextStyle);
fn measure_text(&self, text: &str, style: &TextStyle) -> Size;
fn push_clip(&mut self, rect: Rect);
fn pop_clip(&mut self);
}
pub struct NullPainter;
impl Painter for NullPainter {
fn fill_rect(&mut self, _rect: Rect, _color: Color, _corner_radius: f32) {}
fn stroke_rect(&mut self, _rect: Rect, _color: Color, _width: f32, _corner_radius: f32) {}
fn fill_circle(&mut self, _center: Position, _radius: f32, _color: Color) {}
fn stroke_circle(&mut self, _center: Position, _radius: f32, _color: Color, _width: f32) {}
fn line(&mut self, _from: Position, _to: Position, _color: Color, _width: f32) {}
fn text(&mut self, _pos: Position, _text: &str, _style: &TextStyle) {}
fn measure_text(&self, text: &str, style: &TextStyle) -> Size {
let w = style.font_size * 0.6 * text.len() as f32;
Size::new(w, style.font_size * 1.2)
}
fn push_clip(&mut self, _rect: Rect) {}
fn pop_clip(&mut self) {}
}