pub struct LoadedImageSurface { /* private fields */ }Expand description
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.
Implementations§
Source§impl LoadedImageSurface
impl LoadedImageSurface
Sourcepub fn from_bitmap(
compositor: &Rc<Compositor>,
bitmap: &Bitmap,
) -> Rc<LoadedImageSurface>
pub 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.
Sourcepub fn start_load_from_stream(
compositor: &Rc<Compositor>,
stream: &mut dyn Read,
) -> Rc<LoadedImageSurface>
pub 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.
pub fn compositor(&self) -> &Rc<Compositor>
Sourcepub fn object(&self) -> &CompositionObject
pub fn object(&self) -> &CompositionObject
The embedded CompositionObject.
Sourcepub fn server(&self) -> ServerObjectId
pub fn server(&self) -> ServerObjectId
The id of the server-side surface.
Sourcepub fn load_status(&self) -> LoadedImageSourceLoadStatus
pub fn load_status(&self) -> LoadedImageSourceLoadStatus
The outcome of the load.
Sourcepub fn bitmap(&self) -> Option<&Bitmap>
pub fn bitmap(&self) -> Option<&Bitmap>
The bitmap the surface shows, None when the image did not load or
the surface is disposed.
Sourcepub fn natural_size(&self) -> Size
pub fn natural_size(&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.
Sourcepub fn decoded_size(&self) -> Size
pub fn decoded_size(&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.
Sourcepub fn decoded_physical_size(&self) -> Size
pub fn decoded_physical_size(&self) -> Size
The size of the decoded image in pixels (DecodedPhysicalSize).
pub fn is_disposed(&self) -> bool
Trait Implementations§
impl ICompositionSurface for LoadedImageSurface
Auto Trait Implementations§
impl !Freeze for LoadedImageSurface
impl !RefUnwindSafe for LoadedImageSurface
impl !Send for LoadedImageSurface
impl !Sync for LoadedImageSurface
impl !UnwindSafe for LoadedImageSurface
impl Unpin for LoadedImageSurface
impl UnsafeUnpin for LoadedImageSurface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more