Table of Contents

Interface IImage

Namespace
Xui.Core.Canvas
Assembly
Xui.Core.dll

Represents a decoded, GPU-resident image. Acts as a self-loading resource handle — analogous to HTMLImageElement in the browser.

Acquire instances via GetService(typeof(IImage)) on any View. Then set the source with Load(string) (sync-if-cached) or LoadAsync(string) for first-time remote or large assets.

public interface IImage

Properties

Size

Intrinsic size of the image in points. Returns Empty until loaded.

Size Size { get; }

Property Value

Size

Methods

Load(string)

Loads the image from uri. Returns immediately if the image is already in the platform catalog. For local packaged assets this may block on first call; prefer LoadAsync(string) for anything that could be slow.

void Load(string uri)

Parameters

uri string

LoadAsync(string)

Loads the image from uri on a background thread. The returned task completes once the image is decoded and GPU-resident. Subsequent Load(string) calls with the same URI return instantly from cache.

Task LoadAsync(string uri)

Parameters

uri string

Returns

Task

LoadPixels(int, int, ReadOnlySpan<byte>)

Uploads raw CPU pixel data into this image, replacing any previously loaded content. bgra32Data must contain width * height * 4 bytes in BGRA order (B at the lowest address), matching DXGI_FORMAT_B8G8R8A8_UNORM. Default implementation is a no-op on platforms that do not support pixel upload.

void LoadPixels(int width, int height, ReadOnlySpan<byte> bgra32Data)

Parameters

width int
height int
bgra32Data ReadOnlySpan<byte>