使用 gdi+使用互操作位图
是否可以将 WPF 的 InteropBitmap 与 gdi+ 一起使用?有什么例子吗?
(我需要它来进行 2D 绘图,许多小对象;我知道如何将 gdi+ 与 WriteableBitmap => (参见 Danko 的帖子) ,但毕竟我读过 InteropBitmap 应该更快)
fritz
Is it possible to use WPF's InteropBitmap together with gdi+ ? Any examples ?
(I need it for 2D drawing, many small objects; I know how to use gdi+ with WriteableBitmap => (see post by Danko) , but after all I've read InteropBitmap should be faster)
fritz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我暂时避免使用 InteropBitmap 来完成此类任务。我认为性能提升不会如您所愿,尤其是 内存泄漏,需要您不断调用 GC.Collect()。如果您说您正在使用 Direct2D 而不是 GDI+,我会看到更多尝试走这条路线的理由。
您需要的 GDI+ 2D 绘图是否需要执行一些无法移植到 DrawingContext 方法的操作?根据我的经验,这是将 GDI+ 内容移植到 WPF 的最简单、最快的途径。
I'd avoid using InteropBitmap for the time being and with this kind of task. I don't think the performance increase would be all you're hoping it to be, especially with the memory leak that requires you constantly calling GC.Collect(). If you said you were doing Direct2D instead of GDI+, I would see more of a reason to attempt going this route.
Is the GDI+ 2D drawing you need to do something that can't be ported over to DrawingContext's methods? In my experience, this has been the easiest and fastest route to porting GDI+ stuf to WPF.