|
Why does this code display the bitmap in memory only in 2 colors?
void StrectBMP (char * fileSrc, HDC ClientDc, double proportion)
{
BITMAP srcInfo;
HBITMAP HBmpSource = (HBITMAP) LoadImage (0, fileSrc, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE);
HDC hsrc = CreateCompatibleDC (NULL);
HGDIOBJ hold = SelectObject (hsrc, HBmpSource);
GetObject (HBmpSource, sizeof (BITMAP), (LPVOID)&srcInfo);
HDC hDest = CreateCompatibleDC (NULL);
int mode = SetStretchBltMode (hDest, COLORONCOLOR);
// SelectStockObject (hDest, BLACK_BRUSH);
HBITMAP hmemBmp = CreateCompatibleBitmap (hDest, srcInfo.bmWidth,
srcInfo.bmHeight);
HGDIOBJ holdsrc = SelectObject (hDest, hmemBmp);
BOOL b = StretchBlt (hDest, 0,0, srcInfo.bmWidth, srcInfo.bmHeight, hsrc, 0,0,
srcInfo.bmWidth, srcInfo.bmHeight, SRCCOPY);
b = BitBlt (ClientDc, 0,0, srcInfo.bmWidth, srcInfo.bmHeight, hDest, 0,0, SRCCOPY);
} |
|