paulzazzarino
11-21-2005, 01:42 PM
Well... I am trying to convert a color bitmap to Black and white, and figured I could do it with the following code, but both GetBitmapBits and GetDIBits are not supported in CE. Any recommendations or perhaps is this code in a DDK somewhere? If you have a potential workaround please advise!
Present attempt utilizing GetBitmapBits is the following:
dcMemImage1 = CreateCompatibleDC(NULL);
dcMemImage2 = CreateCompatibleDC(NULL);
memset(BWImage, 0, sizeof(BWImage));
hBitmapImage1 = CreateBitmap(h, w, 1, BitDepth, ClrImage);
SelectObject(dcMemImage1, hBitmapImage1);
hBitmapImage2 = CreateBitmap(h, w, 1, 1, BWImage);
SelectObject(dcMemImage2, hBitmapImage2);
rc = StretchBlt(dcMemImage2, 0, 0, h, w, dcMemImage1, 0, 0, h, w, SRCCOPY);
GetBitmapBits(hBitmapImage2, BWImage, *sz); // arguhh!
DeleteDC(dcMemImage1);
DeleteObject(hBitmapImage1);
DeleteDC(dcMemImage2);
DeleteObject(hBitmapImage2);
Present attempt utilizing GetBitmapBits is the following:
dcMemImage1 = CreateCompatibleDC(NULL);
dcMemImage2 = CreateCompatibleDC(NULL);
memset(BWImage, 0, sizeof(BWImage));
hBitmapImage1 = CreateBitmap(h, w, 1, BitDepth, ClrImage);
SelectObject(dcMemImage1, hBitmapImage1);
hBitmapImage2 = CreateBitmap(h, w, 1, 1, BWImage);
SelectObject(dcMemImage2, hBitmapImage2);
rc = StretchBlt(dcMemImage2, 0, 0, h, w, dcMemImage1, 0, 0, h, w, SRCCOPY);
GetBitmapBits(hBitmapImage2, BWImage, *sz); // arguhh!
DeleteDC(dcMemImage1);
DeleteObject(hBitmapImage1);
DeleteDC(dcMemImage2);
DeleteObject(hBitmapImage2);