EmbeddedImageSource Class
Definition
A Avalonia.Controls.Documents.RichImageSource whose encoded pixel bytes are embedded in the document. Decodes once from the retained bytes, caches and owns the decoded bitmap, and reports the intrinsic size from the image header without a full decode. Dispose to release the cached bitmap.
public class EmbeddedImageSource
Constructors
| Name | Description |
|---|---|
| EmbeddedImageSource | No summary available. |
EmbeddedImageSource Constructor
public EmbeddedImageSource(ReadOnlyMemory<byte> data, string mimeType)
Parameters
data ReadOnlyMemory<byte>
mimeType string
Methods
| Name | Description |
|---|---|
| Dispose | Releases the cached decoded bitmap. Subsequent Avalonia.Controls.Documents.EmbeddedImageSource.ResolveAsync calls return . |
| ResolveAsync | Resolves the decoded image, decoding once and caching the result. The returned bitmap is owned by this source and released by Avalonia.Controls.Documents.EmbeddedImageSource.Dispose; callers must not dispose it. Returns once disposed or when the payload cannot be decoded. |
| TryGetIntrinsicPixelSize | No summary available. |
| TryGetPixels | Inherited from RichImageSource. |
Dispose Method
Releases the cached decoded bitmap. Subsequent Avalonia.Controls.Documents.EmbeddedImageSource.ResolveAsync calls return .
public void Dispose()
ResolveAsync Method
Resolves the decoded image, decoding once and caching the result. The returned bitmap is owned by this source and released by Avalonia.Controls.Documents.EmbeddedImageSource.Dispose; callers must not dispose it. Returns once disposed or when the payload cannot be decoded.
public System.Threading.Tasks.Task<Avalonia.Media.IImage> ResolveAsync()
Returns
System.Threading.Tasks.Task<Avalonia.Media.IImage>
TryGetIntrinsicPixelSize Method
public bool TryGetIntrinsicPixelSize(int& width, int& height)
Parameters
width int&
height int&
Returns
bool
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. |
| 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. Inherited from RichImageSource. |
EncodedBytes Property
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.
public ReadOnlyMemory<byte> EncodedBytes { get; set; }
MimeType Property
The MIME type of Avalonia.Controls.Documents.RichImageSource.EncodedBytes, when known.
public string MimeType { get; set; }