Beispiel #1
0
        public void Test_SetRow()
        {
            MagickColorMatrix matrix = new MagickColorMatrix(2);

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

            matrix.SetRow(1, 6, 8);
            Assert.AreEqual(6, matrix.GetValue(0, 1));
            Assert.AreEqual(8, matrix.GetValue(1, 1));
        }
Beispiel #2
0
        private MagickImage GetImage()
        {
            MagickImage image = new MagickImage(RawData);

            image.ColorSpace = ColorSpace.sRGB;
            MagickColorMatrix matrix = new MagickColorMatrix(3);

            matrix.SetRow(0, 0, 0, 1);
            matrix.SetRow(1, 0, 1, 0);
            matrix.SetRow(2, 1, 0, 0);
            image.ColorMatrix(matrix);
            return(image);
        }
Beispiel #3
0
 public override byte[] ToArray()
 {
     using (MagickImage image = new MagickImage(data))
     {
         if (image.ColorSpace != ColorSpace.sRGB)
         {
             image.ColorSpace = ColorSpace.sRGB;
         }
         MagickColorMatrix matrix = new MagickColorMatrix(3);
         matrix.SetRow(0, 0, 0, 1);
         matrix.SetRow(1, 0, 1, 0);
         matrix.SetRow(2, 1, 0, 0);
         image.ColorMatrix(matrix);
         return(image.ToByteArray());
     }
 }
Beispiel #4
0
        private static void SetRow_InvalidRow_ThrowsException(int y)
        {
            var matrix = new MagickColorMatrix(2);

            Assert.Throws <ArgumentOutOfRangeException>("y", () =>
            {
                matrix.SetRow(y, 1.0, 2.0);
            });
        }
Beispiel #5
0
        public void SetRow_InvalidNumberOfValues_ThrowsException()
        {
            var matrix = new MagickColorMatrix(2);

            Assert.Throws <ArgumentException>("values", () =>
            {
                matrix.SetRow(0, 1, 2, 3);
            });
        }
Beispiel #6
0
        public void SetRowValuesIsNull_ThrowsException()
        {
            var matrix = new MagickColorMatrix(2);

            Assert.Throws <ArgumentNullException>("values", () =>
            {
                matrix.SetRow(0, null);
            });
        }
Beispiel #7
0
        public void SetRow_CorrectNumberOfValues_SetsColumn()
        {
            var matrix = new MagickColorMatrix(2);

            matrix.SetRow(1, 6, 8);
            Assert.Equal(0, matrix.GetValue(0, 0));
            Assert.Equal(6, matrix.GetValue(0, 1));
            Assert.Equal(0, matrix.GetValue(1, 0));
            Assert.Equal(8, matrix.GetValue(1, 1));
        }