Artemis.Utilities.ColorHelpers.ShiftColor C# (CSharp) Метод

ShiftColor() публичный статический Метод

public static ShiftColor ( System.Drawing.Color c, int shiftAmount ) : System.Drawing.Color
c System.Drawing.Color
shiftAmount int
Результат System.Drawing.Color
        public static Color ShiftColor(Color c, int shiftAmount)
        {
            int newRed = c.R;
            int newGreen = c.G;
            int newBlue = c.B;

            // Red to purple
            if (c.R == 255 && c.B < 255 && c.G == 0)
                newBlue = newBlue + shiftAmount;
            // Purple to blue
            else if (c.B == 255 && c.R > 0)
                newRed = newRed - shiftAmount;
            // Blue to light-blue
            else if (c.B == 255 && c.G < 255)
                newGreen = newGreen + shiftAmount;
            // Light-blue to green
            else if (c.G == 255 && c.B > 0)
                newBlue = newBlue - shiftAmount;
            // Green to yellow
            else if (c.G == 255 && c.R < 255)
                newRed = newRed + shiftAmount;
            // Yellow to red
            else if (c.R == 255 && c.G > 0)
                newGreen = newGreen - shiftAmount;

            newRed = BringIntInColorRange(newRed);
            newGreen = BringIntInColorRange(newGreen);
            newBlue = BringIntInColorRange(newBlue);

            return Color.FromArgb(c.A, newRed, newGreen, newBlue);
        }