|
-
February 26th, 2004, 09:45 PM
#1
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.
-
February 26th, 2004, 11:32 PM
#2
Hi,
I think the GetDIBits may work. Below is a link to MSDN for GetDIBits.
GetDIBits
TDM
Last edited by TDM; February 26th, 2004 at 11:39 PM.
-
February 27th, 2004, 04:08 AM
#3
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?
Thks a lot!!!!!
-
February 27th, 2004, 06:33 AM
#4
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.
Good luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|