Skip to main content

Surface

Trait Surface 

Source
pub trait Surface {
    // Required methods
    fn resize(&mut self, size: PhysicalSize);
    fn size(&self) -> PhysicalSize;
    fn present(&mut self, pixmap: &Pixmap, damage: &[Rect]);
}
Expand description

A presentable destination owned by the platform layer (a window’s drawable, a canvas, a layer-backed view, …).

This trait is the GPU-readiness seam: the software backend presents a Pixmap by blitting; a future GPU backend can implement the same trait by uploading or compositing directly. damage lists the regions (in physical pixels) that actually changed since the last present — an empty slice means “assume everything changed.”

Required Methods§

Source

fn resize(&mut self, size: PhysicalSize)

Resize the backing store to size physical pixels.

Source

fn size(&self) -> PhysicalSize

The current backing-store size in physical pixels.

Source

fn present(&mut self, pixmap: &Pixmap, damage: &[Rect])

Present pixmap, optionally limited to the damage regions.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§