FastLED 3.10.8
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("Frame::drawXY: in index out of range: " << in_idx);
77 continue;
78 }
79 if (out_idx >= mPixelsCount) {
80 FL_WARN("Frame::drawXY: out index out of range: " << out_idx);
81 continue;
82 }
83 switch (draw_mode) {
84 case DrawMode::DRAW_MODE_BLEND: // gfx primitives only; treat as overwrite for Frame
86 leds[out_idx] = mRgb[in_idx];
87 break;
88 }
90 leds[out_idx] =
91 CRGB::blendAlphaMaxChannel(mRgb[in_idx], leds[in_idx]);
92 break;
93 }
94 }
95 }
96 }
97}
CRGB leds[1]
fl::XYMap xyMap
fl::vector_psram< CRGB > mRgb
Definition frame.h:65
const size_t mPixelsCount
Definition frame.h:64
u16 getHeight() const FL_NO_EXCEPT
u16 getWidth() const FL_NO_EXCEPT
#define FL_WARN(...)
Definition log.h:437
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_NO_EXCEPT
Definition crgb.cpp.hpp:60

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

+ Here is the call graph for this function: