这是我的位图信息标头的文件结构
// the info header to store reveleant bitmap data
struct InfoHeader
{
unsigned int biSize; // the bit size
unsigned int width;
unsigned int height;
unsigned short biPlanes; // number planes
unsigned short biBitCount; // number of bits for each pixel
unsigned int biCompression; // compression used
unsigned int size; // size of image
unsigned int biXPelsPerMeter; // unit of measurement for x
unsigned int biYPelsPerMeter; // unit of measurement for y
unsigned int biClrUsed; // number of colours
unsigned int biClrImportant;
};
我相信它符合http://en.wikipedia.org/wiki/BMP_file_format上表示的结构
但是当我尝试通过设置图像的大小时
bitmapInfoHeader.size = (width*height*3);
宽度和高度都是无符号整数,大小总是设置为 0。我已经玩了很多年了,请帮忙?
编辑:宽度和高度都通过参数传递给方法(writeBitmapFile)并且都被初始化(我已经测试过了)
谢谢。