Reputation: 5394
Is creating a Color
object for each pixel while using Bitmap.LockBits
still faster than using Bitmap.GetPixel
for each pixel?
Or maybe creating that Color
is the main overhead of Bitmap.GetPixel
as compared to the LockBits
method?
Upvotes: 0
Views: 277
Reputation: 941455
Color is a struct, not an object. Overhead is negligible.
GetPixel() is so expensive because it has to lock and unlock the bitmap for each individual pixel. With LockBits() you can do it only once for the entire bitmap.
Upvotes: 3