33typedef uint16_t (*XYFunction)(uint16_t x, uint16_t y, uint16_t width,
40 enum XyMapType { kSerpentine = 0, kLineByLine, kFunction, kLookUpTable };
42 static XYMap constructWithUserFunction(uint16_t width, uint16_t height,
43 XYFunction xyFunction,
46 static XYMap constructRectangularGrid(uint16_t width, uint16_t height,
49 static XYMap constructWithLookUpTable(uint16_t width, uint16_t height,
50 const uint16_t *lookUpTable,
55 XYMap(uint16_t width, uint16_t height,
bool is_serpentine =
true,
59 XYMap &operator=(
const XYMap &other) =
default;
63 void mapPixels(
const CRGB *input,
CRGB *output)
const;
65 void convertToLookUpTable();
67 void setRectangularGrid();
69 uint16_t operator()(uint16_t x, uint16_t y)
const {
70 return mapToIndex(x, y);
73 uint16_t mapToIndex(uint16_t x, uint16_t y)
const;
74 uint16_t mapToIndex(
int x,
int y)
const {
76 else if (uint16_t(x) >= width) { x = width - 1; }
78 else if (uint16_t(y) >= height) { y = height - 1; }
79 return mapToIndex((uint16_t)x, (uint16_t)y);
82 uint16_t getWidth()
const;
83 uint16_t getHeight()
const;
84 uint16_t getTotal()
const;
85 XyMapType getType()
const;
88 XYMap(uint16_t width, uint16_t height, XyMapType type);
93 XYFunction xyFunction =
nullptr;
94 fl::LUT16Ptr mLookUpTable;