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§
Sourcefn bitmap(&self) -> Option<Arc<SharedBitmapImpl>>
fn bitmap(&self) -> Option<Arc<SharedBitmapImpl>>
The current content of the surface.
Sourcefn changed(&self) -> &ServerCompositionSurfaceChanged
fn changed(&self) -> &ServerCompositionSurfaceChanged
Raised when the content changed.
Provided Methods§
Sourcefn natural_size(&self) -> Option<Size>
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.
Sourcefn draw(&self, canvas: &mut dyn IDrawingContextImpl, dest: Rect, opacity: f64)
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".