calculateRelativeLuminance static method
Calculates the relative luminance for the given red
, green
, blue
values.
The returned value is between 0 and 1 with the given decimals
.
Implementation
static double calculateRelativeLuminance(int red, int green, int blue,
{int decimals = 2}) {
return MathUtils.round(
(0.299 * red + 0.587 * green + 0.114 * blue) / 255, decimals);
}