Skip to main content

BlockRenderer

Trait BlockRenderer 

Source
pub trait BlockRenderer {
    // Required methods
    fn measure_height(&self, block: &Block, width: f32, font_size: f32) -> f32;
    fn render_rects(
        &self,
        block: &Block,
        x: f32,
        y: f32,
        width: f32,
        rects: &mut Vec<RectInstance>,
    );
}
Expand description

Trait implemented by each block type’s renderer.

Required Methods§

Source

fn measure_height(&self, block: &Block, width: f32, font_size: f32) -> f32

Compute the height this block will occupy at the given width.

Source

fn render_rects( &self, block: &Block, x: f32, y: f32, width: f32, rects: &mut Vec<RectInstance>, )

Emit rectangles for this block at the given position.

Implementors§