使用 GDI 繪製散點圖太慢 (Drawing scatter plot is too slow with GDI)


問題描述

使用 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 LEEakton)

參考文件

  1. Drawing scatter plot is too slow with GDI (CC BY‑SA 2.5/3.0/4.0)

#gdi #slimdx #sharpdx #C#






相關問題

繪製鼠標光標 (Draw mouse cursor)

C 和 Windows GDI 中的雙緩衝 *framework* (Double-buffering *framework* in C and Windows GDI)

一個進程的 GDI 洩漏會影響其他進程嗎? (Can GDI leaks from one process affect other processes?)

BeginPath Textout EndPath 繪製反轉文本 (BeginPath Textout EndPath draws inverted text)

監控GDI通話 (Monitoring GDI calls)

如何捕獲(並希望修復)GDI 資源洩漏 (How to catch (and hopefully fix) a GDI resource leak)

如何使用 GDI(+) 在內存中渲染漸變 (How to render a gradient in memory using GDI(+))

使用 BITMAP::bmBits 與 GetDIBits 有什麼區別? (What is the difference between using BITMAP::bmBits vs GetDIBits?)

獲取背景窗口的縮略圖 (Get Thumbnail of background window)

AlphaBlend 返回“假”的原因可能是什麼 (What could be the reason for AlphaBlend to return 'false')

在 C++ 中查找像素 RGB 數據的最快方法是什麼? (What is the fastest method to lookup pixel RGB data in C++?)

逐行讀取文本框並將其視為單獨的文本 (Read a textbox line by line and treat it as a separate text)







留言討論