MCPcopy Create free account
hub / github.com/FastLED/FastLED / draw

Method draw

src/fl/fx/fx2d_to_1d.cpp.hpp:21–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21void Fx2dTo1d::draw(DrawContext context) {
22 // Step 1: Render 2D effect to internal grid
23 DrawContext grid_context(context.now, fl::span<CRGB>(mGrid.get(), mFx2d->getNumLeds()));
24 mFx2d->draw(grid_context);
25
26 // Step 2: Sample from grid to 1D output using fl::sample
27 const XYMap &xyMap = mFx2d->getXYMap();
28 SampleMode mode = static_cast<SampleMode>(mInterpolationMode);
29
30 for (u16 i = 0; i < mNumLeds; i++) {
31 vec2f pos = mScreenMap[i];
32 context.leds[i] = fl::sample(mGrid.get(), xyMap, pos.x, pos.y, mode);
33 }
34}
35
36fl::string Fx2dTo1d::fxName() const {
37 return fl::string("Fx2dTo1d(") + mFx2d->fxName() + ")";

Callers

nothing calls this directly

Calls 4

sampleFunction · 0.85
getNumLedsMethod · 0.80
getXYMapMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected