Aquí está mi intento (GDI + fea y mezcla GDI ...)Gdiplus :: ¿Mapa de bits a matriz BYTE?
// ...
BYTE pixels[BMP_WIDTH * BMP_HEIGHT * BMP_BPP];
HBITMAP hBitmap;
Gdiplus::Bitmap cBitmap(BMP_WIDTH, BMP_HEIGHT, PixelFormat32bppRGB);
Gdiplus::Graphics cGraphics(&cBitmap);
Gdiplus::Pen cPen(Gdiplus::Color(255, 255, 0, 0));
cGraphics.DrawRectangle(&cPen, 0, 0, cBitmap.GetWidth() - 1, cBitmap.GetHeight() - 1);
// and here it get's real ugly, I'd like to change that...
cBitmap.GetHBITMAP(Gdiplus::Color(255, 255, 255), &hBitmap);
GetBitmapBits(hBitmap, sizeof(pixels), pixels);
// ...
Alguien me dijo que usara LockBits pero realmente no entendía cómo. Lo intenté, pero fallé, así que no voy a publicar ese intento también.
Este es un caso fácil, se debe prestar atención que 'stride% 4 == 0' en el caso general (no todos los 3 componentes RGB funcionan). – malat