金牌会员
 
- 积分
- 1887
- 金钱
- 1887
- 注册时间
- 2012-10-28
- 在线时间
- 353 小时
|
5金钱
本帖最后由 hpdell 于 2015-5-2 21:55 编辑
bmp 的 1bit, 4bit, 8bit, 16bit 显示都正常,唯独这个24bit 与 32bit 显示不正常,
大侠们帮忙看看是怎么回事 ??
24、32 位转化为 16位的:#define BMP_GET_RGB_565_CONVERT(red, green, blue) (u16)( (u16)((red >> 3) << 11) | (u16)((green >> 2) << 5) | (u16)(blue >> 3) )
320x480 32bit 源图片
320x480 32bit 单片机显示的图片
32bit 读取函数
for (i = 1; i <= bh.height; i++)
{
f_read(&fsrc, (u8 *)&bmp_buffer[0], line_byte, &counter);
for (j = 0; j < bh.width; j++)
{
__IO u8 r=0,g=0,b=0;
ILI9486_SetCursor((x + j), ((y + bh.height) - i)); //解决图片显示上下反的问题
r = bmp_buffer[j * 4];
g = bmp_buffer[(j * 4) + 1];
b = bmp_buffer[(j * 4) + 2];
LCD_RAM = (u16)( (u16)((r >> 3) << 11) | (u16)((g >> 2) << 5) | (u16)(b >> 3) );
}
}
320x480 24bit 源图片
320x480 24bit 单片机显示的图片
24bit 读取函数
for (i = 1; i <= bh.height; i++)
{
res = f_read(&fsrc, (u8 *)bmp_buffer, line_byte, &counter); //读取24位的*.bmp的颜色数据格式: BGR,切记
for (j = 0; j < bh.width; j++)
{
__IO u8 r=0,g=0,b=0;
ILI9486_SetCursor((x + j), ((y + bh.height) - i)); //解决图片显示上下反的问题
r = bmp_buffer[j * 3];
g = bmp_buffer[(j * 3) + 1];
b = bmp_buffer[(j * 3) + 2];
LCD_RAM = (u16)( (u16)((r >> 3) << 11) | (u16)((g >> 2) << 5) | (u16)(b >> 3) );
}
}
|
|
|