首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

bmp存储时的一个有关问题

2012-01-19 
bmp存储时的一个问题bitmapInfoHeader.biSize sizeof(BITMAPINFOHEADER)bitmapInfoHeader.biWidth st

bmp存储时的一个问题
bitmapInfoHeader.biSize = sizeof(BITMAPINFOHEADER); 
bitmapInfoHeader.biWidth = strBitmap.bmWidth; 
bitmapInfoHeader.biHeight = strBitmap.bmHeight; 
bitmapInfoHeader.biPlanes = 1; 
bitmapInfoHeader.biBitCount = wBitCount; 
bitmapInfoHeader.biClrImportant = BI_RGB; 
bitmapInfoHeader.biSizeImage = 0; //strBitmap.bmWidth * strBitmap.bmHeight; 
bitmapInfoHeader.biXPelsPerMeter = 0; 
bitmapInfoHeader.biYPelsPerMeter = 0; 
bitmapInfoHeader.biClrUsed = 0; 
bitmapInfoHeader.biClrImportant = 0; 

之前为什么必须用
memset(&bitmapInfoHeader, 0, sizeof(BITMAPINFOHEADER));
把结构清空, 我不是已经给每项赋值了吗?

[解决办法]
该项没赋值 biCompression

typedef struct tagBITMAPINFOHEADER{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression; // 这个没有
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER, FAR *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER;

热点排行