Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为每个像素创建一个Color对象,同时使用Bitmap.LockBits仍然比Bitmap.GetPixel为每个像素使用更快吗?
Color
Bitmap.LockBits
Bitmap.GetPixel
或者,与方法相比,创建它Color是主要开销?Bitmap.GetPixelLockBits
LockBits
颜色是一个结构,而不是一个对象。开销可以忽略不计。
GetPixel() 非常昂贵,因为它必须为每个单独的像素锁定和解锁位图。使用 LockBits(),您只能对整个位图执行一次。