Skip to main content

LoadedImageSurface

Struct LoadedImageSurface 

Source
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

Source

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.

Source

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.

Source

pub fn compositor(&self) -> &Rc<Compositor>

Source

pub fn object(&self) -> &CompositionObject

The embedded CompositionObject.

Source

pub fn server(&self) -> ServerObjectId

The id of the server-side surface.

Source

pub fn load_status(&self) -> LoadedImageSourceLoadStatus

The outcome of the load.

Source

pub fn bitmap(&self) -> Option<&Bitmap>

The bitmap the surface shows, None when the image did not load or the surface is disposed.

Source

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.

Source

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.

Source

pub fn decoded_physical_size(&self) -> Size

The size of the decoded image in pixels (DecodedPhysicalSize).

Source

pub fn is_disposed(&self) -> bool

Source

pub fn dispose(&self)

Releases the surface: its server side releases the bitmap with the next batch.

Trait Implementations§

Source§

impl ICompositionObject for LoadedImageSurface

Source§

fn server(&self) -> ServerObjectId

The id of the server-side counterpart of the object.
Source§

fn as_any(&self) -> &dyn Any

Source§

fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>

Source§

impl ICompositionSurface for LoadedImageSurface

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.