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

◆ draw()

void draw ( float pos)
Examples
FxNoiseRing.ino.

Definition at line 526 of file curr.h.

526 {
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}
uint8_t pos
Definition Blur.ino:11
fl::UIDropdown saturationFunction("Saturation Function", easeOptions)
fl::UIDropdown luminanceFunction("Luminance Function", easeOptions)
Entry & at(u16 x, u16 y)
fl::pair< vec2< u16 >, u8 > Entry
Definition tile2x2.h:103
fl::EaseType getEaseType(fl::string value)
Definition curr.h:129
fl::shared_ptr< fl::Grid< fl::CRGB > > frameBufferPtr
Definition curr.h:279
fl::UICheckbox splatRendering("Splat Rendering", true)
fl::Corkscrew corkscrew(CORKSCREW_TURNS, NUM_LEDS)
vec2< float > vec2f
Definition geometry.h:333
EaseType
Definition ease.h:27
unsigned char uint8_t
Definition s16x16x4.h:209
CRGB colorBoost(EaseType saturation_function=EaseType::EASE_NONE, EaseType luminance_function=EaseType::EASE_NONE) const FL_NOEXCEPT
CRGB & nscale8(u8 scaledown) FL_NOEXCEPT
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
Definition crgb.cpp.hpp:88
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>
Definition crgb.h:512
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38
T1 first
Definition pair.h:16
T2 second
Definition pair.h:17
value_type y
Definition geometry.h:191
value_type x
Definition geometry.h:190

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

Referenced by fl::XYRasterSparse_RGB8::draw(), and loop().

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