public void Main() { var square = new Square(5); var drawer = new SquareDrawer(square); drawer.Draw(); }
private void DrawTiltedSquare(int tilt) { SquareShape sqA = new SquareShape(new XY(Dimension / 2, Dimension / 2), Dimension / 4, tilt); Polygon sqProto = new Polygon(); sqProto.Stroke = new SolidColorBrush(Colors.Black); sqProto.StrokeThickness = 2; sqProto.Fill = new SolidColorBrush(Color.FromArgb(255, (byte)((255 * tilt) / 360), 0, 0)); SquareDrawer sqdA = new SquareDrawer(sqA, sqProto); sqdA.AttachToCanvas(MainCanvas.Instance.TheCanvas); }
public void Main() { var shapes = new IShape[] { new Square(5), new Circle(1) /*, ...*/ }; foreach (IShape shape in shapes) { if (shape is Square) { var drawer = new SquareDrawer((Square)shape); drawer.Draw(); } else if (shape is Circle) { var drawer = new CircleDrawer((Circle)shape); drawer.Draw(); } // ... } }
public void VisionAPI_Should_DrawRectangles() { var fr = new FaceRectangle(); fr.Left = 0; fr.Top = 0; fr.Width = 50; fr.Height = 50; var rectangles = new List <FaceRectangle>() { }; using (Stream imageFileStream = File.OpenRead("SAMSON_GERT2.JPG")) { var outputStream = new SquareDrawer().Draw(imageFileStream, rectangles); using (FileStream fs = new FileStream("SAMSON_GERT2_FD.JPG", FileMode.Create)) { outputStream.Position = 0; outputStream.CopyTo(fs); outputStream.Flush(); fs.Flush(); } } }