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

◆ mapToIndex() [1/2]

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

Definition at line 95 of file xymap.cpp.

95 {
96 u16 index;
97 switch (type) {
98 case kSerpentine: {
99 u16 xx = x % width;
100 u16 yy = y % height;
101 index = xy_serpentine(xx, yy, width, height);
102 break;
103 }
104 case kLineByLine: {
105 u16 xx = x % width;
106 u16 yy = y % height;
107 index = xy_line_by_line(xx, yy, width, height);
108 break;
109 }
110 case kFunction:
111 index = xyFunction(x, y, width, height);
112 break;
113 case kLookUpTable:
114 index = mLookUpTable->getData()[y * width + x];
115 break;
116 default:
117 return 0;
118 }
119 return index + mOffset;
120}
int y
Definition simple.h:93
int x
Definition simple.h:92
XYFunction xyFunction
Definition xymap.h:129
u16 mOffset
Definition xymap.h:131
u16 width
Definition xymap.h:127
@ kSerpentine
Definition xymap.h:47
@ kFunction
Definition xymap.h:47
@ kLineByLine
Definition xymap.h:47
@ kLookUpTable
Definition xymap.h:47
u16 height
Definition xymap.h:128
fl::LUT16Ptr mLookUpTable
Definition xymap.h:130
XyMapType type
Definition xymap.h:126
FASTLED_FORCE_INLINE u16 xy_line_by_line(u16 x, u16 y, u16 width, u16 height)
Definition xymap.h:29
FASTLED_FORCE_INLINE u16 xy_serpentine(u16 x, u16 y, u16 width, u16 height)
Definition xymap.h:19

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: