|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
在arm上显示bmp图片时,图片显示不够完整,不知道是像素点的坐标不对,还是在使用framebuferr时出了问题?
关键代码如下:
while(!feof(fp))
{
PIXEL pix;
unsigned short int tmp;
rc = fread( (char *)&pix, 1, sizeof(unsigned short int), fp );
if (rc != sizeof(unsigned short int) )
{ break; }
// location = line_x * bits_per_pixel / 8 + (ciHeight - line_y - 1) * xres * bits_per_pixel / 8;
// location = line_x * bits_per_pixel / 8 + (line_y ) * yres * bits_per_pixel / 8;
// location = line_x * bits_per_pixel / 8 + (line_y ) * yres* bits_per_pixel / 8;
location = line_x * xres* bits_per_pixel / 8 + (line_y ) * bits_per_pixel / 8;
tmp=pix.red<<11 | pix.green<<6 | pix.blue;
*((unsigned short int*)(fbp + location)) = tmp;
/*
line_y++;
if (line_y == ciHeight )
{
line_y = 0;
line_x++;
if(line_x==ciWidth)
{
break;
}
}
*/
line_x++;
if (line_x == ciWidth)
{
line_x = 0;
line_y++;
if(line_y== ciHeight )
{
break;
}
}
}
其中fbp为framebuffer的指针 |
|