bmp_v1/test/struct.h

36 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef STRUCT_H
#define STRUCT_H
// 针对该结构体的字节对齐问题调整对齐策略
#pragma pack(push,1)
struct BMPFILEHEADER
{
unsigned short bfType;
unsigned int bfSize;
unsigned short bfReserved1;
unsigned short bfReserved2;
unsigned int bfOffBits;
};
#pragma pack(pop)
struct BITMAPINFOHEADER
{
unsigned long biSize; //本结构所占用字节数 40字节
long biWidth; //位图的宽度,以像素为单位
long biHeight; //位图的高度,以像素为单位
unsigned short biPlanes; //目标设备的级别必须为1
unsigned short biBitCount; //每个像素所需的位数必须是1双色
//416色、8256色或24真彩色之一
unsigned long biCompression; //位图压缩类型,必须是 0BI_RGB不压缩
//1BI_RLE8压缩类型
//2BI_RLE压缩类型之一
unsigned long biSizeImage; //位图的大小,以字节为单位
long biXPelsPerMeter; //位图水平分辨率,每米像素数
long biYPelsPerMeter; //位图垂直分辨率,每米像素数
unsigned long biClrUsed; //位图实际使用的颜色表中的颜色数
unsigned long biClrImportant; //位图显示过程中重要的颜色数
};
#endif