1160 {
1161 if (blendType == LINEARBLEND_NOWRAP) {
1162 index =
map8(index, 0, 247);
1163
1164 }
1165
1167#if defined(FL_IS_AVR)
1168 hi5 /= 2;
1169 hi5 /= 2;
1170 hi5 /= 2;
1171#else
1172 hi5 >>= 3;
1173#endif
1174 fl::u8 lo3 = index & 0x07;
1175
1177 const CHSV *entry = (
CHSV *)((
fl::u8 *)(&(pal[0])) + hi5XsizeofCHSV);
1178
1179 fl::u8 hue1 = entry->hue;
1180 fl::u8 sat1 = entry->sat;
1181 fl::u8 val1 = entry->val;
1182
1184
1186
1187 if (hi5 == 31) {
1188 entry = &(pal[0]);
1189 } else {
1190 ++entry;
1191 }
1192
1195
1196 fl::u8 hue2 = entry->hue;
1197 fl::u8 sat2 = entry->sat;
1198 fl::u8 val2 = entry->val;
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211 if (sat1 == 0 || val1 == 0) {
1212 hue1 = hue2;
1213 }
1214
1215
1216
1217 if (sat2 == 0 || val2 == 0) {
1218 hue2 = hue1;
1219 }
1220
1221 sat1 = scale8_LEAVING_R1_DIRTY(sat1, f1);
1222 val1 = scale8_LEAVING_R1_DIRTY(val1, f1);
1223
1224 sat2 = scale8_LEAVING_R1_DIRTY(sat2, f2);
1225 val2 = scale8_LEAVING_R1_DIRTY(val2, f2);
1226
1227
1228
1229
1230 sat1 += sat2;
1231 val1 += val2;
1232
1234 if (deltaHue & 0x80) {
1235
1236 hue1 -= scale8(256 - deltaHue, f2);
1237 } else {
1238
1239 hue1 += scale8(deltaHue, f2);
1240 }
1241
1242 cleanup_R1();
1243 }
1244
1247 }
1248
1249 return CHSV(hue1, sat1, val1);
1250}
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.