Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Garcia <danielgarcia@gmail.com>2015-12-10 23:54:37 +0300
committerDaniel Garcia <danielgarcia@gmail.com>2015-12-10 23:54:37 +0300
commit6fa6e2da2c048b45a8b2891383036091fee09417 (patch)
tree42bdc59f557fecc8d21c404890aada7f94e229e7 /pixelset.h
parent3ed70eabd42b37297b49fe44ffa7bce53694a851 (diff)
Rename CPixelSet to CPixelView (it is more accurately a view than a set), make the type of pixel a template parameter (so we can eventually have CPixelView<CRGBW> or CPixelView<CRGB16>
Diffstat (limited to 'pixelset.h')
-rw-r--r--pixelset.h140
1 files changed, 71 insertions, 69 deletions
diff --git a/pixelset.h b/pixelset.h
index 96438aa6..62364137 100644
--- a/pixelset.h
+++ b/pixelset.h
@@ -4,30 +4,31 @@
/// Represents a set of CRGB led objects. Provides the [] array operator, and works like a normal array in that case.
/// This should be kept in sync with the set of functions provided by CRGB as well as functions in colorutils. Note
/// that a pixel set is a window into another set of led data, it is not its own set of led data.
-class CPixelSet {
+template<class PIXEL_TYPE>
+class CPixelView {
public:
const int8_t dir;
const int len;
- CRGB * const leds;
- CRGB * const end_pos;
+ PIXEL_TYPE * const leds;
+ PIXEL_TYPE * const end_pos;
public:
/// PixelSet copy constructor
- inline CPixelSet(const CPixelSet & other) : leds(other.leds), len(other.len), dir(other.dir), end_pos(other.end_pos) {}
+ inline CPixelView(const CPixelView & other) : leds(other.leds), len(other.len), dir(other.dir), end_pos(other.end_pos) {}
- /// pixelset constructor for a pixel set starting at the given CRGB* and going for _len leds. Note that the length
+ /// pixelset constructor for a pixel set starting at the given PIXEL_TYPE* and going for _len leds. Note that the length
/// can be backwards, creating a PixelSet that walks backwards over the data
/// @param leds point to the raw led data
/// @param len how many leds in this set
- inline CPixelSet(CRGB *_leds, int _len) : leds(_leds), len(_len), dir(_len < 0 ? -1 : 1), end_pos(_leds + _len) {}
+ inline CPixelView(PIXEL_TYPE *_leds, int _len) : leds(_leds), len(_len), dir(_len < 0 ? -1 : 1), end_pos(_leds + _len) {}
/// PixelSet constructor for the given set of leds, with start and end boundaries. Note that start can be after
/// end, resulting in a set that will iterate backwards
/// @param leds point to the raw led data
/// @param start the start index of the leds for this array
/// @param end the end index of the leds for this array
- inline CPixelSet(CRGB *_leds, int _start, int _end) : leds(_leds), dir(((_end-_start)<0) ? -1 : 1), len((_end - _start) + dir), end_pos(_leds + len) {}
+ inline CPixelView(PIXEL_TYPE *_leds, int _start, int _end) : leds(_leds), dir(((_end-_start)<0) ? -1 : 1), len((_end - _start) + dir), end_pos(_leds + len) {}
/// Get the size of this set
/// @return the size of the set
@@ -38,33 +39,33 @@ public:
bool reversed() { return len < 0; }
/// do these sets point to the same thing (note, this is different from the contents of the set being the same)
- bool operator==(const CPixelSet & rhs) const { return leds == rhs.leds && len == rhs.len && dir == rhs.dir; }
+ bool operator==(const CPixelView & rhs) const { return leds == rhs.leds && len == rhs.len && dir == rhs.dir; }
/// do these sets point to the different things (note, this is different from the contents of the set being the same)
- bool operator!=(const CPixelSet & rhs) const { return leds != rhs.leds || len != rhs.len || dir != rhs.dir; }
+ bool operator!=(const CPixelView & rhs) const { return leds != rhs.leds || len != rhs.len || dir != rhs.dir; }
/// access a single element in this set, just like an array operator
- inline CRGB & operator[](int x) const { if(dir & 0x80) { return leds[-x]; } else { return leds[x]; } }
+ inline PIXEL_TYPE & operator[](int x) const { if(dir & 0x80) { return leds[-x]; } else { return leds[x]; } }
/// Access an inclusive subset of the leds in this set. Note that start can be greater than end, which will
/// result in a reverse ordering for many functions (useful for mirroring)
/// @param start the first element from this set for the new subset
/// @param end the last element for the new subset
- inline CPixelSet operator()(int start, int end) { return CPixelSet(leds+start, start, end); }
+ inline CPixelView operator()(int start, int end) { return CPixelView(leds+start, start, end); }
/// Access an inclusive subset of the leds in this set, starting from the first.
/// @param end the last element for the new subset
- /// Not sure i want this? inline CPixelSet operator()(int end) { return CPixelSet(leds, 0, end); }
+ /// Not sure i want this? inline CPixelView operator()(int end) { return CPixelView(leds, 0, end); }
/// Return the reverse ordering of this set
- inline CPixelSet operator-() { return CPixelSet(leds + len - dir, len - dir, 0); }
+ inline CPixelView operator-() { return CPixelView(leds + len - dir, len - dir, 0); }
/// Return a pointer to the first element in this set
- inline operator CRGB* () const { return leds; }
+ inline operator PIXEL_TYPE* () const { return leds; }
/// Assign the passed in color to all elements in this set
/// @param color the new color for the elements in the set
- inline CPixelSet & operator=(const CRGB & color) {
+ inline CPixelView & operator=(const PIXEL_TYPE & color) {
for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) = color; }
return *this;
}
@@ -78,7 +79,7 @@ public:
/// Copy the contents of the passed in set to our set. Note if one set is smaller than the other, only the
/// smallest number of items will be copied over.
- inline CPixelSet & operator=(const CPixelSet & rhs) {
+ 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);
}
@@ -88,72 +89,72 @@ public:
/// @name modification/scaling operators
//@{
/// Add the passed in value to r,g, b for all the pixels in this set
- inline CPixelSet & addToRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) += inc; } return *this; }
+ inline CPixelView & addToRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) += inc; } return *this; }
/// Add every pixel in the other set to this set
- inline CPixelSet & operator+=(CPixelSet & 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; }
+ 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; }
/// Subtract the passed in value from r,g,b for all pixels in this set
- inline CPixelSet & subFromRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) -= inc; } return *this; }
+ inline CPixelView & subFromRGB(uint8_t inc) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) -= inc; } return *this; }
/// Subtract every pixel in the other set from this set
- inline CPixelSet & operator-=(CPixelSet & 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; }
+ 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; }
/// Increment every pixel value in this set
- inline CPixelSet & operator++() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
+ inline CPixelView & operator++() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
/// Increment every pixel value in this set
- inline CPixelSet & operator++(int DUMMY_ARG) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
+ inline CPixelView & operator++(int DUMMY_ARG) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)++; } return *this; }
/// Decrement every pixel value in this set
- inline CPixelSet & operator--() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
+ inline CPixelView & operator--() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
/// Decrement every pixel value in this set
- inline CPixelSet & operator--(int DUMMY_ARG) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
+ inline CPixelView & operator--(int DUMMY_ARG) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel)--; } return *this; }
/// Divide every led by the given value
- inline CPixelSet & operator/=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) /= d; } return *this; }
+ inline CPixelView & operator/=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) /= d; } return *this; }
/// Shift every led in this set right by the given number of bits
- inline CPixelSet & operator>>=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) >>= d; } return *this; }
+ inline CPixelView & operator>>=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) >>= d; } return *this; }
/// Multiply every led in this set by the given value
- inline CPixelSet & operator*=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) *= d; } return *this; }
+ inline CPixelView & operator*=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) *= d; } return *this; }
/// Scale every led by the given scale
- inline CPixelSet & nscale8_video(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this;}
+ inline CPixelView & nscale8_video(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this;}
/// Scale down every led by the given scale
- inline CPixelSet & operator%=(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this; }
+ inline CPixelView & operator%=(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8_video(scaledown); } return *this; }
/// Fade every led down by the given scale
- inline CPixelSet & fadeLightBy(uint8_t fadefactor) { return nscale8_video(255 - fadefactor); }
+ inline CPixelView & fadeLightBy(uint8_t fadefactor) { return nscale8_video(255 - fadefactor); }
/// Scale every led by the given scale
- inline CPixelSet & nscale8(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
+ inline CPixelView & nscale8(uint8_t scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
/// Scale every led by the given scale
- inline CPixelSet & nscale8(CRGB & scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
+ inline CPixelView & nscale8(PIXEL_TYPE & scaledown) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel).nscale8(scaledown); } return *this; }
/// Scale every led in this set by every led in the other set
- inline CPixelSet & nscale8(CPixelSet & 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; }
+ 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; }
/// Fade every led down by the given scale
- inline CPixelSet & fadeToBlackBy(uint8_t fade) { return nscale8(255 - fade); }
-
- /// Apply the CRGB |= operator to every pixel in this set with the given CRGB value (bringing each channel to the higher of the two values)
- inline CPixelSet & operator|=(const CRGB & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= rhs; } return *this; }
- /// Apply the CRGB |= operator to every pixel in this set with every pixel in the passed in set
- inline CPixelSet & operator|=(const CPixelSet & 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; }
- /// Apply the CRGB |= operator to every pixel in this set
- inline CPixelSet & operator|=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= d; } return *this; }
-
- /// Apply the CRGB &= operator to every pixel in this set with the given CRGB value (bringing each channel down to the lower of the two values)
- inline CPixelSet & operator&=(const CRGB & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= rhs; } return *this; }
- /// Apply the CRGB &= operator to every pixel in this set with every pixel in the passed in set
- inline CPixelSet & operator&=(const CPixelSet & 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; }
- /// APply the CRGB &= operator to every pixel in this set with the passed in value
- inline CPixelSet & operator&=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= d; } return *this; }
+ inline CPixelView & fadeToBlackBy(uint8_t fade) { return nscale8(255 - fade); }
+
+ /// Apply the PIXEL_TYPE |= operator to every pixel in this set with the given PIXEL_TYPE value (bringing each channel to the higher of the two values)
+ inline CPixelView & operator|=(const PIXEL_TYPE & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= rhs; } return *this; }
+ /// Apply the PIXEL_TYPE |= operator to every pixel in this set with every pixel in the passed in set
+ 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; }
+ /// Apply the PIXEL_TYPE |= operator to every pixel in this set
+ inline CPixelView & operator|=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) |= d; } return *this; }
+
+ /// Apply the PIXEL_TYPE &= operator to every pixel in this set with the given PIXEL_TYPE value (bringing each channel down to the lower of the two values)
+ inline CPixelView & operator&=(const PIXEL_TYPE & rhs) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= rhs; } return *this; }
+ /// Apply the PIXEL_TYPE &= operator to every pixel in this set with every pixel in the passed in set
+ 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; }
+ /// APply the PIXEL_TYPE &= operator to every pixel in this set with the passed in value
+ inline CPixelView & operator&=(uint8_t d) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { (*pixel) &= d; } return *this; }
//@}
/// Returns whether or not any leds in this set are non-zero
inline operator bool() { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { if((*pixel)) return true; } return false; }
// Color util functions
- inline CPixelSet & fill_solid(const CRGB & color) { *this = color; return *this; }
- inline CPixelSet & fill_solid(const CHSV & color) { if(dir>0) { *this = color; return *this; } }
+ inline CPixelView & fill_solid(const PIXEL_TYPE & color) { *this = color; return *this; }
+ inline CPixelView & fill_solid(const CHSV & color) { if(dir>0) { *this = color; return *this; } }
- inline CPixelSet & fill_rainbow(uint8_t initialhue, uint8_t deltahue=5) {
+ inline CPixelView & fill_rainbow(uint8_t initialhue, uint8_t deltahue=5) {
if(dir >= 0) {
::fill_rainbow(leds,len,initialhue,deltahue);
} else {
@@ -162,7 +163,7 @@ public:
return *this;
}
- inline CPixelSet & fill_gradient(const CHSV & startcolor, const CHSV & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
+ inline CPixelView & fill_gradient(const CHSV & startcolor, const CHSV & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
if(dir >= 0) {
::fill_gradient(leds,len,startcolor, endcolor, directionCode);
} else {
@@ -171,7 +172,7 @@ public:
return *this;
}
- inline CPixelSet & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, TGradientDirectionCode directionCode = SHORTEST_HUES) {
+ inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, TGradientDirectionCode directionCode = SHORTEST_HUES) {
if(dir >= 0) {
::fill_gradient(leds, len, c1, c2, c3, directionCode);
} else {
@@ -180,7 +181,7 @@ public:
return *this;
}
- inline CPixelSet & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, const CHSV & c4, TGradientDirectionCode directionCode = SHORTEST_HUES) {
+ inline CPixelView & fill_gradient(const CHSV & c1, const CHSV & c2, const CHSV & c3, const CHSV & c4, TGradientDirectionCode directionCode = SHORTEST_HUES) {
if(dir >= 0) {
::fill_gradient(leds, len, c1, c2, c3, c4, directionCode);
} else {
@@ -189,7 +190,7 @@ public:
return *this;
}
- inline CPixelSet & fill_gradient_RGB(const CRGB & startcolor, const CRGB & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
+ inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & startcolor, const PIXEL_TYPE & endcolor, TGradientDirectionCode directionCode = SHORTEST_HUES) {
if(dir >= 0) {
::fill_gradient_RGB(leds,len,startcolor, endcolor);
} else {
@@ -198,7 +199,7 @@ public:
return *this;
}
- inline CPixelSet & fill_gradient_RGB(const CRGB & c1, const CRGB & c2, const CRGB & c3) {
+ inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3) {
if(dir >= 0) {
::fill_gradient_RGB(leds, len, c1, c2, c3);
} else {
@@ -207,7 +208,7 @@ public:
return *this;
}
- inline CPixelSet & fill_gradient_RGB(const CRGB & c1, const CRGB & c2, const CRGB & c3, const CRGB & c4) {
+ inline CPixelView & fill_gradient_RGB(const PIXEL_TYPE & c1, const PIXEL_TYPE & c2, const PIXEL_TYPE & c3, const PIXEL_TYPE & c4) {
if(dir >= 0) {
::fill_gradient_RGB(leds, len, c1, c2, c3, c4);
} else {
@@ -216,11 +217,11 @@ public:
return *this;
}
- inline CPixelSet & nblend(const CRGB & overlay, fract8 amountOfOverlay) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { ::nblend((*pixel), overlay, amountOfOverlay); } return *this; }
- inline CPixelSet & nblend(const CPixelSet & rhs, fract8 amountOfOverlay) { for(iterator pixel = begin(), rhspixel = rhs.begin(), _end = end(), rhs_end = rhs.end(); (pixel != _end) && (rhspixel != rhs_end); ++pixel, ++rhspixel) { ::nblend((*pixel), (*rhspixel), amountOfOverlay); } return *this; }
+ inline CPixelView & nblend(const PIXEL_TYPE & overlay, fract8 amountOfOverlay) { for(iterator pixel = begin(), _end = end(); pixel != _end; ++pixel) { ::nblend((*pixel), overlay, amountOfOverlay); } return *this; }
+ 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) { ::nblend((*pixel), (*rhspixel), amountOfOverlay); } return *this; }
// Note: only bringing in a 1d blur, not sure 2d blur makes sense when looking at sub arrays
- inline CPixelSet & blur1d(fract8 blur_amount) {
+ inline CPixelView & blur1d(fract8 blur_amount) {
if(dir >= 0) {
::blur1d(leds, len, blur_amount);
} else {
@@ -229,7 +230,7 @@ public:
return *this;
}
- inline CPixelSet & napplyGamma_video(float gamma) {
+ inline CPixelView & napplyGamma_video(float gamma) {
if(dir >= 0) {
::napplyGamma_video(leds, len, gamma);
} else {
@@ -238,7 +239,7 @@ public:
return *this;
}
- inline CPixelSet & napplyGamma_video(float gammaR, float gammaG, float gammaB) {
+ inline CPixelView & napplyGamma_video(float gammaR, float gammaG, float gammaB) {
if(dir >= 0) {
::napplyGamma_video(leds, len, gammaR, gammaG, gammaB);
} else {
@@ -262,11 +263,11 @@ public:
__attribute__((always_inline)) inline bool operator==(pixelset_iterator_base & other) const { return leds == other.leds; } // && set==other.set; }
__attribute__((always_inline)) inline bool operator!=(pixelset_iterator_base & other) const { return leds != other.leds; } // || set != other.set; }
- __attribute__((always_inline)) inline CRGB& operator*() const { return *leds; }
+ __attribute__((always_inline)) inline PIXEL_TYPE& operator*() const { return *leds; }
};
- typedef pixelset_iterator_base<CRGB> iterator;
- typedef pixelset_iterator_base<const CRGB> const_iterator;
+ typedef pixelset_iterator_base<PIXEL_TYPE> iterator;
+ typedef pixelset_iterator_base<const PIXEL_TYPE> const_iterator;
iterator begin() { return iterator(leds, dir); }
iterator end() { return iterator(end_pos, dir); }
@@ -278,16 +279,17 @@ public:
const_iterator cend() const { return const_iterator(end_pos, dir); }
};
+typedef CPixelView<CRGB> CRGBSet;
+
__attribute__((always_inline))
-inline CRGB *operator+(const CPixelSet & pixels, int offset) { return (CRGB*)pixels + offset; }
+inline CRGB *operator+(const CRGBSet & pixels, int offset) { return (CRGB*)pixels + offset; }
-typedef CPixelSet CRGBSet;
template<int SIZE>
-class CRGBArray : public CPixelSet {
+class CRGBArray : public CPixelView<CRGB> {
CRGB rawleds[SIZE];
public:
- CRGBArray() : CPixelSet(rawleds, SIZE) {}
+ CRGBArray() : CPixelView<CRGB>(rawleds, SIZE) {}
};
#endif