FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    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.

    Source

    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.

    Source

    compositor

    fn compositor(self: &Self) -> &Rc<Compositor>
    

    Source

    object

    fn object(self: &Self) -> &CompositionObject
    

    The embedded CompositionObject.

    Source

    load_status

    fn load_status(self: &Self) -> LoadedImageSourceLoadStatus
    

    The outcome of the load.

    Source

    bitmap

    fn bitmap(self: &Self) -> Option<&Bitmap>
    

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

    Source

    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.

    Source

    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.

    Source

    decoded_physical_size

    fn decoded_physical_size(self: &Self) -> Size
    

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

    Source

    is_disposed

    fn is_disposed(self: &Self) -> bool
    

    Source

    dispose

    fn dispose(self: &Self)
    

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

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither
    • ICompositionObject
    • ICompositionSurface

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.