示例#1
0
        /// <summary>
        /// Draws a rectangle on canvas.
        /// </summary>
        /// <param name="canvas">The canvas.</param>
        /// <param name="tokens">The tokens.</param>
        public void DrawARectangleOnCanvas(Canvas canvas, string[] tokens)
        {
            try
            {
                Point[] points = GetPoints(canvas, tokens, 2);

                Point.ReOrderPoints(points[0], points[1]);

                CanvasRenderer.DrawRectangle(points[0], points[1]);
                CanvasRenderer.Draw();
            }
            catch (InvalidPointException invalidPointException)
            {
                OutputWriter.SendToOutput(invalidPointException.Message, true);
            }
        }