-
-
Notifications
You must be signed in to change notification settings - Fork 433
Description
Is your feature request related to a problem? Please describe
No built-in bitmap conversion for AvaloniaUI, like WPF has.
Describe the solution you'd like
I would like to be able to convert a MagickImage to an Avalonia WriteableBitmap, with an easy extension method, just like WPF has.
Describe alternatives you've considered
I'm currently achieving it by setting the format as Png and writing it to a MemorySteam, but that is inefficient. I'm looking for a similar way of correctly converting the pixel data, to use for an Avalonia image.
I've tried doing it myself, but unfortunately I don't understand this well enough, as I've run into multiple issues such as ExecutionEngineException NullReferenceException etc.
Additional context
An example of rendering with WriteableBitmap in Avalonia: https://github.com/AvaloniaUI/Avalonia/blob/68a626f678b7fa4b1d1497cf7f419f7aebf703ee/samples/RenderDemo/Pages/WriteableBitmapPage.cs#L41
https://github.com/stevemonaco/AvaloniaDemos/tree/master/RealTimeBitmapAdapter
How to create Bitmap fron IntPtr
How to create a Bitmap from an image RGB buffer
AvaloniaUI/Avalonia#17365 (comment)