public void Test_Draw() { using (IMagickImage image = new MagickImage(MagickColors.Fuchsia, 100, 100)) { var drawables = new ImageMagick.Drawables() .FillColor(MagickColors.Red) .Rectangle(10, 10, 90, 90); IEnumerator enumerator = ((IEnumerable)drawables).GetEnumerator(); Assert.IsTrue(enumerator.MoveNext()); drawables.Draw(image); ColorAssert.AreEqual(MagickColors.Fuchsia, image, 9, 9); ColorAssert.AreEqual(MagickColors.Red, image, 10, 10); ColorAssert.AreEqual(MagickColors.Red, image, 90, 90); ColorAssert.AreEqual(MagickColors.Fuchsia, image, 91, 91); image.Draw(new ImageMagick.Drawables() .FillColor(MagickColors.Green) .Rectangle(15, 15, 85, 85)); ColorAssert.AreEqual(MagickColors.Fuchsia, image, 9, 9); ColorAssert.AreEqual(MagickColors.Red, image, 10, 10); ColorAssert.AreEqual(MagickColors.Green, image, 15, 15); ColorAssert.AreEqual(MagickColors.Green, image, 85, 85); ColorAssert.AreEqual(MagickColors.Red, image, 90, 90); ColorAssert.AreEqual(MagickColors.Fuchsia, image, 91, 91); } }
public void Test_Paths() { Paths paths = null; ImageMagick.Drawables drawables = paths; Assert.IsNull(drawables); paths = new Paths(); IEnumerator enumerator = ((IEnumerable)paths).GetEnumerator(); Assert.IsFalse(enumerator.MoveNext()); }
private void SetClipMask(IMagickImage image, int x0, int y0, int x1, int y1) { var drawables = new ImageMagick.Drawables(); var paths = drawables.Paths() .MoveToAbs(x0, y0) .LineToAbs(x1, y0) .LineToAbs(x1, y1) .LineToAbs(x0, y1) .LineToAbs(x0, y0); var pathId = nameof(SetClipMask); drawables .PushClipPath(pathId) .Path(paths) .PopClipPath() .ClipPath(pathId) .Draw(image); }
internal Paths(Drawables drawables) : this() { _drawables = drawables; }