問題描述
使用 GDI 繪製散點圖太慢 (Drawing scatter plot is too slow with GDI)
我正在 GDI 的幫助下繪製散點圖。但是,當線條很多時,繪製大約需要兩秒鐘。我研究了使用 SlimDX 和 SharpDX 並使用了它們的 2D。它只減少了一半的時間。有沒有更好的工具可以用來加快繪圖速度?我只是在使用 g.DrawLine。我還聽說有一個工具可以讓我在內存上繪製散點圖並將其放在屏幕上。如果您有想法,將不勝感激。謝謝你。
參考解法
方法 1:
[Are] there any better tools that I can use to speed up the drawing?
First, use g.DrawLines instead of g.DrawLine. This means there is one transition from user code to graphics code instead of one per line.
Second, select a bitmap into the graphics object, draw into that then write the bitmap to the display. See how to draw a line on a image? for an example of drawing a line on a bitmap. This means the lines are drawn once then refreshing the display is a single fast Bit Blit.
Using DirectX ports (e.g. SharpDX, and SlimDX) is possible but probably overkill unless you are dealing with extremely complex scatter plots. These are (generally) more geared toward 3D vector or 2D Bit Blit based graphics.
(by JEONG MIN LEE、akton)