Reputation: 1602
I have a project where i need to perform fast image rendering.
Currently, i use image control with stretch disabled. update is made by timer, by setting Source property.
WriteableBitmap frame = Player.Get().GetFrame();
if (frame != null)
image.Source = frame;
This part become a performance bottleneck. More clearly image.Source = frame is a bottleneck.
I looked at MediaElement, but it's not applicable.
Is there any ways to perform it faster?
Maybe some method as in GDI BitBlt or similar?
Thanks in advance.
Upvotes: 3
Views: 2716
Reputation: 8162
If you really need the performance, your best bet is probably to write a small wrapper for bitblt.
Perhaps those two articles help you:
Using BitBlt to copy and paste graphics
Upvotes: 1
Reputation: 26268
You won't get much performance out of WPF. Even MediaElement can't handle HD videos correctly, without flickering and lagging.
Host a WinForms element in your WPF application using WindowsFormsHost tag and do the blitting there if you want to use GDI. Though GDI is mostly software based, you might want to check out DirectX or GDI+.
Upvotes: 1