iced::advanced::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>;
}
Available on crate feature advanced only.
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.

Implementations on Foreign Types§

Source§

impl Headless for Renderer<Renderer, Renderer>

Source§

fn new( default_font: Font, default_text_size: Pixels, ) -> Renderer<Renderer, Renderer>

Source§

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

Source§

impl Headless for Renderer

Source§

fn new(default_font: Font, default_text_size: Pixels) -> Renderer

Source§

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

Implementors§