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

前端 未结 5 467
生来不讨喜
生来不讨喜 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:49

    Just an idea: Fill an offscreen bitmap with your Brush pixels. You only need to regenerate this bitmap when the brush, size or color is changed. And then just draw this bitmap onto your existing bitmap, where the mouse is located. If you can modulate a bitmap with a color, you could set the pixels in grayscale and modulate it with the current brush color.

提交回复
热议问题