public void TestCropArt() { var srcImage = new CodedImage { Size = new Size(10, 10) }; int[] pixels; using (srcImage.LockPixels(out pixels)) { for (int i = 0; i < pixels.Length; i++) { pixels[i] = 100; } } var cropper = new ImageCropManipulator(srcImage); cropper.CropArc(new Rectangle(1, 1, 8, 8)); var dstImage = cropper.ManipulatedImage; dstImage.CompletePalette(); Assert.AreEqual(new Size(8, 8), dstImage.Size); Assert.AreEqual(new CodedColor(255, 255, 255), dstImage[0, 0]); Assert.AreEqual(new CodedColor(255, 255, 255), dstImage[0, 7]); Assert.AreEqual(new CodedColor(255, 255, 255), dstImage[7, 0]); Assert.AreEqual(new CodedColor(255, 255, 255), dstImage[7, 7]); Assert.AreEqual(new CodedColor(100), dstImage[4, 4], "Some point in the centre"); }
public void TestOperationsCallsOnImageChanged() { var image = new CodedImage { Size = new Size(5, 5) }; var cropper = new ImageCropManipulator(image); var childManipulator = new ImageManipulatorTest.DummyManipulator(cropper); AssertActionCallsOnImageChanged(childManipulator, () => cropper.CropRect(new Rectangle(1, 1, 3, 3))); AssertActionCallsOnImageChanged(childManipulator, () => cropper.CropArc(new Rectangle(1, 1, 3, 3))); }