SetColor() публичный Метод

Updates the color of all vertexes. The method always expects non-premultiplied alpha values.
public SetColor ( uint color ) : void
color uint
Результат void
Пример #1
0
        public void TestSetAllColors()
        {
            uint color = 0xabcdef;
            VertexData vertexData = new VertexData(4);
            vertexData.SetColor(color);

            for (int i = 0; i < vertexData.NumVertices; ++i)
            {
                Assert.AreEqual(color, vertexData.ColorAt(i), "wrong color");
            }
        }
Пример #2
0
        public void TestSetAllColorsAndAlphas()
        {
            uint color = 0xabcdef;
            float alpha = 0.5f;
            VertexData vertexData = new VertexData(4);
            vertexData.SetColor(color);
            vertexData.SetAlpha(alpha);

            for (int i=0; i<vertexData.NumVertices; ++i)
            {
                Assert.AreEqual(color, vertexData.ColorAt(i), "wrong color");
                AssertAreEqualWithSmallError(alpha, vertexData.AlphaAt(i), "wrong alpha", 0.005f);
            }
        }
Пример #3
0
        public void TestScaleAlphaWithoutPMA()
        {
            VertexData vertexData = new VertexData(1);

            vertexData.SetColor(ColorUtil.GetRGB(80, 60, 40), 128/255.0f);

            vertexData.ScaleAlphaBy(0.5f);

            CompareVertexColor(VertexColorHelper.CreateVertexColor(80, 60, 40, 64), vertexData.VertexColors[0]);
        }
Пример #4
0
        public void TestScaleAlphaWithPMA()
        {
            VertexData vertexData = new VertexData(1, true);

            vertexData.SetColor(ColorUtil.GetRGB(80, 60, 40), 204/255.0f);

            vertexData.ScaleAlphaBy(0.8f);

            CompareVertexColor(VertexColorHelper.CreateVertexColor(
                (byte)(80 * 0.64f + 0.5f), 
                (byte)(60 * 0.64f + 0.5f), 
                (byte)(40 * 0.64f + 0.5f), 
                (byte)(204 * 0.8f + 0.5f)), vertexData.VertexColors[0]);
        }
Пример #5
0
        public void TestPremultipliedAlpha()
        {
            VertexData vertexData = new VertexData(1);
          
            vertexData.SetColor(ColorUtil.GetRGB(80, 60, 40), 204/255.0f);

            vertexData.SetPremultipliedAlpha(true, true);

            CompareVertexColor(VertexColorHelper.CreateVertexColor(64, 48, 32, 204), vertexData.VertexColors[0]);

            vertexData.SetPremultipliedAlpha(false, true);

            CompareVertexColor(VertexColorHelper.CreateVertexColor(80, 60, 40, 204), vertexData.VertexColors[0]);
        }