bmp图片格式

总共54字节

/**
 * bmp文件信息
 */
#pragma pack(1)
    typedef struct
    {
        char type[2];             // 文件类型
        unsigned int size;        // 文件大小
        unsigned short reserved1; // 保留, 必须为零
        unsigned short reserved2; // 保留, 必须为零
        unsigned int offset;      // 从头到位图数据的偏移
    } FileInfo;
#pragma pack()

/**
 * 位图信息
 */
#pragma pack(1)
    typedef struct
    {
        unsigned int size;        // 本结构体所占用字节数, 即40个字节
        int width;                // 位图的宽度, 以像素为单位, 像素数量是4字节对齐的
        int height;               // 位图的高度, 以像素为单位
        unsigned short planes;    // 目标设备的级别, 必须为1
        unsigned short count;     // 每个像素所需的位数, 必须是 1(双色), 4(16色), 8(256色)或24(真彩色) 之一
        unsigned int compression; // 位图压缩类型, 必须是 0(不压缩), 1(BI_RLE8压缩类型)或2(BI_RLE4压缩类型) 之一
        unsigned int sizeimage;   // 位图的大小, 以字节为单位
        unsigned int xmeter;      // 位图水平分辨率, 每米像素数
        unsigned int ymeter;      // 位图垂直分辨率, 每米像素数
        unsigned int cused;       // 位图实际使用的颜色表中的颜色数
        unsigned int cimportant;  // 位图显示过程中重要的颜色数
    } BitMapInfo;
#pragma pack()
posted @ 2023-03-11 11:30  thomas_blog  阅读(21)  评论(0编辑  收藏  举报