| 222 | } |
| 223 | |
| 224 | uint32_t interpolateColor(uint32_t color1, uint32_t color2, float t) |
| 225 | { |
| 226 | if (t <= 0.0f) |
| 227 | return color1; |
| 228 | if (t >= 1.0f) |
| 229 | return color2; |
| 230 | |
| 231 | uint8_t r1 = (color1 >> 16) & 0xFF; // R-Komponente aus Farbe 1 |
| 232 | uint8_t g1 = (color1 >> 8) & 0xFF; // G-Komponente aus Farbe 1 |
| 233 | uint8_t b1 = color1 & 0xFF; // B-Komponente aus Farbe 1 |
| 234 | |
| 235 | uint8_t r2 = (color2 >> 16) & 0xFF; // R-Komponente aus Farbe 2 |
| 236 | uint8_t g2 = (color2 >> 8) & 0xFF; // G-Komponente aus Farbe 2 |
| 237 | uint8_t b2 = color2 & 0xFF; // B-Komponente aus Farbe 2 |
| 238 | |
| 239 | // Interpolation für jede Farbkomponente |
| 240 | uint8_t r_interp = r1 + (r2 - r1) * t; |
| 241 | uint8_t g_interp = g1 + (g2 - g1) * t; |
| 242 | uint8_t b_interp = b1 + (b2 - b1) * t; |
| 243 | |
| 244 | return (r_interp << 16) | (g_interp << 8) | b_interp; |
| 245 | } |
| 246 | |
| 247 | void DisplayManager_::GradientText(int16_t x, int16_t y, const char *text, int color1, int color2, bool clear, byte textCase) |
| 248 | { |