1#ifndef __INC_COLORUTILS_H
2#define __INC_COLORUTILS_H
12#if !defined(FASTLED_USE_32_BIT_GRADIENT_FILL)
14 #define FASTLED_USE_32_BIT_GRADIENT_FILL 0
16 #define FASTLED_USE_32_BIT_GRADIENT_FILL 1
66#define DEFINE_GRADIENT_PALETTE(X) \
68 extern const ::TProgmemRGBGradientPalette_byte X[] FL_PROGMEM =
71#define DECLARE_GRADIENT_PALETTE(X) \
73 extern const ::TProgmemRGBGradientPalette_byte X[] FL_PROGMEM
79#define TProgmemPalette16 TProgmemRGBPalette16
83#define TProgmemPalette32 TProgmemRGBPalette32
114 const struct CRGB& color);
118 const struct CHSV& color);
130 uint8_t deltahue = 5);
135 uint8_t deltahue = 5);
147 uint8_t initialhue,
bool reversed=
false);
151 uint8_t initialhue,
bool reversed=
false);
167#define saccum87 int16_t
187 uint16_t startpos,
CHSV startcolor,
188 uint16_t endpos,
CHSV endcolor,
192 if( endpos < startpos ) {
195 endcolor = startcolor;
206 endcolor.
hue = startcolor.
hue;
214 startcolor.
hue = endcolor.
hue;
221 satdistance87 = (endcolor.
sat - startcolor.
sat) << 7;
222 valdistance87 = (endcolor.
val - startcolor.
val) << 7;
224 uint8_t huedelta8 = endcolor.
hue - startcolor.
hue;
228 if( huedelta8 > 127) {
235 if( huedelta8 < 128) {
241 huedistance87 = huedelta8 << 7;
245 huedistance87 = (uint8_t)(256 - huedelta8) << 7;
246 huedistance87 = -huedistance87;
249 uint16_t pixeldistance = endpos - startpos;
250 int16_t divisor = pixeldistance ? pixeldistance : 1;
252 #if FASTLED_USE_32_BIT_GRADIENT_FILL
254 int32_t huedelta823 = (huedistance87 * 65536) / divisor;
255 int32_t satdelta823 = (satdistance87 * 65536) / divisor;
256 int32_t valdelta823 = (valdistance87 * 65536) / divisor;
261 uint32_t hue824 =
static_cast<uint32_t
>(startcolor.
hue) << 24;
262 uint32_t sat824 =
static_cast<uint32_t
>(startcolor.
sat) << 24;
263 uint32_t val824 =
static_cast<uint32_t
>(startcolor.
val) << 24;
264 for( uint16_t i = startpos; i <= endpos; ++i) {
265 targetArray[i] =
CHSV( hue824 >> 24, sat824 >> 24, val824 >> 24);
266 hue824 += huedelta823;
267 sat824 += satdelta823;
268 val824 += valdelta823;
272 saccum87 huedelta87 = huedistance87 / divisor;
273 saccum87 satdelta87 = satdistance87 / divisor;
274 saccum87 valdelta87 = valdistance87 / divisor;
283 for( uint16_t i = startpos; i <= endpos; ++i) {
284 targetArray[i] =
CHSV( hue88 >> 8, sat88 >> 8, val88 >> 8);
304 uint16_t last = numLeds - 1;
321 uint16_t half = (numLeds / 2);
322 uint16_t last = numLeds - 1;
324 fill_gradient( targetArray, half, c2, last, c3, directionCode);
341 uint16_t onethird = (numLeds / 3);
342 uint16_t twothirds = ((numLeds * 2) / 3);
343 uint16_t last = numLeds - 1;
344 fill_gradient( targetArray, 0, c1, onethird, c2, directionCode);
345 fill_gradient( targetArray, onethird, c2, twothirds, c3, directionCode);
346 fill_gradient( targetArray, twothirds, c3, last, c4, directionCode);
350#define fill_gradient_HSV fill_gradient
363 uint16_t startpos,
CRGB startcolor,
364 uint16_t endpos,
CRGB endcolor );
426void fade_raw(
CRGB* leds, uint16_t num_leds, uint8_t fadeBy);
435void nscale8(
CRGB* leds, uint16_t num_leds, uint8_t scale);
478 uint16_t count,
fract8 amountOfsrc2 );
483 uint16_t count,
fract8 amountOfsrc2,
755 for( uint8_t i = 0; i < 16; ++i) {
766 for( uint8_t i = 0; i < 16; ++i) {
813 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
814 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
815 if( p == q)
return true;
816 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
817 if( *p != *q)
return false;
827 return !( *
this == rhs);
884 c08,c09,c10,c11,c12,c13,c14,c15);
957 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
958 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
959 if( p == q)
return true;
960 for( uint16_t i = 0; i < (
sizeof(
entries)); ++i) {
961 if( *p != *q)
return false;
971 return !( *
this == rhs);
1042 for( uint8_t i = 0; i < 16; ++i) {
1049 for( uint8_t i = 0; i < 16; ++i) {
1056 for( uint8_t i = 0; i < 16; ++i) {
1064 for( uint8_t i = 0; i < 16; ++i) {
1073 for( uint8_t i = 0; i < 16; ++i) {
1080 for( uint8_t i = 0; i < 16; ++i) {
1089 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1090 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1091 if( p == q)
return true;
1092 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1093 if( *p != *q)
return false;
1102 return !( *
this == rhs);
1218 }
while ( u.
index != 255);
1220 int8_t lastSlotUsed = -1;
1223 CRGB rgbstart( u.
r, u.
g, u.
b);
1226 uint8_t istart8 = 0;
1228 while( indexstart < 255) {
1231 int indexend = u.
index;
1233 istart8 = indexstart / 16;
1234 iend8 = indexend / 16;
1236 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
1237 istart8 = lastSlotUsed + 1;
1238 if( iend8 < istart8) {
1242 lastSlotUsed = iend8;
1245 indexstart = indexend;
1262 }
while ( u.
index != 255);
1264 int8_t lastSlotUsed = -1;
1268 CRGB rgbstart( u.
r, u.
g, u.
b);
1271 uint8_t istart8 = 0;
1273 while( indexstart < 255) {
1276 int indexend = u.
index;
1278 istart8 = indexstart / 16;
1279 iend8 = indexend / 16;
1281 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
1282 istart8 = lastSlotUsed + 1;
1283 if( iend8 < istart8) {
1287 lastSlotUsed = iend8;
1290 indexstart = indexend;
1316 for( uint8_t i = 0; i < 2; ++i) {
1339 for( uint8_t i = 0; i < 32; ++i) {
1349 for( uint8_t i = 0; i < 32; ++i) {
1389 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1390 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1391 if( p == q)
return true;
1392 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1393 if( *p != *q)
return false;
1402 return !( *
this == rhs);
1446 for( uint8_t i = 0; i < 2; ++i) {
1480 for( uint8_t i = 0; i < 32; ++i) {
1487 for( uint8_t i = 0; i < 32; ++i) {
1494 for( uint8_t i = 0; i < 32; ++i) {
1502 for( uint8_t i = 0; i < 32; ++i) {
1511 for( uint8_t i = 0; i < 32; ++i) {
1518 for( uint8_t i = 0; i < 32; ++i) {
1527 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1528 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1529 if( p == q)
return true;
1530 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1531 if( *p != *q)
return false;
1540 return !( *
this == rhs);
1657 }
while ( u.
index != 255);
1659 int8_t lastSlotUsed = -1;
1662 CRGB rgbstart( u.
r, u.
g, u.
b);
1665 uint8_t istart8 = 0;
1667 while( indexstart < 255) {
1670 int indexend = u.
index;
1672 istart8 = indexstart / 8;
1673 iend8 = indexend / 8;
1675 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1676 istart8 = lastSlotUsed + 1;
1677 if( iend8 < istart8) {
1681 lastSlotUsed = iend8;
1684 indexstart = indexend;
1700 }
while ( u.
index != 255);
1702 int8_t lastSlotUsed = -1;
1706 CRGB rgbstart( u.
r, u.
g, u.
b);
1709 uint8_t istart8 = 0;
1711 while( indexstart < 255) {
1714 int indexend = u.
index;
1716 istart8 = indexstart / 8;
1717 iend8 = indexend / 8;
1719 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1720 istart8 = lastSlotUsed + 1;
1721 if( iend8 < istart8) {
1725 lastSlotUsed = iend8;
1728 indexstart = indexend;
1756 c08,c09,c10,c11,c12,c13,c14,c15);
1786 for(
int i = 0; i < 256; ++i) {
1793 for(
int i = 0; i < 256; ++i) {
1800 for(
int i = 0; i < 256; ++i) {
1808 for(
int i = 0; i < 256; ++i) {
1843 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1844 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1845 if( p == q)
return true;
1846 for( uint16_t i = 0; i < (
sizeof(
entries)); ++i) {
1847 if( *p != *q)
return false;
1856 return !( *
this == rhs);
1940 CRGB rgbstart( u.
r, u.
g, u.
b);
1943 while( indexstart < 255) {
1946 int indexend = u.
index;
1949 indexstart = indexend;
1960 CRGB rgbstart( u.
r, u.
g, u.
b);
1963 while( indexstart < 255) {
1966 int indexend = u.
index;
1969 indexstart = indexend;
2001 uint8_t brightness=255,
2030 uint8_t brightness=255,
2036 uint8_t brightness=255,
2048 uint8_t brightness=255,
2054 uint8_t brightness=255,
2060 uint8_t brightness=255,
2066 uint8_t brightness=255,
2072 uint8_t brightness=255,
2086template <
typename PALETTE>
2090 uint8_t colorIndex = startIndex;
2091 for( uint16_t i = 0; i < N; ++i) {
2093 colorIndex += incIndex;
2109template <
typename PALETTE>
2112 bool reversed=
false)
2116 const uint16_t colorChange = 65535 / N;
2117 uint16_t colorIndex = ((uint16_t) startIndex) << 8;
2119 for (uint16_t i = 0; i < N; ++i) {
2121 if (reversed) colorIndex -= colorChange;
2122 else colorIndex += colorChange;
2144template <
typename PALETTE>
2146 uint8_t *dataArray, uint16_t dataCount,
2147 CRGB* targetColorArray,
2149 uint8_t brightness=255,
2150 uint8_t opacity=255,
2153 for( uint16_t i = 0; i < dataCount; ++i) {
2154 uint8_t d = dataArray[i];
2156 if( opacity == 255 ) {
2157 targetColorArray[i] = rgb;
2159 targetColorArray[i].
nscale8( 256 - opacity);
2161 targetColorArray[i] += rgb;
2207 uint8_t maxChanges=24);
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.
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.
TProgmemRGBGradientPalette_bytes TProgmemRGBGradientPaletteRef
Alias of TProgmemRGBGradientPalette_bytes.
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.
Wrapper definitions to allow seamless use of PROGMEM in environments that have it.
#define FL_PGM_READ_DWORD_NEAR(x)
Read a double word (32-bit) from PROGMEM memory.
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, const fl::XYMap &xymap)
Perform a blur1d() on every row of a rectangular matrix.
void blurColumns(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const fl::XYMap &xymap)
Perform a blur1d() on every column of a rectangular matrix.
void blur1d(CRGB *leds, uint16_t numLeds, fract8 blur_amount)
One-dimensional blur filter.
void blur2d(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const fl::XYMap &xymap)
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.
TDynamicRGBGradientPalette_bytes TDynamicRGBGradientPaletteRef
Alias of TDynamicRGBGradientPalette_bytes.
uint8_t TDynamicRGBGradientPalette_byte
Byte of an RGB gradient entry, stored in dynamic (heap) memory.
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.
CRGB ColorFromPaletteExtended(const CRGBPalette16 &pal, uint16_t index, uint8_t brightness, TBlendType blendType)
Same as ColorFromPalette, but with uint16_t index to give greater precision.
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 class CRGBPalette16 &srcpal16, class CRGBPalette256 &destpal256)
Convert a 16-entry palette to a 256-entry palette.
#define FASTLED_NAMESPACE_END
End of the FastLED namespace.
#define FASTLED_NAMESPACE_BEGIN
Start of the FastLED namespace.
Includes defintions for RGB and HSV pixels.
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)
FASTLED_FORCE_INLINE CRGB & nscale8_video(uint8_t scaledown)
Scale down a RGB to N/256ths of it's current brightness using "video" dimming rules.
FASTLED_FORCE_INLINE 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.