|

楼主 |
发表于 2010-5-23 12:25:00
|
显示全部楼层
Re:求助,,,24位位图载入错误.....
//bit 24-bit
if (bitmap->bitmapinfoheader.biBitCount==24 && screen_bpp==32)
{
int image_width = bitmap->bitmapinfoheader.biWidth,
image_height = bitmap->bitmapinfoheader.biHeight;
UINT *Src = (UINT*)ddsd.lpSurface;
UCHAR *buffer = bitmap->buffer;
int mempitch = ddsd.lPitch>>2;
for (int index_y=0;index_y<image_height;index_y++)
{
for (int index_x=0;index_x<image_width;index_x++)
{
//load the RGB data
UCHAR blue = buffer[index_y*image_width*3 + index_x*3 + 0],
green = buffer[index_y*image_width*3 + index_x*3 + 1],
red = buffer[index_y*image_width*3 + index_x*3 + 2];
//format the RGB data for screen
UINT color = _RGB32BIT8888(0,red,green,blue);
Src[index_x+index_y*mempitch] = color;
}//end for index_x
}//end for index_y
}//end if 24-bit screen_bpp=32
hRet = lpdds->Unlock(NULL);
//return success
return hRet; |
|