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

◆ computeAdjustment()

CRGB CRGB::computeAdjustment ( uint8_t scale,
const CRGB & colorCorrection,
const CRGB & colorTemperature )
static

Calculates the combined color adjustment to the LEDs at a given scale, color correction, and color temperature.

Parameters
scalethe scale value for the RGB data (i.e. brightness)
colorCorrectioncolor correction to apply
colorTemperaturecolor temperature to apply
Returns
a CRGB object representing the adjustment, including color correction and color temperature

Definition at line 25 of file crgb.cpp.

25 {
26 #if defined(NO_CORRECTION) && (NO_CORRECTION==1)
27 return CRGB(scale,scale,scale);
28 #else
29 CRGB adj(0,0,0);
30 if(scale > 0) {
31 for(uint8_t i = 0; i < 3; ++i) {
32 uint8_t cc = colorCorrection.raw[i];
33 uint8_t ct = colorTemperature.raw[i];
34 if(cc > 0 && ct > 0) {
35 // Optimized for AVR size. This function is only called very infrequently so size
36 // matters more than speed.
37 uint32_t work = (((uint16_t)cc)+1);
38 work *= (((uint16_t)ct)+1);
39 work *= scale;
40 work /= 0x10000L;
41 adj.raw[i] = work & 0xFF;
42 }
43 }
44 }
45 return adj;
46 #endif
47}
UISlider scale("Scale", 4,.1, 4,.1)
FASTLED_FORCE_INLINE CRGB()=default
Default constructor.

References CRGB(), and scale.

Referenced by CLEDController::getAdjustment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: