10 FASTLED_NAMESPACE_BEGIN
68 inline CHSV& setHSV(uint8_t ih, uint8_t is, uint8_t iv)
__attribute__((always_inline))
128 : r(ir), g(ig), b(ib)
134 : r((colorcode >> 16) & 0xFF), g((colorcode >> 8) & 0xFF), b((colorcode >> 0) & 0xFF)
140 : r((colorcode >> 16) & 0xFF), g((colorcode >> 8) & 0xFF), b((colorcode >> 0) & 0xFF)
147 : r((colorcode >> 16) & 0xFF), g((colorcode >> 8) & 0xFF), b((colorcode >> 0) & 0xFF)
178 r = (colorcode >> 16) & 0xFF;
179 g = (colorcode >> 8) & 0xFF;
180 b = (colorcode >> 0) & 0xFF;
217 r = (colorcode >> 16) & 0xFF;
218 g = (colorcode >> 8) & 0xFF;
219 b = (colorcode >> 0) & 0xFF;
227 r =
qadd8( r, rhs.r);
228 g =
qadd8( g, rhs.g);
229 b =
qadd8( b, rhs.b);
248 r =
qsub8( r, rhs.r);
249 g =
qsub8( g, rhs.g);
250 b =
qsub8( b, rhs.b);
390 if( rhs.r > r) r = rhs.r;
391 if( rhs.g > g) g = rhs.g;
392 if( rhs.b > b) b = rhs.b;
408 if( rhs.r < r) r = rhs.r;
409 if( rhs.g < g) g = rhs.g;
410 if( rhs.b < b) b = rhs.b;
439 #if (defined SmartMatrix_h || defined SmartMatrix3_h)
440 operator rgb24()
const {
464 #if FASTLED_SCALE8_FIXED == 1
465 const uint8_t eightyfive = 85;
467 const uint8_t eightyfive = 86;
479 if( green > max) max = green;
480 if( blue > max) max = blue;
481 uint16_t factor = ((uint16_t)(limit) * 256) / max;
482 red = (red * factor) / 256;
483 green = (green * factor) / 256;
484 blue = (blue * factor) / 256;
515 uint8_t sum = r + g + b;
546 if( parity == curparity)
return;
550 if( (b > 0) && (b < 255)) {
551 if( r == g && g == b) {
556 }
else if( (r > 0) && (r < 255)) {
558 }
else if( (g > 0) && (g < 255)) {
561 if( r == g && g == b) {
570 if( r == g && g == b) {
580 if( r == g && g == b) {
593 AntiqueWhite=0xFAEBD7,
600 BlanchedAlmond=0xFFEBCD,
609 CornflowerBlue=0x6495ED,
615 DarkGoldenrod=0xB8860B,
620 DarkMagenta=0x8B008B,
621 DarkOliveGreen=0x556B2F,
626 DarkSeaGreen=0x8FBC8F,
627 DarkSlateBlue=0x483D8B,
628 DarkSlateGray=0x2F4F4F,
629 DarkSlateGrey=0x2F4F4F,
630 DarkTurquoise=0x00CED1,
633 DeepSkyBlue=0x00BFFF,
638 FloralWhite=0xFFFAF0,
639 ForestGreen=0x228B22,
648 GreenYellow=0xADFF2F,
656 LavenderBlush=0xFFF0F5,
658 LemonChiffon=0xFFFACD,
662 LightGoldenrodYellow=0xFAFAD2,
666 LightSalmon=0xFFA07A,
667 LightSeaGreen=0x20B2AA,
668 LightSkyBlue=0x87CEFA,
669 LightSlateGray=0x778899,
670 LightSlateGrey=0x778899,
671 LightSteelBlue=0xB0C4DE,
672 LightYellow=0xFFFFE0,
678 MediumAquamarine=0x66CDAA,
680 MediumOrchid=0xBA55D3,
681 MediumPurple=0x9370DB,
682 MediumSeaGreen=0x3CB371,
683 MediumSlateBlue=0x7B68EE,
684 MediumSpringGreen=0x00FA9A,
685 MediumTurquoise=0x48D1CC,
686 MediumVioletRed=0xC71585,
687 MidnightBlue=0x191970,
691 NavajoWhite=0xFFDEAD,
699 PaleGoldenrod=0xEEE8AA,
701 PaleTurquoise=0xAFEEEE,
702 PaleVioletRed=0xDB7093,
714 SaddleBrown=0x8B4513,
726 SpringGreen=0x00FF7F,
738 YellowGreen=0x9ACD32,
746 FairyLightNCC=0xFF9D2A
754 return (lhs.r == rhs.r) && (lhs.g == rhs.g) && (lhs.b == rhs.b);
759 return !(lhs == rhs);
765 sl = lhs.r + lhs.g + lhs.b;
766 sr = rhs.r + rhs.g + rhs.b;
773 sl = lhs.r + lhs.g + lhs.b;
774 sr = rhs.r + rhs.g + rhs.b;
781 sl = lhs.r + lhs.g + lhs.b;
782 sr = rhs.r + rhs.g + rhs.b;
789 sl = lhs.r + lhs.g + lhs.b;
790 sr = rhs.r + rhs.g + rhs.b;
812 inline
CRGB operator*( const
CRGB& p1, uint8_t d)
820 inline
CRGB operator/( const
CRGB& p1, uint8_t d)
822 return CRGB( p1.r/d, p1.g/d, p1.b/d);
829 return CRGB( p1.r < p2.r ? p1.r : p2.r,
830 p1.g < p2.g ? p1.g : p2.g,
831 p1.b < p2.b ? p1.b : p2.b);
837 return CRGB( p1.r > p2.r ? p1.r : p2.r,
838 p1.g > p2.g ? p1.g : p2.g,
839 p1.b > p2.b ? p1.b : p2.b);
843 inline
CRGB operator%( const
CRGB& p1, uint8_t d)
846 retval.nscale8_video( d);
864 FASTLED_NAMESPACE_END
CRGB & setHue(uint8_t hue) __attribute__((always_inline))
allow assignment from just a Hue, saturation and value automatically at max.
CRGB & nscale8(const CRGB &scaledown)
scale down a RGB to N 256ths of it's current brightness, using 'plain math' dimming rules...
uint8_t getLuma() const
Get the 'luma' of a CRGB object - aka roughly how much light the CRGB pixel is putting out (from 0 to...
CRGB & operator/=(uint8_t d)
divide each of the channels by a constant
HSVHue
Pre-defined hue values for HSV objects.
Representation of an RGB pixel (Red, Green, Blue)
CHSV() __attribute__((always_inline))
default values are UNITIALIZED
CRGB & setHSV(uint8_t hue, uint8_t sat, uint8_t val) __attribute__((always_inline))
allow assignment from H, S, and V
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
subtract one byte from another, saturating at 0x00
LIB8STATIC uint8_t lerp8by8(uint8_t a, uint8_t b, fract8 frac)
linear interpolation between two unsigned 8-bit values, with 8-bit fraction
CRGB lerp8(CRGB &other, fract8 frac)
return a new CRGB object after performing a linear interpolation between this object and the passed i...
uint16_t fract16
ANSI: unsigned _Fract.
LIB8STATIC uint16_t lerp16by16(uint16_t a, uint16_t b, fract16 frac)
linear interpolation between two unsigned 16-bit values, with 16-bit fraction
CRGB operator-()
invert each channel
LIB8STATIC_ALWAYS_INLINE uint8_t qmul8(uint8_t i, uint8_t j)
saturating 8x8 bit multiplication, with 8 bit result
uint8_t getParity()
getParity returns 0 or 1, depending on the lowest bit of the sum of the color components.
CRGB & subtractFromRGB(uint8_t d)
subtract a constant from each channel, saturating at 0x00 this is NOT an operator+= overload because ...
CRGB & setColorCode(uint32_t colorcode) __attribute__((always_inline))
allow assignment from 32-bit (really 24-bit) 0xRRGGBB color code
CRGB(ColorTemperature colorcode) __attribute__((always_inline))
allow construction from a ColorTemperature enum
CRGB & operator%=(uint8_t scaledown)
%= is a synonym for nscale8_video.
CRGB & setRGB(uint8_t nr, uint8_t ng, uint8_t nb) __attribute__((always_inline))
allow assignment from R, G, and B
CRGB & operator>>=(uint8_t d)
right shift each of the channels by a constant
CRGB & operator-=(const CRGB &rhs)
subtract one RGB from another, saturating at 0x00 for each channel
CRGB(const CHSV &rhs) __attribute__((always_inline))
allow construction from HSV color
LIB8STATIC void nscale8x3_video(uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale)
scale three one byte values by a fourth one, which is treated as the numerator of a fraction whose de...
CRGB & operator|=(const CRGB &rhs)
"or" operator brings each channel up to the higher of the two values
CRGB(const CRGB &rhs) __attribute__((always_inline))
allow copy construction
uint8_t fract8
ANSI unsigned short _Fract.
CRGB(uint8_t ir, uint8_t ig, uint8_t ib) __attribute__((always_inline))
allow construction from R, G, B
CRGB & fadeToBlackBy(uint8_t fadefactor)
fadeToBlackBy is a synonym for nscale8( ..., 255-fadefactor)
CRGB & nscale8_video(uint8_t scaledown)
scale down a RGB to N 256ths of it's current brightness, using 'video' dimming rules, which means that unless the scale factor is ZERO each channel is guaranteed NOT to dim down to zero.
CRGB & operator--() __attribute__((always_inline))
subtract a constant of '1' from each channel, saturating at 0x00
CRGB & nscale8(uint8_t scaledown)
scale down a RGB to N 256ths of it's current brightness, using 'plain math' dimming rules...
uint8_t getAverageLight() const
Get the average of the R, G, and B values.
CRGB & operator+=(const CRGB &rhs)
add one RGB to another, saturating at 0xFF for each channel
CRGB & operator++() __attribute__((always_inline))
add a constant of '1' from each channel, saturating at 0xFF
central include file for FastLED, defines the CFastLED class/object
CRGB & operator*=(uint8_t d)
multiply each of the channels by a constant, saturating each channel at 0xFF
contains definitions for color correction and temperature
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
add one byte to another, saturating at 0xFF
void maximizeBrightness(uint8_t limit=255)
maximize the brightness of this CRGB object
CRGB & operator&=(const CRGB &rhs)
"and" operator brings each channel down to the lower of the two values
CRGB & fadeLightBy(uint8_t fadefactor)
fadeLightBy is a synonym for nscale8_video( ..., 255-fadefactor)
CRGB & operator=(const CRGB &rhs) __attribute__((always_inline))
allow assignment from one RGB struct to another
void hsv2rgb_rainbow(const CHSV &hsv, CRGB &rgb)
Forward declaration of hsv2rgb_rainbow here, to avoid circular dependencies.
CRGB(LEDColorCorrection colorcode) __attribute__((always_inline))
allow construction from a LEDColorCorrection enum
CRGB lerp16(CRGB &other, fract16 frac)
return a new CRGB object after performing a linear interpolation between this object and the passed i...
CRGB scale8(const CRGB &scaledown) const
return a CRGB object that is a scaled down version of this object
LIB8STATIC void nscale8x3(uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale)
scale three one byte values by a fourth one, which is treated as the numerator of a fraction whose de...
__attribute__((always_inline)) bool operator
Do an 8byte by 8bit rotation.
CRGB(uint32_t colorcode) __attribute__((always_inline))
allow construction from 32-bit (really 24-bit) bit 0xRRGGBB color code
void setParity(uint8_t parity)
setParity adjusts the color in the smallest way possible so that the parity of the color is now the d...
CRGB & addToRGB(uint8_t d)
add a contstant to each channel, saturating at 0xFF this is NOT an operator+= overload because the co...
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
uint8_t & operator[](uint8_t x) __attribute__((always_inline))
Array access operator to index into the crgb object.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_LEAVING_R1_DIRTY(uint8_t i, fract8 scale)
This version of scale8 does not clean up the R1 register on AVR If you are doing several 'scale8's in...
CHSV(const CHSV &rhs) __attribute__((always_inline))
allow copy construction
HTMLColorCode
Predefined RGB colors.
CHSV(uint8_t ih, uint8_t is, uint8_t iv) __attribute__((always_inline))
allow construction from H, S, V