CrystalMpq.DataFormats.ArgbColor.ArgbColor C# (CSharp) Method

ArgbColor() public method

public ArgbColor ( ushort color ) : System
color ushort
return System
        public ArgbColor(ushort color)
        {
            // Optimization used here:
            // x / 31 = x * 8457 >> 18 (for 0 ≤ x ≤ 31 * 255)
            // x / 63 = x * 16645 >> 20 (for 0 ≤ x ≤ 63 * 255)
            // Since a multiplication is needed anyway, it is probably useless to try optimizing the * 255…
            B = (byte)((color & 0x001F) * (255 * 8457) >> 18);
            G = (byte)(((color & 0x07E0) >> 5) * (255 * 16645) >> 20);
            R = (byte)((color >> 11) * (255 * 8457) >> 18);
            A = 255;
        }

Same methods

ArgbColor::ArgbColor ( byte r, byte g, byte b ) : System
ArgbColor::ArgbColor ( byte r, byte g, byte b, byte a ) : System