Trait Headless

Source
pub trait Headless {
    // Required methods
    fn new(
        default_font: Font,
        default_text_size: Pixels,
        backend: Option<&str>,
    ) -> impl Future<Output = Option<Self>>
       where Self: Sized;
    fn name(&self) -> String;
    fn screenshot(
        &mut self,
        size: Size<u32>,
        scale_factor: f32,
        background_color: Color,
    ) -> Vec<u8> ;
}
Expand description

A headless renderer is a renderer that can render offscreen without a window nor a compositor.

Required Methods§

Source

fn new( default_font: Font, default_text_size: Pixels, backend: Option<&str>, ) -> impl Future<Output = Option<Self>>
where Self: Sized,

Creates a new Headless renderer;

Source

fn name(&self) -> String

Returns the unique name of the renderer.

This name may be used by testing libraries to uniquely identify snapshots.

Source

fn screenshot( &mut self, size: Size<u32>, scale_factor: f32, background_color: Color, ) -> Vec<u8>

Draws offscreen into a screenshot, returning a collection of bytes representing the rendered pixels in RGBA order.

Implementors§

impl<A, B> Headless for Renderer<A, B>
where A: Headless, B: Headless,

impl Headless for Renderer

impl Headless for Renderer