使用 gdi+使用互操作位图

发布于 2024-08-29 22:47:52 字数 284 浏览 4 评论 0原文

是否可以将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

老街孤人 2024-09-05 22:47:52

我暂时避免使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文