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

◆ toScreenMap()

ScreenMap fl::XYMap::toScreenMap ( ) const

Definition at line 12 of file xymap.cpp.hpp.

12 {
13 const u16 length = width * height;
14 ScreenMap out(length);
15 for (u16 w = 0; w < width; w++) {
16 for (u16 h = 0; h < height; h++) {
17 u16 index = mapToIndex(w, h);
18 vec2f p = {static_cast<float>(w), static_cast<float>(h)};
19 out.set(index, p);
20 }
21 }
22 // Store a shared_ptr to this XYMap so it can be used for encoding
23 out.setSourceXYMap(fl::make_shared<XYMap>(*this));
24 return out;
25}
u16 mapToIndex(const u16 &x, const u16 &y) const FL_NOEXCEPT
u16 width
Definition xymap.h:128
u16 height
Definition xymap.h:129
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
vec2< float > vec2f
Definition geometry.h:333
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414

References height, length(), fl::make_shared(), mapToIndex(), fl::ScreenMap::set(), fl::ScreenMap::setSourceXYMap(), and width.

Referenced by operator=().

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