Animatroller.Framework.Utility.RgbConverter.GetSaturation C# (CSharp) Метод

GetSaturation() приватный статический Метод

private static GetSaturation ( Color rgb ) : int
rgb Color
Результат int
        private static int GetSaturation(Color rgb)
        {
            // Find the smallest of all three parameters.
            float low = Math.Min(rgb.R, Math.Min(rgb.G, rgb.B));

            // Find the highest of all three parameters.
            float high = Math.Max(rgb.R, Math.Max(rgb.G, rgb.B));

            // The difference between the last two variables
            // divided by the highest is the saturation.
            return (int)Math.Round(100 * ((high - low) / high));
        }