qt RGB 转RGB565 生成提供单片机LCD显示


void convertRgbToRgb565(int red, int green, int blue)
{
  uint16_t rgb565;
  QColor color(red, green, blue);
  uint16_t r = color.red() >> 3;
  uint16_t g = color.green() >> 2;
  uint16_t b = color.blue() >> 3;
  rgb565 = (r << 11) | (g << 5) | b;
  printf("%s%s%s","0x",qPrintable(QString("%1").arg(rgb565,4,16,QLatin1Char('0')).toUpper()),",");//不足8位补0;
fflush (stdout);
}
posted @   zhaocundang  阅读(166)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· .NET Core 中如何实现缓存的预热?
· 三行代码完成国际化适配,妙~啊~
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
点击右上角即可分享
微信分享提示