delinearized static method
- double rgbComponent
Delinearizes an RGB component.
rgbComponent
0.0 <= rgb_component <= 100.0, represents linear
R/G/B channel
Returns 0 <= output <= 255, color channel converted to regular
RGB space
Implementation
static int delinearized(double rgbComponent) {
final normalized = rgbComponent / 100.0;
var delinearized = 0.0;
if (normalized <= 0.0031308) {
delinearized = normalized * 12.92;
} else {
delinearized = 1.055 * pow(normalized, 1.0 / 2.4).toDouble() - 0.055;
}
return MathUtils.clampInt(0, 255, (delinearized * 255.0).round());
}