This is a good example on how to lock and read/write the bits of a bitmap in C#:
Work with bitmaps faster in C#[
^]. Note that 24/32 bit bitmaps contain the pixel data in BGR format. I would questions the "faster" part of the title of the article depending on your goals. This can come handy for example if you are implementing some image processing algorithms.
Differences between BGR and ARGB:
The old winapi and GDI stuff stores dibsection data in BGR format in memory, this is basically the same as the format used in bitmap files. palettized (8 or less bit) bmp files have a palette consisting of an array of
RGBQUAD[
^] structures and the pixels are just 1, 4, or 8 bit indices to this array. When you have a 32 bit bitmap then you don't have a palette but every pixel has the same format as the RGBQUAD structure. The difference between BGRA and ARGB is that they store the red, green, blue and alpha components in different bitranges of the integer.