MCPcopy Create free account
hub / github.com/FastLED/FastLED / Tile2x2_u8_wrap

Class Tile2x2_u8_wrap

src/fl/gfx/tile2x2.h:97–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95};
96
97class Tile2x2_u8_wrap {
98 // This is a class that is like a Tile2x2_u8 but wraps around the edges.
99 // This is useful for cylinder mapping where the x-coordinate wraps around
100 // the width of the cylinder and the y-coordinate wraps around the height.
101 // This converts a tile2x2 to a wrapped x,y version.
102 public:
103 using Entry = fl::pair<vec2<u16>, u8>; // absolute position, alpha
104 using Data = Entry[2][2];
105
106 Tile2x2_u8_wrap() FL_NOEXCEPT;
107 Tile2x2_u8_wrap(const Tile2x2_u8 &from, u16 width);
108 Tile2x2_u8_wrap(const Tile2x2_u8 &from, u16 width, u16 height);
109
110 Tile2x2_u8_wrap(const Data& data);
111
112 // Returns the absolute position and the alpha.
113 Entry &at(u16 x, u16 y);
114 const Entry &at(u16 x, u16 y) const;
115
116 // Interpolates between two wrapped tiles and returns up to 2 interpolated tiles
117 static vector_fixed<Tile2x2_u8_wrap, 2> Interpolate(const Tile2x2_u8_wrap& a, const Tile2x2_u8_wrap& b, float t);
118
119 private:
120 Data mData = {};
121};
122
123} // namespace fl

Callers 1

calculateTileAtWrapMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected