MCPcopy Create free account
hub / github.com/FastLED/FastLED / PaintBrightSurprise

Method PaintBrightSurprise

examples/LuminescentGrand/shared/Painter.cpp:409–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409void Painter::PaintBrightSurprise(
410 const KeyboardState& keyboard,
411 const int* led_column_table, int led_column_table_length,
412 LedRopeInterface* led_rope) {
413
414 led_rope->RawBeginDraw();
415 int total_counted = 0;
416
417 float r, g, b;
418 r = g = b = 0;
419
420 for (int i = 0; i < KeyboardState::kNumKeys; ++i) {
421 const Key& key = keyboard.mKeys[i];
422
423
424 if (key.mCurrColor.v_ > 0.0f) {
425 const Color3i rgb = key.mCurrColor.ToRGB();
426 r += rgb.r_;
427 g += rgb.g_;
428 b += rgb.b_;
429 ++total_counted;
430 }
431 }
432
433 float denom = total_counted ? total_counted : 1;
434 r /= denom;
435 g /= denom;
436 b /= denom;
437
438
439 const Color3i rgb(r, g, b);
440
441 for (int i = 0; i < led_column_table_length; ++i) {
442 const int n = led_column_table[i];
443 for (int i = 0; i < n; ++i) {
444 led_rope->RawDrawPixel(rgb);
445 }
446 }
447 led_rope->RawCommitDraw();
448}
449
450void Painter::PaintVuSpaceInvaders(uint32_t /*now_ms*/,
451 const KeyboardState& keyboard,

Callers

nothing calls this directly

Calls 4

RawBeginDrawMethod · 0.80
RawDrawPixelMethod · 0.80
RawCommitDrawMethod · 0.80
ToRGBMethod · 0.45

Tested by

no test coverage detected