public override double GetValue(double x, double y) { // Read: Color colour = SourceModule.GetColour(x, y); // Get: float channel = HslRgb.Luminance(colour.r, colour.g, colour.b); return(channel); }
public override UnityEngine.Color GetColour(double x, double y) { // Read: Color colour = SourceModule.GetColour(x, y); // Get: float channel = HslRgb.Luminance(colour.r, colour.g, colour.b); return(new Color(channel, channel, channel, 1f)); }
public override UnityEngine.Color GetColour(double x, double y) { UnityEngine.Color col1 = SourceModule.GetColour(x, y); float result; switch (Method) { case DesaturateMethod.YChannel: // HSY model result = HsyRgb.Luminance(col1.r, col1.g, col1.b); break; case DesaturateMethod.LChannel: // HSL model result = HslRgb.Luminance(col1.r, col1.g, col1.b); break; case DesaturateMethod.VChannel: // HSV model result = HsvRgb.Luminance(col1.r, col1.g, col1.b); break; default: case DesaturateMethod.Greyscale: // Greyscale RGB average result = (col1.r + col1.g + col1.b) / 3f; break; } // Grey colour: return(new Color(result, result, result, col1.a)); }