public void MoveGeneratedRectangles_RelativeCenter() { PositionedLayouter layouter = new PositionedLayouter(new LayouterMock(), new Vector(11, 22)); Rectangle rectangle = layouter.Place(new Vector(15, 12)); rectangle.Center.Should().Be(new Vector(11, 22)); }
private static Bitmap DrawCase(Case c) { Random random = new Random(c.Seed); ColorGenerator colorGenerator = new ColorGenerator(random); IRectangleLayouter layouter = new PositionedLayouter(new CircularCloudLayouter(c.PlacementRadius, c.PlacementSegments, c.Accuracy), new Vector(860, 540)); List <Rectangle> rectangles = Enumerable.Range(0, c.Count).Select(_ => layouter.Place(GetRandomSize(random, c))).ToList(); Bitmap result = rectangles.Colorize(colorGenerator.GetRandomColor).ToBitmap(new System.Drawing.Rectangle(0, 0, 1920, 1080)); Graphics graphics = Graphics.FromImage(result); graphics.DrawString(c.GetDescription(), new Font("Tahoma", 16), Brushes.White, 10, 10); return(result); }