FastLED 3.10.8
Loading...
Searching...
No Matches
fx2d.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stl/stdint.h"
4
5#include "fl/stl/shared_ptr.h" // For FASTLED_SHARED_PTR macros
6#include "fl/math/xymap.h"
7#include "fl/fx/fx.h"
8#include "fl/stl/noexcept.h"
9
10namespace fl {
11
13
14// Abstract base class for 2D effects that use a grid, which is defined
15// by an XYMap.
16class Fx2d : public Fx {
17 public:
18 // XYMap holds either a function or a look up table to map x, y coordinates
19 // to a 1D index.
20 Fx2d(const XYMap &xyMap) FL_NO_EXCEPT : Fx(xyMap.getTotal()), mXyMap(xyMap) {}
21 u16 xyMap(u16 x, u16 y) const FL_NO_EXCEPT {
22 return mXyMap.mapToIndex(x, y);
23 }
24 u16 getHeight() const FL_NO_EXCEPT { return mXyMap.getHeight(); }
25 u16 getWidth() const FL_NO_EXCEPT { return mXyMap.getWidth(); }
28 const XYMap &getXYMap() const FL_NO_EXCEPT { return mXyMap; }
29
30 protected:
32};
33
34} // namespace fl
XYMap & getXYMap() FL_NO_EXCEPT
Definition fx2d.h:27
const XYMap & getXYMap() const FL_NO_EXCEPT
Definition fx2d.h:28
void setXYMap(const XYMap &xyMap) FL_NO_EXCEPT
Definition fx2d.h:26
XYMap mXyMap
Definition fx2d.h:31
u16 xyMap(u16 x, u16 y) const FL_NO_EXCEPT
Definition fx2d.h:21
u16 getWidth() const FL_NO_EXCEPT
Definition fx2d.h:25
Fx2d(const XYMap &xyMap) FL_NO_EXCEPT
Definition fx2d.h:20
u16 getHeight() const FL_NO_EXCEPT
Definition fx2d.h:24
Fx(u16 numLeds) FL_NO_EXCEPT
Definition fx.h:23
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
Base definition for an LED controller.
#define FASTLED_SHARED_PTR(type)
Definition shared_ptr.h:577