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

◆ drawXY()

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

Definition at line 46 of file frame.cpp.

46 {
47 const uint16_t width = xyMap.getWidth();
48 const uint16_t height = xyMap.getHeight();
49 uint32_t count = 0;
50 for (uint16_t h = 0; h < height; ++h) {
51 for (uint16_t w = 0; w < width; ++w) {
52 uint32_t in_idx = xyMap(w, h);
53 uint32_t out_idx = count++;
54 if (in_idx >= mPixelsCount) {
55 FASTLED_WARN("Frame::drawXY: in index out of range: " << in_idx);
56 continue;
57 }
58 if (out_idx >= mPixelsCount) {
59 FASTLED_WARN("Frame::drawXY: out index out of range: " << out_idx);
60 continue;
61 }
62 switch (draw_mode) {
64 leds[out_idx] = mRgb[in_idx];
65 break;
66 }
68 leds[out_idx] = CRGB::blendAlphaMaxChannel(mRgb[in_idx], leds[in_idx]);
69 break;
70 }
71 }
72 }
73 }
74}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
XYMap xyMap(HEIGHT, WIDTH, SERPENTINE)
fl::scoped_array< CRGB > mRgb
Definition frame.h:43
const size_t mPixelsCount
Definition frame.h:42
uint16_t getWidth() const
Definition xymap.cpp:121
uint16_t getHeight() const
Definition xymap.cpp:123
@ DRAW_MODE_BLEND_BY_BLACK
Definition frame.h:19
@ DRAW_MODE_OVERWRITE
Definition frame.h:18
static CRGB blendAlphaMaxChannel(const CRGB &upper, const CRGB &lower)
Definition crgb.cpp:58
#define FASTLED_WARN
Definition warn.h:7

References CRGB::blendAlphaMaxChannel(), fl::DRAW_MODE_BLEND_BY_BLACK, fl::DRAW_MODE_OVERWRITE, FASTLED_WARN, leds, mPixelsCount, mRgb, and xyMap.

+ Here is the call graph for this function: