在 .NET 中从多边形生成位图的最快方法
阅读此博客后,我想要尝试自己编写一个类似的程序。
子任务之一是拥有一组源多边形,并使用这些多边形生成将与目标图像进行比较的位图。
在.NET 2005 中,显而易见的方法是使用GDI+。只需创建一个位图,获取一个与该位图交互的Graphics对象,然后调用多个Graphics对象渲染函数即可。
显然,这不利用硬件加速。这就是 WPF 不使用 GDI+ 的原因。
.NET 中是否有 API 可以利用更先进的渲染技术生成位图?
After readingthis blog, I want to try writing a similar program myself.
One of the subtasks is to have a source set of polygons, and use these polygons to generate the bitmap that is going to be compared with the target image.
In .NET 2005 the obvious method is to use GDI+. Simply create a bitmap, get a Graphics object that interfaces to the bitmap, and call a number of the Graphics objects rendering functions.
Apparently, this doesn't utilise hardware accelaration. This is why WPF doesn't use GDI+.
Is there an API in .NET to generate a bitmap utilising more advanced rendering technologies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于您已将其标记为 WPF,因此您可以尝试 RenderTargetBitmap.Render。
根据您要渲染的内容,WPF 将使用您的视频卡来加速渲染。
还有 Managed DirectX,但它已过时(MS 不再维护它)。我相信现在推荐使用 XNA。
Since you've tagged this as WPF, you could try RenderTargetBitmap.Render.
Depending on what you're rendering, WPF will use your video card to accelerate rendering.
There is also Managed DirectX, but that is obsolete (MS does not maintain it anymore). I believe XNA is recommended instead now.
我确信 DirectDraw 会满足您的需要。据我所知,这就是 WPF 使用的方法。
I'm sure DirectDraw would do what you need. It's what WPF uses, as far as I know.
我会研究 托管 DirectX (或更新的 XNA)。这将使您能够利用加速的 Direct3D 或 DirectDraw 库,并为您的应用程序获得完全加速的性能。
I would look into Managed DirectX (or the more recent XNA). This would allow you to make use of the accelerated Direct3D or DirectDraw libraries, and get fully accelerated performance for your application.