Felix
Felix

Reputation: 4081

How to render graphics from byte buffer in WinUI3?

I am receiving real time graphics data via:

void Data(ref UInt8[] buffer, UInt64 length);

How can I display this data in a Window in WinUI3 via C#?

The WritableBitmap class in UWP looks promising, but I haven't found a WinUI equivalent.

CanvasRenderTarget from the Win2D for WinUI3 library also sounds promising, but that library doesn't look stable yet.

Any ideas?

Upvotes: 0

Views: 544

Answers (1)

Gavin Williams
Gavin Williams

Reputation: 462

If Win2d is good enough for you that's the easy way. If you want lower level control at some point, you can use SharpDX or perhaps better, it's spiritual successor Vortice. They are DirectX wrappers that can output to the Xaml SwapChainPanel in WinUI. There is also TerraFX, another DirectX wrapper which uses non-standard, lower level C# without trying to match any C# conventions. It's the most difficult option, but it's available if you need a little bit more performance.

SharpDX is retired, but it's very stable, and has been in use for many years.

https://github.com/amerkoleci/Vortice.Windows

http://sharpdx.org/

https://github.com/terrafx/terrafx.interop.windows

All these are available as nuget packages as well.

Upvotes: 1

Related Questions