c语言32位bmp存储,TFT LCD数据存储为BMP文件的C语言代码

#ifdef RGB565_FILE

const char BmpHeaderRGB565[RGB565_FILE_HEADER_SIZE]={

//file header

0x42,0x4D,     //0x00~0x01,type"BM"

0x48,0xFC,0x03,0x00, //0x02~0x05,file size:16bit:480x2(RGB565)x272+0x36+2(result need Divisible by 4)

0x00,0x00,0x00,0x00, //0x06~0x09,reserved 0x00

0x46,0x00,0x00,0x00, //0x0A~0x0D,bmp data offset

0x38,0x00,0x00,0x00, //0x0E~0x11,bmp header size

0xE0,0x01,0x00,0x00, //0x12~0x15,width:480

0x10,0x01,0x00,0x00, //0x16~0x19,height:272

0x01,0x00,      //0x1A~0x1B,planes:always"1"

//information header

0x10,0x00,   //0x1C~0x1D,bits per pixel:16bits;

0x03,0x00,0x00,0x00, //0x1E~0x21,compression:no

0x02,0xFC,0x03,0x00, //0x22~0x25,bmp data size:480*2(R5G6B5)*272+2(result need Divisible by 4)

0x00,0x00,0x00,0x00, //0x26~0x29,HResolution

0x00,0x00,0x00,0x00, //0x2A~0x2D,VResolution

0x00,0x00,0x00,0x00, //0x2E~0x31,colors

0x00,0x00,0x00,0x00, //0x32~0x35,important

//Palettte: RGB565

///*

0x00,0xF8,0x00,  //0x36~0x38,Blue mask:& 0xF800)>>8

0x00,0xE0,0x07,  //0x39~0x3B,Green mask:& 0x07E0)>>3

0x00,0x00,0x1F,  //0x3C~0x3E,Red mask:& 0x001F)<<3;

0x00,0x00,0x00,  //0x3F~0x41,Alpha

0x00,0x00,0x00,0x00,  //0x42~0x45,reserved

//*/

};

#else //RGB555 bmp file

const char BmpHeader[FILE_HEADER_SIZE]={

//file header

0x42,0x4D,     //0x00~0x01,type"BM"

0x38,0xFC,0x03,0x00, //0x02~0x05,file size:16bit:480x2(RGB565)x272+0x36+2(result need Divisible by 4)

0x00,0x00,0x00,0x00, //0x06~0x09,reserved 0x00

0x36,0x00,0x00,0x00, //0x0A~0x0D,bmp data offset

0x28,0x00,0x00,0x00, //0x0E~0x11,bmp header size

0xE0,0x01,0x00,0x00, //0x12~0x15,width:480

0x10,0x01,0x00,0x00, //0x16~0x19,height:272

0x01,0x00,      //0x1A~0x1B,planes:always"1"

//information header

0x10,0x00,   //0x1C~0x1D,bits per pixel:16bits;

0x00,0x00,0x00,0x00, //0x1E~0x21,compression:no

0x02,0xFC,0x03,0x00, //0x22~0x25,bmp data size:480*2(R5G6B5)*272+2(result need Divisible by 4)

0x00,0x00,0x00,0x00, //0x26~0x29,HResolution

0x00,0x00,0x00,0x00, //0x2A~0x2D,VResolution

0x00,0x00,0x00,0x00, //0x2E~0x31,colors

0x00,0x00,0x00,0x00, //0x32~0x35,important

//Palettte: RGB555 :no

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值