- 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);
- }