Approximates a "black body radiation" spectrum for a given "heat" level.
This is useful for animations of "fire". Heat is specified as an arbitrary scale from 0 (cool) to 255 (hot). This is NOT a chromatically correct "black body radiation" spectrum, but it's surprisingly close, and it's fast and small.
Definition at line 543 of file colorutils.cpp.
544{
546
547
548
549
551
552
553
554 uint8_t heatramp = t192 & 0x3F;
555 heatramp <<= 2;
556
557
558 if( t192 & 0x80) {
559
560 heatcolor.r = 255;
561 heatcolor.g = 255;
562 heatcolor.b = heatramp;
563
564 } else if( t192 & 0x40 ) {
565
566 heatcolor.r = 255;
567 heatcolor.g = heatramp;
568 heatcolor.b = 0;
569
570 } else {
571
572 heatcolor.r = heatramp;
573 heatcolor.g = 0;
574 heatcolor.b = 0;
575 }
576
577 return heatcolor;
578}
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video(uint8_t i, fract8 scale)
The "video" version of scale8() guarantees that the output will be only be zero if one or both of the...
Representation of an RGB pixel (Red, Green, Blue)
References scale8_video().
Referenced by Fire2012().