LoadedImageSurface
struct · ferroui-base · v0.5.0
struct LoadedImageSurface
A composition surface whose content is an image (WinUI
Microsoft.UI.Xaml.Media.LoadedImageSurface), here backed by a
Bitmap.
The surface holds a reference to the platform bitmap; the server-side surface holds another one until it is disposed.
Deviation (winui-composition.md): WinUI loads the image asynchronously
from a URI or a stream and raises LoadCompleted; here a surface is made
from a bitmap, or loaded from a stream at once, and the outcome is
load_status. There is no LoadCompleted event and
no decode size.
Members
from_bitmapstart_load_from_streamcompositorobjectload_statusbitmapnatural_sizedecoded_sizedecoded_physical_sizeis_disposeddispose
from_bitmap
fn from_bitmap(compositor: &Rc<Compositor>, bitmap: &Bitmap) -> Rc<LoadedImageSurface>
A surface that shows bitmap. The surface takes another reference to
the platform bitmap: disposing bitmap afterwards does not affect it.
start_load_from_stream
fn start_load_from_stream(compositor: &Rc<Compositor>, stream: &mut dyn Read) -> Rc<LoadedImageSurface>
StartLoadFromStream: a surface with the image decoded from
stream. The image is decoded at once; a stream that cannot be read
or decoded gives an empty surface whose
load_status says why.
compositor
fn compositor(self: &Self) -> &Rc<Compositor>
object
fn object(self: &Self) -> &CompositionObject
The embedded CompositionObject.
load_status
fn load_status(self: &Self) -> LoadedImageSourceLoadStatus
The outcome of the load.
bitmap
fn bitmap(self: &Self) -> Option<&Bitmap>
The bitmap the surface shows, None when the image did not load or
the surface is disposed.
natural_size
fn natural_size(self: &Self) -> Size
The size of the image in device independent pixels (NaturalSize):
what a surface brush lays out. Empty when the image did not load.
decoded_size
fn decoded_size(self: &Self) -> Size
The size of the decoded image in device independent pixels
(DecodedSize): the natural size, as the image is decoded at its
full size.
decoded_physical_size
fn decoded_physical_size(self: &Self) -> Size
The size of the decoded image in pixels (DecodedPhysicalSize).
is_disposed
fn is_disposed(self: &Self) -> bool
dispose
fn dispose(self: &Self)
Releases the surface: its server side releases the bitmap with the next batch.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherICompositionObjectICompositionSurface
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.