FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

◆ 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 29 of file crgb.cpp.

30 {
31#if defined(NO_CORRECTION) && (NO_CORRECTION == 1)
32 return CRGB(scale, scale, scale);
33#else
34 CRGB adj(0, 0, 0);
35 if (scale > 0) {
36 for (uint8_t i = 0; i < 3; ++i) {
37 uint8_t cc = colorCorrection.raw[i];
38 uint8_t ct = colorTemperature.raw[i];
39 if (cc > 0 && ct > 0) {
40 // Optimized for AVR size. This function is only called very
41 // infrequently so size matters more than speed.
42 uint32_t work = (((uint16_t)cc) + 1);
43 work *= (((uint16_t)ct) + 1);
44 work *= scale;
45 work /= 0x10000L;
46 adj.raw[i] = work & 0xFF;
47 }
48 }
49 }
50 return adj;
51#endif
52}
UISlider scale("Scale", 1.0f, 0.0f, 1.0f, 0.01f)
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: