Exemplo n.º 1
0
        public void ColorMatrixEquality()
        {
            ColorMatrix m   = KnownFilterMatrices.CreateHueFilter(45F);
            ColorMatrix m2  = KnownFilterMatrices.CreateHueFilter(45F);
            object      obj = m2;

            Assert.True(m.Equals(obj));
            Assert.True(m.Equals(m2));
            Assert.True(m == m2);
            Assert.False(m != m2);
        }
Exemplo n.º 2
0
        public void ElementsTest1()
        {
            ColorMatrix m1 = ColorMatrix.Identity;
            ColorMatrix m2 = new ColorMatrix(0.5, 0.5, 0.5, 1, 0, 0, 0, 0);

            Assert.Equal(5, m1.RowCount);
            Assert.Equal(5, m2.ColumnCount);

            DoubleComponent[][] expected = new DoubleComponent[][]
            {
                new DoubleComponent[] { 0.5, 0, 0, 0, 0 },
                new DoubleComponent[] { 0, 0.5, 0, 0, 0 },
                new DoubleComponent[] { 0, 0, 0.5, 0, 0 },
                new DoubleComponent[] { 0, 0, 0, 1, 0 },
                new DoubleComponent[] { 0, 0, 0, 0, 1 }
            };

            //DoubleComponent[][] actual = m2.Elements;

            Assert.Equal(expected[0][0], m2[0, 0]);
            Assert.Equal(expected[0][1], m2[0, 1]);
            Assert.Equal(expected[0][2], m2[0, 2]);
            Assert.Equal(expected[1][0], m2[1, 0]);
            Assert.Equal(expected[1][1], m2[1, 1]);
            Assert.Equal(expected[1][2], m2[1, 2]);
            Assert.Equal(expected[2][0], m2[2, 0]);
            Assert.Equal(expected[2][1], m2[2, 1]);
            Assert.Equal(expected[2][2], m2[2, 2]);

            //m1.Elements = expected;
            m1 = new ColorMatrix(new Matrix(MatrixFormat.RowMajor, expected));
            Assert.Equal(m1, m2);
            Assert.True(m1.Equals(m2 as IMatrix <DoubleComponent>));
        }
Exemplo n.º 3
0
        public void ElementsTest1()
        {
            ColorMatrix m1 = ColorMatrix.Identity;
            ColorMatrix m2 = new ColorMatrix(0.5, 0.5, 0.5, 1, 0, 0, 0, 0);

            Assert.Equal(5, m1.RowCount);
            Assert.Equal(5, m2.ColumnCount);

            DoubleComponent[][] expected = new DoubleComponent[][]
                {
                    new DoubleComponent[] {0.5, 0, 0, 0, 0},
                    new DoubleComponent[] {0, 0.5, 0, 0, 0},
                    new DoubleComponent[] {0, 0, 0.5, 0, 0},
                    new DoubleComponent[] {0, 0, 0, 1, 0},
                    new DoubleComponent[] {0, 0, 0, 0, 1}
                };

            //DoubleComponent[][] actual = m2.Elements;

            Assert.Equal(expected[0][0], m2[0, 0]);
            Assert.Equal(expected[0][1], m2[0, 1]);
            Assert.Equal(expected[0][2], m2[0, 2]);
            Assert.Equal(expected[1][0], m2[1, 0]);
            Assert.Equal(expected[1][1], m2[1, 1]);
            Assert.Equal(expected[1][2], m2[1, 2]);
            Assert.Equal(expected[2][0], m2[2, 0]);
            Assert.Equal(expected[2][1], m2[2, 1]);
            Assert.Equal(expected[2][2], m2[2, 2]);

            //m1.Elements = expected;
            m1 = new ColorMatrix(new Matrix(MatrixFormat.RowMajor, expected));
            Assert.Equal(m1, m2);
            Assert.True(m1.Equals(m2 as IMatrix<DoubleComponent>));
        }