FastLED  3.1
CPixelView< PIXEL_TYPE > Class Template Reference

Represents a set of CRGB led objects. More...

#include <pixelset.h>

+ Collaboration diagram for CPixelView< PIXEL_TYPE >:

Classes

class  pixelset_iterator_base
 

Public Types

typedef pixelset_iterator_base< PIXEL_TYPE > iterator
 
typedef pixelset_iterator_base< const PIXEL_TYPE > const_iterator
 

Public Member Functions

 CPixelView (const CPixelView &other)
 PixelSet copy constructor.
 
 CPixelView (PIXEL_TYPE *_leds, int _len)
 pixelset constructor for a pixel set starting at the given PIXEL_TYPE* and going for _len leds. More...
 
 CPixelView (PIXEL_TYPE *_leds, int _start, int _end)
 PixelSet constructor for the given set of leds, with start and end boundaries. More...
 
int size ()
 Get the size of this set. More...
 
bool reversed ()
 Whether or not this set goes backwards. More...
 
bool operator== (const CPixelView &rhs) const
 do these sets point to the same thing (note, this is different from the contents of the set being the same)
 
bool operator!= (const CPixelView &rhs) const
 do these sets point to the different things (note, this is different from the contents of the set being the same)
 
PIXEL_TYPE & operator[] (int x) const
 access a single element in this set, just like an array operator
 
CPixelView operator() (int start, int end)
 Access an inclusive subset of the leds in this set. More...
 
CPixelView operator- ()
 Access an inclusive subset of the leds in this set, starting from the first. More...
 
 operator PIXEL_TYPE * () const
 Return a pointer to the first element in this set.
 
CPixelViewoperator= (const PIXEL_TYPE &color)
 Assign the passed in color to all elements in this set. More...
 
void dump () const
 
CPixelViewoperator= (const CPixelView &rhs)
 Copy the contents of the passed in set to our set. More...
 
 operator bool ()
 Returns whether or not any leds in this set are non-zero.
 
CPixelViewfill_solid (const PIXEL_TYPE &color)
 
CPixelViewfill_solid (const CHSV &color)
 
CPixelViewfill_rainbow (uint8_t initialhue, uint8_t deltahue=5)
 
CPixelViewfill_gradient (const CHSV &startcolor, const CHSV &endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
 
CPixelViewfill_gradient (const CHSV &c1, const CHSV &c2, const CHSV &c3, TGradientDirectionCode directionCode=SHORTEST_HUES)
 
CPixelViewfill_gradient (const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4, TGradientDirectionCode directionCode=SHORTEST_HUES)
 
CPixelViewfill_gradient_RGB (const PIXEL_TYPE &startcolor, const PIXEL_TYPE &endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
 
CPixelViewfill_gradient_RGB (const PIXEL_TYPE &c1, const PIXEL_TYPE &c2, const PIXEL_TYPE &c3)
 
CPixelViewfill_gradient_RGB (const PIXEL_TYPE &c1, const PIXEL_TYPE &c2, const PIXEL_TYPE &c3, const PIXEL_TYPE &c4)
 
CPixelViewnblend (const PIXEL_TYPE &overlay, fract8 amountOfOverlay)
 
CPixelViewnblend (const CPixelView &rhs, fract8 amountOfOverlay)
 
CPixelViewblur1d (fract8 blur_amount)
 
CPixelViewnapplyGamma_video (float gamma)
 
CPixelViewnapplyGamma_video (float gammaR, float gammaG, float gammaB)
 
iterator begin ()
 
iterator end ()
 
iterator begin () const
 
iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
modification/scaling operators
CPixelViewaddToRGB (uint8_t inc)
 Add the passed in value to r,g, b for all the pixels in this set.
 
CPixelViewoperator+= (CPixelView &rhs)
 Add every pixel in the other set to this set.
 
CPixelViewsubFromRGB (uint8_t inc)
 Subtract the passed in value from r,g,b for all pixels in this set.
 
CPixelViewoperator-= (CPixelView &rhs)
 Subtract every pixel in the other set from this set.
 
CPixelViewoperator++ ()
 Increment every pixel value in this set.
 
CPixelViewoperator++ (int DUMMY_ARG)
 Increment every pixel value in this set.
 
CPixelViewoperator-- ()
 Decrement every pixel value in this set.
 
CPixelViewoperator-- (int DUMMY_ARG)
 Decrement every pixel value in this set.
 
CPixelViewoperator/= (uint8_t d)
 Divide every led by the given value.
 
CPixelViewoperator>>= (uint8_t d)
 Shift every led in this set right by the given number of bits.
 
CPixelViewoperator*= (uint8_t d)
 Multiply every led in this set by the given value.
 
CPixelViewnscale8_video (uint8_t scaledown)
 Scale every led by the given scale.
 
CPixelViewoperator%= (uint8_t scaledown)
 Scale down every led by the given scale.
 
CPixelViewfadeLightBy (uint8_t fadefactor)
 Fade every led down by the given scale.
 
CPixelViewnscale8 (uint8_t scaledown)
 Scale every led by the given scale.
 
CPixelViewnscale8 (PIXEL_TYPE &scaledown)
 Scale every led by the given scale.
 
CPixelViewnscale8 (CPixelView &rhs)
 Scale every led in this set by every led in the other set.
 
CPixelViewfadeToBlackBy (uint8_t fade)
 Fade every led down by the given scale.
 
CPixelViewoperator|= (const PIXEL_TYPE &rhs)
 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)
 
CPixelViewoperator|= (const CPixelView &rhs)
 Apply the PIXEL_TYPE |= operator to every pixel in this set with every pixel in the passed in set.
 
CPixelViewoperator|= (uint8_t d)
 Apply the PIXEL_TYPE |= operator to every pixel in this set.
 
CPixelViewoperator&= (const PIXEL_TYPE &rhs)
 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)
 
CPixelViewoperator&= (const CPixelView &rhs)
 Apply the PIXEL_TYPE &= operator to every pixel in this set with every pixel in the passed in set.
 
CPixelViewoperator&= (uint8_t d)
 APply the PIXEL_TYPE &= operator to every pixel in this set with the passed in value.
 

Public Attributes

const int8_t dir
 
const int len
 
PIXEL_TYPE *const leds
 
PIXEL_TYPE *const end_pos
 

Detailed Description

template<class PIXEL_TYPE>
class CPixelView< PIXEL_TYPE >

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.

Definition at line 10 of file pixelset.h.

Constructor & Destructor Documentation

template<class PIXEL_TYPE>
CPixelView< PIXEL_TYPE >::CPixelView ( PIXEL_TYPE *  _leds,
int  _len 
)
inline

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

Parameters
ledspoint to the raw led data
lenhow many leds in this set

Definition at line 26 of file pixelset.h.

template<class PIXEL_TYPE>
CPixelView< PIXEL_TYPE >::CPixelView ( PIXEL_TYPE *  _leds,
int  _start,
int  _end 
)
inline

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

Parameters
ledspoint to the raw led data
startthe start index of the leds for this array
endthe end index of the leds for this array

Definition at line 33 of file pixelset.h.

Member Function Documentation

template<class PIXEL_TYPE>
void CPixelView< PIXEL_TYPE >::dump ( ) const
inline

Serial.print("len: "); Serial.print(len); Serial.print(", dir:"); Serial.print((int)dir); Serial.print(", range:"); Serial.print((uint32_t)leds); Serial.print("-"); Serial.print((uint32_t)end_pos); Serial.print(", diff:"); Serial.print((int32_t)(end_pos - leds)); Serial.println("");

Definition at line 76 of file pixelset.h.

template<class PIXEL_TYPE>
CPixelView CPixelView< PIXEL_TYPE >::operator() ( int  start,
int  end 
)
inline

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)

Parameters
startthe first element from this set for the new subset
endthe last element for the new subset

Definition at line 56 of file pixelset.h.

template<class PIXEL_TYPE>
CPixelView CPixelView< PIXEL_TYPE >::operator- ( )
inline

Access an inclusive subset of the leds in this set, starting from the first.

Parameters
endthe last element for the new subset Not sure i want this? inline CPixelView operator()(int end) { return CPixelView(leds, 0, end); } Return the reverse ordering of this set

Definition at line 63 of file pixelset.h.

template<class PIXEL_TYPE>
CPixelView& CPixelView< PIXEL_TYPE >::operator= ( const PIXEL_TYPE &  color)
inline

Assign the passed in color to all elements in this set.

Parameters
colorthe new color for the elements in the set

Definition at line 70 of file pixelset.h.

template<class PIXEL_TYPE>
CPixelView& CPixelView< PIXEL_TYPE >::operator= ( const CPixelView< PIXEL_TYPE > &  rhs)
inline

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.

Definition at line 87 of file pixelset.h.

template<class PIXEL_TYPE>
bool CPixelView< PIXEL_TYPE >::reversed ( )
inline

Whether or not this set goes backwards.

Returns
whether or not the set is backwards

Definition at line 41 of file pixelset.h.

template<class PIXEL_TYPE>
int CPixelView< PIXEL_TYPE >::size ( )
inline

Get the size of this set.

Returns
the size of the set

Definition at line 37 of file pixelset.h.


The documentation for this class was generated from the following file: