Skip to main content

IServerCompositionSurface

Trait IServerCompositionSurface 

Source
pub trait IServerCompositionSurface: IServerObject {
    // Required methods
    fn bitmap(&self) -> Option<Arc<SharedBitmapImpl>>;
    fn changed(&self) -> &ServerCompositionSurfaceChanged;

    // Provided methods
    fn natural_size(&self) -> Option<Size> { ... }
    fn draw(
        &self,
        canvas: &mut dyn IDrawingContextImpl,
        dest: Rect,
        opacity: f64,
    ) { ... }
}
Expand description

Server-side counterpart of a composition surface: something that provides a bitmap to the surface visuals that show it.

The WinUI port adds the surfaces whose content is not a bitmap (a visual surface renders a visual subtree): what a surface visual or a surface brush shows goes through natural_size and draw, whose defaults use the bitmap.

Required Methods§

Source

fn bitmap(&self) -> Option<Arc<SharedBitmapImpl>>

The current content of the surface.

Source

fn changed(&self) -> &ServerCompositionSurfaceChanged

Raised when the content changed.

Provided Methods§

Source

fn natural_size(&self) -> Option<Size>

The size of the content in device independent pixels (the natural size of WinUI’s surfaces), which a surface brush lays out; None while the surface has no content. The default is the size of the bitmap at its DPI.

Source

fn draw(&self, canvas: &mut dyn IDrawingContextImpl, dest: Rect, opacity: f64)

Draws the whole content of the surface into dest, in the coordinates of canvas. The default draws the bitmap.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§