WPF在UI中绘制图像的快速方法 [英] WPF fast method to draw image in UI

查看:165
本文介绍了WPF在UI中绘制图像的快速方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目需要执行快速图像渲染.

I have a project where i need to perform fast image rendering.

当前,我在禁用拉伸的情况下使用图像控制.计时器通过设置Source属性来进行更新.

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;

这部分成为性能瓶颈.图片更清晰.Source=框架是瓶颈.

This part become a performance bottleneck. More clearly image.Source = frame is a bottleneck.

我查看了MediaElement,但这并不适用.

I looked at MediaElement, but it's not applicable.

有什么方法可以更快地执行它?

Is there any ways to perform it faster?

也许是GDI BitBlt中的某种方法或类似方法?

Maybe some method as in GDI BitBlt or similar?

谢谢.

推荐答案

您不会从WPF中获得太多性能.甚至MediaElement也无法正确处理高清视频,而不会闪烁和滞后.

You won't get much performance out of WPF. Even MediaElement can't handle HD videos correctly, without flickering and lagging.

使用WindowsFormsHost标记在WPF应用程序中托管WinForms元素,如果要使用GDI,请在其中进行blitting.尽管GDI主要是基于软件的,但您可能希望检出DirectX或GDI +.

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+.

这篇关于WPF在UI中绘制图像的快速方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆