FastLED 3.10.8
Loading...
Searching...
No Matches
pixelset.h
Go to the documentation of this file.
1#pragma once
2
3
5#include "fl/gfx/colorutils.h"
6#include "fl/math/math.h"
7
8#include "fl/gfx/fill.h"
9#include "fl/gfx/blur.h"
10
11#include "fl/system/fastled.h"
12#include "fl/stl/span.h"
13#include "fl/stl/noexcept.h"
14
15#define FUNCTION_FILL_RAINBOW(a,b,c,d) fl::fill_rainbow(a,b,c,d)
16#define FUNCTION_NAPPLY_GAMMA(a,b,c) fl::napplyGamma_video(a,b,c)
17#define FUNCTION_NAPPLY_GAMMA_RGB(a,b,c,d,e) fl::napplyGamma_video(a,b,c,d,e)
18#define FUNCTION_BLUR1D(a,b,c) fl::blur1d(a,b,c)
19#define FUNCTION_FILL_GRADIENT(a,b,c,d,e) fl::fill_gradient(a,b,c,d,e)
20#define FUNCTION_FILL_GRADIENT3(a,b,c,d,e,f) fl::fill_gradient(a,b,c,d,e,f)
21#define FUNCTION_FILL_GRADIENT4(a,b,c,d,e,f,g) fl::fill_gradient(a,b,c,d,e,f,g)
22#define FUNCTION_NBLEND(a,b,c) fl::nblend(a,b,c)
23#define FUNCTION_FILL_GRADIENT_RGB(a,b,c,d) fl::fill_gradient_RGB(a,b,c,d)
24#define FUNCTION_FILL_GRADIENT_RGB3(a,b,c,d,e) fl::fill_gradient_RGB(a,b,c,d,e)
25#define FUNCTION_FILL_GRADIENT_RGB4(a,b,c,d,e,f) fl::fill_gradient_RGB(a,b,c,d,e,f)
26
27
28template<class PIXEL_TYPE>
29class CPixelView;
30
53
56CRGB *operator+(const CRGBSet & pixels, int offset) FL_NO_EXCEPT;
57
58
61
62
66
102template<class PIXEL_TYPE>
104public:
105 const fl::i8 dir;
106 const int len;
108 PIXEL_TYPE * const leds;
109 PIXEL_TYPE * const end_pos;
110
111public:
113 inline CPixelView(const CPixelView & other) FL_NO_EXCEPT : dir(other.dir), len(other.len), leds(other.leds), end_pos(other.end_pos) {}
114
119 inline CPixelView(PIXEL_TYPE *_leds, int _len) FL_NO_EXCEPT : dir(_len < 0 ? -1 : 1), len(_len), leds(_leds), end_pos(_leds + _len) {}
120
126 inline CPixelView(PIXEL_TYPE *_leds, int _start, int _end) FL_NO_EXCEPT : dir(((_end-_start)<0) ? -1 : 1), len((_end - _start) + dir), leds(_leds + _start), end_pos(_leds + _start + len) {}
127
130 int size() const FL_NO_EXCEPT { return fl::abs(len); }
131
134 bool reversed() FL_NO_EXCEPT { return len < 0; }
135
137 bool operator==(const CPixelView & rhs) const FL_NO_EXCEPT { return leds == rhs.leds && len == rhs.len && dir == rhs.dir; }
138
140 bool operator!=(const CPixelView & rhs) const FL_NO_EXCEPT { return leds != rhs.leds || len != rhs.len || dir != rhs.dir; }
141
143 inline PIXEL_TYPE & operator[](int x) const FL_NO_EXCEPT { if(dir & 0x80) { return leds[-x]; } else { return leds[x]; } }
144
150 inline CPixelView operator()(int start, int end) FL_NO_EXCEPT { if(dir & 0x80) { return CPixelView(leds+len+1, -len-start-1, -len-end-1); } else { return CPixelView(leds, start, end); } }
151
152 // Access an inclusive subset of the LEDs in this set, starting from the first.
153 // @param end the last element for the new subset
154 // @todo Not sure i want this? inline CPixelView operator()(int end) { return CPixelView(leds, 0, end); }
155
158
160 inline operator PIXEL_TYPE* () const FL_NO_EXCEPT { return leds; }
161
164 inline CPixelView & operator=(const PIXEL_TYPE & color) FL_NO_EXCEPT {
165 for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) = color; }
166 return *this;
167 }
168
171 void dump() const FL_NO_EXCEPT {
178 }
179
184 for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) {
185 (*pixel) = (*rhspixel);
186 }
187 return *this;
188 }
189
192
194 inline CPixelView & addToRGB(fl::u8 inc) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) += inc; } return *this; }
196 inline CPixelView & operator+=(CPixelView & rhs) FL_NO_EXCEPT { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) += (*rhspixel); } return *this; }
197
199 inline CPixelView & subFromRGB(fl::u8 inc) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) -= inc; } return *this; }
201 inline CPixelView & operator-=(CPixelView & rhs) FL_NO_EXCEPT { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) -= (*rhspixel); } return *this; }
202
204 inline CPixelView & operator++() FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
206 inline CPixelView & operator++(int DUMMY_ARG) FL_NO_EXCEPT {
207 FASTLED_UNUSED(DUMMY_ARG);
208 for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) {
209 (*pixel)++;
210 }
211 return *this;
212 }
213
215 inline CPixelView & operator--() FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
217 inline CPixelView & operator--(int DUMMY_ARG) FL_NO_EXCEPT {
218 FASTLED_UNUSED(DUMMY_ARG);
219 for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) {
220 (*pixel)--;
221 }
222 return *this;
223 }
224
226 inline CPixelView & operator/=(fl::u8 d) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) /= d; } return *this; }
228 inline CPixelView & operator>>=(fl::u8 d) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) >>= d; } return *this; }
230 inline CPixelView & operator*=(fl::u8 d) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) *= d; } return *this; }
231
233 inline CPixelView & nscale8_video(fl::u8 scaledown) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this;}
235 inline CPixelView & operator%=(fl::u8 scaledown) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this; }
237 inline CPixelView & fadeLightBy(fl::u8 fadefactor) FL_NO_EXCEPT { return nscale8_video(255 - fadefactor); }
238
240 inline CPixelView & nscale8(fl::u8 scaledown) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
242 inline CPixelView & nscale8(PIXEL_TYPE & scaledown) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
244 inline CPixelView & nscale8(CPixelView & rhs) FL_NO_EXCEPT { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel).nscale8((*rhspixel)); } return *this; }
245
247 inline CPixelView & fadeToBlackBy(fl::u8 fade) FL_NO_EXCEPT { return nscale8(255 - fade); }
248
252 inline CPixelView & operator|=(const PIXEL_TYPE & rhs) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= rhs; } return *this; }
255 inline CPixelView & operator|=(const CPixelView & rhs) FL_NO_EXCEPT { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) |= (*rhspixel); } return *this; }
258 inline CPixelView & operator|=(fl::u8 d) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= d; } return *this; }
259
263 inline CPixelView & operator&=(const PIXEL_TYPE & rhs) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= rhs; } return *this; }
266 inline CPixelView & operator&=(const CPixelView & rhs) FL_NO_EXCEPT { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) &= (*rhspixel); } return *this; }
269 inline CPixelView & operator&=(fl::u8 d) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= d; } return *this; }
270
272
273
275 inline operator bool() FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { if((*pixel)) return true; } return false; }
276
277
280
283 inline CPixelView & fill_solid(const PIXEL_TYPE & color) FL_NO_EXCEPT { *this = color; return *this; }
285 inline CPixelView & fill_solid(const CHSV & color) FL_NO_EXCEPT { *this = color; return *this; }
286
291 inline CPixelView & fill_rainbow(fl::u8 initialhue, fl::u8 deltahue=5) FL_NO_EXCEPT {
292 if(dir >= 0) {
293 FUNCTION_FILL_RAINBOW(leds,len,initialhue,deltahue);
294 } else {
295 FUNCTION_FILL_RAINBOW(leds + len + 1, -len, initialhue - deltahue * (len+1), -deltahue);
296 }
297 return *this;
298 }
299
305 inline CPixelView & fill_gradient(const CHSV & startcolor, const CHSV & endcolor, TGradientDirectionCode directionCode = fl::SHORTEST_HUES) FL_NO_EXCEPT {
306 if(dir >= 0) {
307 FUNCTION_FILL_GRADIENT(leds,len,startcolor, endcolor, directionCode);
308 } else {
309 FUNCTION_FILL_GRADIENT(leds + len + 1, (-len), endcolor, startcolor, directionCode);
310 }
311 return *this;
312 }
313
320 inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, TGradientDirectionCode directionCode = fl::SHORTEST_HUES) FL_NO_EXCEPT {
321 if(dir >= 0) {
322 FUNCTION_FILL_GRADIENT3(leds, len, c1, c2, c3, directionCode);
323 } else {
324 FUNCTION_FILL_GRADIENT3(leds + len + 1, -len, c3, c2, c1, directionCode);
325 }
326 return *this;
327 }
328
336 inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, const CHSV & c4, TGradientDirectionCode directionCode = fl::SHORTEST_HUES) FL_NO_EXCEPT {
337 if(dir >= 0) {
338 FUNCTION_FILL_GRADIENT4(leds, len, c1, c2, c3, c4, directionCode);
339 } else {
340 FUNCTION_FILL_GRADIENT4(leds + len + 1, -len, c4, c3, c2, c1, directionCode);
341 }
342 return *this;
343 }
344
350 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & startcolor, const PIXEL_TYPE & endcolor, TGradientDirectionCode directionCode = fl::SHORTEST_HUES) FL_NO_EXCEPT {
351 FASTLED_UNUSED(directionCode); // TODO: why is this not used?
352 if(dir >= 0) {
353 FUNCTION_FILL_GRADIENT_RGB(leds,len,startcolor, endcolor);
354 } else {
355 FUNCTION_FILL_GRADIENT_RGB(leds + len + 1, (-len), endcolor, startcolor);
356 }
357 return *this;
358 }
359
365 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3) FL_NO_EXCEPT {
366 if(dir >= 0) {
368 } else {
369 FUNCTION_FILL_GRADIENT_RGB3(leds + len + 1, -len, c3, c2, c1);
370 }
371 return *this;
372 }
373
380 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3, const PIXEL_TYPE & c4) FL_NO_EXCEPT {
381 if(dir >= 0) {
382 FUNCTION_FILL_GRADIENT_RGB4(leds, len, c1, c2, c3, c4);
383 } else {
384 FUNCTION_FILL_GRADIENT_RGB4(leds + len + 1, -len, c4, c3, c2, c1);
385 }
386 return *this;
387 }
388
393 inline CPixelView & nblend(const PIXEL_TYPE & overlay, fract8 amountOfOverlay) FL_NO_EXCEPT { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { FUNCTION_NBLEND((*pixel), overlay, amountOfOverlay); } return *this; }
394
399 inline CPixelView & nblend(const CPixelView & rhs, fract8 amountOfOverlay) FL_NO_EXCEPT { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { FUNCTION_NBLEND((*pixel), (*rhspixel), amountOfOverlay); } return *this; }
400
405 inline CPixelView & blur1d(fract8 blur_amount) FL_NO_EXCEPT {
406 if(dir >= 0) {
407 FUNCTION_BLUR1D(leds, len, blur_amount);
408 } else {
409 FUNCTION_BLUR1D(leds + len + 1, -len, blur_amount);
410 }
411 return *this;
412 }
413
418 if(dir >= 0) {
420 } else {
421 FUNCTION_NAPPLY_GAMMA(leds + len + 1, -len, gamma);
422 }
423 return *this;
424 }
425
431 inline CPixelView & napplyGamma_video(float gammaR, float gammaG, float gammaB) FL_NO_EXCEPT {
432 if(dir >= 0) {
433 FUNCTION_NAPPLY_GAMMA_RGB(leds, len, gammaR, gammaG, gammaB);
434 } else {
435 FUNCTION_NAPPLY_GAMMA_RGB(leds + len + 1, -len, gammaR, gammaG, gammaB);
436 }
437 return *this;
438 }
439
441
442
445
449 template <class T>
451 T * leds;
452 const fl::i8 dir;
453
454 public:
457
462 FASTLED_FORCE_INLINE pixelset_iterator_base(T * _leds, const char _dir) FL_NO_EXCEPT : leds(_leds), dir(_dir) {}
463
466
467 // `const &`, not `&`: taking a mutable lvalue reference meant these
468 // could not bind a temporary, so the idiomatic
469 // `for (it = s.begin(); it != s.end(); ++it)` failed to compile
470 // against the rvalue returned by end(). Every loop in this file works
471 // around that by hoisting `end()` into a named variable first. #822.
472 FASTLED_FORCE_INLINE bool operator==(const pixelset_iterator_base & other) const FL_NO_EXCEPT { return leds == other.leds; /* && set==other.set; */ }
473 FASTLED_FORCE_INLINE bool operator!=(const pixelset_iterator_base & other) const FL_NO_EXCEPT { return leds != other.leds; /* || set != other.set; */ }
474
475 FASTLED_FORCE_INLINE PIXEL_TYPE& operator*() const FL_NO_EXCEPT { return *leds; }
476 };
477
478 typedef pixelset_iterator_base<PIXEL_TYPE> iterator;
479 typedef pixelset_iterator_base<const PIXEL_TYPE> const_iterator;
480
483
486
489
491};
492
494CRGB *operator+(const CRGBSet & pixels, int offset) FL_NO_EXCEPT {
495 return (CRGB*)pixels + offset;
496}
497
498
501template<int SIZE>
502class CRGBArray : public CPixelView<CRGB> {
503 CRGB rawleds[SIZE] = {0};
504
505public:
507 using CPixelView::operator=;
508 CRGB* get() FL_NO_EXCEPT { return &rawleds[0]; }
509 const CRGB* get() const FL_NO_EXCEPT { return &rawleds[0]; }
510 size_t size() const FL_NO_EXCEPT { return SIZE; }
511 operator fl::span<CRGB>() FL_NO_EXCEPT { return fl::span<CRGB>(rawleds, SIZE); }
513};
514
516
517
518
519#undef FUNCTION_FILL_RAINBOW
520#undef FUNCTION_NAPPLY_GAMMA
521#undef FUNCTION_NAPPLY_GAMMA_RGB
522#undef FUNCTION_BLUR1D
523#undef FUNCTION_FILL_GRADIENT
524#undef FUNCTION_FILL_GRADIENT3
525#undef FUNCTION_FILL_GRADIENT4
526#undef FUNCTION_NBLEND
527#undef FUNCTION_FILL_GRADIENT_RGB
528#undef FUNCTION_FILL_GRADIENT_RGB3
529#undef FUNCTION_FILL_GRADIENT_RGB4
int x
Definition simple.h:92
FASTLED_FORCE_INLINE pixelset_iterator_base operator++(int) FL_NO_EXCEPT
Increment LED pointer in data direction.
Definition pixelset.h:465
FASTLED_FORCE_INLINE PIXEL_TYPE & operator*() const FL_NO_EXCEPT
Dereference operator, to get underlying pointer to the LEDs.
Definition pixelset.h:475
FASTLED_FORCE_INLINE pixelset_iterator_base(T *_leds, const char _dir) FL_NO_EXCEPT
Base constructor.
Definition pixelset.h:462
FASTLED_FORCE_INLINE pixelset_iterator_base & operator++() FL_NO_EXCEPT
Increment LED pointer in data direction.
Definition pixelset.h:464
FASTLED_FORCE_INLINE pixelset_iterator_base(const pixelset_iterator_base &rhs) FL_NO_EXCEPT
Copy constructor.
Definition pixelset.h:456
FASTLED_FORCE_INLINE bool operator!=(const pixelset_iterator_base &other) const FL_NO_EXCEPT
Check if iterator is not at the same position.
Definition pixelset.h:473
FASTLED_FORCE_INLINE bool operator==(const pixelset_iterator_base &other) const FL_NO_EXCEPT
Check if iterator is at the same position.
Definition pixelset.h:472
CPixelView(const CPixelView &other) FL_NO_EXCEPT
PixelSet copy constructor.
Definition pixelset.h:113
CPixelView & operator&=(const PIXEL_TYPE &rhs) FL_NO_EXCEPT
Apply the PIXEL_TYPE &= operator to every pixel in this set with the given PIXEL_TYPE value.
Definition pixelset.h:263
CPixelView & nblend(const CPixelView &rhs, fract8 amountOfOverlay) FL_NO_EXCEPT
Destructively blend another set of LEDs into this one.
Definition pixelset.h:399
iterator end() FL_NO_EXCEPT
Definition pixelset.h:482
bool operator!=(const CPixelView &rhs) const FL_NO_EXCEPT
Do these sets point to different things? Note that this is different from the contents of the set bei...
Definition pixelset.h:140
CPixelView & blur1d(fract8 blur_amount) FL_NO_EXCEPT
One-dimensional blur filter.
Definition pixelset.h:405
iterator end() const FL_NO_EXCEPT
Makes an iterator instance for the end of the LED set, const qualified.
Definition pixelset.h:485
CPixelView & operator=(const PIXEL_TYPE &color) FL_NO_EXCEPT
Assign the passed in color to all elements in this set.
Definition pixelset.h:164
CPixelView & operator++(int DUMMY_ARG) FL_NO_EXCEPT
Increment every pixel value in this set.
Definition pixelset.h:206
CPixelView operator-() FL_NO_EXCEPT
Return the reverse ordering of this set.
Definition pixelset.h:157
CPixelView & fill_gradient(const CHSV &startcolor, const CHSV &endcolor, TGradientDirectionCode directionCode=fl::SHORTEST_HUES) FL_NO_EXCEPT
Fill all of the LEDs with a smooth HSV gradient between two HSV colors.
Definition pixelset.h:305
CPixelView & fill_gradient_RGB(const PIXEL_TYPE &c1, const PIXEL_TYPE &c2, const PIXEL_TYPE &c3, const PIXEL_TYPE &c4) FL_NO_EXCEPT
Fill all of the LEDs with a smooth RGB gradient between four RGB colors.
Definition pixelset.h:380
CRGB *const leds
Definition pixelset.h:108
PIXEL_TYPE & operator[](int x) const FL_NO_EXCEPT
Access a single element in this set, just like an array operator.
Definition pixelset.h:143
CPixelView & operator|=(const PIXEL_TYPE &rhs) FL_NO_EXCEPT
Apply the PIXEL_TYPE |= operator to every pixel in this set with the given PIXEL_TYPE value.
Definition pixelset.h:252
CPixelView & addToRGB(fl::u8 inc) FL_NO_EXCEPT
Add the passed in value to all channels for all of the pixels in this set.
Definition pixelset.h:194
int size() const FL_NO_EXCEPT
Get the size of this set.
Definition pixelset.h:130
CPixelView & nscale8(fl::u8 scaledown) FL_NO_EXCEPT
Scale every LED by the given scale.
Definition pixelset.h:240
const_iterator cend() const FL_NO_EXCEPT
Makes a const iterator instance for the end of the LED set, const qualified.
Definition pixelset.h:488
CPixelView & fadeToBlackBy(fl::u8 fade) FL_NO_EXCEPT
Fade every LED down by the given scale.
Definition pixelset.h:247
CPixelView & operator|=(fl::u8 d) FL_NO_EXCEPT
Apply the PIXEL_TYPE |= operator to every pixel in this set.
Definition pixelset.h:258
bool operator==(const CPixelView &rhs) const FL_NO_EXCEPT
Do these sets point to the same thing? Note that this is different from the contents of the set being...
Definition pixelset.h:137
bool reversed() FL_NO_EXCEPT
Whether or not this set goes backwards.
Definition pixelset.h:134
CPixelView & nscale8(PIXEL_TYPE &scaledown) FL_NO_EXCEPT
Scale every LED by the given scale.
Definition pixelset.h:242
CPixelView & operator=(const CPixelView &rhs) FL_NO_EXCEPT
Copy the contents of the passed-in set to our set.
Definition pixelset.h:183
CPixelView & operator%=(fl::u8 scaledown) FL_NO_EXCEPT
Scale down every LED by the given scale.
Definition pixelset.h:235
CPixelView & fadeLightBy(fl::u8 fadefactor) FL_NO_EXCEPT
Fade every LED down by the given scale.
Definition pixelset.h:237
CPixelView & nblend(const PIXEL_TYPE &overlay, fract8 amountOfOverlay) FL_NO_EXCEPT
Destructively modifies all LEDs, blending in a given fraction of an overlay color.
Definition pixelset.h:393
CPixelView & napplyGamma_video(float gammaR, float gammaG, float gammaB) FL_NO_EXCEPT
Destructively applies a gamma adjustment to all LEDs.
Definition pixelset.h:431
CPixelView & operator--(int DUMMY_ARG) FL_NO_EXCEPT
Decrement every pixel value in this set.
Definition pixelset.h:217
CPixelView & subFromRGB(fl::u8 inc) FL_NO_EXCEPT
Subtract the passed in value from all channels for all of the pixels in this set.
Definition pixelset.h:199
CPixelView & operator-=(CPixelView &rhs) FL_NO_EXCEPT
Subtract every pixel in the other set from this set.
Definition pixelset.h:201
iterator begin() FL_NO_EXCEPT
Makes an iterator instance for the start of the LED set.
Definition pixelset.h:481
CPixelView(PIXEL_TYPE *_leds, int _len) FL_NO_EXCEPT
PixelSet constructor for a pixel set starting at the given PIXEL_TYPE* and going for _len leds.
Definition pixelset.h:119
CPixelView & operator/=(fl::u8 d) FL_NO_EXCEPT
Divide every LED by the given value.
Definition pixelset.h:226
CPixelView & nscale8(CPixelView &rhs) FL_NO_EXCEPT
Scale every LED in this set by every led in the other set.
Definition pixelset.h:244
pixelset_iterator_base< CRGB > iterator
Definition pixelset.h:478
void dump() const FL_NO_EXCEPT
Print debug data to serial, disabled for release.
Definition pixelset.h:171
CPixelView & fill_solid(const CHSV &color) FL_NO_EXCEPT
Fill all of the LEDs with a solid color.
Definition pixelset.h:285
CPixelView & fill_gradient(const CHSV &c1, const CHSV &c2, const CHSV &c3, TGradientDirectionCode directionCode=fl::SHORTEST_HUES) FL_NO_EXCEPT
Fill all of the LEDs with a smooth HSV gradient between three HSV colors.
Definition pixelset.h:320
CPixelView & fill_gradient_RGB(const PIXEL_TYPE &startcolor, const PIXEL_TYPE &endcolor, TGradientDirectionCode directionCode=fl::SHORTEST_HUES) FL_NO_EXCEPT
Fill all of the LEDs with a smooth RGB gradient between two RGB colors.
Definition pixelset.h:350
const_iterator cbegin() const FL_NO_EXCEPT
Makes a const iterator instance for the start of the LED set, const qualified.
Definition pixelset.h:487
iterator begin() const FL_NO_EXCEPT
Makes an iterator instance for the start of the LED set, const qualified.
Definition pixelset.h:484
CRGB *const end_pos
Definition pixelset.h:109
CPixelView & operator++() FL_NO_EXCEPT
Increment every pixel value in this set.
Definition pixelset.h:204
CPixelView & nscale8_video(fl::u8 scaledown) FL_NO_EXCEPT
Scale every LED by the given scale.
Definition pixelset.h:233
CPixelView & operator>>=(fl::u8 d) FL_NO_EXCEPT
Shift every LED in this set right by the given number of bits.
Definition pixelset.h:228
CPixelView & napplyGamma_video(float gamma) FL_NO_EXCEPT
Destructively applies a gamma adjustment to all LEDs.
Definition pixelset.h:417
pixelset_iterator_base< const CRGB > const_iterator
Definition pixelset.h:479
CPixelView & operator|=(const CPixelView &rhs) FL_NO_EXCEPT
Apply the PIXEL_TYPE |= operator to every pixel in this set with every pixel in the passed in set.
Definition pixelset.h:255
CPixelView operator()(int start, int end) FL_NO_EXCEPT
Access an inclusive subset of the LEDs in this set.
Definition pixelset.h:150
CPixelView & fill_gradient(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4, TGradientDirectionCode directionCode=fl::SHORTEST_HUES) FL_NO_EXCEPT
Fill all of the LEDs with a smooth HSV gradient between four HSV colors.
Definition pixelset.h:336
const fl::i8 dir
Definition pixelset.h:105
CPixelView & fill_gradient_RGB(const PIXEL_TYPE &c1, const PIXEL_TYPE &c2, const PIXEL_TYPE &c3) FL_NO_EXCEPT
Fill all of the LEDs with a smooth RGB gradient between three RGB colors.
Definition pixelset.h:365
CPixelView & operator+=(CPixelView &rhs) FL_NO_EXCEPT
Add every pixel in the other set to this set.
Definition pixelset.h:196
CPixelView & fill_solid(const PIXEL_TYPE &color) FL_NO_EXCEPT
Fill all of the LEDs with a solid color.
Definition pixelset.h:283
CPixelView & fill_rainbow(fl::u8 initialhue, fl::u8 deltahue=5) FL_NO_EXCEPT
Fill all of the LEDs with a rainbow of colors.
Definition pixelset.h:291
CPixelView & operator&=(fl::u8 d) FL_NO_EXCEPT
Apply the PIXEL_TYPE &= operator to every pixel in this set with the passed in value.
Definition pixelset.h:269
CPixelView & operator--() FL_NO_EXCEPT
Decrement every pixel value in this set.
Definition pixelset.h:215
CPixelView(PIXEL_TYPE *_leds, int _start, int _end) FL_NO_EXCEPT
PixelSet constructor for the given set of LEDs, with start and end boundaries.
Definition pixelset.h:126
CPixelView & operator&=(const CPixelView &rhs) FL_NO_EXCEPT
Apply the PIXEL_TYPE &= operator to every pixel in this set with every pixel in the passed in set.
Definition pixelset.h:266
CPixelView & operator*=(fl::u8 d) FL_NO_EXCEPT
Multiply every LED in this set by the given value.
Definition pixelset.h:230
Represents a view/window into a set of LED pixels, providing array-like access and rich color operati...
Definition pixelset.h:103
CRGB rawleds[SIZE]
the LED data
Definition pixelset.h:503
CRGB * get() FL_NO_EXCEPT
Definition pixelset.h:508
const CRGB * get() const FL_NO_EXCEPT
Definition pixelset.h:509
size_t size() const FL_NO_EXCEPT
Definition pixelset.h:510
CRGBArray() FL_NO_EXCEPT
Definition pixelset.h:506
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
Utility functions for color fill, palettes, blending, and more.
Internal FastLED header for implementation files.
fl::hsv8 CHSV
Definition chsv.h:11
fl::CRGB CRGB
Definition crgb.h:25
FASTLED_FORCE_INLINE CRGB * operator+(const CRGBSet &pixels, int offset) FL_NO_EXCEPT
Retrieve a pointer to a CRGB array, using a CRGBSet and an LED offset.
Definition pixelset.h:494
u8 fract8
Fixed-Point Fractional Types.
Definition s16x16x4.h:161
unsigned char u8
Definition stdint.h:131
TGradientDirectionCode
Hue direction for calculating fill gradients.
@ SHORTEST_HUES
Hue goes whichever way is shortest.
signed char i8
Definition stdint.h:130
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NO_EXCEPT
#define FUNCTION_NBLEND(a, b, c)
Definition pixelset.h:22
#define FUNCTION_FILL_GRADIENT3(a, b, c, d, e, f)
Definition pixelset.h:20
#define FUNCTION_FILL_GRADIENT_RGB3(a, b, c, d, e)
Definition pixelset.h:24
#define FUNCTION_FILL_GRADIENT4(a, b, c, d, e, f, g)
Definition pixelset.h:21
#define FUNCTION_FILL_GRADIENT(a, b, c, d, e)
Definition pixelset.h:19
#define FUNCTION_FILL_GRADIENT_RGB(a, b, c, d)
Definition pixelset.h:23
#define FUNCTION_FILL_GRADIENT_RGB4(a, b, c, d, e, f)
Definition pixelset.h:25
#define FUNCTION_BLUR1D(a, b, c)
Definition pixelset.h:18
#define FUNCTION_NAPPLY_GAMMA_RGB(a, b, c, d, e)
Definition pixelset.h:17
#define FUNCTION_NAPPLY_GAMMA(a, b, c)
Definition pixelset.h:16
CPixelView< CRGB > CRGBSet
CPixelView specialized for CRGB pixel arrays - the most commonly used pixel view type.
Definition pixelset.h:52
#define FUNCTION_FILL_RAINBOW(a, b, c, d)
Definition pixelset.h:15
#define FASTLED_FORCE_INLINE
#define FASTLED_UNUSED(x)
#define FL_NO_EXCEPT