Encapsulates a color matrix in the order of 1 to 6 (1x1 through 6x6).
상속: DoubleMatrix
예제 #1
0
    public void Test_SetColumn()
    {
      MagickColorMatrix matrix = new MagickColorMatrix(2);

      matrix.SetColumn(0, 2, 4);
      Assert.AreEqual(2, matrix.GetValue(0, 0));
      Assert.AreEqual(4, matrix.GetValue(0, 1));

      matrix.SetColumn(1, 6, 8);
      Assert.AreEqual(6, matrix.GetValue(1, 0));
      Assert.AreEqual(8, matrix.GetValue(1, 1));
    }
예제 #2
0
    public void Test_Constructor()
    {
      ExceptionAssert.Throws<ArgumentException>(delegate ()
      {
        new MagickColorMatrix(-1);
      });

      ExceptionAssert.Throws<ArgumentException>(delegate ()
      {
        new MagickColorMatrix(7);
      });

      new MagickColorMatrix(1);

      ExceptionAssert.Throws<ArgumentException>(delegate ()
      {
        new MagickColorMatrix(2, 1.0);
      });

      MagickColorMatrix matrix = new MagickColorMatrix(2, 0.0, 1.0, 0.1, 1.1);
      Assert.AreEqual(0.0, matrix.GetValue(0, 0));
      Assert.AreEqual(1.0, matrix.GetValue(1, 0));
      Assert.AreEqual(0.1, matrix.GetValue(0, 1));
      Assert.AreEqual(1.1, matrix.GetValue(1, 1));

      ExceptionAssert.Throws<ArgumentOutOfRangeException>(delegate ()
      {
        matrix.GetValue(2, 1);
      });

      ExceptionAssert.Throws<ArgumentOutOfRangeException>(delegate ()
      {
        matrix.GetValue(1, 2);
      });

      ExceptionAssert.Throws<ArgumentOutOfRangeException>(delegate ()
      {
        matrix.GetValue(1, -1);
      });

      ExceptionAssert.Throws<ArgumentOutOfRangeException>(delegate ()
      {
        matrix.GetValue(-1, 1);
      });
    }
예제 #3
0
    public void Test_Value()
    {
      MagickColorMatrix matrix = new MagickColorMatrix(2);

      matrix.SetValue(0, 0, 1.5);
      Assert.AreEqual(1.5, matrix.GetValue(0, 0));

      Assert.AreEqual(0.0, matrix.GetValue(0, 1));
      Assert.AreEqual(0.0, matrix.GetValue(1, 0));
    }
예제 #4
0
    public void Test_ColorMatrix()
    {
      using (MagickImage image = new MagickImage(Files.Builtin.Rose))
      {
        MagickColorMatrix matrix = new MagickColorMatrix(3, 0, 0, 1, 0, 1, 0, 1, 0, 0);

        image.ColorMatrix(matrix);

        ColorAssert.AreEqual(MagickColor.FromRgb(58, 31, 255), image, 39, 25);
      }
    }