1 #ifndef __INC_COLORUTILS_H
2 #define __INC_COLORUTILS_H
8 #include "pixeltypes.h"
11 FASTLED_NAMESPACE_BEGIN
19 const struct CRGB& color);
24 const struct CHSV& hsvColor);
31 uint8_t deltahue = 5);
37 uint8_t deltahue = 5);
63 typedef enum { FORWARD_HUES, BACKWARD_HUES, SHORTEST_HUES, LONGEST_HUES } TGradientDirectionCode;
67 #define saccum87 int16_t
95 uint16_t startpos,
CHSV startcolor,
96 uint16_t endpos,
CHSV endcolor,
97 TGradientDirectionCode directionCode = SHORTEST_HUES )
100 if( endpos < startpos ) {
103 endcolor = startcolor;
113 if( endcolor.value == 0 || endcolor.saturation == 0) {
114 endcolor.hue = startcolor.hue;
121 if( startcolor.value == 0 || startcolor.saturation == 0) {
122 startcolor.hue = endcolor.hue;
125 saccum87 huedistance87;
126 saccum87 satdistance87;
127 saccum87 valdistance87;
129 satdistance87 = (endcolor.sat - startcolor.sat) << 7;
130 valdistance87 = (endcolor.val - startcolor.val) << 7;
132 uint8_t huedelta8 = endcolor.hue - startcolor.hue;
134 if( directionCode == SHORTEST_HUES ) {
135 directionCode = FORWARD_HUES;
136 if( huedelta8 > 127) {
137 directionCode = BACKWARD_HUES;
141 if( directionCode == LONGEST_HUES ) {
142 directionCode = FORWARD_HUES;
143 if( huedelta8 < 128) {
144 directionCode = BACKWARD_HUES;
148 if( directionCode == FORWARD_HUES) {
149 huedistance87 = huedelta8 << 7;
153 huedistance87 = (uint8_t)(256 - huedelta8) << 7;
154 huedistance87 = -huedistance87;
157 uint16_t pixeldistance = endpos - startpos;
158 int16_t divisor = pixeldistance ? pixeldistance : 1;
160 saccum87 huedelta87 = huedistance87 / divisor;
161 saccum87 satdelta87 = satdistance87 / divisor;
162 saccum87 valdelta87 = valdistance87 / divisor;
168 accum88 hue88 = startcolor.hue << 8;
169 accum88 sat88 = startcolor.sat << 8;
170 accum88 val88 = startcolor.val << 8;
171 for( uint16_t i = startpos; i <= endpos; i++) {
172 targetArray[i] =
CHSV( hue88 >> 8, sat88 >> 8, val88 >> 8);
182 template <
typename T>
184 TGradientDirectionCode directionCode = SHORTEST_HUES )
186 uint16_t last = numLeds - 1;
190 template <
typename T>
193 TGradientDirectionCode directionCode = SHORTEST_HUES )
195 uint16_t half = (numLeds / 2);
196 uint16_t last = numLeds - 1;
198 fill_gradient( targetArray, half, c2, last, c3, directionCode);
201 template <
typename T>
204 TGradientDirectionCode directionCode = SHORTEST_HUES )
206 uint16_t onethird = (numLeds / 3);
207 uint16_t twothirds = ((numLeds * 2) / 3);
208 uint16_t last = numLeds - 1;
209 fill_gradient( targetArray, 0, c1, onethird, c2, directionCode);
210 fill_gradient( targetArray, onethird, c2, twothirds, c3, directionCode);
211 fill_gradient( targetArray, twothirds, c3, last, c4, directionCode);
215 #define fill_gradient_HSV fill_gradient
223 void fill_gradient_RGB(
CRGB* leds,
224 uint16_t startpos,
CRGB startcolor,
225 uint16_t endpos,
CRGB endcolor );
226 void fill_gradient_RGB(
CRGB* leds, uint16_t numLeds,
const CRGB& c1,
const CRGB& c2);
227 void fill_gradient_RGB(
CRGB* leds, uint16_t numLeds,
const CRGB& c1,
const CRGB& c2,
const CRGB& c3);
228 void fill_gradient_RGB(
CRGB* leds, uint16_t numLeds,
const CRGB& c1,
const CRGB& c2,
const CRGB& c3,
const CRGB& c4);
235 void fadeLightBy(
CRGB* leds, uint16_t num_leds, uint8_t fadeBy);
236 void fade_video(
CRGB* leds, uint16_t num_leds, uint8_t fadeBy);
241 void nscale8_video(
CRGB* leds, uint16_t num_leds, uint8_t scale);
248 void fadeToBlackBy(
CRGB* leds, uint16_t num_leds, uint8_t fadeBy);
249 void fade_raw(
CRGB* leds, uint16_t num_leds, uint8_t fadeBy);
254 void nscale8(
CRGB* leds, uint16_t num_leds, uint8_t scale);
268 void fadeUsingColor(
CRGB* leds, uint16_t numLeds,
const CRGB& colormask);
278 TGradientDirectionCode directionCode = SHORTEST_HUES );
285 uint16_t count,
fract8 amountOfsrc2 );
288 uint16_t count,
fract8 amountOfsrc2,
289 TGradientDirectionCode directionCode = SHORTEST_HUES );
296 TGradientDirectionCode directionCode = SHORTEST_HUES );
300 void nblend(
CRGB* existing,
CRGB* overlay, uint16_t count,
fract8 amountOfOverlay);
302 void nblend(
CHSV* existing,
CHSV* overlay, uint16_t count,
fract8 amountOfOverlay,
303 TGradientDirectionCode directionCode = SHORTEST_HUES);
319 void blur1d(
CRGB* leds, uint16_t numLeds,
fract8 blur_amount);
320 void blur2d(
CRGB* leds, uint8_t width, uint8_t height,
fract8 blur_amount);
323 void blurRows(
CRGB* leds, uint8_t width, uint8_t height,
fract8 blur_amount);
325 void blurColumns(
CRGB* leds, uint8_t width, uint8_t height,
fract8 blur_amount);
335 CRGB HeatColor( uint8_t temperature);
400 typedef uint32_t TProgmemRGBPalette16[16];
401 typedef uint32_t TProgmemHSVPalette16[16];
402 #define TProgmemPalette16 TProgmemRGBPalette16
403 typedef uint32_t TProgmemRGBPalette32[32];
404 typedef uint32_t TProgmemHSVPalette32[32];
405 #define TProgmemPalette32 TProgmemRGBPalette32
407 typedef const uint8_t TProgmemRGBGradientPalette_byte ;
408 typedef const TProgmemRGBGradientPalette_byte *TProgmemRGBGradientPalette_bytes;
409 typedef TProgmemRGBGradientPalette_bytes TProgmemRGBGradientPalettePtr;
421 typedef uint8_t TDynamicRGBGradientPalette_byte ;
422 typedef const TDynamicRGBGradientPalette_byte *TDynamicRGBGradientPalette_bytes;
423 typedef TDynamicRGBGradientPalette_bytes TDynamicRGBGradientPalettePtr;
447 entries[0]=c00; entries[1]=c01; entries[2]=c02; entries[3]=c03;
448 entries[4]=c04; entries[5]=c05; entries[6]=c06; entries[7]=c07;
449 entries[8]=c08; entries[9]=c09; entries[10]=c10; entries[11]=c11;
450 entries[12]=c12; entries[13]=c13; entries[14]=c14; entries[15]=c15;
455 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
459 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
465 for( uint8_t i = 0; i < 16; i++) {
466 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
467 entries[i].hue = xyz.red;
468 entries[i].sat = xyz.green;
469 entries[i].val = xyz.blue;
474 for( uint8_t i = 0; i < 16; i++) {
475 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
476 entries[i].hue = xyz.red;
477 entries[i].sat = xyz.green;
478 entries[i].val = xyz.blue;
494 return entries[(uint8_t)x];
498 return entries[(uint8_t)x];
503 return &(entries[0]);
508 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
509 const uint8_t*
q = (
const uint8_t*)(&(rhs.entries[0]));
510 if( p == q)
return true;
511 for( uint8_t i = 0; i < (
sizeof( entries)); i++) {
512 if( *p != *q)
return false;
520 return !( *
this == rhs);
552 c08,c09,c10,c11,c12,c13,c14,c15);
558 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
562 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
568 UpscalePalette( rhs16, *
this);
572 UpscalePalette( rhs16, *
this);
599 return entries[(uint8_t)x];
603 return entries[(uint8_t)x];
608 return &(entries[0]);
613 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
614 const uint8_t*
q = (
const uint8_t*)(&(rhs.entries[0]));
615 if( p == q)
return true;
616 for( uint16_t i = 0; i < (
sizeof( entries)); i++) {
617 if( *p != *q)
return false;
625 return !( *
this == rhs);
655 entries[0]=c00; entries[1]=c01; entries[2]=c02; entries[3]=c03;
656 entries[4]=c04; entries[5]=c05; entries[6]=c06; entries[7]=c07;
657 entries[8]=c08; entries[9]=c09; entries[10]=c10; entries[11]=c11;
658 entries[12]=c12; entries[13]=c13; entries[14]=c14; entries[15]=c15;
663 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
667 memmove8( &(entries[0]), &(rhs[0]),
sizeof( entries));
671 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
676 memmove8( &(entries[0]), &(rhs[0]),
sizeof( entries));
682 for( uint8_t i = 0; i < 16; i++) {
683 entries[i] = rhs.entries[i];
688 for( uint8_t i = 0; i < 16; i++) {
694 for( uint8_t i = 0; i < 16; i++) {
695 entries[i] = rhs.entries[i];
701 for( uint8_t i = 0; i < 16; i++) {
709 for( uint8_t i = 0; i < 16; i++) {
710 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
715 for( uint8_t i = 0; i < 16; i++) {
716 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
723 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
724 const uint8_t*
q = (
const uint8_t*)(&(rhs.entries[0]));
725 if( p == q)
return true;
726 for( uint8_t i = 0; i < (
sizeof( entries)); i++) {
727 if( *p != *q)
return false;
735 return !( *
this == rhs);
749 return entries[(uint8_t)x];
753 return entries[(uint8_t)x];
758 return &(entries[0]);
784 fill_gradient_RGB( &(entries[0]), 16, c1, c2);
788 fill_gradient_RGB( &(entries[0]), 16, c1, c2, c3);
792 fill_gradient_RGB( &(entries[0]), 16, c1, c2, c3, c4);
822 CRGBPalette16& operator=( TProgmemRGBGradientPalette_bytes progpal )
830 u.dword = FL_PGM_READ_DWORD_NEAR(progent + count);
832 }
while ( u.index != 255);
834 int8_t lastSlotUsed = -1;
836 u.dword = FL_PGM_READ_DWORD_NEAR( progent);
837 CRGB rgbstart( u.r, u.g, u.b);
842 while( indexstart < 255) {
844 u.dword = FL_PGM_READ_DWORD_NEAR( progent);
845 int indexend = u.index;
846 CRGB rgbend( u.r, u.g, u.b);
847 istart8 = indexstart / 16;
848 iend8 = indexend / 16;
850 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
851 istart8 = lastSlotUsed + 1;
852 if( iend8 < istart8) {
856 lastSlotUsed = iend8;
858 fill_gradient_RGB( &(entries[0]), istart8, rgbstart, iend8, rgbend);
859 indexstart = indexend;
864 CRGBPalette16& loadDynamicGradientPalette( TDynamicRGBGradientPalette_bytes gpal )
874 }
while ( u.index != 255);
876 int8_t lastSlotUsed = -1;
880 CRGB rgbstart( u.r, u.g, u.b);
885 while( indexstart < 255) {
888 int indexend = u.index;
889 CRGB rgbend( u.r, u.g, u.b);
890 istart8 = indexstart / 16;
891 iend8 = indexend / 16;
893 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
894 istart8 = lastSlotUsed + 1;
895 if( iend8 < istart8) {
899 lastSlotUsed = iend8;
901 fill_gradient_RGB( &(entries[0]), istart8, rgbstart, iend8, rgbend);
902 indexstart = indexend;
921 for( uint8_t i = 0; i < 2; i++) {
922 entries[0+i]=c00; entries[2+i]=c01; entries[4+i]=c02; entries[6+i]=c03;
923 entries[8+i]=c04; entries[10+i]=c05; entries[12+i]=c06; entries[14+i]=c07;
924 entries[16+i]=c08; entries[18+i]=c09; entries[20+i]=c10; entries[22+i]=c11;
925 entries[24+i]=c12; entries[26+i]=c13; entries[28+i]=c14; entries[30+i]=c15;
931 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
935 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
941 for( uint8_t i = 0; i < 32; i++) {
942 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
943 entries[i].hue = xyz.red;
944 entries[i].sat = xyz.green;
945 entries[i].val = xyz.blue;
950 for( uint8_t i = 0; i < 32; i++) {
951 CRGB xyz = FL_PGM_READ_DWORD_NEAR( rhs + i);
952 entries[i].hue = xyz.red;
953 entries[i].sat = xyz.green;
954 entries[i].val = xyz.blue;
970 return entries[(uint8_t)x];
974 return entries[(uint8_t)x];
979 return &(entries[0]);
984 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
985 const uint8_t*
q = (
const uint8_t*)(&(rhs.entries[0]));
986 if( p == q)
return true;
987 for( uint8_t i = 0; i < (
sizeof( entries)); i++) {
988 if( *p != *q)
return false;
996 return !( *
this == rhs);
1027 for( uint8_t i = 0; i < 2; i++) {
1028 entries[0+i]=c00; entries[2+i]=c01; entries[4+i]=c02; entries[6+i]=c03;
1029 entries[8+i]=c04; entries[10+i]=c05; entries[12+i]=c06; entries[14+i]=c07;
1030 entries[16+i]=c08; entries[18+i]=c09; entries[20+i]=c10; entries[22+i]=c11;
1031 entries[24+i]=c12; entries[26+i]=c13; entries[28+i]=c14; entries[30+i]=c15;
1037 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
1041 memmove8( &(entries[0]), &(rhs[0]),
sizeof( entries));
1045 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
1050 memmove8( &(entries[0]), &(rhs[0]),
sizeof( entries));
1056 for( uint8_t i = 0; i < 32; i++) {
1057 entries[i] = rhs.entries[i];
1062 for( uint8_t i = 0; i < 32; i++) {
1063 entries[i] = rhs[i];
1068 for( uint8_t i = 0; i < 32; i++) {
1069 entries[i] = rhs.entries[i];
1075 for( uint8_t i = 0; i < 32; i++) {
1076 entries[i] = rhs[i];
1083 for( uint8_t i = 0; i < 32; i++) {
1084 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
1089 for( uint8_t i = 0; i < 32; i++) {
1090 entries[i] = FL_PGM_READ_DWORD_NEAR( rhs + i);
1097 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1098 const uint8_t*
q = (
const uint8_t*)(&(rhs.entries[0]));
1099 if( p == q)
return true;
1100 for( uint8_t i = 0; i < (
sizeof( entries)); i++) {
1101 if( *p != *q)
return false;
1109 return !( *
this == rhs);
1123 return entries[(uint8_t)x];
1127 return entries[(uint8_t)x];
1132 return &(entries[0]);
1158 fill_gradient_RGB( &(entries[0]), 32, c1, c2);
1162 fill_gradient_RGB( &(entries[0]), 32, c1, c2, c3);
1166 fill_gradient_RGB( &(entries[0]), 32, c1, c2, c3, c4);
1172 UpscalePalette( rhs16, *
this);
1176 UpscalePalette( rhs16, *
this);
1219 CRGBPalette32& operator=( TProgmemRGBGradientPalette_bytes progpal )
1227 u.dword = FL_PGM_READ_DWORD_NEAR(progent + count);
1229 }
while ( u.index != 255);
1231 int8_t lastSlotUsed = -1;
1233 u.dword = FL_PGM_READ_DWORD_NEAR( progent);
1234 CRGB rgbstart( u.r, u.g, u.b);
1237 uint8_t istart8 = 0;
1239 while( indexstart < 255) {
1241 u.dword = FL_PGM_READ_DWORD_NEAR( progent);
1242 int indexend = u.index;
1243 CRGB rgbend( u.r, u.g, u.b);
1244 istart8 = indexstart / 8;
1245 iend8 = indexend / 8;
1247 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1248 istart8 = lastSlotUsed + 1;
1249 if( iend8 < istart8) {
1253 lastSlotUsed = iend8;
1255 fill_gradient_RGB( &(entries[0]), istart8, rgbstart, iend8, rgbend);
1256 indexstart = indexend;
1261 CRGBPalette32& loadDynamicGradientPalette( TDynamicRGBGradientPalette_bytes gpal )
1271 }
while ( u.index != 255);
1273 int8_t lastSlotUsed = -1;
1277 CRGB rgbstart( u.r, u.g, u.b);
1280 uint8_t istart8 = 0;
1282 while( indexstart < 255) {
1285 int indexend = u.index;
1286 CRGB rgbend( u.r, u.g, u.b);
1287 istart8 = indexstart / 8;
1288 iend8 = indexend / 8;
1290 if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1291 istart8 = lastSlotUsed + 1;
1292 if( iend8 < istart8) {
1296 lastSlotUsed = iend8;
1298 fill_gradient_RGB( &(entries[0]), istart8, rgbstart, iend8, rgbend);
1299 indexstart = indexend;
1319 c08,c09,c10,c11,c12,c13,c14,c15);
1325 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
1329 memmove8( &(entries[0]), &(rhs[0]),
sizeof( entries));
1333 memmove8( &(entries[0]), &(rhs.entries[0]),
sizeof( entries));
1338 memmove8( &(entries[0]), &(rhs[0]),
sizeof( entries));
1344 for(
int i = 0; i < 256; i++) {
1345 entries[i] = rhs.entries[i];
1350 for(
int i = 0; i < 256; i++) {
1351 entries[i] = rhs[i];
1356 for(
int i = 0; i < 256; i++) {
1357 entries[i] = rhs.entries[i];
1363 for(
int i = 0; i < 256; i++) {
1364 entries[i] = rhs[i];
1371 UpscalePalette( rhs16, *
this);
1375 UpscalePalette( rhs16, *
this);
1393 const uint8_t* p = (
const uint8_t*)(&(this->entries[0]));
1394 const uint8_t*
q = (
const uint8_t*)(&(rhs.entries[0]));
1395 if( p == q)
return true;
1396 for( uint16_t i = 0; i < (
sizeof( entries)); i++) {
1397 if( *p != *q)
return false;
1405 return !( *
this == rhs);
1419 return entries[(uint8_t)x];
1423 return entries[(uint8_t)x];
1428 return &(entries[0]);
1454 fill_gradient_RGB( &(entries[0]), 256, c1, c2);
1458 fill_gradient_RGB( &(entries[0]), 256, c1, c2, c3);
1462 fill_gradient_RGB( &(entries[0]), 256, c1, c2, c3, c4);
1469 CRGBPalette256& operator=( TProgmemRGBGradientPalette_bytes progpal )
1473 u.dword = FL_PGM_READ_DWORD_NEAR( progent);
1474 CRGB rgbstart( u.r, u.g, u.b);
1477 while( indexstart < 255) {
1479 u.dword = FL_PGM_READ_DWORD_NEAR( progent);
1480 int indexend = u.index;
1481 CRGB rgbend( u.r, u.g, u.b);
1482 fill_gradient_RGB( &(entries[0]), indexstart, rgbstart, indexend, rgbend);
1483 indexstart = indexend;
1488 CRGBPalette256& loadDynamicGradientPalette( TDynamicRGBGradientPalette_bytes gpal )
1493 CRGB rgbstart( u.r, u.g, u.b);
1496 while( indexstart < 255) {
1499 int indexend = u.index;
1500 CRGB rgbend( u.r, u.g, u.b);
1501 fill_gradient_RGB( &(entries[0]), indexstart, rgbstart, indexend, rgbend);
1502 indexstart = indexend;
1511 typedef enum { NOBLEND=0, LINEARBLEND=1 } TBlendType;
1515 uint8_t brightness=255,
1516 TBlendType blendType=LINEARBLEND);
1518 CRGB ColorFromPalette(
const TProgmemRGBPalette16& pal,
1520 uint8_t brightness=255,
1521 TBlendType blendType=LINEARBLEND);
1525 uint8_t brightness=255,
1526 TBlendType blendType=NOBLEND );
1530 uint8_t brightness=255,
1531 TBlendType blendType=LINEARBLEND);
1535 uint8_t brightness=255,
1536 TBlendType blendType=NOBLEND );
1540 uint8_t brightness=255,
1541 TBlendType blendType=LINEARBLEND);
1543 CRGB ColorFromPalette(
const TProgmemRGBPalette32& pal,
1545 uint8_t brightness=255,
1546 TBlendType blendType=LINEARBLEND);
1550 uint8_t brightness=255,
1551 TBlendType blendType=LINEARBLEND);
1555 template <
typename PALETTE>
1556 void fill_palette(
CRGB* L, uint16_t N, uint8_t startIndex, uint8_t incIndex,
1557 const PALETTE& pal, uint8_t brightness, TBlendType blendType)
1559 uint8_t colorIndex = startIndex;
1560 for( uint16_t i = 0; i < N; i++) {
1561 L[i] = ColorFromPalette( pal, colorIndex, brightness, blendType);
1562 colorIndex += incIndex;
1566 template <
typename PALETTE>
1567 void map_data_into_colors_through_palette(
1568 uint8_t *dataArray, uint16_t dataCount,
1569 CRGB* targetColorArray,
1571 uint8_t brightness=255,
1572 uint8_t opacity=255,
1573 TBlendType blendType=LINEARBLEND)
1575 for( uint16_t i = 0; i < dataCount; i++) {
1576 uint8_t d = dataArray[i];
1577 CRGB rgb = ColorFromPalette( pal, d, brightness, blendType);
1578 if( opacity == 255 ) {
1579 targetColorArray[i] = rgb;
1581 targetColorArray[i].
nscale8( 256 - opacity);
1583 targetColorArray[i] += rgb;
1620 void nblendPaletteTowardPalette(
CRGBPalette16& currentPalette,
1622 uint8_t maxChanges=24);
1670 #define DEFINE_GRADIENT_PALETTE(X) \
1671 extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM =
1673 #define DECLARE_GRADIENT_PALETTE(X) \
1674 extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM
1691 uint8_t applyGamma_video( uint8_t brightness,
float gamma);
1692 CRGB applyGamma_video(
const CRGB& orig,
float gamma);
1693 CRGB applyGamma_video(
const CRGB& orig,
float gammaR,
float gammaG,
float gammaB);
1695 CRGB& napplyGamma_video(
CRGB& rgb,
float gamma);
1696 CRGB& napplyGamma_video(
CRGB& rgb,
float gammaR,
float gammaG,
float gammaB);
1697 void napplyGamma_video(
CRGB* rgbarray, uint16_t count,
float gamma);
1698 void napplyGamma_video(
CRGB* rgbarray, uint16_t count,
float gammaR,
float gammaG,
float gammaB);
1701 FASTLED_NAMESPACE_END
Representation of an RGB pixel (Red, Green, Blue)
uint16_t accum88
ANSI: unsigned short _Accum. 8 bits int, 8 bits fraction.
uint8_t fract8
ANSI unsigned short _Fract.
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.
void fill_rainbow(struct CRGB *pFirstLED, int numToFill, uint8_t initialhue, uint8_t deltahue=5)
fill_rainbow - fill a range of LEDs with a rainbow of colors, at full saturation and full value (brig...
CRGB & nscale8(uint8_t scaledown)
scale down a RGB to N 256ths of it's current brightness, using 'plain math' dimming rules...
void fill_gradient(T *targetArray, uint16_t startpos, CHSV startcolor, uint16_t endpos, CHSV endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
fill_gradient - fill an array of colors with a smooth HSV gradient between two specified HSV colors...
central include file for FastLED, defines the CFastLED class/object
__attribute__((always_inline)) inline void swapbits8(bitswap_type in
Do an 8byte by 8bit rotation.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
void fill_solid(struct CRGB *leds, int numToFill, const struct CRGB &color)
fill_solid - fill a range of LEDs with a solid color Example: fill_solid( leds, NUM_LEDS, CRGB(50,0,200));
Template class for represneting fractional ints.
wrapper definitions to allow seamless use of PROGMEM in environmens that have it