|
这段代码为什么把位图在内存缩放后只能2色显示?
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);
}
|
|