1#ifndef __INC_COLORUTILS_H
2#define __INC_COLORUTILS_H
11#include "fl/deprecated.h"
13#if !defined(FASTLED_USE_32_BIT_GRADIENT_FILL)
15 #define FASTLED_USE_32_BIT_GRADIENT_FILL 0
17 #define FASTLED_USE_32_BIT_GRADIENT_FILL 1
21#pragma GCC diagnostic push
22#pragma GCC diagnostic ignored "-Wcast-align"
69#define DEFINE_GRADIENT_PALETTE(X) \
71 extern const ::TProgmemRGBGradientPalette_byte X[] FL_PROGMEM =
74#define DECLARE_GRADIENT_PALETTE(X) \
76 extern const ::TProgmemRGBGradientPalette_byte X[] FL_PROGMEM
82#define TProgmemPalette16 TProgmemRGBPalette16
86#define TProgmemPalette32 TProgmemRGBPalette32
117 const struct CRGB& color);
121 const struct CHSV& color);
133 uint8_t deltahue = 5);
138 uint8_t deltahue = 5);
150 uint8_t initialhue,
bool reversed=
false);
154 uint8_t initialhue,
bool reversed=
false);
170#define saccum87 int16_t
190 uint16_t startpos,
CHSV startcolor,
191 uint16_t endpos,
CHSV endcolor,
195 if( endpos < startpos ) {
198 endcolor = startcolor;
209 endcolor.
hue = startcolor.
hue;
217 startcolor.
hue = endcolor.
hue;
224 satdistance87 = (endcolor.
sat - startcolor.
sat) << 7;
225 valdistance87 = (endcolor.
val - startcolor.
val) << 7;
227 uint8_t huedelta8 = endcolor.
hue - startcolor.
hue;
231 if( huedelta8 > 127) {
238 if( huedelta8 < 128) {
244 huedistance87 = huedelta8 << 7;
248 huedistance87 = (uint8_t)(256 - huedelta8) << 7;
249 huedistance87 = -huedistance87;
252 uint16_t pixeldistance = endpos - startpos;
253 int16_t divisor = pixeldistance ? pixeldistance : 1;
255 #if FASTLED_USE_32_BIT_GRADIENT_FILL
257 int32_t huedelta823 = (huedistance87 * 65536) / divisor;
258 int32_t satdelta823 = (satdistance87 * 65536) / divisor;
259 int32_t valdelta823 = (valdistance87 * 65536) / divisor;
264 uint32_t hue824 =
static_cast<uint32_t
>(startcolor.
hue) << 24;
265 uint32_t sat824 =
static_cast<uint32_t
>(startcolor.
sat) << 24;
266 uint32_t val824 =
static_cast<uint32_t
>(startcolor.
val) << 24;
267 for( uint16_t i = startpos; i <= endpos; ++i) {
268 targetArray[i] =
CHSV( hue824 >> 24, sat824 >> 24, val824 >> 24);
269 hue824 += huedelta823;
270 sat824 += satdelta823;
271 val824 += valdelta823;
275 saccum87 huedelta87 = huedistance87 / divisor;
276 saccum87 satdelta87 = satdistance87 / divisor;
277 saccum87 valdelta87 = valdistance87 / divisor;
286 for( uint16_t i = startpos; i <= endpos; ++i) {
287 targetArray[i] =
CHSV( hue88 >> 8, sat88 >> 8, val88 >> 8);
307 uint16_t last = numLeds - 1;
324 uint16_t half = (numLeds / 2);
325 uint16_t last = numLeds - 1;
327 fill_gradient( targetArray, half, c2, last, c3, directionCode);
344 uint16_t onethird = (numLeds / 3);
345 uint16_t twothirds = ((numLeds * 2) / 3);
346 uint16_t last = numLeds - 1;
347 fill_gradient( targetArray, 0, c1, onethird, c2, directionCode);
348 fill_gradient( targetArray, onethird, c2, twothirds, c3, directionCode);
349 fill_gradient( targetArray, twothirds, c3, last, c4, directionCode);
353#define fill_gradient_HSV fill_gradient
366 uint16_t startpos,
CRGB startcolor,
367 uint16_t endpos,
CRGB endcolor );
429void fade_raw(
CRGB* leds, uint16_t num_leds, uint8_t fadeBy);
438void nscale8(
CRGB* leds, uint16_t num_leds, uint8_t scale);
481 uint16_t count,
fract8 amountOfsrc2 );
486 uint16_t count,
fract8 amountOfsrc2,
556void blur2d(
CRGB* leds, uint8_t width, uint8_t height,
fract8 blur_amount) FASTLED_DEPRECATED(
"Use blur2d(..., const fl::XYMap& xymap) instead");
762 for( uint8_t i = 0; i < 16; ++i) {
773 for( uint8_t i = 0; i < 16; ++i) {
820 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
821 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
822 if( p == q)
return true;
823 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
824 if( *p != *q)
return false;
834 return !( *
this == rhs);
891 c08,c09,c10,c11,c12,c13,c14,c15);
964 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
965 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
966 if( p == q)
return true;
967 for( uint16_t i = 0; i < (
sizeof(
entries)); ++i) {
968 if( *p != *q)
return false;
978 return !( *
this == rhs);
1049 for( uint8_t i = 0; i < 16; ++i) {
1056 for( uint8_t i = 0; i < 16; ++i) {
1063 for( uint8_t i = 0; i < 16; ++i) {
1071 for( uint8_t i = 0; i < 16; ++i) {
1080 for( uint8_t i = 0; i < 16; ++i) {
1087 for( uint8_t i = 0; i < 16; ++i) {
1096 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1097 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1098 if( p == q)
return true;
1099 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1100 if( *p != *q)
return false;
1109 return !( *
this == rhs);
1225 }
while ( u.
index != 255);
1227 int8_t lastSlotUsed = -1;
1230 CRGB rgbstart( u.
r, u.
g, u.
b);
1233 uint8_t istart8 = 0;
1235 while( indexstart < 255) {
1238 int indexend = u.
index;
1240 istart8 = indexstart / 16;
1241 iend8 = indexend / 16;
1243 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
1244 istart8 = lastSlotUsed + 1;
1245 if( iend8 < istart8) {
1249 lastSlotUsed = iend8;
1252 indexstart = indexend;
1269 }
while ( u.
index != 255);
1271 int8_t lastSlotUsed = -1;
1275 CRGB rgbstart( u.
r, u.
g, u.
b);
1278 uint8_t istart8 = 0;
1280 while( indexstart < 255) {
1283 int indexend = u.
index;
1285 istart8 = indexstart / 16;
1286 iend8 = indexend / 16;
1288 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
1289 istart8 = lastSlotUsed + 1;
1290 if( iend8 < istart8) {
1294 lastSlotUsed = iend8;
1297 indexstart = indexend;
1323 for( uint8_t i = 0; i < 2; ++i) {
1346 for( uint8_t i = 0; i < 32; ++i) {
1356 for( uint8_t i = 0; i < 32; ++i) {
1396 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1397 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1398 if( p == q)
return true;
1399 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1400 if( *p != *q)
return false;
1409 return !( *
this == rhs);
1453 for( uint8_t i = 0; i < 2; ++i) {
1487 for( uint8_t i = 0; i < 32; ++i) {
1494 for( uint8_t i = 0; i < 32; ++i) {
1501 for( uint8_t i = 0; i < 32; ++i) {
1509 for( uint8_t i = 0; i < 32; ++i) {
1518 for( uint8_t i = 0; i < 32; ++i) {
1525 for( uint8_t i = 0; i < 32; ++i) {
1534 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1535 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1536 if( p == q)
return true;
1537 for( uint8_t i = 0; i < (
sizeof(
entries)); ++i) {
1538 if( *p != *q)
return false;
1547 return !( *
this == rhs);
1664 }
while ( u.
index != 255);
1666 int8_t lastSlotUsed = -1;
1669 CRGB rgbstart( u.
r, u.
g, u.
b);
1672 uint8_t istart8 = 0;
1674 while( indexstart < 255) {
1677 int indexend = u.
index;
1679 istart8 = indexstart / 8;
1680 iend8 = indexend / 8;
1682 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1683 istart8 = lastSlotUsed + 1;
1684 if( iend8 < istart8) {
1688 lastSlotUsed = iend8;
1691 indexstart = indexend;
1707 }
while ( u.
index != 255);
1709 int8_t lastSlotUsed = -1;
1713 CRGB rgbstart( u.
r, u.
g, u.
b);
1716 uint8_t istart8 = 0;
1718 while( indexstart < 255) {
1721 int indexend = u.
index;
1723 istart8 = indexstart / 8;
1724 iend8 = indexend / 8;
1726 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1727 istart8 = lastSlotUsed + 1;
1728 if( iend8 < istart8) {
1732 lastSlotUsed = iend8;
1735 indexstart = indexend;
1763 c08,c09,c10,c11,c12,c13,c14,c15);
1793 for(
int i = 0; i < 256; ++i) {
1800 for(
int i = 0; i < 256; ++i) {
1807 for(
int i = 0; i < 256; ++i) {
1815 for(
int i = 0; i < 256; ++i) {
1850 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1851 const uint8_t* q = (
const uint8_t*)(&(rhs.
entries[0]));
1852 if( p == q)
return true;
1853 for( uint16_t i = 0; i < (
sizeof(
entries)); ++i) {
1854 if( *p != *q)
return false;
1863 return !( *
this == rhs);
1947 CRGB rgbstart( u.
r, u.
g, u.
b);
1950 while( indexstart < 255) {
1953 int indexend = u.
index;
1956 indexstart = indexend;
1967 CRGB rgbstart( u.
r, u.
g, u.
b);
1970 while( indexstart < 255) {
1973 int indexend = u.
index;
1976 indexstart = indexend;
2008 uint8_t brightness=255,
2037 uint8_t brightness=255,
2043 uint8_t brightness=255,
2055 uint8_t brightness=255,
2061 uint8_t brightness=255,
2067 uint8_t brightness=255,
2073 uint8_t brightness=255,
2079 uint8_t brightness=255,
2093template <
typename PALETTE>
2097 uint8_t colorIndex = startIndex;
2098 for( uint16_t i = 0; i < N; ++i) {
2100 colorIndex += incIndex;
2116template <
typename PALETTE>
2119 bool reversed=
false)
2123 const uint16_t colorChange = 65535 / N;
2124 uint16_t colorIndex = ((uint16_t) startIndex) << 8;
2126 for (uint16_t i = 0; i < N; ++i) {
2128 if (reversed) colorIndex -= colorChange;
2129 else colorIndex += colorChange;
2151template <
typename PALETTE>
2153 uint8_t *dataArray, uint16_t dataCount,
2154 CRGB* targetColorArray,
2156 uint8_t brightness=255,
2157 uint8_t opacity=255,
2160 for( uint16_t i = 0; i < dataCount; ++i) {
2161 uint8_t d = dataArray[i];
2163 if( opacity == 255 ) {
2164 targetColorArray[i] = rgb;
2166 targetColorArray[i].
nscale8( 256 - opacity);
2168 targetColorArray[i] += rgb;
2214 uint8_t maxChanges=24);
2306#pragma GCC diagnostic pop
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.
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.