19#if !defined(FASTLED_USE_32_BIT_GRADIENT_FILL)
21#define FASTLED_USE_32_BIT_GRADIENT_FILL 0
23#define FASTLED_USE_32_BIT_GRADIENT_FILL 1
27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Wcast-align"
258} TRGBGradientPaletteEntryUnion;
261 TDynamicRGBGradientPalette_byte;
263typedef const TDynamicRGBGradientPalette_byte
264 *TDynamicRGBGradientPalette_bytes;
266typedef TDynamicRGBGradientPalette_bytes
267 TDynamicRGBGradientPaletteRef;
280 class CRGBPalette256 &destpal256);
283 class CHSVPalette256 &destpal256);
289 class CRGBPalette32 &destpal32);
292 class CHSVPalette32 &destpal32);
298 class CRGBPalette256 &destpal256);
301 class CHSVPalette256 &destpal256);
317 CHSVPalette16(
const CHSV &c00,
const CHSV &c01,
const CHSV &c02,
342 CHSVPalette16(
const CHSVPalette16 &rhs) {
343 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
347 CHSVPalette16 &operator=(
const CHSVPalette16 &rhs) {
348 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
354 for (uint8_t i = 0; i < 16; ++i) {
356 entries[i].hue = xyz.red;
357 entries[i].sat = xyz.green;
358 entries[i].val = xyz.blue;
364 for (uint8_t i = 0; i < 16; ++i) {
366 entries[i].hue = xyz.red;
367 entries[i].sat = xyz.green;
368 entries[i].val = xyz.blue;
379 inline CHSV &operator[](uint8_t
x) __attribute__((always_inline)) {
384 inline const CHSV &operator[](uint8_t
x)
const
385 __attribute__((always_inline)) {
390 inline CHSV &operator[](
int x) __attribute__((always_inline)) {
391 return entries[(uint8_t)
x];
395 inline const CHSV &operator[](
int x)
const __attribute__((always_inline)) {
396 return entries[(uint8_t)
x];
400 operator CHSV *() {
return &(entries[0]); }
403 bool operator==(
const CHSVPalette16 &rhs)
const {
404 const uint8_t *
p = (
const uint8_t *)(&(this->entries[0]));
405 const uint8_t *q = (
const uint8_t *)(&(rhs.entries[0]));
408 for (uint8_t i = 0; i < (
sizeof(entries)); ++i) {
418 bool operator!=(
const CHSVPalette16 &rhs)
const {
return !(*
this == rhs); }
422 CHSVPalette16(
const CHSV &c1) {
fill_solid(&(entries[0]), 16, c1); }
427 CHSVPalette16(
const CHSV &c1,
const CHSV &c2) {
435 CHSVPalette16(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3) {
444 CHSVPalette16(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3,
451class CHSVPalette256 {
462 CHSVPalette256(
const CHSV &c00,
const CHSV &c01,
const CHSV &c02,
468 CHSVPalette16 p16(c00, c01, c02, c03, c04, c05, c06, c07, c08, c09, c10,
469 c11, c12, c13, c14, c15);
474 CHSVPalette256(
const CHSVPalette256 &rhs) {
475 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
478 CHSVPalette256 &operator=(
const CHSVPalette256 &rhs) {
479 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
484 CHSVPalette256(
const CHSVPalette16 &rhs16) { UpscalePalette(rhs16, *
this); }
486 CHSVPalette256 &operator=(
const CHSVPalette16 &rhs16) {
487 UpscalePalette(rhs16, *
this);
493 CHSVPalette16 p16(rhs);
498 CHSVPalette16 p16(rhs);
504 inline CHSV &operator[](uint8_t
x) __attribute__((always_inline)) {
508 inline const CHSV &operator[](uint8_t
x)
const
509 __attribute__((always_inline)) {
514 inline CHSV &operator[](
int x) __attribute__((always_inline)) {
515 return entries[(uint8_t)
x];
518 inline const CHSV &operator[](
int x)
const __attribute__((always_inline)) {
519 return entries[(uint8_t)
x];
523 operator CHSV *() {
return &(entries[0]); }
526 bool operator==(
const CHSVPalette256 &rhs)
const {
527 const uint8_t *
p = (
const uint8_t *)(&(this->entries[0]));
528 const uint8_t *q = (
const uint8_t *)(&(rhs.entries[0]));
531 for (uint16_t i = 0; i < (
sizeof(entries)); ++i) {
541 bool operator!=(
const CHSVPalette256 &rhs)
const {
return !(*
this == rhs); }
544 CHSVPalette256(
const CHSV &c1) {
fill_solid(&(entries[0]), 256, c1); }
546 CHSVPalette256(
const CHSV &c1,
const CHSV &c2) {
551 CHSVPalette256(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3) {
556 CHSVPalette256(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3,
571 CRGBPalette16(
const CRGB &c00,
const CRGB &c01,
const CRGB &c02,
596 CRGBPalette16(
const CRGBPalette16 &rhs) {
597 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
600 CRGBPalette16(
const CRGB rhs[16]) {
601 memmove8((
void *)&(entries[0]), &(rhs[0]),
sizeof(entries));
604 CRGBPalette16 &operator=(
const CRGBPalette16 &rhs) {
605 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
609 CRGBPalette16 &operator=(
const CRGB rhs[16]) {
610 memmove8((
void *)&(entries[0]), &(rhs[0]),
sizeof(entries));
615 CRGBPalette16(
const CHSVPalette16 &rhs) {
616 for (uint8_t i = 0; i < 16; ++i) {
617 entries[i] = rhs.entries[i];
621 CRGBPalette16(
const CHSV rhs[16]) {
622 for (uint8_t i = 0; i < 16; ++i) {
627 CRGBPalette16 &operator=(
const CHSVPalette16 &rhs) {
628 for (uint8_t i = 0; i < 16; ++i) {
629 entries[i] = rhs.entries[i];
634 CRGBPalette16 &operator=(
const CHSV rhs[16]) {
635 for (uint8_t i = 0; i < 16; ++i) {
643 for (uint8_t i = 0; i < 16; ++i) {
649 for (uint8_t i = 0; i < 16; ++i) {
656 bool operator==(
const CRGBPalette16 &rhs)
const {
657 const uint8_t *
p = (
const uint8_t *)(&(this->entries[0]));
658 const uint8_t *q = (
const uint8_t *)(&(rhs.entries[0]));
661 for (uint8_t i = 0; i < (
sizeof(entries)); ++i) {
670 bool operator!=(
const CRGBPalette16 &rhs)
const {
return !(*
this == rhs); }
672 inline CRGB &operator[](uint8_t
x) __attribute__((always_inline)) {
676 inline const CRGB &operator[](uint8_t
x)
const
677 __attribute__((always_inline)) {
682 inline CRGB &operator[](
int x) __attribute__((always_inline)) {
683 return entries[(uint8_t)
x];
686 inline const CRGB &operator[](
int x)
const __attribute__((always_inline)) {
687 return entries[(uint8_t)
x];
691 operator CRGB *() {
return &(entries[0]); }
694 CRGBPalette16(
const CHSV &c1) {
fill_solid(&(entries[0]), 16, c1); }
696 CRGBPalette16(
const CHSV &c1,
const CHSV &c2) {
701 CRGBPalette16(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3) {
706 CRGBPalette16(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3,
712 CRGBPalette16(
const CRGB &c1) {
fill_solid(&(entries[0]), 16, c1); }
714 CRGBPalette16(
const CRGB &c1,
const CRGB &c2) {
715 fill_gradient_RGB(&(entries[0]), 16, c1, c2);
719 CRGBPalette16(
const CRGB &c1,
const CRGB &c2,
const CRGB &c3) {
720 fill_gradient_RGB(&(entries[0]), 16, c1, c2, c3);
724 CRGBPalette16(
const CRGB &c1,
const CRGB &c2,
const CRGB &c3,
726 fill_gradient_RGB(&(entries[0]), 16, c1, c2, c3, c4);
761 TRGBGradientPaletteEntryUnion *progent =
762 (TRGBGradientPaletteEntryUnion *)(progpal);
763 TRGBGradientPaletteEntryUnion u;
770 }
while (u.index != 255);
772 int8_t lastSlotUsed = -1;
775 CRGB rgbstart(u.r, u.g, u.b);
780 while (indexstart < 255) {
783 int indexend = u.index;
784 CRGB rgbend(u.r, u.g, u.b);
785 istart8 = indexstart / 16;
786 iend8 = indexend / 16;
788 if ((istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
789 istart8 = lastSlotUsed + 1;
790 if (iend8 < istart8) {
794 lastSlotUsed = iend8;
796 fill_gradient_RGB(&(entries[0]), istart8, rgbstart, iend8, rgbend);
797 indexstart = indexend;
806 loadDynamicGradientPalette(TDynamicRGBGradientPalette_bytes gpal) {
807 TRGBGradientPaletteEntryUnion *ent =
808 (TRGBGradientPaletteEntryUnion *)(gpal);
809 TRGBGradientPaletteEntryUnion u;
816 }
while (u.index != 255);
818 int8_t lastSlotUsed = -1;
821 CRGB rgbstart(u.r, u.g, u.b);
826 while (indexstart < 255) {
829 int indexend = u.index;
830 CRGB rgbend(u.r, u.g, u.b);
831 istart8 = indexstart / 16;
832 iend8 = indexend / 16;
834 if ((istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
835 istart8 = lastSlotUsed + 1;
836 if (iend8 < istart8) {
840 lastSlotUsed = iend8;
842 fill_gradient_RGB(&(entries[0]), istart8, rgbstart, iend8, rgbend);
843 indexstart = indexend;
862 CHSVPalette32(
const CHSV &c00,
const CHSV &c01,
const CHSV &c02,
868 for (uint8_t i = 0; i < 2; ++i) {
869 entries[0 + i] = c00;
870 entries[2 + i] = c01;
871 entries[4 + i] = c02;
872 entries[6 + i] = c03;
873 entries[8 + i] = c04;
874 entries[10 + i] = c05;
875 entries[12 + i] = c06;
876 entries[14 + i] = c07;
877 entries[16 + i] = c08;
878 entries[18 + i] = c09;
879 entries[20 + i] = c10;
880 entries[22 + i] = c11;
881 entries[24 + i] = c12;
882 entries[26 + i] = c13;
883 entries[28 + i] = c14;
884 entries[30 + i] = c15;
889 CHSVPalette32(
const CHSVPalette32 &rhs) {
890 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
893 CHSVPalette32 &operator=(
const CHSVPalette32 &rhs) {
894 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
900 for (uint8_t i = 0; i < 32; ++i) {
902 entries[i].hue = xyz.red;
903 entries[i].sat = xyz.green;
904 entries[i].val = xyz.blue;
909 for (uint8_t i = 0; i < 32; ++i) {
911 entries[i].hue = xyz.red;
912 entries[i].sat = xyz.green;
913 entries[i].val = xyz.blue;
919 inline CHSV &operator[](uint8_t
x) __attribute__((always_inline)) {
923 inline const CHSV &operator[](uint8_t
x)
const
924 __attribute__((always_inline)) {
929 inline CHSV &operator[](
int x) __attribute__((always_inline)) {
930 return entries[(uint8_t)
x];
933 inline const CHSV &operator[](
int x)
const __attribute__((always_inline)) {
934 return entries[(uint8_t)
x];
938 operator CHSV *() {
return &(entries[0]); }
941 bool operator==(
const CHSVPalette32 &rhs)
const {
942 const uint8_t *
p = (
const uint8_t *)(&(this->entries[0]));
943 const uint8_t *q = (
const uint8_t *)(&(rhs.entries[0]));
946 for (uint8_t i = 0; i < (
sizeof(entries)); ++i) {
955 bool operator!=(
const CHSVPalette32 &rhs)
const {
return !(*
this == rhs); }
958 CHSVPalette32(
const CHSV &c1) {
fill_solid(&(entries[0]), 32, c1); }
960 CHSVPalette32(
const CHSV &c1,
const CHSV &c2) {
965 CHSVPalette32(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3) {
970 CHSVPalette32(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3,
989 CRGBPalette32(
const CRGB &c00,
const CRGB &c01,
const CRGB &c02,
995 for (uint8_t i = 0; i < 2; ++i) {
996 entries[0 + i] = c00;
997 entries[2 + i] = c01;
998 entries[4 + i] = c02;
999 entries[6 + i] = c03;
1000 entries[8 + i] = c04;
1001 entries[10 + i] = c05;
1002 entries[12 + i] = c06;
1003 entries[14 + i] = c07;
1004 entries[16 + i] = c08;
1005 entries[18 + i] = c09;
1006 entries[20 + i] = c10;
1007 entries[22 + i] = c11;
1008 entries[24 + i] = c12;
1009 entries[26 + i] = c13;
1010 entries[28 + i] = c14;
1011 entries[30 + i] = c15;
1016 CRGBPalette32(
const CRGBPalette32 &rhs) {
1017 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
1020 CRGBPalette32(
const CRGB rhs[32]) {
1021 memmove8((
void *)&(entries[0]), &(rhs[0]),
sizeof(entries));
1024 CRGBPalette32 &operator=(
const CRGBPalette32 &rhs) {
1025 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
1029 CRGBPalette32 &operator=(
const CRGB rhs[32]) {
1030 memmove8((
void *)&(entries[0]), &(rhs[0]),
sizeof(entries));
1035 CRGBPalette32(
const CHSVPalette32 &rhs) {
1036 for (uint8_t i = 0; i < 32; ++i) {
1037 entries[i] = rhs.entries[i];
1041 CRGBPalette32(
const CHSV rhs[32]) {
1042 for (uint8_t i = 0; i < 32; ++i) {
1043 entries[i] = rhs[i];
1047 CRGBPalette32 &operator=(
const CHSVPalette32 &rhs) {
1048 for (uint8_t i = 0; i < 32; ++i) {
1049 entries[i] = rhs.entries[i];
1054 CRGBPalette32 &operator=(
const CHSV rhs[32]) {
1055 for (uint8_t i = 0; i < 32; ++i) {
1056 entries[i] = rhs[i];
1063 for (uint8_t i = 0; i < 32; ++i) {
1069 for (uint8_t i = 0; i < 32; ++i) {
1076 bool operator==(
const CRGBPalette32 &rhs)
const {
1077 const uint8_t *
p = (
const uint8_t *)(&(this->entries[0]));
1078 const uint8_t *q = (
const uint8_t *)(&(rhs.entries[0]));
1081 for (uint8_t i = 0; i < (
sizeof(entries)); ++i) {
1090 bool operator!=(
const CRGBPalette32 &rhs)
const {
return !(*
this == rhs); }
1093 inline CRGB &operator[](uint8_t
x) __attribute__((always_inline)) {
1097 inline const CRGB &operator[](uint8_t
x)
const
1098 __attribute__((always_inline)) {
1103 inline CRGB &operator[](
int x) __attribute__((always_inline)) {
1104 return entries[(uint8_t)
x];
1107 inline const CRGB &operator[](
int x)
const __attribute__((always_inline)) {
1108 return entries[(uint8_t)
x];
1112 operator CRGB *() {
return &(entries[0]); }
1115 CRGBPalette32(
const CHSV &c1) {
fill_solid(&(entries[0]), 32, c1); }
1117 CRGBPalette32(
const CHSV &c1,
const CHSV &c2) {
1122 CRGBPalette32(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3) {
1127 CRGBPalette32(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3,
1133 CRGBPalette32(
const CRGB &c1) {
fill_solid(&(entries[0]), 32, c1); }
1135 CRGBPalette32(
const CRGB &c1,
const CRGB &c2) {
1136 fill_gradient_RGB(&(entries[0]), 32, c1, c2);
1140 CRGBPalette32(
const CRGB &c1,
const CRGB &c2,
const CRGB &c3) {
1141 fill_gradient_RGB(&(entries[0]), 32, c1, c2, c3);
1145 CRGBPalette32(
const CRGB &c1,
const CRGB &c2,
const CRGB &c3,
1147 fill_gradient_RGB(&(entries[0]), 32, c1, c2, c3, c4);
1151 CRGBPalette32(
const CRGBPalette16 &rhs16) { UpscalePalette(rhs16, *
this); }
1153 CRGBPalette32 &operator=(
const CRGBPalette16 &rhs16) {
1154 UpscalePalette(rhs16, *
this);
1160 CRGBPalette16 p16(rhs);
1165 CRGBPalette16 p16(rhs);
1174 TRGBGradientPaletteEntryUnion *progent =
1175 (TRGBGradientPaletteEntryUnion *)(progpal);
1176 TRGBGradientPaletteEntryUnion u;
1183 }
while (u.index != 255);
1185 int8_t lastSlotUsed = -1;
1188 CRGB rgbstart(u.r, u.g, u.b);
1191 uint8_t istart8 = 0;
1193 while (indexstart < 255) {
1196 int indexend = u.index;
1197 CRGB rgbend(u.r, u.g, u.b);
1198 istart8 = indexstart / 8;
1199 iend8 = indexend / 8;
1201 if ((istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1202 istart8 = lastSlotUsed + 1;
1203 if (iend8 < istart8) {
1207 lastSlotUsed = iend8;
1209 fill_gradient_RGB(&(entries[0]), istart8, rgbstart, iend8, rgbend);
1210 indexstart = indexend;
1218 loadDynamicGradientPalette(TDynamicRGBGradientPalette_bytes gpal) {
1219 TRGBGradientPaletteEntryUnion *ent =
1220 (TRGBGradientPaletteEntryUnion *)(gpal);
1221 TRGBGradientPaletteEntryUnion u;
1228 }
while (u.index != 255);
1230 int8_t lastSlotUsed = -1;
1233 CRGB rgbstart(u.r, u.g, u.b);
1236 uint8_t istart8 = 0;
1238 while (indexstart < 255) {
1241 int indexend = u.index;
1242 CRGB rgbend(u.r, u.g, u.b);
1243 istart8 = indexstart / 8;
1244 iend8 = indexend / 8;
1246 if ((istart8 <= lastSlotUsed) && (lastSlotUsed < 31)) {
1247 istart8 = lastSlotUsed + 1;
1248 if (iend8 < istart8) {
1252 lastSlotUsed = iend8;
1254 fill_gradient_RGB(&(entries[0]), istart8, rgbstart, iend8, rgbend);
1255 indexstart = indexend;
1263class CRGBPalette256 {
1268 CRGBPalette256() {};
1275 CRGBPalette256(
const CRGB &c00,
const CRGB &c01,
const CRGB &c02,
1281 CRGBPalette16 p16(c00, c01, c02, c03, c04, c05, c06, c07, c08, c09, c10,
1282 c11, c12, c13, c14, c15);
1287 CRGBPalette256(
const CRGBPalette256 &rhs) {
1288 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
1291 CRGBPalette256(
const CRGB rhs[256]) {
1292 memmove8((
void *)&(entries[0]), &(rhs[0]),
sizeof(entries));
1295 CRGBPalette256 &operator=(
const CRGBPalette256 &rhs) {
1296 memmove8((
void *)&(entries[0]), &(rhs.entries[0]),
sizeof(entries));
1300 CRGBPalette256 &operator=(
const CRGB rhs[256]) {
1301 memmove8((
void *)&(entries[0]), &(rhs[0]),
sizeof(entries));
1306 CRGBPalette256(
const CHSVPalette256 &rhs) {
1307 for (
int i = 0; i < 256; ++i) {
1308 entries[i] = rhs.entries[i];
1312 CRGBPalette256(
const CHSV rhs[256]) {
1313 for (
int i = 0; i < 256; ++i) {
1314 entries[i] = rhs[i];
1318 CRGBPalette256 &operator=(
const CHSVPalette256 &rhs) {
1319 for (
int i = 0; i < 256; ++i) {
1320 entries[i] = rhs.entries[i];
1325 CRGBPalette256 &operator=(
const CHSV rhs[256]) {
1326 for (
int i = 0; i < 256; ++i) {
1327 entries[i] = rhs[i];
1333 CRGBPalette256(
const CRGBPalette16 &rhs16) { UpscalePalette(rhs16, *
this); }
1335 CRGBPalette256 &operator=(
const CRGBPalette16 &rhs16) {
1336 UpscalePalette(rhs16, *
this);
1342 CRGBPalette16 p16(rhs);
1347 CRGBPalette16 p16(rhs);
1353 bool operator==(
const CRGBPalette256 &rhs)
const {
1354 const uint8_t *
p = (
const uint8_t *)(&(this->entries[0]));
1355 const uint8_t *q = (
const uint8_t *)(&(rhs.entries[0]));
1358 for (uint16_t i = 0; i < (
sizeof(entries)); ++i) {
1367 bool operator!=(
const CRGBPalette256 &rhs)
const {
return !(*
this == rhs); }
1370 inline CRGB &operator[](uint8_t
x) __attribute__((always_inline)) {
1374 inline const CRGB &operator[](uint8_t
x)
const
1375 __attribute__((always_inline)) {
1380 inline CRGB &operator[](
int x) __attribute__((always_inline)) {
1381 return entries[(uint8_t)
x];
1384 inline const CRGB &operator[](
int x)
const __attribute__((always_inline)) {
1385 return entries[(uint8_t)
x];
1389 operator CRGB *() {
return &(entries[0]); }
1392 CRGBPalette256(
const CHSV &c1) {
fill_solid(&(entries[0]), 256, c1); }
1394 CRGBPalette256(
const CHSV &c1,
const CHSV &c2) {
1399 CRGBPalette256(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3) {
1404 CRGBPalette256(
const CHSV &c1,
const CHSV &c2,
const CHSV &c3,
1410 CRGBPalette256(
const CRGB &c1) {
fill_solid(&(entries[0]), 256, c1); }
1412 CRGBPalette256(
const CRGB &c1,
const CRGB &c2) {
1413 fill_gradient_RGB(&(entries[0]), 256, c1, c2);
1417 CRGBPalette256(
const CRGB &c1,
const CRGB &c2,
const CRGB &c3) {
1418 fill_gradient_RGB(&(entries[0]), 256, c1, c2, c3);
1422 CRGBPalette256(
const CRGB &c1,
const CRGB &c2,
const CRGB &c3,
1424 fill_gradient_RGB(&(entries[0]), 256, c1, c2, c3, c4);
1433 TRGBGradientPaletteEntryUnion *progent =
1434 (TRGBGradientPaletteEntryUnion *)(progpal);
1435 TRGBGradientPaletteEntryUnion u;
1437 CRGB rgbstart(u.r, u.g, u.b);
1440 while (indexstart < 255) {
1443 int indexend = u.index;
1444 CRGB rgbend(u.r, u.g, u.b);
1445 fill_gradient_RGB(&(entries[0]), indexstart, rgbstart, indexend,
1447 indexstart = indexend;
1455 loadDynamicGradientPalette(TDynamicRGBGradientPalette_bytes gpal) {
1456 TRGBGradientPaletteEntryUnion *ent =
1457 (TRGBGradientPaletteEntryUnion *)(gpal);
1458 TRGBGradientPaletteEntryUnion u;
1460 CRGB rgbstart(u.r, u.g, u.b);
1463 while (indexstart < 255) {
1466 int indexend = u.index;
1467 CRGB rgbend(u.r, u.g, u.b);
1468 fill_gradient_RGB(&(entries[0]), indexstart, rgbstart, indexend,
1470 indexstart = indexend;
1489 LINEARBLEND_NOWRAP =
1505 TBlendType blendType = LINEARBLEND);
1528 TBlendType blendType = LINEARBLEND);
1533 uint8_t
brightness = 255, TBlendType blendType = NOBLEND);
1538 TBlendType blendType = LINEARBLEND);
1544 TBlendType blendType = LINEARBLEND);
1549 uint8_t
brightness = 255, TBlendType blendType = NOBLEND);
1555 TBlendType blendType = LINEARBLEND);
1561 TBlendType blendType = LINEARBLEND);
1567 TBlendType blendType = LINEARBLEND);
1579template <
typename PALETTE>
1580void fill_palette(
CRGB *L, uint16_t N, uint8_t startIndex, uint8_t incIndex,
1581 const PALETTE &pal, uint8_t
brightness = 255,
1582 TBlendType blendType = LINEARBLEND) {
1583 uint8_t colorIndex = startIndex;
1584 for (uint16_t i = 0; i < N; ++i) {
1586 colorIndex += incIndex;
1601template <
typename PALETTE>
1602void fill_palette_circular(
CRGB *L, uint16_t N, uint8_t startIndex,
1603 const PALETTE &pal, uint8_t
brightness = 255,
1604 TBlendType blendType = LINEARBLEND,
1605 bool reversed =
false) {
1609 const uint16_t colorChange =
1611 uint16_t colorIndex = ((uint16_t)startIndex)
1614 for (uint16_t i = 0; i < N; ++i) {
1617 colorIndex -= colorChange;
1619 colorIndex += colorChange;
1642template <
typename PALETTE>
1643void map_data_into_colors_through_palette(
1644 uint8_t *dataArray, uint16_t dataCount,
CRGB *targetColorArray,
1645 const PALETTE &pal, uint8_t
brightness = 255, uint8_t opacity = 255,
1646 TBlendType blendType = LINEARBLEND) {
1647 for (uint16_t i = 0; i < dataCount; ++i) {
1648 uint8_t d = dataArray[i];
1650 if (opacity == 255) {
1651 targetColorArray[i] = rgb;
1653 targetColorArray[i].
nscale8(256 - opacity);
1655 targetColorArray[i] += rgb;
1699 CRGBPalette16 &targetPalette,
1700 uint8_t maxChanges = 24);
1786 float gammaG,
float gammaB);
1792#pragma GCC diagnostic pop
UISlider scale("Scale", 1.0f, 0.0f, 1.0f, 0.01f)
CRGBPalette16 currentPalette
UISlider brightness("Brightness", 255, 0, 255, 1)
TGradientDirectionCode
Hue direction for calculating fill gradients.
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.
void fill_solid(struct CRGB *targetArray, int numToFill, const struct CRGB &color)
Fill a range of LEDs with a solid color.
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.
uint32_t TProgmemHSVPalette16[16]
CHSVPalette16 entries stored in PROGMEM memory.
Defines the red, green, and blue (RGB) pixel struct.
#define FL_PGM_READ_DWORD_NEAR(x)
Read a double word (32-bit) from PROGMEM memory.
Wrapper definitions to allow seamless use of PROGMEM in environments that have it.
void * memmove8(void *dst, const void *src, uint16_t num)
Faster alternative to memmove() on AVR.
uint8_t fract8
ANSI: unsigned short _Fract.
FASTLED_FORCE_INLINE bool operator!=(const CRGB &lhs, const CRGB &rhs)
Check if two CRGB objects do not have the same color data.
FASTLED_FORCE_INLINE bool operator==(const CRGB &lhs, const CRGB &rhs)
Check if two CRGB objects have the same color data.
void fadeUsingColor(CRGB *leds, uint16_t numLeds, const CRGB &colormask)
@ SHORTEST_HUES
Hue goes whichever way is shortest.
void UpscalePalette(const class CRGBPalette16 &srcpal16, class CRGBPalette256 &destpal256)
CRGB ColorFromPaletteExtended(const CRGBPalette32 &pal, uint16_t index, uint8_t brightness, TBlendType blendType)
uint8_t applyGamma_video(uint8_t brightness, float gamma)
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
CRGB HeatColor(uint8_t temperature)
void fadeToBlackBy(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
void nblendPaletteTowardPalette(CRGBPalette16 ¤t, CRGBPalette16 &target, uint8_t maxChanges)
CRGB & nblend(CRGB &existing, const CRGB &overlay, fract8 amountOfOverlay)
void fade_raw(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
void fadeLightBy(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
void nscale8(CRGB *leds, uint16_t num_leds, uint8_t scale)
CRGB & napplyGamma_video(CRGB &rgb, float gamma)
void fade_video(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
void nscale8_video(CRGB *leds, uint16_t num_leds, uint8_t scale)
Implements a simple red square effect for 2D LED grids.
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
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.
Representation of an RGB pixel (Red, Green, Blue)