300 {
301 if (blendType == LINEARBLEND_NOWRAP) {
302 index =
map8(index, 0, 239);
303
304 }
305
306
307 uint8_t hi4 =
lsrX4(index);
308 uint8_t lo4 = index & 0x0F;
309
310
311
312
313
314 uint8_t hi4XsizeofCRGB = hi4 *
sizeof(
CRGB);
315
316 const CRGB *entry = (
CRGB *)((uint8_t *)(&(pal[0])) + hi4XsizeofCRGB);
317
318 uint8_t
blend = lo4 && (blendType != NOBLEND);
319
320 uint8_t red1 = entry->red;
321 uint8_t green1 = entry->green;
322 uint8_t blue1 = entry->blue;
323
325
326 if (hi4 == 15) {
327 entry = &(pal[0]);
328 } else {
329 ++entry;
330 }
331
332 uint8_t f2 = lo4 << 4;
333 uint8_t f1 = 255 - f2;
334
335
336 uint8_t red2 = entry->red;
339 red1 += red2;
340
341 uint8_t green2 = entry->green;
344 green1 += green2;
345
346 uint8_t blue2 = entry->blue;
349 blue1 += blue2;
350
352 }
353
357
358
359
360 if (red1) {
362#if !(FASTLED_SCALE8_FIXED == 1)
363 ++red1;
364#endif
365 }
366 if (green1) {
368#if !(FASTLED_SCALE8_FIXED == 1)
369 ++green1;
370#endif
371 }
372 if (blue1) {
374#if !(FASTLED_SCALE8_FIXED == 1)
375 ++blue1;
376#endif
377 }
379 } else {
380 red1 = 0;
381 green1 = 0;
382 blue1 = 0;
383 }
384 }
385
386 return CRGB(red1, green1, blue1);
387}
UISlider brightness("Brightness", 255, 0, 255, 1)
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
LIB8STATIC uint8_t map8(uint8_t in, uint8_t rangeStart, uint8_t rangeEnd)
Map from one full-range 8-bit value into a narrower range of 8-bit values, possibly a range of hues.
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_LEAVING_R1_DIRTY(uint8_t i, fract8 scale)
This version of scale8() does not clean up the R1 register on AVR.
uint8_t lsrX4(uint8_t dividend)
Helper function to divide a number by 16, aka four logical shift right (LSR)'s.
Representation of an RGB pixel (Red, Green, Blue)