Terraria.Gore.GetAlpha C# (CSharp) Method

GetAlpha() public method

public GetAlpha ( Color newColor ) : Color
newColor Color
return Color
        public Color GetAlpha(Color newColor)
        {
            float num1 = (float)((int)byte.MaxValue - this.alpha) / (float)byte.MaxValue;
            int r;
            int g;
            int b;
            if (this.type == 16 || this.type == 17)
            {
                r = (int)newColor.R;
                g = (int)newColor.G;
                b = (int)newColor.B;
            }
            else
            {
                if (this.type == 716)
                    return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 200);
                if (this.type >= 570 && this.type <= 572)
                {
                    byte num2 = (byte)((int)byte.MaxValue - this.alpha);
                    return new Color((int)num2, (int)num2, (int)num2, (int)num2 / 2);
                }
                if (this.type == 331)
                    return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 50);
                r = (int)((double)newColor.R * (double)num1);
                g = (int)((double)newColor.G * (double)num1);
                b = (int)((double)newColor.B * (double)num1);
            }
            int a = (int)newColor.A - this.alpha;
            if (a < 0)
                a = 0;
            if (a > (int)byte.MaxValue)
                a = (int)byte.MaxValue;
            return new Color(r, g, b, a);
        }
    }