FastLED 3.9.15
Loading...
Searching...
No Matches

◆ draw()

void draw ( float pos)

Definition at line 538 of file curr.h.

538 {
539 if (splatRendering) {
540 Tile2x2_u8_wrap pos_tile = corkscrew.at_wrap(pos);
541 //FL_WARN("pos_tile: " << pos_tile);
542 CRGB color = CRGB::Blue;
543 // Apply color boost using ease functions
544 EaseType sat_ease = getEaseType(saturationFunction.value());
545 EaseType lum_ease = getEaseType(luminanceFunction.value());
546 color = color.colorBoost(sat_ease, lum_ease);
547 // Draw each pixel in the 2x2 tile using the new wrapping API
548 for (int dx = 0; dx < 2; ++dx) {
549 for (int dy = 0; dy < 2; ++dy) {
550 Tile2x2_u8_wrap::Entry data = pos_tile.at(dx, dy);
551 vec2<u16> wrapped_pos = data.first; // Already wrapped position
552 uint8_t alpha = data.second; // Alpha value
553
554 if (alpha > 0) { // Only draw if there's some alpha
555 CRGB c = color;
556 c.nscale8(alpha); // Scale the color by the alpha value
557 frameBufferPtr->at(wrapped_pos.x, wrapped_pos.y) = c;
558 }
559 }
560 }
561 } else {
562 // None splat rendering, looks aweful.
563 vec2f pos_vec2f = corkscrew.at_no_wrap(pos);
564 vec2<u16> pos_i16 = vec2<u16>(pos_vec2f.x, pos_vec2f.y);
565
566 CRGB color = CRGB::Blue;
567 // Apply color boost using ease functions
568 EaseType sat_ease = getEaseType(saturationFunction.value());
569 EaseType lum_ease = getEaseType(luminanceFunction.value());
570 color = color.colorBoost(sat_ease, lum_ease);
571
572 // Now map the cork screw position to the cylindrical buffer that we
573 // will draw.
574 frameBufferPtr->at(pos_i16.x, pos_i16.y) = color; // Draw a blue pixel at (w, h)
575 }
576}
uint8_t pos
Definition Blur.ino:11
UIDropdown luminanceFunction("Luminance Function", easeOptions)
UIDropdown saturationFunction("Saturation Function", easeOptions)
Entry & at(u16 x, u16 y)
Definition tile2x2.cpp:65
fl::pair< vec2< u16 >, u8 > Entry
Definition tile2x2.h:108
fl::shared_ptr< Grid< CRGB > > frameBufferPtr
Definition curr.h:291
EaseType getEaseType(fl::string value)
Definition curr.h:142
Corkscrew corkscrew(CORKSCREW_TURNS, NUM_LEDS)
UICheckbox splatRendering("Splat Rendering", true)
vec2< float > vec2f
Definition geometry.h:333
EaseType
Definition ease.h:21
CRGB & nscale8(fl::u8 scaledown)
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
CRGB colorBoost(fl::EaseType saturation_function=fl::EASE_NONE, fl::EaseType luminance_function=fl::EASE_NONE) const
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>
Definition crgb.h:569
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86
T1 first
Definition pair.h:14
T2 second
Definition pair.h:15
value_type y
Definition geometry.h:191
value_type x
Definition geometry.h:190

References fl::Tile2x2_u8_wrap::at(), CRGB::Blue, CRGB::colorBoost(), corkscrew(), fl::pair< T1, T2 >::first, frameBufferPtr, getEaseType(), luminanceFunction(), CRGB::nscale8(), pos, saturationFunction(), fl::pair< T1, T2 >::second, splatRendering(), fl::vec2< T >::x, and fl::vec2< T >::y.

Referenced by fl::XYRasterSparse_CRGB::draw(), fl::FASTLED_SMART_PTR(), and loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: