Artemis.Utilities.Keyboard.KeyboardRectangle.CreateColorBlend C# (CSharp) Метод

CreateColorBlend() приватный Метод

private CreateColorBlend ( ) : System.Drawing.Drawing2D.ColorBlend
Результат System.Drawing.Drawing2D.ColorBlend
        private ColorBlend CreateColorBlend()
        {
            if (Colors.Count == 1)
                return new ColorBlend {Colors = new[] {Colors[0], Colors[0]}, Positions = new[] {0F, 1F}};
            var colorBlend = Rotate
                ? new ColorBlend {Colors = CreateTilebleColors(Colors).ToArray()}
                : new ColorBlend {Colors = Colors.ToArray()};

            // If needed, apply opacity to the colors in the blend
            if (Opacity < 255)
                for (var i = 0; i < colorBlend.Colors.Length; i++)
                    colorBlend.Colors[i] = Color.FromArgb(Opacity, colorBlend.Colors[i]);

            // Devide the colors over the colorblend
            var devider = (float) colorBlend.Colors.Length - 1;
            var positions = new List<float>();
            for (var i = 0; i < colorBlend.Colors.Length; i++)
                positions.Add(i/devider);

            // Apply the devided positions
            colorBlend.Positions = positions.ToArray();
            return colorBlend;
        }