开发者

Creating a Color object for each pixel while using Bitmap.LockBits faster than BitMap.GetPixel?

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.Ge开发者_运维问答tPixel as compared to the LockBits method?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜