Skip to main content

GraphicsAdapter

Trait GraphicsAdapter 

Source
pub trait GraphicsAdapter: Send + Sync {
    type Screen: DisplayScreen;

    // Required methods
    fn display_count(&self) -> usize;
    fn display_size(&self, display_id: usize) -> (u32, u32);
    fn create_framebuffer(&self, width: u32, height: u32) -> Self::Screen;
    fn update_plane(
        &self,
        display_id: usize,
        screen: &Self::Screen,
        damage: Damage,
    );

    // Provided method
    fn supports_hw_cursor(&self) -> bool { ... }
}
Expand description

Trait for a graphics adapter managing one or more displays.

Required Associated Types§

Source

type Screen: DisplayScreen

The screen type created by this adapter.

Required Methods§

Source

fn display_count(&self) -> usize

Number of connected displays.

Source

fn display_size(&self, display_id: usize) -> (u32, u32)

Resolution of a specific display.

Source

fn create_framebuffer(&self, width: u32, height: u32) -> Self::Screen

Create an offscreen framebuffer of the given size.

Source

fn update_plane(&self, display_id: usize, screen: &Self::Screen, damage: Damage)

Present an offscreen buffer to a physical display.

Only the damage region needs to be copied.

Provided Methods§

Source

fn supports_hw_cursor(&self) -> bool

Returns true if the adapter supports hardware cursor planes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§