private void DrawFigure(SharpDXFigure figure) { SharpDX.Direct2D1.PathGeometry geometry = new SharpDX.Direct2D1.PathGeometry(Core.Globals.D2DFactory); SharpDX.Direct2D1.GeometrySink sink = geometry.Open(); sink.BeginFigure(figure.Points[0], new SharpDX.Direct2D1.FigureBegin()); for (int i = 0; i < figure.Points.Length; i++) { sink.AddLine(figure.Points[i]); } sink.AddLine(figure.Points[0]); sink.EndFigure(SharpDX.Direct2D1.FigureEnd.Closed); sink.Close(); RenderTarget.FillGeometry(geometry, dxmBrushes[figure.Color].DxBrush); geometry.Dispose(); sink.Dispose(); }