pub trait Compositor: Sized {
    type Settings: Default;
    type Renderer: Renderer;
    type Surface;

    // Required methods
    fn new<W: Window + Clone>(
        settings: Self::Settings,
        compatible_window: W
    ) -> Result<Self, Error>;
    fn create_renderer(&self) -> Self::Renderer;
    fn create_surface<W: Window + Clone>(
        &mut self,
        window: W,
        width: u32,
        height: u32
    ) -> Self::Surface;
    fn configure_surface(
        &mut self,
        surface: &mut Self::Surface,
        width: u32,
        height: u32
    );
    fn fetch_information(&self) -> Information;
    fn present<T: AsRef<str>>(
        &mut self,
        renderer: &mut Self::Renderer,
        surface: &mut Self::Surface,
        viewport: &Viewport,
        background_color: Color,
        overlay: &[T]
    ) -> Result<(), SurfaceError>;
    fn screenshot<T: AsRef<str>>(
        &mut self,
        renderer: &mut Self::Renderer,
        surface: &mut Self::Surface,
        viewport: &Viewport,
        background_color: Color,
        overlay: &[T]
    ) -> Vec<u8>;
}
Expand description

A graphics compositor that can draw to windows.

Required Associated Types§

source

type Settings: Default

The settings of the backend.

source

type Renderer: Renderer

The iced renderer of the backend.

source

type Surface

The surface of the backend.

Required Methods§

source

fn new<W: Window + Clone>( settings: Self::Settings, compatible_window: W ) -> Result<Self, Error>

Creates a new Compositor.

source

fn create_renderer(&self) -> Self::Renderer

Creates a Self::Renderer for the Compositor.

source

fn create_surface<W: Window + Clone>( &mut self, window: W, width: u32, height: u32 ) -> Self::Surface

Crates a new Surface for the given window.

source

fn configure_surface( &mut self, surface: &mut Self::Surface, width: u32, height: u32 )

Configures a new Surface with the given dimensions.

source

fn fetch_information(&self) -> Information

Returns Information used by this Compositor.

source

fn present<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, surface: &mut Self::Surface, viewport: &Viewport, background_color: Color, overlay: &[T] ) -> Result<(), SurfaceError>

Presents the Renderer primitives to the next frame of the given Surface.

source

fn screenshot<T: AsRef<str>>( &mut self, renderer: &mut Self::Renderer, surface: &mut Self::Surface, viewport: &Viewport, background_color: Color, overlay: &[T] ) -> Vec<u8>

Screenshots the current Renderer primitives to an offscreen texture, and returns the bytes of the texture ordered as RGBA in the sRGB color space.

Object Safety§

This trait is not object safe.

Implementors§