Esempio n. 1
0
        public void GradientLinearlyInterpolatesBetweenColors()
        {
            var pat = new GradientPattern(white, black);

            Assert.Equal(white, pat.GetColor(Vector4.CreatePosition(0, 0, 0)));
            Assert.Equal(new Color(0.75, 0.75, 0.75), pat.GetColor(Vector4.CreatePosition(0.25, 0, 0)));
            Assert.Equal(new Color(0.5, 0.5, 0.5), pat.GetColor(Vector4.CreatePosition(0.5, 0, 0)));
            Assert.Equal(new Color(0.25, 0.25, 0.25), pat.GetColor(Vector4.CreatePosition(0.75, 0, 0)));
        }
        public void BasicTest()
        {
            var pattern = new GradientPattern(Color.White, Color.Black);

            Check.That(pattern.GetColor(Helper.CreatePoint(0, 0, 0))).IsEqualTo(new Color(1, 1, 1));
            Check.That(pattern.GetColor(Helper.CreatePoint(0.25, 0, 0))).IsEqualTo(new Color(0.75, 0.75, 0.75));
            Check.That(pattern.GetColor(Helper.CreatePoint(0.5, 0, 0))).IsEqualTo(new Color(0.5, 0.5, 0.5));
            Check.That(pattern.GetColor(Helper.CreatePoint(0.75, 0, 0))).IsEqualTo(new Color(0.25, 0.25, 0.25));
        }