RGB888和RGB565屏幕显示效果区别

很想测试一下RGB888和RGB565屏幕的显示区别

用image2lcd把图片转换一下, 屏幕分辨率为800x480

1 以下是对比: 左边RGB888 右边RGB565

 

 

 

 

 

 

 

 

 

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
以下是显示 RGB888 图片的完整代码: ```c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <linux/fb.h> int main(int argc, char *argv[]) { int fbfd = ; struct fb_var_screeninfo vinfo; struct fb_fix_screeninfo finfo; long int screensize = ; char *fbp = ; int x = , y = ; long int location = ; // 打开 framebuffer 设备文件 fbfd = open("/dev/fb", O_RDWR); if (fbfd == -1) { perror("Error: cannot open framebuffer device"); exit(1); } // 获取可变屏幕信息 if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) { perror("Error: cannot get variable screen info"); exit(1); } // 获取固定屏幕信息 if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1) { perror("Error: cannot get fixed screen info"); exit(1); } // 计算屏幕大小(以字节为单位) screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; // 映射 framebuffer 到内存 fbp = (char *) mmap(, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, ); if ((int) fbp == -1) { perror("Error: failed to mmap framebuffer"); exit(1); } // 绘制 RGB888 图片 for (y = ; y < vinfo.yres; y++) { for (x = ; x < vinfo.xres; x++) { location = (x + vinfo.xoffset) * (vinfo.bits_per_pixel / 8) + (y + vinfo.yoffset) * finfo.line_length; *(fbp + location) = xFF; // 蓝色 *(fbp + location + 1) = x00; // 绿色 *(fbp + location + 2) = x00; // 红色 *(fbp + location + 3) = x00; // Alpha 通道 } } // 解除内存映射 munmap(fbp, screensize); // 关闭 framebuffer 设备文件 close(fbfd); return ; } ``` 希望能对你有所帮助!
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值