Esempio n. 1
0
        private static void DrawCanvas()
        {
            if (_canvasSize.IsEmpty)
            {
                return;
            }
            var rect = new Rectangle(new Point(0, 0), _canvasSize);

            Shape.AddToCanvas(canvasPage, rect, '-', '|', true);
            Shape.DrawCanvas(canvasPage);
        }
Esempio n. 2
0
        private static void DrawFill(IList <string> splitCommand, char drawChar)
        {
            var pt = Utility.ParseCord(splitCommand[1], splitCommand[2]);

            if (!Utility.ValidCordinate(pt, _canvasSize))
            {
                return;
            }

            Shape.AddToCanvas(canvasPage, pt, drawChar);
            Shape.DrawCanvas(canvasPage);
        }
Esempio n. 3
0
        private static void DrawLine(IList <string> splitCommand, char drawChar)
        {
            var pts = new Shape.Points();

            if (!Utility.ValidateCanvas(splitCommand, 5, _canvasSize, ref pts, true))
            {
                return;
            }

            Shape.AddToCanvas(canvasPage, pts.fromPoint, pts.toPoint, drawChar);
            Shape.DrawCanvas(canvasPage);
        }
Esempio n. 4
0
        private static void DrawRectangle(IList <string> splitCommand, char drawCharX, char drawCharY)
        {
            var pts = new Shape.Points();

            if (!Utility.ValidateCanvas(splitCommand, 5, _canvasSize, ref pts))
            {
                return;
            }

            var rectangleSize = new Size
            {
                Height = pts.toPoint.Y - pts.fromPoint.Y,
                Width  = pts.toPoint.X - pts.fromPoint.X
            };

            var rect = new Rectangle(pts.fromPoint, rectangleSize);

            Shape.AddToCanvas(canvasPage, rect, drawCharX, drawCharY);
            Shape.DrawCanvas(canvasPage);
        }