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

◆ applyGamma_video()

fl::u8 fl::applyGamma_video ( fl::u8 brightness,
float gamma )

Definition at line 1057 of file colorutils.cpp.

1057 {
1058 float orig;
1059 float adj;
1060 orig = (float)(brightness) / (255.0);
1061 adj = pow(orig, gamma) * (255.0);
1062 fl::u8 result = (fl::u8)(adj);
1063 if ((brightness > 0) && (result == 0)) {
1064 result = 1; // never gamma-adjust a positive number down to zero
1065 }
1066 return result;
1067}
UISlider brightness("Brightness", 128, 0, 255, 1)
unsigned char u8
Definition int.h:17