FastLED 3.9.3
Loading...
Searching...
No Matches
pixelset.h
Go to the documentation of this file.
1#pragma once
2
3#include "FastLED.h"
4#include "force_inline.h"
5
6#if FASTLED_IS_USING_NAMESPACE
7#define FUNCTION_FILL_RAINBOW(a,b,c,d) FASTLED_NAMESPACE::fill_rainbow(a,b,c,d)
8#define FUNCTION_NAPPLY_GAMMA(a,b,c) FASTLED_NAMESPACE::napplyGamma_video(a,b,c)
9#define FUNCTION_NAPPLY_GAMMA_RGB(a,b,c,d,e) FASTLED_NAMESPACE::napplyGamma_video(a,b,c,d,e)
10#define FUNCTION_BLUR1D(a,b,c) FASTLED_NAMESPACE::blur1d(a,b,c)
11#define FUNCTION_FILL_GRADIENT(a,b,c,d,e) FASTLED_NAMESPACE::fill_gradient(a,b,c,d,e)
12#define FUNCTION_FILL_GRADIENT3(a,b,c,d,e,f) FASTLED_NAMESPACE::fill_gradient(a,b,c,d,e,f)
13#define FUNCTION_FILL_GRADIENT4(a,b,c,d,e,f,g) FASTLED_NAMESPACE::fill_gradient(a,b,c,d,e,f,g)
14#define FUNCTION_NBLEND(a,b,c) FASTLED_NAMESPACE::nblend(a,b,c)
15#define FUNCTION_FILL_GRADIENT_RGB(a,b,c,d) FASTLED_NAMESPACE::fill_gradient_RGB(a,b,c,d)
16#define FUNCTION_FILL_GRADIENT_RGB3(a,b,c,d,e) FASTLED_NAMESPACE::fill_gradient_RGB(a,b,c,d,e)
17#define FUNCTION_FILL_GRADIENT_RGB4(a,b,c,d,e,f) FASTLED_NAMESPACE::fill_gradient_RGB(a,b,c,d,e,f)
18#else
19#define FUNCTION_FILL_RAINBOW(a,b,c,d) ::fill_rainbow(a,b,c,d)
20#define FUNCTION_NAPPLY_GAMMA(a,b,c) ::napplyGamma_video(a,b,c)
21#define FUNCTION_NAPPLY_GAMMA_RGB(a,b,c,d,e) ::napplyGamma_video(a,b,c,d,e)
22#define FUNCTION_BLUR1D(a,b,c) ::blur1d(a,b,c)
23#define FUNCTION_FILL_GRADIENT(a,b,c,d,e) ::fill_gradient(a,b,c,d,e)
24#define FUNCTION_FILL_GRADIENT3(a,b,c,d,e,f) ::fill_gradient(a,b,c,d,e,f)
25#define FUNCTION_FILL_GRADIENT4(a,b,c,d,e,f,g) ::fill_gradient(a,b,c,d,e,f,g)
26#define FUNCTION_NBLEND(a,b,c) ::nblend(a,b,c)
27#define FUNCTION_FILL_GRADIENT_RGB(a,b,c,d) ::fill_gradient_RGB(a,b,c,d)
28#define FUNCTION_FILL_GRADIENT_RGB3(a,b,c,d,e) ::fill_gradient_RGB(a,b,c,d,e)
29#define FUNCTION_FILL_GRADIENT_RGB4(a,b,c,d,e,f) ::fill_gradient_RGB(a,b,c,d,e,f)
30#endif
31
32#ifndef abs
33#include <stdlib.h>
34#endif
35
36
37#include "namespace.h"
38
39FASTLED_NAMESPACE_BEGIN
40
41template<class PIXEL_TYPE>
42class CPixelView;
43
46
48FASTLED_FORCE_INLINE
49CRGB *operator+(const CRGBSet & pixels, int offset);
50
51
54
55
59
64template<class PIXEL_TYPE>
66public:
67 const int8_t dir;
68 const int len;
70 PIXEL_TYPE * const leds;
71 PIXEL_TYPE * const end_pos;
72
73public:
75 inline CPixelView(const CPixelView & other) : dir(other.dir), len(other.len), leds(other.leds), end_pos(other.end_pos) {}
76
81 inline CPixelView(PIXEL_TYPE *_leds, int _len) : dir(_len < 0 ? -1 : 1), len(_len), leds(_leds), end_pos(_leds + _len) {}
82
88 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) {}
89
92 int size() { return abs(len); }
93
96 bool reversed() { return len < 0; }
97
99 bool operator==(const CPixelView & rhs) const { return leds == rhs.leds && len == rhs.len && dir == rhs.dir; }
100
102 bool operator!=(const CPixelView & rhs) const { return leds != rhs.leds || len != rhs.len || dir != rhs.dir; }
103
105 inline PIXEL_TYPE & operator[](int x) const { if(dir & 0x80) { return leds[-x]; } else { return leds[x]; } }
106
112 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); } }
113
114 // Access an inclusive subset of the LEDs in this set, starting from the first.
115 // @param end the last element for the new subset
116 // @todo Not sure i want this? inline CPixelView operator()(int end) { return CPixelView(leds, 0, end); }
117
119 inline CPixelView operator-() { return CPixelView(leds, len - dir, 0); }
120
122 inline operator PIXEL_TYPE* () const { return leds; }
123
126 inline CPixelView & operator=(const PIXEL_TYPE & color) {
127 for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) = color; }
128 return *this;
129 }
130
133 void dump() const {
140 }
141
145 inline CPixelView & operator=(const CPixelView & rhs) {
146 for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) {
147 (*pixel) = (*rhspixel);
148 }
149 return *this;
150 }
151
154
156 inline CPixelView & addToRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) += inc; } return *this; }
158 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; }
159
161 inline CPixelView & subFromRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) -= inc; } return *this; }
163 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; }
164
166 inline CPixelView & operator++() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
168 inline CPixelView & operator++(int DUMMY_ARG) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
169
171 inline CPixelView & operator--() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
173 inline CPixelView & operator--(int DUMMY_ARG) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
174
176 inline CPixelView & operator/=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) /= d; } return *this; }
178 inline CPixelView & operator>>=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) >>= d; } return *this; }
180 inline CPixelView & operator*=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) *= d; } return *this; }
181
183 inline CPixelView & nscale8_video(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this;}
185 inline CPixelView & operator%=(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this; }
187 inline CPixelView & fadeLightBy(uint8_t fadefactor) { return nscale8_video(255 - fadefactor); }
188
190 inline CPixelView & nscale8(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
192 inline CPixelView & nscale8(PIXEL_TYPE & scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
194 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; }
195
197 inline CPixelView & fadeToBlackBy(uint8_t fade) { return nscale8(255 - fade); }
198
202 inline CPixelView & operator|=(const PIXEL_TYPE & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= rhs; } return *this; }
205 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; }
208 inline CPixelView & operator|=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= d; } return *this; }
209
213 inline CPixelView & operator&=(const PIXEL_TYPE & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= rhs; } return *this; }
216 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; }
219 inline CPixelView & operator&=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= d; } return *this; }
220
222
223
225 inline operator bool() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { if((*pixel)) return true; } return false; }
226
227
230
233 inline CPixelView & fill_solid(const PIXEL_TYPE & color) { *this = color; return *this; }
235 inline CPixelView & fill_solid(const CHSV & color) { *this = color; return *this; }
236
241 inline CPixelView & fill_rainbow(uint8_t initialhue, uint8_t deltahue=5) {
242 if(dir >= 0) {
243 FUNCTION_FILL_RAINBOW(leds,len,initialhue,deltahue);
244 } else {
245 FUNCTION_FILL_RAINBOW(leds + len + 1, -len, initialhue - deltahue * (len+1), -deltahue);
246 }
247 return *this;
248 }
249
255 inline CPixelView & fill_gradient(const CHSV & startcolor, const CHSV & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
256 if(dir >= 0) {
257 FUNCTION_FILL_GRADIENT(leds,len,startcolor, endcolor, directionCode);
258 } else {
259 FUNCTION_FILL_GRADIENT(leds + len + 1, (-len), endcolor, startcolor, directionCode);
260 }
261 return *this;
262 }
263
270 inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, TGradientDirectionCode directionCode = SHORTEST_HUES) {
271 if(dir >= 0) {
272 FUNCTION_FILL_GRADIENT3(leds, len, c1, c2, c3, directionCode);
273 } else {
274 FUNCTION_FILL_GRADIENT3(leds + len + 1, -len, c3, c2, c1, directionCode);
275 }
276 return *this;
277 }
278
286 inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, const CHSV & c4, TGradientDirectionCode directionCode = SHORTEST_HUES) {
287 if(dir >= 0) {
288 FUNCTION_FILL_GRADIENT4(leds, len, c1, c2, c3, c4, directionCode);
289 } else {
290 FUNCTION_FILL_GRADIENT4(leds + len + 1, -len, c4, c3, c2, c1, directionCode);
291 }
292 return *this;
293 }
294
300 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & startcolor, const PIXEL_TYPE & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
301 if(dir >= 0) {
302 FUNCTION_FILL_GRADIENT_RGB(leds,len,startcolor, endcolor);
303 } else {
304 FUNCTION_FILL_GRADIENT_RGB(leds + len + 1, (-len), endcolor, startcolor);
305 }
306 return *this;
307 }
308
314 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3) {
315 if(dir >= 0) {
316 FUNCTION_FILL_GRADIENT_RGB3(leds, len, c1, c2, c3);
317 } else {
318 FUNCTION_FILL_GRADIENT_RGB3(leds + len + 1, -len, c3, c2, c1);
319 }
320 return *this;
321 }
322
329 inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3, const PIXEL_TYPE & c4) {
330 if(dir >= 0) {
331 FUNCTION_FILL_GRADIENT_RGB4(leds, len, c1, c2, c3, c4);
332 } else {
333 FUNCTION_FILL_GRADIENT_RGB4(leds + len + 1, -len, c4, c3, c2, c1);
334 }
335 return *this;
336 }
337
342 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; }
343
348 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; }
349
354 inline CPixelView & blur1d(fract8 blur_amount) {
355 if(dir >= 0) {
356 FUNCTION_BLUR1D(leds, len, blur_amount);
357 } else {
358 FUNCTION_BLUR1D(leds + len + 1, -len, blur_amount);
359 }
360 return *this;
361 }
362
366 inline CPixelView & napplyGamma_video(float gamma) {
367 if(dir >= 0) {
368 FUNCTION_NAPPLY_GAMMA(leds, len, gamma);
369 } else {
370 FUNCTION_NAPPLY_GAMMA(leds + len + 1, -len, gamma);
371 }
372 return *this;
373 }
374
380 inline CPixelView & napplyGamma_video(float gammaR, float gammaG, float gammaB) {
381 if(dir >= 0) {
382 FUNCTION_NAPPLY_GAMMA_RGB(leds, len, gammaR, gammaG, gammaB);
383 } else {
384 FUNCTION_NAPPLY_GAMMA_RGB(leds + len + 1, -len, gammaR, gammaG, gammaB);
385 }
386 return *this;
387 }
388
390
391
394
398 template <class T>
400 T * leds;
401 const int8_t dir;
402
403 public:
405 FASTLED_FORCE_INLINE pixelset_iterator_base(const pixelset_iterator_base & rhs) : leds(rhs.leds), dir(rhs.dir) {}
406
411 FASTLED_FORCE_INLINE pixelset_iterator_base(T * _leds, const char _dir) : leds(_leds), dir(_dir) {}
412
413 FASTLED_FORCE_INLINE pixelset_iterator_base& operator++() { leds += dir; return *this; }
414 FASTLED_FORCE_INLINE pixelset_iterator_base operator++(int) { pixelset_iterator_base tmp(*this); leds += dir; return tmp; }
415
416 FASTLED_FORCE_INLINE bool operator==(pixelset_iterator_base & other) const { return leds == other.leds; /* && set==other.set; */ }
417 FASTLED_FORCE_INLINE bool operator!=(pixelset_iterator_base & other) const { return leds != other.leds; /* || set != other.set; */ }
418
419 FASTLED_FORCE_INLINE PIXEL_TYPE& operator*() const { return *leds; }
420 };
421
424
425 iterator begin() { return iterator(leds, dir); }
426 iterator end() { return iterator(end_pos, dir); }
427
428 iterator begin() const { return iterator(leds, dir); }
429 iterator end() const { return iterator(end_pos, dir); }
430
433
435};
436
437FASTLED_FORCE_INLINE
438CRGB *operator+(const CRGBSet & pixels, int offset) {
439 return (CRGB*)pixels + offset;
440}
441
442
445template<int SIZE>
446class CRGBArray : public CPixelView<CRGB> {
447 CRGB rawleds[SIZE];
448
449public:
450 CRGBArray() : CPixelView<CRGB>(rawleds, SIZE) {}
451 using CPixelView::operator=;
452};
453
455
456FASTLED_NAMESPACE_END
457
458#undef FUNCTION_FILL_RAINBOW
459#undef FUNCTION_NAPPLY_GAMMA
460#undef FUNCTION_NAPPLY_GAMMA_RGB
461#undef FUNCTION_BLUR1D
462#undef FUNCTION_FILL_GRADIENT
463#undef FUNCTION_FILL_GRADIENT3
464#undef FUNCTION_FILL_GRADIENT4
465#undef FUNCTION_NBLEND
466#undef FUNCTION_FILL_GRADIENT_RGB
467#undef FUNCTION_FILL_GRADIENT_RGB3
468#undef FUNCTION_FILL_GRADIENT_RGB4
central include file for FastLED, defines the CFastLED class/object
Iterator helper class for CPixelView.
Definition pixelset.h:399
FASTLED_FORCE_INLINE bool operator==(pixelset_iterator_base &other) const
Check if iterator is at the same position.
Definition pixelset.h:416
FASTLED_FORCE_INLINE pixelset_iterator_base & operator++()
Increment LED pointer in data direction.
Definition pixelset.h:413
FASTLED_FORCE_INLINE pixelset_iterator_base operator++(int)
Increment LED pointer in data direction.
Definition pixelset.h:414
FASTLED_FORCE_INLINE pixelset_iterator_base(const pixelset_iterator_base &rhs)
Copy constructor.
Definition pixelset.h:405
FASTLED_FORCE_INLINE pixelset_iterator_base(T *_leds, const char _dir)
Base constructor.
Definition pixelset.h:411
FASTLED_FORCE_INLINE PIXEL_TYPE & operator*() const
Dereference operator, to get underlying pointer to the LEDs.
Definition pixelset.h:419
FASTLED_FORCE_INLINE bool operator!=(pixelset_iterator_base &other) const
Check if iterator is not at the same position.
Definition pixelset.h:417
Represents a set of LED objects.
Definition pixelset.h:65
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:81
CPixelView & nscale8(PIXEL_TYPE &scaledown)
Scale every LED by the given scale.
Definition pixelset.h:192
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:216
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:270
CPixelView & operator-=(CPixelView &rhs)
Subtract every pixel in the other set from this set.
Definition pixelset.h:163
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:329
CPixelView & fill_rainbow(uint8_t initialhue, uint8_t deltahue=5)
Fill all of the LEDs with a rainbow of colors.
Definition pixelset.h:241
CPixelView & addToRGB(uint8_t inc)
Add the passed in value to all channels for all of the pixels in this set.
Definition pixelset.h:156
PIXEL_TYPE *const leds
pointer to the LED data
Definition pixelset.h:70
CPixelView & nscale8_video(uint8_t scaledown)
Scale every LED by the given scale.
Definition pixelset.h:183
CPixelView & operator--()
Decrement every pixel value in this set.
Definition pixelset.h:171
const_iterator cbegin() const
Makes a const iterator instance for the start of the LED set, const qualified.
Definition pixelset.h:431
const_iterator cend() const
Makes a const iterator instance for the end of the LED set, const qualified.
Definition pixelset.h:432
CPixelView & operator*=(uint8_t d)
Multiply every LED in this set by the given value.
Definition pixelset.h:180
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:202
bool reversed()
Whether or not this set goes backwards.
Definition pixelset.h:96
CPixelView & operator--(int DUMMY_ARG)
Decrement every pixel value in this set.
Definition pixelset.h:173
CPixelView & fill_solid(const CHSV &color)
Fill all of the LEDs with a solid color.
Definition pixelset.h:235
CPixelView & operator=(const CPixelView &rhs)
Copy the contents of the passed-in set to our set.
Definition pixelset.h:145
CPixelView & operator++(int DUMMY_ARG)
Increment every pixel value in this set.
Definition pixelset.h:168
iterator end()
Makes an iterator instance for the end of the LED set.
Definition pixelset.h:426
CPixelView & operator+=(CPixelView &rhs)
Add every pixel in the other set to this set.
Definition pixelset.h:158
CPixelView & operator=(const PIXEL_TYPE &color)
Assign the passed in color to all elements in this set.
Definition pixelset.h:126
const int8_t dir
direction of the LED data, either 1 or -1. Determines how the pointer is incremented.
Definition pixelset.h:67
CPixelView & operator++()
Increment every pixel value in this set.
Definition pixelset.h:166
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:314
void dump() const
Print debug data to serial, disabled for release.
Definition pixelset.h:133
CPixelView & blur1d(fract8 blur_amount)
One-dimensional blur filter.
Definition pixelset.h:354
CPixelView & nblend(const PIXEL_TYPE &overlay, fract8 amountOfOverlay)
Destructively modifies all LEDs, blending in a given fraction of an overlay color.
Definition pixelset.h:342
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:213
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:255
CPixelView & operator%=(uint8_t scaledown)
Scale down every LED by the given scale.
Definition pixelset.h:185
pixelset_iterator_base< PIXEL_TYPE > iterator
Iterator helper type for this class.
Definition pixelset.h:422
CPixelView & operator/=(uint8_t d)
Divide every LED by the given value.
Definition pixelset.h:176
CPixelView & nscale8(uint8_t scaledown)
Scale every LED by the given scale.
Definition pixelset.h:190
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:300
CPixelView & operator>>=(uint8_t d)
Shift every LED in this set right by the given number of bits.
Definition pixelset.h:178
CPixelView operator()(int start, int end)
Access an inclusive subset of the LEDs in this set.
Definition pixelset.h:112
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:99
CPixelView & napplyGamma_video(float gamma)
Destructively applies a gamma adjustment to all LEDs.
Definition pixelset.h:366
CPixelView & fadeToBlackBy(uint8_t fade)
Fade every LED down by the given scale.
Definition pixelset.h:197
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:286
CPixelView & operator|=(uint8_t d)
Apply the PIXEL_TYPE |= operator to every pixel in this set.
Definition pixelset.h:208
PIXEL_TYPE *const end_pos
pointer to the end position of the LED data
Definition pixelset.h:71
PIXEL_TYPE & operator[](int x) const
Access a single element in this set, just like an array operator.
Definition pixelset.h:105
CPixelView & subFromRGB(uint8_t inc)
Subtract the passed in value from all channels for all of the pixels in this set.
Definition pixelset.h:161
CPixelView & fadeLightBy(uint8_t fadefactor)
Fade every LED down by the given scale.
Definition pixelset.h:187
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:205
pixelset_iterator_base< const PIXEL_TYPE > const_iterator
Const iterator helper type for this class.
Definition pixelset.h:423
CPixelView & nscale8(CPixelView &rhs)
Scale every LED in this set by every led in the other set.
Definition pixelset.h:194
CPixelView operator-()
Return the reverse ordering of this set.
Definition pixelset.h:119
CPixelView & fill_solid(const PIXEL_TYPE &color)
Fill all of the LEDs with a solid color.
Definition pixelset.h:233
CPixelView(PIXEL_TYPE *_leds, int _start, int _end)
PixelSet constructor for the given set of LEDs, with start and end boundaries.
Definition pixelset.h:88
CPixelView & operator&=(uint8_t d)
Apply the PIXEL_TYPE &= operator to every pixel in this set with the passed in value.
Definition pixelset.h:219
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:102
CPixelView & nblend(const CPixelView &rhs, fract8 amountOfOverlay)
Destructively blend another set of LEDs into this one.
Definition pixelset.h:348
iterator begin() const
Makes an iterator instance for the start of the LED set, const qualified.
Definition pixelset.h:428
iterator begin()
Makes an iterator instance for the start of the LED set.
Definition pixelset.h:425
iterator end() const
Makes an iterator instance for the end of the LED set, const qualified.
Definition pixelset.h:429
const int len
length of the LED data, in PIXEL_TYPE units.
Definition pixelset.h:68
CPixelView & napplyGamma_video(float gammaR, float gammaG, float gammaB)
Destructively applies a gamma adjustment to all LEDs.
Definition pixelset.h:380
CPixelView(const CPixelView &other)
PixelSet copy constructor.
Definition pixelset.h:75
int size()
Get the size of this set.
Definition pixelset.h:92
A version of CPixelView<CRGB> with an included array of CRGB LEDs.
Definition pixelset.h:446
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:30
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:438
CPixelView< CRGB > CRGBSet
CPixelView for CRGB arrays.
Definition pixelset.h:45
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:11
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:39