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.
我有 HBITMAP hBitmap。我使用 GetBitmapBits(hbitmap, width * height, buffer);
缓冲区中写入的像素格式是什么?
谢谢。
您想改用 GetDIBits。
看看 MSDN 是怎么说的: GetDIBits
总是询问 MSDN(如果使用 Visual Studio)
可以不同,这取决于位图。这是一个查找代码:
BITMAP bmp; if( 0 == GetObject( hbitmap, sizeof( BITMAP ), &bmp ) ) // handle error
从那个 BITMAP 结构中,您可以找到像素格式和其他有关内存布局的重要信息。例如,以下是所需缓冲区大小的公式:bmp.bmWidthBytes * bmp.bmHeight
bmp.bmWidthBytes * bmp.bmHeight