You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ExecutionEngineExceptionNullReferenceException etc.
Marking this issue as an enhancement and hoping that someone will pick this up.
It looks like you will need to call Lock() on the WriteableBitmap and then write bytes to that memory address. You probably also need to check if RowBytes has padding per row. If you happen to get this working then please come back here with the solution.
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)
The text was updated successfully, but these errors were encountered: