DeferredImageSource Class
Definition
A Avalonia.Controls.Documents.RichImageSource backed by an asynchronous resolver — typically a URL fetched by a loader. The image is produced only when presented and off the UI thread; the document carries a Avalonia.Controls.Documents.DeferredImageSource.SourceUri reference rather than embedded bytes.
public class DeferredImageSource
Constructors
| Name | Description |
|---|---|
| DeferredImageSource | No summary available. |
DeferredImageSource Constructor
public DeferredImageSource(Func<System.Threading.Tasks.Task<Avalonia.Media.IImage>> resolver, string sourceUri, string mimeType)
Parameters
resolver Func<System.Threading.Tasks.Task<Avalonia.Media.IImage>>
sourceUri string
mimeType string
Methods
| Name | Description |
|---|---|
| ResolveAsync | Resolves the decoded image. Embedded sources complete synchronously; deferred sources fetch/decode in the background. Returns when the image cannot be produced. Callers must not dispose the returned image — its lifetime is owned by the source (or its loader); a source that owns a decoded bitmap implements IDisposable. |
| TryGetIntrinsicPixelSize | Inherited from RichImageSource. |
| TryGetPixels | Inherited from RichImageSource. |
ResolveAsync Method
Resolves the decoded image. Embedded sources complete synchronously; deferred sources fetch/decode in the background. Returns when the image cannot be produced. Callers must not dispose the returned image — its lifetime is owned by the source (or its loader); a source that owns a decoded bitmap implements IDisposable.
public System.Threading.Tasks.Task<Avalonia.Media.IImage> ResolveAsync()
Returns
System.Threading.Tasks.Task<Avalonia.Media.IImage>
Properties
| Name | Description |
|---|---|
| EncodedBytes | The encoded image bytes when the payload is embedded in the document, or an empty buffer for reference (URI) sources. Serializers that embed pixel data read this. Inherited from RichImageSource. |
| MimeType | The MIME type of Avalonia.Controls.Documents.RichImageSource.EncodedBytes, when known. |
| SourceUri | The reference URI for a deferred/linked source (e.g. an image URL), or for an embedded source. |
MimeType Property
The MIME type of Avalonia.Controls.Documents.RichImageSource.EncodedBytes, when known.
public string MimeType { get; set; }
SourceUri Property
The reference URI for a deferred/linked source (e.g. an image URL), or for an embedded source.
public string SourceUri { get; set; }