26#ifndef FASTLED_RASTER_SPARSE_INLINED_COUNT
27#define FASTLED_RASTER_SPARSE_INLINED_COUNT 128
91 const rect<u16> *optional_bounds =
nullptr);
102 if (val !=
nullptr) {
117 bool min_x_set =
false;
119 bool min_y_set =
false;
121 bool max_x_set =
false;
123 bool max_y_set =
false;
126 if (!min_x_set || pt.
x < min_x) {
130 if (!min_y_set || pt.
y < min_y) {
134 if (!max_x_set || pt.
x > max_x) {
138 if (!max_y_set || pt.
y > max_y) {
143 return rect<u16>(min_x, min_y, max_x + 1, max_y + 1);
158 template <
typename XYVisitor>
162 if (!
xymap.has(pt.x, pt.y)) {
165 u32 index =
xymap(pt.x, pt.y);
166 u8 value = it.second;
168 visitor.draw(pt, index, value);
179 u8 **cached =
mCache.find_value(pt);
282 if (val !=
nullptr) {
297 bool min_x_set =
false;
299 bool min_y_set =
false;
301 bool max_x_set =
false;
303 bool max_y_set =
false;
306 if (!min_x_set || pt.
x < min_x) {
310 if (!min_y_set || pt.
y < min_y) {
314 if (!max_x_set || pt.
x > max_x) {
318 if (!max_y_set || pt.
y > max_y) {
323 return rect<u16>(min_x, min_y, max_x + 1, max_y + 1);
335 template <
typename XYVisitor>
339 if (!
xymap.has(pt.x, pt.y)) {
342 u32 index =
xymap(pt.x, pt.y);
343 const CRGB &color = it.second;
345 if (color.r != 0 || color.g != 0 || color.b != 0) {
346 visitor.draw(pt, index, color);
XYMap xymap(WIDTH, HEIGHT, SERPENTINE)
fl::HashMap< vec2< u16 >, CRGB >::const_iterator const_iterator
fl::HashMap< vec2< u16 >, CRGB >::iterator iterator
void write(const vec2< u16 > &pt, const CRGB &color)
rect< u16 > bounds_pixels() const
static const int kMaxCacheSize
const_iterator begin() const
fl::rect< u16 > mAbsoluteBounds
HashMap< vec2< u16 >, CRGB *, FastHashKey, EqualToKey, kMaxCacheSize > mCache
XYRasterSparse_CRGB(XYRasterSparse_CRGB &&)=default
XYRasterSparse_CRGB & clear()
pair< bool, CRGB > at(u16 x, u16 y) const
void draw(const XYMap &xymap, CRGB *out)
XYRasterSparse_CRGB & operator=(XYRasterSparse_CRGB &)=default
void draw(const XYMap &xymap, XYVisitor &visitor)
XYRasterSparse_CRGB(u16 width, u16 height)
void rasterize(const vec2< u16 > &pt, const CRGB &color)
XYRasterSparse_CRGB & reset()
FastHash< Key > FastHashKey
void setSize(u16 width, u16 height)
XYRasterSparse_CRGB(const XYRasterSparse_CRGB &)=default
XYRasterSparse_CRGB()=default
XYRasterSparse_CRGB & operator=(XYRasterSparse_CRGB &&)=default
rect< u16 > bounds() const
EqualTo< Key > EqualToKey
const_iterator end() const
fl::HashMap< Key, Value, HashKey, EqualToKey, FASTLED_HASHMAP_INLINED_COUNT > HashMapLarge
void setBounds(const rect< u16 > &bounds)
XYRasterU8Sparse(const XYRasterU8Sparse &)=default
void rasterize(const vec2< u16 > &pt, u8 value)
fl::HashMap< Key, Value, HashKey, EqualToKey, FASTLED_HASHMAP_INLINED_COUNT > HashMapLarge
XYRasterU8Sparse & operator=(const XYRasterU8Sparse &)=default
void setBounds(const rect< u16 > &bounds)
void draw(const XYMap &xymap, XYVisitor &visitor)
XYRasterU8Sparse & clear()
XYRasterU8Sparse(int width, int height)
pair< bool, u8 > at(u16 x, u16 y) const
XYRasterU8Sparse()=default
fl::HashMap< vec2< u16 >, u8 >::const_iterator const_iterator
void rasterize(const Tile2x2_u8 &tile)
const_iterator begin() const
static const int kMaxCacheSize
XYRasterU8Sparse(XYRasterU8Sparse &&)=default
fl::rect< u16 > mAbsoluteBounds
rect< u16 > bounds() const
EqualTo< Key > EqualToKey
fl::HashMap< vec2< u16 >, u8 >::iterator iterator
rect< u16 > bounds_pixels() const
const_iterator end() const
FastHash< Key > FastHashKey
void setSize(u16 width, u16 height)
XYRasterU8Sparse & reset()
void draw(const CRGB &color, const XYMap &xymap, CRGB *out)
void drawGradient(const Gradient &gradient, const XYMap &xymap, CRGB *out)
XYRasterU8Sparse & operator=(XYRasterU8Sparse &&)=default
HashMap< vec2< u16 >, u8 *, FastHashKey, EqualToKey, kMaxCacheSize > mCache
void rasterize_internal(const Tile2x2_u8 &tile, const rect< u16 > *optional_bounds=nullptr)
void write(const vec2< u16 > &pt, u8 value)
#define FASTLED_HASHMAP_INLINED_COUNT
#define FASTLED_NAMESPACE_END
#define FASTLED_NAMESPACE_BEGIN
Implements the FastLED namespace macros.
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Representation of an RGB pixel (Red, Green, Blue)