1079 {
1080 if (blendType == LINEARBLEND_NOWRAP) {
1081 index =
map8(index, 0, 247);
1082
1083 }
1084
1086#if defined(FL_IS_AVR)
1087 hi5 /= 2;
1088 hi5 /= 2;
1089 hi5 /= 2;
1090#else
1091 hi5 >>= 3;
1092#endif
1093 fl::u8 lo3 = index & 0x07;
1094
1096 const CHSV *entry = (
CHSV *)((
fl::u8 *)(&(pal[0])) + hi5XsizeofCHSV);
1097
1098 fl::u8 hue1 = entry->hue;
1099 fl::u8 sat1 = entry->sat;
1100 fl::u8 val1 = entry->val;
1101
1103
1105
1106 if (hi5 == 31) {
1107 entry = &(pal[0]);
1108 } else {
1109 ++entry;
1110 }
1111
1114
1115 fl::u8 hue2 = entry->hue;
1116 fl::u8 sat2 = entry->sat;
1117 fl::u8 val2 = entry->val;
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130 if (sat1 == 0 || val1 == 0) {
1131 hue1 = hue2;
1132 }
1133
1134
1135
1136 if (sat2 == 0 || val2 == 0) {
1137 hue2 = hue1;
1138 }
1139
1140 sat1 = scale8_LEAVING_R1_DIRTY(sat1, f1);
1141 val1 = scale8_LEAVING_R1_DIRTY(val1, f1);
1142
1143 sat2 = scale8_LEAVING_R1_DIRTY(sat2, f2);
1144 val2 = scale8_LEAVING_R1_DIRTY(val2, f2);
1145
1146
1147
1148
1149 sat1 += sat2;
1150 val1 += val2;
1151
1153 if (deltaHue & 0x80) {
1154
1155 hue1 -= scale8(256 - deltaHue, f2);
1156 } else {
1157
1158 hue1 += scale8(deltaHue, f2);
1159 }
1160
1161 cleanup_R1();
1162 }
1163
1166 }
1167
1168 return CHSV(hue1, sat1, val1);
1169}
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
LIB8STATIC fl::u8 map8(fl::u8 in, fl::u8 rangeStart, fl::u8 rangeEnd)
Map from one full-range 8-bit value into a narrower range of 8-bit values, possibly a range of hues.