FastLED 3.9.15
Loading...
Searching...
No Matches

◆ getLuma()

FASTLED_FORCE_INLINE uint8_t CRGB::getLuma ( ) const

Get the "luma" of a CRGB object.

In other words, roughly how much light the CRGB pixel is putting out (from 0 to 255).

Definition at line 152 of file crgb.hpp.

152 {
153 //Y' = 0.2126 R' + 0.7152 G' + 0.0722 B'
154 // 54 183 18 (!)
155
156 uint8_t luma = scale8_LEAVING_R1_DIRTY( r, 54) + \
157 scale8_LEAVING_R1_DIRTY( g, 183) + \
158 scale8_LEAVING_R1_DIRTY( b, 18);
159 cleanup_R1();
160 return luma;
161}
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
Definition scale8.h:333
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.
Definition scale8.h:170

References cleanup_R1(), FASTLED_FORCE_INLINE, and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function: