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

◆ mapToIndex() [2/2]

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

Definition at line 96 of file xymap.cpp.

96 {
97 uint16_t index;
98 switch (type) {
99 case kSerpentine:
100 x = x % width;
101 y = y % height;
102 index = xy_serpentine(x, y, width, height);
103 break;
104 case kLineByLine:
105 index = xy_line_by_line(x, y, width, height);
106 break;
107 case kFunction:
108 x = x % width;
109 y = y % height;
110 index = xyFunction(x, y, width, height);
111 break;
112 case kLookUpTable:
113 index = mLookUpTable->getData()[y * width + x];
114 break;
115 default:
116 return 0;
117 }
118 return index + mOffset;
119}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
XYFunction xyFunction
Definition xymap.h:102
uint16_t mOffset
Definition xymap.h:104
uint16_t width
Definition xymap.h:100
@ kSerpentine
Definition xymap.h:40
@ kFunction
Definition xymap.h:40
@ kLineByLine
Definition xymap.h:40
@ kLookUpTable
Definition xymap.h:40
uint16_t height
Definition xymap.h:101
fl::LUT16Ptr mLookUpTable
Definition xymap.h:103
XyMapType type
Definition xymap.h:99
FASTLED_FORCE_INLINE uint16_t xy_serpentine(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Definition xymap.h:16
FASTLED_FORCE_INLINE uint16_t xy_line_by_line(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Definition xymap.h:26

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(), mapPixels(), mapToIndex(), operator()(), and toScreenMap().

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