New app: Spectrum Painter (#988)

* added spectrum painter app
This commit is contained in:
Bernd Herzog
2023-05-14 23:09:43 +02:00
committed by GitHub
parent a27881ecd6
commit b4da86d491
24 changed files with 1457 additions and 21 deletions

View File

@@ -57,6 +57,16 @@ struct Color {
)}
{
}
uint8_t to_greyscale() {
uint32_t r = ((v >> 11) & 31U) << 3;
uint32_t g = ((v >> 5) & 63U) << 2;
uint32_t b = (v & 31U) << 3;
uint32_t grey = (r * 299 + g * 587 + b * 114) / 1000;
return (uint8_t)grey;
}
Color operator-() const {
return (v ^ 0xffff);