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§
Sourcetype Screen: DisplayScreen
type Screen: DisplayScreen
The screen type created by this adapter.
Required Methods§
Sourcefn display_count(&self) -> usize
fn display_count(&self) -> usize
Number of connected displays.
Sourcefn display_size(&self, display_id: usize) -> (u32, u32)
fn display_size(&self, display_id: usize) -> (u32, u32)
Resolution of a specific display.
Sourcefn create_framebuffer(&self, width: u32, height: u32) -> Self::Screen
fn create_framebuffer(&self, width: u32, height: u32) -> Self::Screen
Create an offscreen framebuffer of the given size.
Sourcefn update_plane(&self, display_id: usize, screen: &Self::Screen, damage: Damage)
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§
Sourcefn supports_hw_cursor(&self) -> bool
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".