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 138 of file crgb.hpp.

138 {
139 //Y' = 0.2126 R' + 0.7152 G' + 0.0722 B'
140 // 54 183 18 (!)
141
142 uint8_t luma = scale8_LEAVING_R1_DIRTY( r, 54) + \
143 scale8_LEAVING_R1_DIRTY( g, 183) + \
144 scale8_LEAVING_R1_DIRTY( b, 18);
145 cleanup_R1();
146 return luma;
147}
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
Definition scale8.h:339
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:176

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

+ Here is the call graph for this function: