SetPixel is too slow. Is there a faster way to draw to bitmap?

前端 未结 5 468
生来不讨喜
生来不讨喜 2020-11-30 06:08

I have a small paint program that I am working on. I am using SetPixel on a bitmap to do that drawing of lines. When the brush size gets large, like 25 pixels across there i

5条回答
  •  误落风尘
    2020-11-30 06:48

    You're calling GetBitmap within your nested for loop. It looks like that's not necessary, you should GetBitmap outside the for loops as the reference isn't going to change.

    Also look at @fantasticfix answer, Lockbits nearly always sorts slow performance issues with getting/setting pixels

提交回复
热议问题