Trait cosmic::iced_winit::graphics::Compositor

source ·
pub trait Compositor: Sized {
    type Renderer;
    type Surface;

    // Required methods
    fn with_backend<W>(
        _settings: Settings,
        _compatible_window: W,
        _backend: Option<&str>,
    ) -> impl Future<Output = Result<Self, Error>>
       where W: Window + Clone;
    fn create_renderer(&self) -> Self::Renderer;
    fn create_surface<W>(
        &mut self,
        window: W,
        width: u32,
        height: u32,
    ) -> Self::Surface
       where W: Window + Clone;
    fn configure_surface(
        &mut self,
        surface: &mut Self::Surface,
        width: u32,
        height: u32,
    );
    fn fetch_information(&self) -> Information;
    fn present<T>(
        &mut self,
        renderer: &mut Self::Renderer,
        surface: &mut Self::Surface,
        viewport: &Viewport,
        background_color: Color,
        overlay: &[T],
    ) -> Result<(), SurfaceError>
       where T: AsRef<str>;
    fn screenshot<T>(
        &mut self,
        renderer: &mut Self::Renderer,
        surface: &mut Self::Surface,
        viewport: &Viewport,
        background_color: Color,
        overlay: &[T],
    ) -> Vec<u8> 
       where T: AsRef<str>;

    // Provided methods
    fn new<W>(
        settings: Settings,
        compatible_window: W,
    ) -> impl Future<Output = Result<Self, Error>>
       where W: Window + Clone { ... }
    fn load_font(&mut self, font: Cow<'static, [u8]>) { ... }
}
Expand description

A graphics compositor that can draw to windows.

Required Associated Types§

source

type Renderer

The iced renderer of the backend.

source

type Surface

The surface of the backend.

Required Methods§

source

fn with_backend<W>( _settings: Settings, _compatible_window: W, _backend: Option<&str>, ) -> impl Future<Output = Result<Self, Error>>
where W: Window + Clone,

Creates a new Compositor with a backend preference.

If the backend does not match the preference, it will return Error::GraphicsAdapterNotFound.

source

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

Creates a Self::Renderer for the Compositor.

source

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

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>( &mut self, renderer: &mut Self::Renderer, surface: &mut Self::Surface, viewport: &Viewport, background_color: Color, overlay: &[T], ) -> Result<(), SurfaceError>
where T: AsRef<str>,

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

source

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

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

Provided Methods§

source

fn new<W>( settings: Settings, compatible_window: W, ) -> impl Future<Output = Result<Self, Error>>
where W: Window + Clone,

Creates a new Compositor.

source

fn load_font(&mut self, font: Cow<'static, [u8]>)

Loads a font from its bytes.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Compositor for ()

source§

type Renderer = ()

source§

type Surface = ()

source§

async fn with_backend<W>( _settings: Settings, _compatible_window: W, _preferred_backend: Option<&str>, ) -> Result<(), Error>
where W: Window + Clone,

source§

fn create_renderer(&self) -> <() as Compositor>::Renderer

source§

fn create_surface<W>( &mut self, _window: W, _width: u32, _height: u32, ) -> <() as Compositor>::Surface
where W: Window + Clone,

source§

fn configure_surface( &mut self, _surface: &mut <() as Compositor>::Surface, _width: u32, _height: u32, )

source§

fn load_font(&mut self, _font: Cow<'static, [u8]>)

source§

fn fetch_information(&self) -> Information

source§

fn present<T>( &mut self, _renderer: &mut <() as Compositor>::Renderer, _surface: &mut <() as Compositor>::Surface, _viewport: &Viewport, _background_color: Color, _overlay: &[T], ) -> Result<(), SurfaceError>
where T: AsRef<str>,

source§

fn screenshot<T>( &mut self, _renderer: &mut <() as Compositor>::Renderer, _surface: &mut <() as Compositor>::Surface, _viewport: &Viewport, _background_color: Color, _overlay: &[T], ) -> Vec<u8>
where T: AsRef<str>,

source§

impl Compositor for Compositor

source§

type Renderer = Renderer

source§

type Surface = Surface

source§

async fn with_backend<W>( settings: Settings, compatible_window: W, backend: Option<&str>, ) -> Result<Compositor, Error>
where W: Window,

source§

fn create_renderer(&self) -> <Compositor as Compositor>::Renderer

source§

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

source§

fn configure_surface( &mut self, surface: &mut <Compositor as Compositor>::Surface, width: u32, height: u32, )

source§

fn fetch_information(&self) -> Information

source§

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

source§

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

Implementors§

source§

impl<A, B> Compositor for cosmic::iced_widget::renderer::fallback::Compositor<A, B>
where A: Compositor, B: Compositor,