I have a question about the Bitmap class. If you want to set a lot of pixels on the bitmap, then you can use the SetPixel method, but it’s very slow. There is a lot of documentation on how you can speed it up with the LockBits methodes etc, so i’ve created a method: SetFastPixelto speed it up a bit.
However, and I’m really confused by it: Why doesn’t microsoft change the implementation of SetPixel() to an implementation that’s faster? In other words, is there and advantage for using SetPixel instead of the LockBits method?
Cases where
SetFastPixelprobably doesn’t work:SetPixelhandles the RGB to palette index mapping)LockBits)SetPixelis designed to handle all of the above, at the expense of being slow. If you’re willing to sacrifice some of the above points, or if you’re happy to handle them in your application, then you have the ability to draw images viaLockBits.