views:

25

answers:

2

GdipBitmapLockBits works on pBitmaps, requires locking ?
CreatDIBSection gives you a DIBsection, doesn't require locking ?

which method is better for working with raw pixel data ?
Here are two implementations for finding the difference between two images using each method.

+1  A: 

These pieces, by themselves, aren't enough different to care much about. Mostly it comes down to a question of whether the rest of your code is using GDI or GDI+. If you're using GDI+, you might as well use gdipBitmapLockBits. If the rest of your drawing code just uses GDI, then you might as well use CreateDIBSection.

Jerry Coffin
+1  A: 

I won't expect any difference. The "lock" is just there to avoid the access violation you'd get when you close the memory mapped file and use the pointer to the bitmap data afterward.

The real cost is going to be in the code you run that whacks the bitmap bits.

Hans Passant