简体   繁体   English

C#本身是否使用GPU进行图形处理?

[英]Does C# natively use GPU for graphics?

I'd like to draw heavy usage graphics in the fastest way. 我想以最快的方式绘制大量使用图形。 If I use standard C# graphics callbacks (es.graphics.drawline) am I doing it right? 如果我使用标准的C#图形回调(es.graphics.drawline),我做得对吗? Or am I to use different libraries? 还是我要使用不同的库?

Graphics.DrawLine is a GDI+ call. Graphics.DrawLine是一个GDI +调用。 If you're using Windows Forms and doing your drawing with the System.Drawing classes, you're using GDI+, which is not hardware-accelerated. 如果您正在使用Windows窗体并使用System.Drawing类进行绘图,那么您使用的是GDI +,它不是硬件加速的。 To get hardware acceleration, you need to use WPF in place of WinForms or draw with Direct3D/Direct2D. 要获得硬件加速,您需要使用WPF代替WinForms或使用Direct3D / Direct2D进行绘制。 The latter two (Direct3D/Direct2D) are COM-based, so you'll need a .NET wrapper. 后两者(Direct3D / Direct2D)是基于COM的,所以你需要一个.NET包装器。 Microsoft wrapped Direct3D for .NET with Managed DirectX followed by XNA. 微软用Managed DirectX和XNA包装Direct3D for .NET。 Both (I believe) are now deprecated. 两者(我相信)现已弃用。 There are also third-party wrappers for the DirectX libraries that are more up-to-date. DirectX库还有第三方包装器 ,它们是最新的。

Edit: I just learned from @HansPassant's comment that GDI+ is 2D accelerated. 编辑:我刚从@ HansPassant的评论中了解到GDI +是2D加速的。 I thought that only applied to GDI (as opposed to GDI+) because GDI+ handles things like antialiasing that (as I understood it) 2D hardware didn't do. 我认为这只适用于GDI(而不是GDI +),因为GDI +处理的事情就像抗锯齿一样(据我所知)2D硬件没有做到。 But apparently I was wrong. 但显然我错了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM