1#ifndef __INC_COLORUTILS_H
2#define __INC_COLORUTILS_H
11FASTLED_NAMESPACE_BEGIN
26 const struct CRGB& color);
30 const struct CHSV& color);
42 uint8_t deltahue = 5);
47 uint8_t deltahue = 5);
59 uint8_t initialhue,
bool reversed=
false);
63 uint8_t initialhue,
bool reversed=
false);
79#define saccum87 int16_t
99 uint16_t startpos,
CHSV startcolor,
100 uint16_t endpos,
CHSV endcolor,
104 if( endpos < startpos ) {
107 endcolor = startcolor;
118 endcolor.
hue = startcolor.
hue;
126 startcolor.
hue = endcolor.
hue;
133 satdistance87 = (endcolor.
sat - startcolor.
sat) << 7;
134 valdistance87 = (endcolor.
val - startcolor.
val) << 7;
136 uint8_t huedelta8 = endcolor.
hue - startcolor.
hue;
140 if( huedelta8 > 127) {
147 if( huedelta8 < 128) {
153 huedistance87 = huedelta8 << 7;
157 huedistance87 = (uint8_t)(256 - huedelta8) << 7;
158 huedistance87 = -huedistance87;
161 uint16_t pixeldistance = endpos - startpos;
162 int16_t divisor = pixeldistance ? pixeldistance : 1;
164 saccum87 huedelta87 = huedistance87 / divisor;
165 saccum87 satdelta87 = satdistance87 / divisor;
166 saccum87 valdelta87 = valdistance87 / divisor;
175 for( uint16_t i = startpos; i <= endpos; ++i) {
176 targetArray[i] =
CHSV( hue88 >> 8, sat88 >> 8, val88 >> 8);
195 uint16_t last = numLeds - 1;
212 uint16_t half = (numLeds / 2);
213 uint16_t last = numLeds - 1;
215 fill_gradient( targetArray, half, c2, last, c3, directionCode);
232 uint16_t onethird = (numLeds / 3);
233 uint16_t twothirds = ((numLeds * 2) / 3);
234 uint16_t last = numLeds - 1;
235 fill_gradient( targetArray, 0, c1, onethird, c2, directionCode);
236 fill_gradient( targetArray, onethird, c2, twothirds, c3, directionCode);
237 fill_gradient( targetArray, twothirds, c3, last, c4, directionCode);
241#define fill_gradient_HSV fill_gradient
254 uint16_t startpos,
CRGB startcolor,
255 uint16_t endpos,
CRGB endcolor );
317void fade_raw(
CRGB* leds, uint16_t num_leds, uint8_t fadeBy);
326void nscale8(
CRGB* leds, uint16_t num_leds, uint8_t scale);
369 uint16_t count,
fract8 amountOfsrc2 );
374 uint16_t count,
fract8 amountOfsrc2,
558#define TProgmemPalette16 TProgmemRGBPalette16
562#define TProgmemPalette32 TProgmemRGBPalette32
662 for( uint8_t i = 0; i < 16; ++i) {
663 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
673 for( uint8_t i = 0; i < 16; ++i) {
674 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
720 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
721 const uint8_t*
q = (
const uint8_t*)(&(rhs.
entries[0]));
722 if( p ==
q)
return true;
723 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
724 if( *p != *
q)
return false;
734 return !( *
this == rhs);
791 c08,c09,c10,c11,c12,c13,c14,c15);
864 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
865 const uint8_t*
q = (
const uint8_t*)(&(rhs.
entries[0]));
866 if( p ==
q)
return true;
867 for( uint16_t i = 0; i < (
sizeof(
entries)); ++i) {
868 if( *p != *
q)
return false;
878 return !( *
this == rhs);
949 for( uint8_t i = 0; i < 16; ++i) {
956 for( uint8_t i = 0; i < 16; ++i) {
963 for( uint8_t i = 0; i < 16; ++i) {
971 for( uint8_t i = 0; i < 16; ++i) {
980 for( uint8_t i = 0; i < 16; ++i) {
981 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
987 for( uint8_t i = 0; i < 16; ++i) {
988 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
996 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
997 const uint8_t*
q = (
const uint8_t*)(&(rhs.
entries[0]));
998 if( p ==
q)
return true;
999 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1000 if( *p != *
q)
return false;
1009 return !( *
this == rhs);
1123 u.
dword = FL_PGM_READ_DWORD_NEAR(progent + count);
1125 }
while ( u.
index != 255);
1127 int8_t lastSlotUsed = -1;
1129 u.
dword = FL_PGM_READ_DWORD_NEAR( progent);
1130 CRGB rgbstart( u.
r, u.
g, u.
b);
1133 uint8_t istart8 = 0;
1135 while( indexstart < 255) {
1137 u.
dword = FL_PGM_READ_DWORD_NEAR( progent);
1138 int indexend = u.
index;
1140 istart8 = indexstart / 16;
1141 iend8 = indexend / 16;
1143 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
1144 istart8 = lastSlotUsed + 1;
1145 if( iend8 < istart8) {
1149 lastSlotUsed = iend8;
1152 indexstart = indexend;
1169 }
while ( u.
index != 255);
1171 int8_t lastSlotUsed = -1;
1175 CRGB rgbstart( u.
r, u.
g, u.
b);
1178 uint8_t istart8 = 0;
1180 while( indexstart < 255) {
1183 int indexend = u.
index;
1185 istart8 = indexstart / 16;
1186 iend8 = indexend / 16;
1188 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
1189 istart8 = lastSlotUsed + 1;
1190 if( iend8 < istart8) {
1194 lastSlotUsed = iend8;
1197 indexstart = indexend;
1223 for( uint8_t i = 0; i < 2; ++i) {
1246 for( uint8_t i = 0; i < 32; ++i) {
1247 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
1256 for( uint8_t i = 0; i < 32; ++i) {
1257 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
1296 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1297 const uint8_t*
q = (
const uint8_t*)(&(rhs.
entries[0]));
1298 if( p ==
q)
return true;
1299 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1300 if( *p != *
q)
return false;
1309 return !( *
this == rhs);
1353 for( uint8_t i = 0; i < 2; ++i) {
1387 for( uint8_t i = 0; i < 32; ++i) {
1394 for( uint8_t i = 0; i < 32; ++i) {
1401 for( uint8_t i = 0; i < 32; ++i) {
1409 for( uint8_t i = 0; i < 32; ++i) {
1418 for( uint8_t i = 0; i < 32; ++i) {
1419 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
1425 for( uint8_t i = 0; i < 32; ++i) {
1426 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
1434 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1435 const uint8_t*
q = (
const uint8_t*)(&(rhs.
entries[0]));
1436 if( p ==
q)
return true;
1437 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1438 if( *p != *
q)
return false;
1447 return !( *
this == rhs);
1562 u.
dword = FL_PGM_READ_DWORD_NEAR(progent + count);
1564 }
while ( u.
index != 255);
1566 int8_t lastSlotUsed = -1;
1568 u.
dword = FL_PGM_READ_DWORD_NEAR( progent);
1569 CRGB rgbstart( u.
r, u.
g, u.
b);
1572 uint8_t istart8 = 0;
1574 while( indexstart < 255) {
1576 u.
dword = FL_PGM_READ_DWORD_NEAR( progent);
1577 int indexend = u.
index;
1579 istart8 = indexstart / 8;
1580 iend8 = indexend / 8;
1582 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1583 istart8 = lastSlotUsed + 1;
1584 if( iend8 < istart8) {
1588 lastSlotUsed = iend8;
1591 indexstart = indexend;
1607 }
while ( u.
index != 255);
1609 int8_t lastSlotUsed = -1;
1613 CRGB rgbstart( u.
r, u.
g, u.
b);
1616 uint8_t istart8 = 0;
1618 while( indexstart < 255) {
1621 int indexend = u.
index;
1623 istart8 = indexstart / 8;
1624 iend8 = indexend / 8;
1626 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1627 istart8 = lastSlotUsed + 1;
1628 if( iend8 < istart8) {
1632 lastSlotUsed = iend8;
1635 indexstart = indexend;
1663 c08,c09,c10,c11,c12,c13,c14,c15);
1693 for(
int i = 0; i < 256; ++i) {
1700 for(
int i = 0; i < 256; ++i) {
1707 for(
int i = 0; i < 256; ++i) {
1715 for(
int i = 0; i < 256; ++i) {
1750 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1751 const uint8_t*
q = (
const uint8_t*)(&(rhs.
entries[0]));
1752 if( p ==
q)
return true;
1753 for( uint16_t i = 0; i < (
sizeof(
entries)); ++i) {
1754 if( *p != *
q)
return false;
1763 return !( *
this == rhs);
1846 u.
dword = FL_PGM_READ_DWORD_NEAR( progent);
1847 CRGB rgbstart( u.
r, u.
g, u.
b);
1850 while( indexstart < 255) {
1852 u.
dword = FL_PGM_READ_DWORD_NEAR( progent);
1853 int indexend = u.
index;
1856 indexstart = indexend;
1867 CRGB rgbstart( u.
r, u.
g, u.
b);
1870 while( indexstart < 255) {
1873 int indexend = u.
index;
1876 indexstart = indexend;
1908 uint8_t brightness=255,
1914 uint8_t brightness=255,
1920 uint8_t brightness=255,
1926 uint8_t brightness=255,
1932 uint8_t brightness=255,
1938 uint8_t brightness=255,
1944 uint8_t brightness=255,
1950 uint8_t brightness=255,
1964template <
typename PALETTE>
1968 uint8_t colorIndex = startIndex;
1969 for( uint16_t i = 0; i < N; ++i) {
1971 colorIndex += incIndex;
1987template <
typename PALETTE>
1990 bool reversed=
false)
1994 const uint16_t colorChange = 65535 / N;
1995 uint16_t colorIndex = ((uint16_t) startIndex) << 8;
1997 for (uint16_t i = 0; i < N; ++i) {
1999 if (reversed) colorIndex -= colorChange;
2000 else colorIndex += colorChange;
2022template <
typename PALETTE>
2024 uint8_t *dataArray, uint16_t dataCount,
2025 CRGB* targetColorArray,
2027 uint8_t brightness=255,
2028 uint8_t opacity=255,
2031 for( uint16_t i = 0; i < dataCount; ++i) {
2032 uint8_t d = dataArray[i];
2034 if( opacity == 255 ) {
2035 targetColorArray[i] = rgb;
2037 targetColorArray[i].
nscale8( 256 - opacity);
2039 targetColorArray[i] += rgb;
2085 uint8_t maxChanges=24);
2134#define DEFINE_GRADIENT_PALETTE(X) \
2136 extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM =
2139#define DECLARE_GRADIENT_PALETTE(X) \
2141 extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM
2227FASTLED_NAMESPACE_END
central include file for FastLED, defines the CFastLED class/object
HSV color palette with 16 discrete values.
CHSVPalette16(const CHSV &c1)
Create palette filled with one color.
CHSVPalette16(const CHSVPalette16 &rhs)
Copy constructor.
CHSVPalette16(const CHSV &c00, const CHSV &c01, const CHSV &c02, const CHSV &c03, const CHSV &c04, const CHSV &c05, const CHSV &c06, const CHSV &c07, const CHSV &c08, const CHSV &c09, const CHSV &c10, const CHSV &c11, const CHSV &c12, const CHSV &c13, const CHSV &c14, const CHSV &c15)
Create palette from 16 CHSV values.
CHSVPalette16 & operator=(const TProgmemHSVPalette16 &rhs)
Create palette from palette stored in PROGMEM.
bool operator==(const CHSVPalette16 &rhs) const
Check if two palettes have the same color entries.
bool operator!=(const CHSVPalette16 &rhs) const
Check if two palettes do not have the same color entries.
CHSVPalette16(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4)
Create palette with four-color gradient.
CHSVPalette16()
Default constructor.
CHSVPalette16(const CHSV &c1, const CHSV &c2)
Create palette with a gradient from one color to another.
CHSV entries[16]
the color entries that make up the palette
CHSVPalette16 & operator=(const CHSVPalette16 &rhs)
Copy constructor.
CHSVPalette16(const CHSV &c1, const CHSV &c2, const CHSV &c3)
Create palette with three-color gradient.
CHSVPalette16(const TProgmemHSVPalette16 &rhs)
Create palette from palette stored in PROGMEM.
CHSV & operator[](uint8_t x)
Array access operator to index into the gradient entries.
HSV color palette with 256 discrete values.
CHSV & operator[](uint8_t x)
Array access operator to index into the gradient entries.
CHSVPalette256()
Default constructor.
CHSVPalette256(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4)
Create palette with four-color gradient.
CHSVPalette256 & operator=(const CHSVPalette256 &rhs)
Copy constructor.
CHSVPalette256(const CHSV &c1)
Create palette filled with one color.
CHSVPalette256(const CHSV &c00, const CHSV &c01, const CHSV &c02, const CHSV &c03, const CHSV &c04, const CHSV &c05, const CHSV &c06, const CHSV &c07, const CHSV &c08, const CHSV &c09, const CHSV &c10, const CHSV &c11, const CHSV &c12, const CHSV &c13, const CHSV &c14, const CHSV &c15)
Create palette from 16 CHSV values.
CHSV entries[256]
the color entries that make up the palette
CHSVPalette256(const CHSVPalette16 &rhs16)
Create upscaled palette from 16-entry palette.
CHSVPalette256(const CHSV &c1, const CHSV &c2, const CHSV &c3)
Create palette with three-color gradient.
CHSVPalette256(const CHSVPalette256 &rhs)
Copy constructor.
CHSVPalette256 & operator=(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
CHSVPalette256(const CHSV &c1, const CHSV &c2)
Create palette with a gradient from one color to another.
bool operator!=(const CHSVPalette256 &rhs) const
Check if two palettes do not have the same color entries.
bool operator==(const CHSVPalette256 &rhs) const
Check if two palettes have the same color entries.
CHSVPalette256 & operator=(const CHSVPalette16 &rhs16)
Create upscaled palette from 16-entry palette.
CHSVPalette256(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
HSV color palette with 32 discrete values.
CHSV entries[32]
the color entries that make up the palette
CHSVPalette32(const TProgmemHSVPalette32 &rhs)
Create palette from palette stored in PROGMEM.
bool operator!=(const CHSVPalette32 &rhs) const
Check if two palettes do not have the same color entries.
CHSVPalette32(const CHSVPalette32 &rhs)
Copy constructor.
CHSVPalette32(const CHSV &c00, const CHSV &c01, const CHSV &c02, const CHSV &c03, const CHSV &c04, const CHSV &c05, const CHSV &c06, const CHSV &c07, const CHSV &c08, const CHSV &c09, const CHSV &c10, const CHSV &c11, const CHSV &c12, const CHSV &c13, const CHSV &c14, const CHSV &c15)
Create palette from 16 CHSV values.
CHSVPalette32 & operator=(const CHSVPalette32 &rhs)
Copy constructor.
CHSVPalette32(const CHSV &c1, const CHSV &c2)
Create palette with a gradient from one color to another.
CHSVPalette32()
Default constructor.
bool operator==(const CHSVPalette32 &rhs) const
Check if two palettes have the same color entries.
CHSVPalette32(const CHSV &c1, const CHSV &c2, const CHSV &c3)
Create palette with three-color gradient.
CHSVPalette32(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4)
Create palette with four-color gradient.
CHSVPalette32 & operator=(const TProgmemHSVPalette32 &rhs)
Create palette from palette stored in PROGMEM.
CHSV & operator[](uint8_t x)
Create palette from palette stored in PROGMEM.
CHSVPalette32(const CHSV &c1)
Create palette filled with one color.
RGB color palette with 16 discrete values.
CRGBPalette16(const CHSV &c1)
Create palette filled with one color.
CRGBPalette16(const CRGB &c1, const CRGB &c2)
Create palette with a gradient from one color to another.
CRGB entries[16]
the color entries that make up the palette
CRGBPalette16(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
bool operator!=(const CRGBPalette16 &rhs) const
Check if two palettes do not have the same color entries.
CRGBPalette16 & operator=(const CHSV rhs[16])
Create palette from array of CHSV colors.
CRGBPalette16(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4)
Create palette with four-color gradient.
CRGBPalette16(const CHSV rhs[16])
Create palette from array of CHSV colors.
bool operator==(const CRGBPalette16 &rhs) const
Check if two palettes have the same color entries.
CRGBPalette16(const CRGB &c00, const CRGB &c01, const CRGB &c02, const CRGB &c03, const CRGB &c04, const CRGB &c05, const CRGB &c06, const CRGB &c07, const CRGB &c08, const CRGB &c09, const CRGB &c10, const CRGB &c11, const CRGB &c12, const CRGB &c13, const CRGB &c14, const CRGB &c15)
Create palette from 16 CRGB values.
CRGBPalette16(const CRGB &c1, const CRGB &c2, const CRGB &c3)
Create palette with three-color gradient.
CRGBPalette16 & operator=(const CRGBPalette16 &rhs)
Copy constructor.
CRGBPalette16(const CHSVPalette16 &rhs)
Create palette from CHSV palette.
CRGBPalette16(const CHSV &c1, const CHSV &c2, const CHSV &c3)
Create palette with three-color gradient.
CRGBPalette16(TProgmemRGBGradientPalette_bytes progpal)
Creates a palette from a gradient palette in PROGMEM.
CRGBPalette16 & operator=(const CHSVPalette16 &rhs)
Create palette from CHSV palette.
CRGBPalette16 & operator=(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
CRGBPalette16(const CRGB rhs[16])
Create palette from array of CRGB colors.
CRGBPalette16(const CHSV &c1, const CHSV &c2)
Create palette with a gradient from one color to another.
CRGBPalette16(const CRGBPalette16 &rhs)
Copy constructor.
CRGBPalette16 & operator=(const CRGB rhs[16])
Create palette from array of CRGB colors.
CRGB & operator[](uint8_t x)
Array access operator to index into the gradient entries.
CRGBPalette16 & loadDynamicGradientPalette(TDynamicRGBGradientPalette_bytes gpal)
Creates a palette from a gradient palette in dynamic (heap) memory.
CRGBPalette16(const CRGB &c1)
Create palette filled with one color.
CRGBPalette16(const CRGB &c1, const CRGB &c2, const CRGB &c3, const CRGB &c4)
Create palette with four-color gradient.
CRGBPalette16()
Default constructor.
CRGBPalette16 & operator=(TProgmemRGBGradientPalette_bytes progpal)
Creates a palette from a gradient palette in PROGMEM.
RGB color palette with 256 discrete values.
CRGBPalette256(const CRGBPalette16 &rhs16)
Create upscaled palette from 16-entry palette.
CRGBPalette256(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4)
Create palette with four-color gradient.
CRGBPalette256(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
CRGBPalette256(const CRGB &c1, const CRGB &c2)
Create palette with a gradient from one color to another.
CRGBPalette256 & operator=(const CHSV rhs[256])
Create palette from array of CHSV colors.
CRGB entries[256]
the color entries that make up the palette
bool operator!=(const CRGBPalette256 &rhs) const
Check if two palettes do not have the same color entries.
CRGBPalette256(const CRGB &c00, const CRGB &c01, const CRGB &c02, const CRGB &c03, const CRGB &c04, const CRGB &c05, const CRGB &c06, const CRGB &c07, const CRGB &c08, const CRGB &c09, const CRGB &c10, const CRGB &c11, const CRGB &c12, const CRGB &c13, const CRGB &c14, const CRGB &c15)
Create palette from 16 CRGB values.
CRGBPalette256(const CRGB &c1, const CRGB &c2, const CRGB &c3, const CRGB &c4)
Create palette with four-color gradient.
CRGBPalette256(const CHSVPalette256 &rhs)
Create palette from CHSV palette.
CRGBPalette256 & loadDynamicGradientPalette(TDynamicRGBGradientPalette_bytes gpal)
Creates a palette from a gradient palette in dynamic (heap) memory.
CRGBPalette256 & operator=(TProgmemRGBGradientPalette_bytes progpal)
Creates a palette from a gradient palette in PROGMEM.
CRGBPalette256 & operator=(const CRGBPalette256 &rhs)
Copy constructor.
CRGBPalette256 & operator=(const CRGBPalette16 &rhs16)
Create upscaled palette from 16-entry palette.
CRGBPalette256(const CHSV &c1, const CHSV &c2)
Create palette with a gradient from one color to another.
CRGBPalette256(const CHSV rhs[256])
Create palette from array of CHSV colors.
CRGBPalette256(const CHSV &c1)
Create palette filled with one color.
CRGBPalette256(const CRGB rhs[256])
Create palette from array of CRGB colors.
CRGBPalette256(const CRGBPalette256 &rhs)
Copy constructor.
CRGBPalette256 & operator=(const CHSVPalette256 &rhs)
Copy constructor.
CRGBPalette256(const CRGB &c1, const CRGB &c2, const CRGB &c3)
Create palette with three-color gradient.
bool operator==(const CRGBPalette256 &rhs) const
Check if two palettes have the same color entries.
CRGBPalette256()
Default constructor.
CRGBPalette256 & operator=(const CRGB rhs[256])
Create palette from array of CRGB colors.
CRGBPalette256(TProgmemRGBGradientPalette_bytes progpal)
Creates a palette from a gradient palette in PROGMEM.
CRGB & operator[](uint8_t x)
Array access operator to index into the gradient entries.
CRGBPalette256(const CHSV &c1, const CHSV &c2, const CHSV &c3)
Create palette with three-color gradient.
CRGBPalette256(const CRGB &c1)
Create palette filled with one color.
CRGBPalette256 & operator=(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
RGB color palette with 32 discrete values.
CRGBPalette32(const CHSV &c1, const CHSV &c2, const CHSV &c3)
Create palette with three-color gradient.
CRGBPalette32(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
bool operator!=(const CRGBPalette32 &rhs) const
Check if two palettes do not have the same color entries.
CRGBPalette32(const CHSV &c1)
Create palette filled with one color.
CRGBPalette32()
Default constructor.
CRGBPalette32 & operator=(const CRGBPalette32 &rhs)
Copy constructor.
bool operator==(const CRGBPalette32 &rhs) const
Check if two palettes have the same color entries.
CRGBPalette32(const CRGB rhs[32])
Create palette from array of CRGB colors.
CRGBPalette32(const CHSV &c1, const CHSV &c2)
Create palette with a gradient from one color to another.
CRGBPalette32(const CRGB &c1, const CRGB &c2, const CRGB &c3)
Create palette with three-color gradient.
CRGBPalette32(const CRGB &c1)
Create palette filled with one color.
CRGBPalette32 & operator=(const CHSVPalette32 &rhs)
Create palette from CHSV palette.
CRGBPalette32 & loadDynamicGradientPalette(TDynamicRGBGradientPalette_bytes gpal)
Creates a palette from a gradient palette in dynamic (heap) memory.
CRGBPalette32(const CRGBPalette32 &rhs)
Copy constructor.
CRGBPalette32(const TProgmemRGBPalette32 &rhs)
Create palette from palette stored in PROGMEM.
CRGBPalette32 & operator=(const CHSV rhs[32])
Create palette from array of CHSV colors.
CRGBPalette32 & operator=(const CRGB rhs[32])
Create palette from array of CRGB colors.
CRGBPalette32 & operator=(const CRGBPalette16 &rhs16)
Create upscaled palette from 16-entry palette.
CRGBPalette32(const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4)
Create palette with four-color gradient.
CRGBPalette32(const CRGBPalette16 &rhs16)
Create upscaled palette from 16-entry palette.
CRGBPalette32 & operator=(const TProgmemRGBPalette32 &rhs)
Create palette from palette stored in PROGMEM.
CRGB & operator[](uint8_t x)
Array access operator to index into the gradient entries.
CRGBPalette32 & operator=(TProgmemRGBGradientPalette_bytes progpal)
Creates a palette from a gradient palette in PROGMEM.
CRGBPalette32(const CRGB &c1, const CRGB &c2, const CRGB &c3, const CRGB &c4)
Create palette with four-color gradient.
CRGBPalette32(const CHSV rhs[32])
Create palette from array of CHSV colors.
CRGBPalette32(const CRGB &c00, const CRGB &c01, const CRGB &c02, const CRGB &c03, const CRGB &c04, const CRGB &c05, const CRGB &c06, const CRGB &c07, const CRGB &c08, const CRGB &c09, const CRGB &c10, const CRGB &c11, const CRGB &c12, const CRGB &c13, const CRGB &c14, const CRGB &c15)
Create palette from 16 CRGB values.
CRGB entries[32]
the color entries that make up the palette
CRGBPalette32(const CHSVPalette32 &rhs)
Create palette from CHSV palette.
CRGBPalette32(TProgmemRGBGradientPalette_bytes progpal)
Creates a palette from a gradient palette in PROGMEM.
CRGBPalette32(const CRGB &c1, const CRGB &c2)
Create palette with a gradient from one color to another.
CRGBPalette32 & operator=(const TProgmemRGBPalette16 &rhs)
Create palette from palette stored in PROGMEM.
Template class for representing fractional ints.
Wrapper definitions to allow seamless use of PROGMEM in environments that have it.
CRGB & nblend(CRGB &existing, const CRGB &overlay, fract8 amountOfOverlay)
Destructively modifies one color, blending in a given fraction of an overlay color.
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
Computes a new color blended some fraction of the way between two other colors.
void blurRows(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount)
Perform a blur1d() on every row of a rectangular matrix.
void blur1d(CRGB *leds, uint16_t numLeds, fract8 blur_amount)
One-dimensional blur filter.
void blurColumns(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount)
Perform a blur1d() on every column of a rectangular matrix.
void blur2d(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount)
Two-dimensional blur filter.
void fadeToBlackBy(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
Reduce the brightness of an array of pixels all at once.
void nscale8_video(CRGB *leds, uint16_t num_leds, uint8_t scale)
Scale the brightness of an array of pixels all at once.
void fade_raw(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
Reduce the brightness of an array of pixels all at once.
void fadeLightBy(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
Reduce the brightness of an array of pixels all at once.
void nscale8(CRGB *leds, uint16_t num_leds, uint8_t scale)
Scale the brightness of an array of pixels all at once.
void fadeUsingColor(CRGB *leds, uint16_t numLeds, const CRGB &colormask)
Reduce the brightness of an array of pixels as thought it were seen through a transparent filter with...
void fade_video(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
Reduce the brightness of an array of pixels all at once.
TGradientDirectionCode
Hue direction for calculating fill gradients.
void fill_rainbow(struct CRGB *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5)
Fill a range of LEDs with a rainbow of colors.
void fill_gradient(T *targetArray, uint16_t startpos, CHSV startcolor, uint16_t endpos, CHSV endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
Fill a range of LEDs with a smooth HSV gradient between two HSV colors.
#define saccum87
ANSI: signed short _Accum.
void fill_gradient_RGB(CRGB *leds, uint16_t startpos, CRGB startcolor, uint16_t endpos, CRGB endcolor)
Fill a range of LEDs with a smooth RGB gradient between two RGB colors.
void fill_rainbow_circular(struct CRGB *targetArray, int numToFill, uint8_t initialhue, bool reversed=false)
Fill a range of LEDs with a rainbow of colors, so that the hues are continuous between the end of the...
void fill_solid(struct CRGB *targetArray, int numToFill, const struct CRGB &color)
Fill a range of LEDs with a solid color.
CRGB HeatColor(uint8_t temperature)
Approximates a "black body radiation" spectrum for a given "heat" level.
@ LONGEST_HUES
Hue goes whichever way is longest.
@ FORWARD_HUES
Hue always goes clockwise around the color wheel.
@ SHORTEST_HUES
Hue goes whichever way is shortest.
@ BACKWARD_HUES
Hue always goes counter-clockwise around the color wheel.
void * memmove8(void *dst, const void *src, uint16_t num)
Faster alternative to memmove() on AVR.
uint16_t accum88
ANSI: unsigned short _Accum. 8 bits int, 8 bits fraction.
uint8_t fract8
ANSI: unsigned short _Fract.
CRGB & napplyGamma_video(CRGB &rgb, float gamma)
Destructively applies a gamma adjustment to a color.
uint8_t applyGamma_video(uint8_t brightness, float gamma)
Applies a gamma adjustment to a color channel.
uint32_t TProgmemRGBPalette32[32]
CRGBPalette32 entries stored in PROGMEM memory.
uint32_t TProgmemRGBPalette16[16]
CRGBPalette16 entries stored in PROGMEM memory.
uint32_t TProgmemHSVPalette32[32]
CHSVPalette32 entries stored in PROGMEM memory.
const TProgmemRGBGradientPalette_byte * TProgmemRGBGradientPalette_bytes
Pointer to bytes of an RGB gradient, stored in PROGMEM memory.
const uint8_t TProgmemRGBGradientPalette_byte
Byte of an RGB gradient, stored in PROGMEM memory.
uint32_t TProgmemHSVPalette16[16]
CHSVPalette16 entries stored in PROGMEM memory.
TDynamicRGBGradientPalette_bytes TDynamicRGBGradientPalettePtr
Alias of TDynamicRGBGradientPalette_bytes.
uint8_t TDynamicRGBGradientPalette_byte
Byte of an RGB gradient entry, stored in dynamic (heap) memory.
TProgmemRGBGradientPalette_bytes TProgmemRGBGradientPalettePtr
Alias of TProgmemRGBGradientPalette_bytes.
const TDynamicRGBGradientPalette_byte * TDynamicRGBGradientPalette_bytes
Pointer to bytes of an RGB gradient, stored in dynamic (heap) memory.
void fill_palette_circular(CRGB *L, uint16_t N, uint8_t startIndex, const PALETTE &pal, uint8_t brightness=255, TBlendType blendType=LINEARBLEND, bool reversed=false)
Fill a range of LEDs with a sequence of entries from a palette, so that the entire palette smoothly c...
void nblendPaletteTowardPalette(CRGBPalette16 ¤tPalette, CRGBPalette16 &targetPalette, uint8_t maxChanges=24)
Alter one palette by making it slightly more like a "target palette".
TBlendType
Color interpolation options for palette.
void fill_palette(CRGB *L, uint16_t N, uint8_t startIndex, uint8_t incIndex, const PALETTE &pal, uint8_t brightness=255, TBlendType blendType=LINEARBLEND)
Fill a range of LEDs with a sequence of entries from a palette.
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness=255, TBlendType blendType=LINEARBLEND)
Get a color from a palette.
void map_data_into_colors_through_palette(uint8_t *dataArray, uint16_t dataCount, CRGB *targetColorArray, const PALETTE &pal, uint8_t brightness=255, uint8_t opacity=255, TBlendType blendType=LINEARBLEND)
Maps an array of palette color indexes into an array of LED colors.
@ NOBLEND
No interpolation between palette entries.
@ LINEARBLEND
Linear interpolation between palette entries, with wrap-around from end to the beginning again.
@ LINEARBLEND_NOWRAP
Linear interpolation between palette entries, but no wrap-around.
void UpscalePalette(const struct CRGBPalette16 &srcpal16, struct CRGBPalette256 &destpal256)
Convert a 16-entry palette to a 256-entry palette.
Definitions for pixel color data structs.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
uint8_t sat
Color saturation.
uint8_t value
Color value (brightness).
uint8_t saturation
Color saturation.
uint8_t val
Color value (brightness).
Representation of an RGB pixel (Red, Green, Blue)
CRGB & nscale8_video(uint8_t scaledown)
Scale down a RGB to N/256ths of it's current brightness using "video" dimming rules.
CRGB & nscale8(uint8_t scaledown)
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
uint8_t red
Red channel value.
uint8_t blue
Blue channel value.
uint8_t green
Green channel value.
Struct for digesting gradient pointer data into its components.
uint8_t g
CRGB::green channel value of the color entry.
uint32_t dword
values as a packed 32-bit double word
uint8_t b
CRGB::blue channel value of the color entry.
uint8_t index
index of the color entry in the gradient
uint8_t r
CRGB::red channel value of the color entry.