rlvgl_core/renderer.rs
1//! Rendering interface used by widgets.
2//!
3//! Implementors of this trait can target displays, off-screen buffers or
4//! simulator windows.
5
6use crate::widget::{Color, Rect};
7
8/// Target-agnostic drawing interface.
9///
10/// Renderers are supplied to widgets during the draw phase. Implementations
11/// may target a physical display, an off-screen buffer or a simulator window.
12pub trait Renderer {
13 /// Fill the given rectangle with a solid color.
14 fn fill_rect(&mut self, rect: Rect, color: Color);
15
16 /// Draw UTF‑8 text with its baseline anchored at the provided position using the color.
17 fn draw_text(&mut self, position: (i32, i32), text: &str, color: Color);
18}