pub trait Compositor: Sized {
type Renderer;
type Surface;
// Required methods
fn new(
settings: Settings,
display: impl Display + Clone,
compatible_window: impl Window + Clone,
shell: Shell,
) -> impl Future<Output = Result<Self, Error>>;
fn create_renderer(&self, settings: Settings) -> Self::Renderer;
fn create_surface(
&mut self,
window: impl Window + Clone,
width: u32,
height: u32,
) -> Self::Surface;
fn configure_surface(
&mut self,
surface: &mut Self::Surface,
width: u32,
height: u32,
);
fn information(&self) -> Information;
fn present(
&mut self,
renderer: &mut Self::Renderer,
surface: &mut Self::Surface,
viewport: &Viewport,
background_color: Color,
on_pre_present: impl FnOnce(),
) -> Result<(), SurfaceError>;
fn screenshot(
&mut self,
renderer: &mut Self::Renderer,
viewport: &Viewport,
background_color: Color,
) -> Vec<u8> ⓘ;
// Provided methods
fn load_font(&mut self, font: Cow<'static, [u8]>) -> Result<(), Error> { ... }
fn list_fonts(&mut self) -> Result<Vec<Family>, Error> { ... }
}Expand description
A graphics compositor that can draw to windows.
Required Associated Types§
Required Methods§
Sourcefn new(
settings: Settings,
display: impl Display + Clone,
compatible_window: impl Window + Clone,
shell: Shell,
) -> impl Future<Output = Result<Self, Error>>
fn new( settings: Settings, display: impl Display + Clone, compatible_window: impl Window + Clone, shell: Shell, ) -> impl Future<Output = Result<Self, Error>>
Creates a new Compositor with the given [backend::Settings].
Sourcefn create_renderer(&self, settings: Settings) -> Self::Renderer
fn create_renderer(&self, settings: Settings) -> Self::Renderer
Creates a Self::Renderer for the Compositor.
Sourcefn create_surface(
&mut self,
window: impl Window + Clone,
width: u32,
height: u32,
) -> Self::Surface
fn create_surface( &mut self, window: impl Window + Clone, width: u32, height: u32, ) -> Self::Surface
Crates a new Surface for the given window.
Sourcefn configure_surface(
&mut self,
surface: &mut Self::Surface,
width: u32,
height: u32,
)
fn configure_surface( &mut self, surface: &mut Self::Surface, width: u32, height: u32, )
Configures a new Surface with the given dimensions.
Sourcefn information(&self) -> Information
fn information(&self) -> Information
Returns Information used by this Compositor.
Provided Methods§
Sourcefn load_font(&mut self, font: Cow<'static, [u8]>) -> Result<(), Error>
fn load_font(&mut self, font: Cow<'static, [u8]>) -> Result<(), Error>
Loads a font from its bytes.
Sourcefn list_fonts(&mut self) -> Result<Vec<Family>, Error>
fn list_fonts(&mut self) -> Result<Vec<Family>, Error>
Lists all the available font families.
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 Compositor for ()
Available on debug-assertions enabled only.
impl Compositor for ()
Available on debug-assertions enabled only.