linearized static method
Linearizes an RGB component.
rgbComponent
0 <= rgb_component <= 255, represents R/G/B
channel
Returns 0.0 <= output <= 100.0, color channel converted to
linear RGB space
Implementation
static double linearized(int rgbComponent) {
final normalized = rgbComponent / 255.0;
if (normalized <= 0.040449936) {
return normalized / 12.92 * 100.0;
} else {
return pow((normalized + 0.055) / 1.055, 2.4).toDouble() * 100.0;
}
}