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

◆ drawXY()

void fl::Frame::drawXY ( fl::span< CRGB > leds,
const XYMap & xyMap,
DrawMode draw_mode = DrawMode::DRAW_MODE_OVERWRITE ) const

Definition at line 67 of file frame.cpp.hpp.

67 {
68 const u16 width = xyMap.getWidth();
69 const u16 height = xyMap.getHeight();
70 fl::u32 count = 0;
71 for (u16 h = 0; h < height; ++h) {
72 for (u16 w = 0; w < width; ++w) {
73 fl::u32 in_idx = xyMap(w, h);
74 fl::u32 out_idx = count++;
75 if (in_idx >= mPixelsCount) {
76 FL_WARN(
77 "Frame::drawXY: in index out of range: " << in_idx);
78 continue;
79 }
80 if (out_idx >= mPixelsCount) {
81 FL_WARN(
82 "Frame::drawXY: out index out of range: " << out_idx);
83 continue;
84 }
85 switch (draw_mode) {
86 case DrawMode::DRAW_MODE_BLEND: // gfx primitives only; treat as overwrite for Frame
88 leds[out_idx] = mRgb[in_idx];
89 break;
90 }
92 leds[out_idx] =
93 CRGB::blendAlphaMaxChannel(mRgb[in_idx], leds[in_idx]);
94 break;
95 }
96 }
97 }
98 }
99}
fl::XYMap xyMap
fl::CRGB leds[NUM_LEDS]
fl::vector_psram< CRGB > mRgb
Definition frame.h:65
const size_t mPixelsCount
Definition frame.h:64
u16 getWidth() const FL_NOEXCEPT
u16 getHeight() const FL_NOEXCEPT
#define FL_WARN(X)
Definition log.h:276
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186
@ DRAW_MODE_OVERWRITE
Definition draw_mode.h:5
@ DRAW_MODE_BLEND_BY_MAX_BRIGHTNESS
Definition draw_mode.h:5
@ DRAW_MODE_BLEND
Definition draw_mode.h:5
static CRGB blendAlphaMaxChannel(const CRGB &upper, const CRGB &lower) FL_NOEXCEPT
Definition crgb.cpp.hpp:59

References fl::CRGB::blendAlphaMaxChannel(), fl::DRAW_MODE_BLEND, fl::DRAW_MODE_BLEND_BY_MAX_BRIGHTNESS, fl::DRAW_MODE_OVERWRITE, FL_WARN, fl::height, leds, mPixelsCount, mRgb, fl::width, and xyMap.

+ Here is the call graph for this function: