显示的位图显示的时候,色深是8的情况下,只有3通道的情况下不需要LUT表,其他情况都需要LUT表
char __bif[sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256];
BITMAPINFO& bif = *(BITMAPINFO*)__bif;
bif.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bif.bmiHeader.biWidth = width;
bif.bmiHeader.biHeight = height;
bif.bmiHeader.biPlanes = 1;
bif.bmiHeader.biBitCount = 8;
bif.bmiHeader.biCompression = BI_RGB;
bif.bmiHeader.biSizeImage = 0;
bif.bmiHeader.biXPelsPerMeter = 1;
bif.bmiHeader.biYPelsPerMeter = 1;
bif.bmiHeader.biClrUsed = 0;
bif.bmiHeader.biClrImportant = 0;
for(int i = 0; i < 256; ++i)
{
int b = i;
bif.bmiColors[i].rgbBlue = b;
bif.bmiColors[i].rgbGreen = b;
bif.bmiColors[i].rgbRed = b;
bif.bmiColors[i].rgbReserved = 0;
}
SetStretchBltMode(hDC, COLORONCOLOR);
StretchDIBits(hDC, destRt.left, destRt.top, destRt.right - destRt.left, destRt.bottom - destRt.top,
0,0,width,height,pImage,(BITMAPINFO*)&bif, DIB_RGB_COLORS, SRCCOPY);