FastLED 3.9.7
Loading...
Searching...
No Matches
pixelset.h
Go to the documentation of this file.
1#pragma once
2
3#include "FastLED.h"
4#include "fl/force_inline.h"
5#include "fl/unused.h"
6
7#if FASTLED_IS_USING_NAMESPACE
8#define FUNCTION_FILL_RAINBOW(a,b,c,d) FASTLED_NAMESPACE::fill_rainbow(a,b,c,d)
9#define FUNCTION_NAPPLY_GAMMA(a,b,c) FASTLED_NAMESPACE::napplyGamma_video(a,b,c)
10#define FUNCTION_NAPPLY_GAMMA_RGB(a,b,c,d,e) FASTLED_NAMESPACE::napplyGamma_video(a,b,c,d,e)
11#define FUNCTION_BLUR1D(a,b,c) FASTLED_NAMESPACE::blur1d(a,b,c)
12#define FUNCTION_FILL_GRADIENT(a,b,c,d,e) FASTLED_NAMESPACE::fill_gradient(a,b,c,d,e)
13#define FUNCTION_FILL_GRADIENT3(a,b,c,d,e,f) FASTLED_NAMESPACE::fill_gradient(a,b,c,d,e,f)
14#define FUNCTION_FILL_GRADIENT4(a,b,c,d,e,f,g) FASTLED_NAMESPACE::fill_gradient(a,b,c,d,e,f,g)
15#define FUNCTION_NBLEND(a,b,c) FASTLED_NAMESPACE::nblend(a,b,c)
16#define FUNCTION_FILL_GRADIENT_RGB(a,b,c,d) FASTLED_NAMESPACE::fill_gradient_RGB(a,b,c,d)
17#define FUNCTION_FILL_GRADIENT_RGB3(a,b,c,d,e) FASTLED_NAMESPACE::fill_gradient_RGB(a,b,c,d,e)
18#define FUNCTION_FILL_GRADIENT_RGB4(a,b,c,d,e,f) FASTLED_NAMESPACE::fill_gradient_RGB(a,b,c,d,e,f)
19#else
20#define FUNCTION_FILL_RAINBOW(a,b,c,d) ::fill_rainbow(a,b,c,d)
21#define FUNCTION_NAPPLY_GAMMA(a,b,c) ::napplyGamma_video(a,b,c)
22#define FUNCTION_NAPPLY_GAMMA_RGB(a,b,c,d,e) ::napplyGamma_video(a,b,c,d,e)
23#define FUNCTION_BLUR1D(a,b,c) ::blur1d(a,b,c)
24#define FUNCTION_FILL_GRADIENT(a,b,c,d,e) ::fill_gradient(a,b,c,d,e)
25#define FUNCTION_FILL_GRADIENT3(a,b,c,d,e,f) ::fill_gradient(a,b,c,d,e,f)
26#define FUNCTION_FILL_GRADIENT4(a,b,c,d,e,f,g) ::fill_gradient(a,b,c,d,e,f,g)
27#define FUNCTION_NBLEND(a,b,c) ::nblend(a,b,c)
28#define FUNCTION_FILL_GRADIENT_RGB(a,b,c,d) ::fill_gradient_RGB(a,b,c,d)
29#define FUNCTION_FILL_GRADIENT_RGB3(a,b,c,d,e) ::fill_gradient_RGB(a,b,c,d,e)
30#define FUNCTION_FILL_GRADIENT_RGB4(a,b,c,d,e,f) ::fill_gradient_RGB(a,b,c,d,e,f)
31#endif
32
33#ifndef abs
34#include <stdlib.h>
35#endif
36
37
38#include "fl/namespace.h"
39
41
42template<class PIXEL_TYPE>
43class CPixelView;
44
47
49FASTLED_FORCE_INLINE
50CRGB *operator+(const CRGBSet & pixels, int offset);
51
52
55
56
60
65template<class PIXEL_TYPE>
67public:
68 const int8_t dir;
69 const int len;
71 PIXEL_TYPE * const leds;
72 PIXEL_TYPE * const end_pos;
73
74public:
76 inline CPixelView(const CPixelView & other) : dir(other.dir), len(other.len), leds(other.leds), end_pos(other.end_pos) {}
77
82 inline CPixelView(PIXEL_TYPE *_leds, int _len) : dir(_len < 0 ? -1 : 1), len(_len), leds(_leds), end_pos(_leds + _len) {}
83
89 inline CPixelView(PIXEL_TYPE *_leds, int _start, int _end) : dir(((_end-_start)<0) ? -1 : 1), len((_end - _start) + dir), leds(_leds + _start), end_pos(_leds + _start + len) {}
90
93 int size() { return abs(len); }
94
97 bool reversed() { return len < 0; }
98
100 bool operator==(const CPixelView & rhs) const { return leds == rhs.leds && len == rhs.len && dir == rhs.dir; }
101
103 bool operator!=(const CPixelView & rhs) const { return leds != rhs.leds || len != rhs.len || dir != rhs.dir; }
104
106 inline PIXEL_TYPE & operator[](int x) const { if(dir & 0x80) { return leds[-x]; } else { return leds[x]; } }
107
113 inline CPixelView operator()(int start, int end) { if(dir & 0x80) { return CPixelView(leds+len+1, -len-start-1, -len-end-1); } else { return CPixelView(leds, start, end); } }
114
115 // Access an inclusive subset of the LEDs in this set, starting from the first.
116 // @param end the last element for the new subset
117 // @todo Not sure i want this? inline CPixelView operator()(int end) { return CPixelView(leds, 0, end); }
118
120 inline CPixelView operator-() { return CPixelView(leds, len - dir, 0); }
121
123 inline operator PIXEL_TYPE* () const { return leds; }
124
127 inline CPixelView & operator=(const PIXEL_TYPE & color) {
128 for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) = color; }
129 return *this;
130 }
131
134 void dump() const {
141 }
142
146 inline CPixelView & operator=(const CPixelView & rhs) {
147 for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) {
148 (*pixel) = (*rhspixel);
149 }
150 return *this;
151 }
152
155
157 inline CPixelView & addToRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) += inc; } return *this; }
159 inline CPixelView & operator+=(CPixelView & rhs) { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) += (*rhspixel); } return *this; }
160
162 inline CPixelView & subFromRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) -= inc; } return *this; }
164 inline CPixelView & operator-=(CPixelView & rhs) { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) -= (*rhspixel); } return *this; }
165
167 inline CPixelView & operator++() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
169 inline CPixelView & operator++(int DUMMY_ARG) {
170 FASTLED_UNUSED(DUMMY_ARG);
171 for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) {
172 (*pixel)++;
173 }
174 return *this;
175 }
176
178 inline CPixelView & operator--() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
180 inline CPixelView & operator--(int DUMMY_ARG) {
181 FASTLED_UNUSED(DUMMY_ARG);
182 for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) {
183 (*pixel)--;
184 }
185 return *this;
186 }
187
189 inline CPixelView & operator/=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) /= d; } return *this; }
191 inline CPixelView & operator>>=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) >>= d; } return *this; }
193 inline CPixelView & operator*=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) *= d; } return *this; }
194
196 inline CPixelView & nscale8_video(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this;}
198 inline CPixelView & operator%=(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this; }
200 inline CPixelView & fadeLightBy(uint8_t fadefactor) { return nscale8_video(255 - fadefactor); }
201
203 inline CPixelView & nscale8(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
205 inline CPixelView & nscale8(PIXEL_TYPE & scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
207 inline CPixelView & nscale8(CPixelView & rhs) { 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; }
208
210 inline CPixelView & fadeToBlackBy(uint8_t fade) { return nscale8(255 - fade); }
211
215 inline CPixelView & operator|=(const PIXEL_TYPE & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= rhs; } return *this; }
218 inline CPixelView & operator|=(const CPixelView & rhs) { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) |= (*rhspixel); } return *this; }
221 inline CPixelView & operator|=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= d; } return *this; }
222
226 inline CPixelView & operator&=(const PIXEL_TYPE & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= rhs; } return *this; }
229 inline CPixelView & operator&=(const CPixelView & rhs) { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { (*pixel) &= (*rhspixel); } return *this; }
232 inline CPixelView & operator&=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= d; } return *this; }
233
235
236
238 inline operator bool() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { if((*pixel)) return true; } return false; }
239
240
243
246 inline CPixelView & fill_solid(const PIXEL_TYPE & color) { *this = color; return *this; }
248 inline CPixelView & fill_solid(const CHSV & color) { *this = color; return *this; }
249
254 inline CPixelView & fill_rainbow(uint8_t initialhue, uint8_t deltahue=5) {
255 if(dir >= 0) {
256 FUNCTION_FILL_RAINBOW(leds,len,initialhue,deltahue);
257 } else {
258 FUNCTION_FILL_RAINBOW(leds + len + 1, -len, initialhue - deltahue * (len+1), -deltahue);
259 }
260 return *this;
261 }
262
268 inline CPixelView & fill_gradient(const CHSV & startcolor, const CHSV & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
269 if(dir >= 0) {
270 FUNCTION_FILL_GRADIENT(leds,len,startcolor, endcolor, directionCode);
271 } else {
272 FUNCTION_FILL_GRADIENT(leds + len + 1, (-len), endcolor, startcolor, directionCode);
273 }
274 return *this;
275 }
276
283 inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, TGradientDirectionCode directionCode = SHORTEST_HUES) {
284 if(dir >= 0) {
285 FUNCTION_FILL_GRADIENT3(leds, len, c1, c2, c3, directionCode);
286 } else {
287 FUNCTION_FILL_GRADIENT3(leds + len + 1, -len, c3, c2, c1, directionCode);
288 }
289 return *this;
290 }
291
299 inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, const CHSV & c4, TGradientDirectionCode directionCode = SHORTEST_HUES) {
300 if(dir >= 0) {
301 FUNCTION_FILL_GRADIENT4(leds, len, c1, c2, c3, c4, directionCode);
302 } else {
303 FUNCTION_FILL_GRADIENT4(leds + len + 1, -len, c4, c3, c2, c1, directionCode);
304 }
305 return *this;
306 }
307
313 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & startcolor, const PIXEL_TYPE & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
314 FASTLED_UNUSED(directionCode); // TODO: why is this not used?
315 if(dir >= 0) {
316 FUNCTION_FILL_GRADIENT_RGB(leds,len,startcolor, endcolor);
317 } else {
318 FUNCTION_FILL_GRADIENT_RGB(leds + len + 1, (-len), endcolor, startcolor);
319 }
320 return *this;
321 }
322
328 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3) {
329 if(dir >= 0) {
330 FUNCTION_FILL_GRADIENT_RGB3(leds, len, c1, c2, c3);
331 } else {
332 FUNCTION_FILL_GRADIENT_RGB3(leds + len + 1, -len, c3, c2, c1);
333 }
334 return *this;
335 }
336
343 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3, const PIXEL_TYPE & c4) {
344 if(dir >= 0) {
345 FUNCTION_FILL_GRADIENT_RGB4(leds, len, c1, c2, c3, c4);
346 } else {
347 FUNCTION_FILL_GRADIENT_RGB4(leds + len + 1, -len, c4, c3, c2, c1);
348 }
349 return *this;
350 }
351
356 inline CPixelView & nblend(const PIXEL_TYPE & overlay, fract8 amountOfOverlay) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { FUNCTION_NBLEND((*pixel), overlay, amountOfOverlay); } return *this; }
357
362 inline CPixelView & nblend(const CPixelView & rhs, fract8 amountOfOverlay) { 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; }
363
368 inline CPixelView & blur1d(fract8 blur_amount) {
369 if(dir >= 0) {
370 FUNCTION_BLUR1D(leds, len, blur_amount);
371 } else {
372 FUNCTION_BLUR1D(leds + len + 1, -len, blur_amount);
373 }
374 return *this;
375 }
376
380 inline CPixelView & napplyGamma_video(float gamma) {
381 if(dir >= 0) {
382 FUNCTION_NAPPLY_GAMMA(leds, len, gamma);
383 } else {
384 FUNCTION_NAPPLY_GAMMA(leds + len + 1, -len, gamma);
385 }
386 return *this;
387 }
388
394 inline CPixelView & napplyGamma_video(float gammaR, float gammaG, float gammaB) {
395 if(dir >= 0) {
396 FUNCTION_NAPPLY_GAMMA_RGB(leds, len, gammaR, gammaG, gammaB);
397 } else {
398 FUNCTION_NAPPLY_GAMMA_RGB(leds + len + 1, -len, gammaR, gammaG, gammaB);
399 }
400 return *this;
401 }
402
404
405
408
412 template <class T>
414 T * leds;
415 const int8_t dir;
416
417 public:
419 FASTLED_FORCE_INLINE pixelset_iterator_base(const pixelset_iterator_base & rhs) : leds(rhs.leds), dir(rhs.dir) {}
420
425 FASTLED_FORCE_INLINE pixelset_iterator_base(T * _leds, const char _dir) : leds(_leds), dir(_dir) {}
426
427 FASTLED_FORCE_INLINE pixelset_iterator_base& operator++() { leds += dir; return *this; }
428 FASTLED_FORCE_INLINE pixelset_iterator_base operator++(int) { pixelset_iterator_base tmp(*this); leds += dir; return tmp; }
429
430 FASTLED_FORCE_INLINE bool operator==(pixelset_iterator_base & other) const { return leds == other.leds; /* && set==other.set; */ }
431 FASTLED_FORCE_INLINE bool operator!=(pixelset_iterator_base & other) const { return leds != other.leds; /* || set != other.set; */ }
432
433 FASTLED_FORCE_INLINE PIXEL_TYPE& operator*() const { return *leds; }
434 };
435
438
439 iterator begin() { return iterator(leds, dir); }
440 iterator end() { return iterator(end_pos, dir); }
441
442 iterator begin() const { return iterator(leds, dir); }
443 iterator end() const { return iterator(end_pos, dir); }
444
447
449};
450
451FASTLED_FORCE_INLINE
452CRGB *operator+(const CRGBSet & pixels, int offset) {
453 return (CRGB*)pixels + offset;
454}
455
456
459template<int SIZE>
460class CRGBArray : public CPixelView<CRGB> {
461 CRGB rawleds[SIZE] = {0};
462
463public:
464 CRGBArray() : CPixelView<CRGB>(rawleds, SIZE) {}
465 using CPixelView::operator=;
466 CRGB* get() { return &rawleds[0]; }
467 const CRGB* get() const { return &rawleds[0]; }
468 size_t size() const { return SIZE; }
469};
470
472
474
475#undef FUNCTION_FILL_RAINBOW
476#undef FUNCTION_NAPPLY_GAMMA
477#undef FUNCTION_NAPPLY_GAMMA_RGB
478#undef FUNCTION_BLUR1D
479#undef FUNCTION_FILL_GRADIENT
480#undef FUNCTION_FILL_GRADIENT3
481#undef FUNCTION_FILL_GRADIENT4
482#undef FUNCTION_NBLEND
483#undef FUNCTION_FILL_GRADIENT_RGB
484#undef FUNCTION_FILL_GRADIENT_RGB3
485#undef FUNCTION_FILL_GRADIENT_RGB4
central include file for FastLED, defines the CFastLED class/object
Iterator helper class for CPixelView.
Definition pixelset.h:413
FASTLED_FORCE_INLINE bool operator==(pixelset_iterator_base &other) const
Check if iterator is at the same position.
Definition pixelset.h:430
FASTLED_FORCE_INLINE pixelset_iterator_base & operator++()
Increment LED pointer in data direction.
Definition pixelset.h:427
FASTLED_FORCE_INLINE pixelset_iterator_base operator++(int)
Increment LED pointer in data direction.
Definition pixelset.h:428
FASTLED_FORCE_INLINE pixelset_iterator_base(const pixelset_iterator_base &rhs)
Copy constructor.
Definition pixelset.h:419
FASTLED_FORCE_INLINE pixelset_iterator_base(T *_leds, const char _dir)
Base constructor.
Definition pixelset.h:425
FASTLED_FORCE_INLINE PIXEL_TYPE & operator*() const
Dereference operator, to get underlying pointer to the LEDs.
Definition pixelset.h:433
FASTLED_FORCE_INLINE bool operator!=(pixelset_iterator_base &other) const
Check if iterator is not at the same position.
Definition pixelset.h:431
Represents a set of LED objects.
Definition pixelset.h:66
CPixelView(PIXEL_TYPE *_leds, int _len)
PixelSet constructor for a pixel set starting at the given PIXEL_TYPE* and going for _len leds.
Definition pixelset.h:82
CPixelView & nscale8(PIXEL_TYPE &scaledown)
Scale every LED by the given scale.
Definition pixelset.h:205
CPixelView & operator&=(const CPixelView &rhs)
Apply the PIXEL_TYPE &= operator to every pixel in this set with every pixel in the passed in set.
Definition pixelset.h:229
CPixelView & fill_gradient(const CHSV &c1, const CHSV &c2, const CHSV &c3, TGradientDirectionCode directionCode=SHORTEST_HUES)
Fill all of the LEDs with a smooth HSV gradient between three HSV colors.
Definition pixelset.h:283
CPixelView & operator-=(CPixelView &rhs)
Subtract every pixel in the other set from this set.
Definition pixelset.h:164
CPixelView & fill_gradient_RGB(const PIXEL_TYPE &c1, const PIXEL_TYPE &c2, const PIXEL_TYPE &c3, const PIXEL_TYPE &c4)
Fill all of the LEDs with a smooth RGB gradient between four RGB colors.
Definition pixelset.h:343
CPixelView & fill_rainbow(uint8_t initialhue, uint8_t deltahue=5)
Fill all of the LEDs with a rainbow of colors.
Definition pixelset.h:254
CPixelView & addToRGB(uint8_t inc)
Add the passed in value to all channels for all of the pixels in this set.
Definition pixelset.h:157
PIXEL_TYPE *const leds
pointer to the LED data
Definition pixelset.h:71
CPixelView & nscale8_video(uint8_t scaledown)
Scale every LED by the given scale.
Definition pixelset.h:196
CPixelView & operator--()
Decrement every pixel value in this set.
Definition pixelset.h:178
const_iterator cbegin() const
Makes a const iterator instance for the start of the LED set, const qualified.
Definition pixelset.h:445
const_iterator cend() const
Makes a const iterator instance for the end of the LED set, const qualified.
Definition pixelset.h:446
CPixelView & operator*=(uint8_t d)
Multiply every LED in this set by the given value.
Definition pixelset.h:193
CPixelView & operator|=(const PIXEL_TYPE &rhs)
Apply the PIXEL_TYPE |= operator to every pixel in this set with the given PIXEL_TYPE value.
Definition pixelset.h:215
bool reversed()
Whether or not this set goes backwards.
Definition pixelset.h:97
CPixelView & operator--(int DUMMY_ARG)
Decrement every pixel value in this set.
Definition pixelset.h:180
CPixelView & fill_solid(const CHSV &color)
Fill all of the LEDs with a solid color.
Definition pixelset.h:248
CPixelView & operator=(const CPixelView &rhs)
Copy the contents of the passed-in set to our set.
Definition pixelset.h:146
CPixelView & operator++(int DUMMY_ARG)
Increment every pixel value in this set.
Definition pixelset.h:169
iterator end()
Makes an iterator instance for the end of the LED set.
Definition pixelset.h:440
CPixelView & operator+=(CPixelView &rhs)
Add every pixel in the other set to this set.
Definition pixelset.h:159
CPixelView & operator=(const PIXEL_TYPE &color)
Assign the passed in color to all elements in this set.
Definition pixelset.h:127
const int8_t dir
direction of the LED data, either 1 or -1. Determines how the pointer is incremented.
Definition pixelset.h:68
CPixelView & operator++()
Increment every pixel value in this set.
Definition pixelset.h:167
CPixelView & fill_gradient_RGB(const PIXEL_TYPE &c1, const PIXEL_TYPE &c2, const PIXEL_TYPE &c3)
Fill all of the LEDs with a smooth RGB gradient between three RGB colors.
Definition pixelset.h:328
void dump() const
Print debug data to serial, disabled for release.
Definition pixelset.h:134
CPixelView & blur1d(fract8 blur_amount)
One-dimensional blur filter.
Definition pixelset.h:368
CPixelView & nblend(const PIXEL_TYPE &overlay, fract8 amountOfOverlay)
Destructively modifies all LEDs, blending in a given fraction of an overlay color.
Definition pixelset.h:356
CPixelView & operator&=(const PIXEL_TYPE &rhs)
Apply the PIXEL_TYPE &= operator to every pixel in this set with the given PIXEL_TYPE value.
Definition pixelset.h:226
CPixelView & fill_gradient(const CHSV &startcolor, const CHSV &endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
Fill all of the LEDs with a smooth HSV gradient between two HSV colors.
Definition pixelset.h:268
CPixelView & operator%=(uint8_t scaledown)
Scale down every LED by the given scale.
Definition pixelset.h:198
pixelset_iterator_base< PIXEL_TYPE > iterator
Iterator helper type for this class.
Definition pixelset.h:436
CPixelView & operator/=(uint8_t d)
Divide every LED by the given value.
Definition pixelset.h:189
CPixelView & nscale8(uint8_t scaledown)
Scale every LED by the given scale.
Definition pixelset.h:203
CPixelView & fill_gradient_RGB(const PIXEL_TYPE &startcolor, const PIXEL_TYPE &endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
Fill all of the LEDs with a smooth RGB gradient between two RGB colors.
Definition pixelset.h:313
CPixelView & operator>>=(uint8_t d)
Shift every LED in this set right by the given number of bits.
Definition pixelset.h:191
CPixelView operator()(int start, int end)
Access an inclusive subset of the LEDs in this set.
Definition pixelset.h:113
bool operator==(const CPixelView &rhs) const
Do these sets point to the same thing? Note that this is different from the contents of the set being...
Definition pixelset.h:100
CPixelView & napplyGamma_video(float gamma)
Destructively applies a gamma adjustment to all LEDs.
Definition pixelset.h:380
CPixelView & fadeToBlackBy(uint8_t fade)
Fade every LED down by the given scale.
Definition pixelset.h:210
CPixelView & fill_gradient(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4, TGradientDirectionCode directionCode=SHORTEST_HUES)
Fill all of the LEDs with a smooth HSV gradient between four HSV colors.
Definition pixelset.h:299
CPixelView & operator|=(uint8_t d)
Apply the PIXEL_TYPE |= operator to every pixel in this set.
Definition pixelset.h:221
PIXEL_TYPE *const end_pos
pointer to the end position of the LED data
Definition pixelset.h:72
PIXEL_TYPE & operator[](int x) const
Access a single element in this set, just like an array operator.
Definition pixelset.h:106
CPixelView & subFromRGB(uint8_t inc)
Subtract the passed in value from all channels for all of the pixels in this set.
Definition pixelset.h:162
CPixelView & fadeLightBy(uint8_t fadefactor)
Fade every LED down by the given scale.
Definition pixelset.h:200
CPixelView & operator|=(const CPixelView &rhs)
Apply the PIXEL_TYPE |= operator to every pixel in this set with every pixel in the passed in set.
Definition pixelset.h:218
pixelset_iterator_base< const PIXEL_TYPE > const_iterator
Const iterator helper type for this class.
Definition pixelset.h:437
CPixelView & nscale8(CPixelView &rhs)
Scale every LED in this set by every led in the other set.
Definition pixelset.h:207
CPixelView operator-()
Return the reverse ordering of this set.
Definition pixelset.h:120
CPixelView & fill_solid(const PIXEL_TYPE &color)
Fill all of the LEDs with a solid color.
Definition pixelset.h:246
CPixelView(PIXEL_TYPE *_leds, int _start, int _end)
PixelSet constructor for the given set of LEDs, with start and end boundaries.
Definition pixelset.h:89
CPixelView & operator&=(uint8_t d)
Apply the PIXEL_TYPE &= operator to every pixel in this set with the passed in value.
Definition pixelset.h:232
bool operator!=(const CPixelView &rhs) const
Do these sets point to different things? Note that this is different from the contents of the set bei...
Definition pixelset.h:103
CPixelView & nblend(const CPixelView &rhs, fract8 amountOfOverlay)
Destructively blend another set of LEDs into this one.
Definition pixelset.h:362
iterator begin() const
Makes an iterator instance for the start of the LED set, const qualified.
Definition pixelset.h:442
iterator begin()
Makes an iterator instance for the start of the LED set.
Definition pixelset.h:439
iterator end() const
Makes an iterator instance for the end of the LED set, const qualified.
Definition pixelset.h:443
const int len
length of the LED data, in PIXEL_TYPE units.
Definition pixelset.h:69
CPixelView & napplyGamma_video(float gammaR, float gammaG, float gammaB)
Destructively applies a gamma adjustment to all LEDs.
Definition pixelset.h:394
CPixelView(const CPixelView &other)
PixelSet copy constructor.
Definition pixelset.h:76
int size()
Get the size of this set.
Definition pixelset.h:93
A version of CPixelView<CRGB> with an included array of CRGB LEDs.
Definition pixelset.h:460
TGradientDirectionCode
Hue direction for calculating fill gradients.
Definition colorutils.h:157
@ SHORTEST_HUES
Hue goes whichever way is shortest.
Definition colorutils.h:160
uint8_t fract8
ANSI: unsigned short _Fract.
Definition types.h:36
FASTLED_FORCE_INLINE CRGB * operator+(const CRGBSet &pixels, int offset)
Retrieve a pointer to a CRGB array, using a CRGBSet and an LED offset.
Definition pixelset.h:452
Implements the FastLED namespace macros.
#define FASTLED_NAMESPACE_END
End of the FastLED namespace.
Definition namespace.h:16
#define FASTLED_NAMESPACE_BEGIN
Start of the FastLED namespace.
Definition namespace.h:14
CPixelView< CRGB > CRGBSet
CPixelView for CRGB arrays.
Definition pixelset.h:46
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54