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

Function draw

examples/FestivalStick/curr.h:526–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526void draw(float pos) {
527 if (splatRendering) {
528 fl::Tile2x2_u8_wrap pos_tile = corkscrew.at_wrap(pos);
529 //FL_WARN("pos_tile: " << pos_tile);
530 fl::CRGB color = fl::CRGB::Blue;
531 // Apply color boost using ease functions
532 fl::EaseType sat_ease = getEaseType(saturationFunction.value());
533 fl::EaseType lum_ease = getEaseType(luminanceFunction.value());
534 color = color.colorBoost(sat_ease, lum_ease);
535 // Draw each pixel in the 2x2 tile using the new wrapping API
536 for (int dx = 0; dx < 2; ++dx) {
537 for (int dy = 0; dy < 2; ++dy) {
538 fl::Tile2x2_u8_wrap::Entry data = pos_tile.at(dx, dy);
539 fl::vec2<fl::u16> wrapped_pos = data.first; // Already wrapped position
540 uint8_t alpha = data.second; // Alpha value
541
542 if (alpha > 0) { // Only draw if there's some alpha
543 fl::CRGB c = color;
544 c.nscale8(alpha); // Scale the color by the alpha value
545 frameBufferPtr->at(wrapped_pos.x, wrapped_pos.y) = c;
546 }
547 }
548 }
549 } else {
550 // None splat rendering, looks aweful.
551 fl::vec2f pos_vec2f = corkscrew.at_no_wrap(pos);
552 fl::vec2<fl::u16> pos_i16 = fl::vec2<fl::u16>(pos_vec2f.x, pos_vec2f.y);
553
554 fl::CRGB color = fl::CRGB::Blue;
555 // Apply color boost using ease functions
556 fl::EaseType sat_ease = getEaseType(saturationFunction.value());
557 fl::EaseType lum_ease = getEaseType(luminanceFunction.value());
558 color = color.colorBoost(sat_ease, lum_ease);
559
560 // Now map the cork screw position to the cylindrical buffer that we
561 // will draw.
562 frameBufferPtr->at(pos_i16.x, pos_i16.y) = color; // Draw a blue pixel at (w, h)
563 }
564}
565
566fl::CRGBPalette16 getFirePalette() {
567 int paletteIndex = (int)firePalette.value();

Callers 6

drawMethod · 0.85
drawGradientMethod · 0.85
drawMethod · 0.85
drawMethod · 0.85
drawMethod · 0.85
loopFunction · 0.85

Calls 6

at_wrapMethod · 0.80
at_no_wrapMethod · 0.80
getEaseTypeFunction · 0.70
valueMethod · 0.45
colorBoostMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected