-
Help in bitmap
Hi,
I am aware that bitmap object consists of 4 parts: BITMAPFILEHEADER, BITMAPINFOHEADER, color platette and the pixel data. Can anyone tell me how to extraxt only the pixel data from bitmap object and put it inside a char array or byte array?
Hope someone could help me. Thank you.
-
Hi,
I think the GetDIBits may work. Below is a link to MSDN for GetDIBits.
GetDIBits
TDM
-
Hi,
I am also interested in finding out about extracting pixel data from bitmap object..but have little knowledge of Visual C++. Is there any sample code on using the GetDIBits to refer to?
Btw, i've make some research and found out that LockBits method might also work in extracting pixel data from bitmap object. Is it true? :confused:
Thks a lot!!!!!
-
I think you're talking about GetBitmapBits function.
Example:
BITMAP bitmap = { 0 };
::GetObject(hBitmap, sizeof(BITMAP), &bitmap);
int nSize = ((((bitmap.bmWidth * bitmap.bmBitsPixel) + 31) & ~31) >> 3) * bitmap.bmHeight;
void* pBuffer = malloc(nSize);
memset(pBuffer, 0, nSize);
::GetBitmapBits(hBitmap, nSize, pBuffer);
I'll be glad to find something like this for WinCE.