iced_core::renderer

Trait Headless

Source
pub trait Headless {
    // Required methods
    fn new(default_font: Font, default_text_size: Pixels) -> Self;
    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) -> Self

Creates a new Headless renderer;

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§