Beispiel #1
0
        public void ParseTest()
        {
            Assert.AreEqual(Color4bs.Blue, Color4b.Parse("Blue"));
            Assert.AreEqual(Color4bs.Blue, Color4b.Parse("blue"));
            Assert.AreEqual(Color4bs.Blue, Color4b.Parse(" blue "));
            Assert.AreEqual(Color4bs.Blue, Color4b.Parse(" blUe"));
            Assert.AreEqual(Color4bs.Blue, Color4b.Parse("BLUE"));

            var color = Color4b.FromValue(0xFFCCBBAA);

            Assert.AreEqual(Color4bs.Black, Color4b.Parse("#FF000000"));
            Assert.AreEqual(Color4bs.YellowGreen, Color4b.Parse("#FF9ACD32"));
            Assert.AreEqual(Color4bs.YellowGreen, Color4b.Parse("#9ACD32"));
            Assert.AreEqual(color, Color4b.Parse("#FFCCBBAA"));
            Assert.AreEqual(color, Color4b.Parse("#CCbBaA"));
            Assert.AreEqual(color, Color4b.Parse("#FCBA"));
            Assert.AreEqual(color, Color4b.Parse("#cba"));
            Assert.AreEqual(color, Color4b.Parse(" #CBA "));

            Assert.Catch <FormatException>(() => Color4b.Parse(" bl Ue"));
            Assert.Catch <FormatException>(() => Color4b.Parse(" blxUe"));
            Assert.Catch <FormatException>(() => Color4b.Parse(" blUex"));

            Assert.Catch <FormatException>(() => Color4b.Parse("#0xFFCCBBAA"));
            Assert.Catch <FormatException>(() => Color4b.Parse("# C B A"));
            Assert.Catch <FormatException>(() => Color4b.Parse("#d0C0BcA"));
        }
Beispiel #2
0
        public void CreateTest()
        {
            var c = Color4b.FromArgb(50, 100, 150, 200);

            Test(Color4b.FromArgb(1, 2, 3, 4), 1, 2, 3, 4);
            Test(Color4b.FromArgb(1, 2, 3), 255, 1, 2, 3);
            Test(Color4b.FromArgb(10, c), 10, 100, 150, 200);
            Test(Color4b.FromValue(0x11223344), 0x11, 0x22, 0x33, 0x44);
        }
Beispiel #3
0
 public TargetColor(uint targetColor, double rate)
     : this(Color4b.FromValue(targetColor), rate)
 {
 }
Beispiel #4
0
 public TargetColor(uint targetColor)
     : this(Color4b.FromValue(targetColor))
 {
 }
Beispiel #5
0
 public ColorChange(uint startColor, uint endColor)
 {
     m_startColor = Color4b.FromValue(startColor);
     m_endColor   = Color4b.FromValue(endColor);
 }