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)); }
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); }
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()); } }
private static void SetRow_InvalidRow_ThrowsException(int y) { var matrix = new MagickColorMatrix(2); Assert.Throws <ArgumentOutOfRangeException>("y", () => { matrix.SetRow(y, 1.0, 2.0); }); }
public void SetRow_InvalidNumberOfValues_ThrowsException() { var matrix = new MagickColorMatrix(2); Assert.Throws <ArgumentException>("values", () => { matrix.SetRow(0, 1, 2, 3); }); }
public void SetRowValuesIsNull_ThrowsException() { var matrix = new MagickColorMatrix(2); Assert.Throws <ArgumentNullException>("values", () => { matrix.SetRow(0, null); }); }
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)); }