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

◆ mapToIndex() [1/2]

uint16_t fl::XYMap::mapToIndex ( const uint16_t & x,
const uint16_t & y ) const

Definition at line 97 of file xymap.cpp.

97 {
98 uint16_t index;
99 switch (type) {
100 case kSerpentine: {
101 uint16_t xx = x % width;
102 uint16_t yy = y % height;
103 index = xy_serpentine(xx, yy, width, height);
104 break;
105 }
106 case kLineByLine: {
107 uint16_t xx = x % width;
108 uint16_t yy = y % height;
109 index = xy_line_by_line(xx, yy, width, height);
110 break;
111 }
112 case kFunction:
113 index = xyFunction(x, y, width, height);
114 break;
115 case kLookUpTable:
116 index = mLookUpTable->getData()[y * width + x];
117 break;
118 default:
119 return 0;
120 }
121 return index + mOffset;
122}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:82
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:83
XYFunction xyFunction
Definition xymap.h:123
uint16_t mOffset
Definition xymap.h:125
uint16_t width
Definition xymap.h:121
@ kSerpentine
Definition xymap.h:45
@ kFunction
Definition xymap.h:45
@ kLineByLine
Definition xymap.h:45
@ kLookUpTable
Definition xymap.h:45
uint16_t height
Definition xymap.h:122
fl::LUT16Ptr mLookUpTable
Definition xymap.h:124
XyMapType type
Definition xymap.h:120
FASTLED_FORCE_INLINE uint16_t xy_serpentine(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Definition xymap.h:17
FASTLED_FORCE_INLINE uint16_t xy_line_by_line(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Definition xymap.h:27

References height, kFunction, kLineByLine, kLookUpTable, kSerpentine, mLookUpTable, mOffset, type, width, x, fl::xy_line_by_line(), fl::xy_serpentine(), xyFunction, and y.

Referenced by convertToLookUpTable(), fl::downscaleArbitrary(), fl::downscaleHalf(), mapPixels(), mapToIndex(), operator()(), and toScreenMap().

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