pub trait RenderBackend {
// Required methods
fn initialize(&mut self) -> Result<(), Box<dyn Error>>;
fn cleanup(&mut self);
fn begin_frame(&mut self);
fn end_frame(&mut self);
fn render_component(
&mut self,
component: &Component,
x: f32,
y: f32,
width: f32,
height: f32,
);
fn draw_rect(
&mut self,
x: f32,
y: f32,
width: f32,
height: f32,
style: &Style,
);
fn draw_text(&mut self, text: &str, x: f32, y: f32, style: &Style);
fn measure_text(&mut self, text: &str, style: &Style) -> (f32, f32);
}Expand description
渲染系统相关功能 渲染后端 trait
Required Methods§
Sourcefn begin_frame(&mut self)
fn begin_frame(&mut self)
开始渲染帧