コード例 #1
0
        public static void DrawGreenLines(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(0, 300, 600, 300);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(300, 0, 300, 600);
        }
コード例 #2
0
        public static void DrawRays(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.Purple);

            for (int i = 0; i < 12; i++)
            {
                var startPoint = new Point(i * 50 + 50, 0);
                var endPoint   = new Point(600, i * 50 + 50);
                foxDraw.DrawLine(startPoint, endPoint);
            }
            foxDraw.StrokeColor(Colors.Green);

            for (int i = 0; i < 12; i++)
            {
                var startPoint = new Point(0, i * 50 + 50);
                var endPoint   = new Point(i * 50 + 50, 600);
                foxDraw.DrawLine(startPoint, endPoint);
            }

            /*
             * Here we can see the crappy method but the
             * coordinates are informative:
             *
             * foxDraw.StrokeColor(Colors.Purple);
             * foxDraw.DrawLine(0, 0, 700, 50);
             * foxDraw.DrawLine(50, 0, 700, 100);
             * foxDraw.DrawLine(100, 0, 700, 150);
             * foxDraw.DrawLine(150, 0, 700, 200);
             * foxDraw.DrawLine(200, 0, 700, 250);
             * foxDraw.DrawLine(250, 0, 700, 300);
             * foxDraw.DrawLine(300, 0, 700, 350);
             * foxDraw.DrawLine(350, 0, 700, 400);
             * foxDraw.DrawLine(400, 0, 700, 450);
             * foxDraw.DrawLine(450, 0, 700, 500);
             * foxDraw.DrawLine(500, 0, 700, 550);
             * foxDraw.DrawLine(550, 0, 700, 600);
             * foxDraw.DrawLine(600, 0, 700, 650);
             * foxDraw.DrawLine(650, 0, 700, 700);
             *
             * foxDraw.StrokeColor(Colors.Green);
             * foxDraw.DrawLine(0, 50, 50, 700);
             * foxDraw.DrawLine(0, 100, 100, 700);
             * foxDraw.DrawLine(0, 150, 150, 700);
             * foxDraw.DrawLine(0, 200, 200, 700);
             * foxDraw.DrawLine(0, 250, 250, 700);
             * foxDraw.DrawLine(0, 300, 300, 700);
             * foxDraw.DrawLine(0, 350, 350, 700);
             * foxDraw.DrawLine(0, 400, 400, 700);
             * foxDraw.DrawLine(0, 450, 450, 700);
             * foxDraw.DrawLine(0, 500, 500, 700);
             * foxDraw.DrawLine(0, 550, 550, 700);
             * foxDraw.DrawLine(0, 600, 600, 700);
             * foxDraw.DrawLine(0, 650, 650, 700);
             * foxDraw.DrawLine(0, 700, 700, 700);
             */
        }
コード例 #3
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(300, 200, 500, 200, 5);
            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(400, 80, 400, 325, 5);
        }
コード例 #4
0
        public static void DrawColoredSquare(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.Blue);
            foxDraw.DrawLine(200, 200, 400, 200, 5);

            foxDraw.StrokeColor(Colors.Purple);
            foxDraw.DrawLine(200, 400, 400, 400, 5);

            foxDraw.StrokeColor(Colors.Yellow);
            foxDraw.DrawLine(200, 200, 200, 400, 5);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(400, 200, 400, 400, 5);
        }
コード例 #5
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            // Draw the canvas' diagonals.
            // If it starts from the upper-left corner it should be green, otherwise it should be red.

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(0, 0, 1600, 850);

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(0, 850, 1600, 0);
        }
コード例 #6
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            // draw a red horizontal line to the canvas' middle.
            // draw a green vertical line to the canvas' middle.

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(0, 400, 1600, 400);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(800, 0, 800, 800);
        }
コード例 #7
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            // Draw a box that has different colored lines on each edge.

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(200, 400, 200, 800);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(200, 800, 800, 800);

            foxDraw.StrokeColor(Colors.Blue);
            foxDraw.DrawLine(800, 800, 800, 400);

            foxDraw.StrokeColor(Colors.Black);
            foxDraw.DrawLine(200, 400, 800, 400);
        }
コード例 #8
0
 public static void DrawHorizontal50(FoxDraw foxDraw)
 {
     foxDraw.StrokeColor(Colors.Black);
     int[] x = { 300, 100, 900 };
     int[] y = { 100, 500, 200 };
     for (int i = 0; i < 3; i++)
     {
         var startPoint = new Point(x[i], y[i]);
         var endPoint   = new Point(x[i] + 50, y[i]);
         foxDraw.DrawLine(startPoint, endPoint);
     }
 }
コード例 #9
0
 public static void DrawToCenter(FoxDraw foxDraw)
 {
     foxDraw.StrokeColor(Colors.Black);
     int[] x = { 300, 100, 500 };
     int[] y = { 100, 500, 500 };
     for (int i = 0; i < 3; i++)
     {
         var startPoint = new Point(x[i], y[i]);
         var endPoint   = new Point(800, 400);
         foxDraw.DrawLine(startPoint, endPoint);
     }
 }
コード例 #10
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);
            //  draw a red horizontal line to the canvas' middle.
            //  draw a green vertical line to the canvas' middle.
            var startingPoint = new Point(0, 150);
            var endingPoint   = new Point(300, 150);


            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(startingPoint, endingPoint);


            var startingPoint2 = new Point(150, 0);
            var endingPoint2   = new Point(150, 300);


            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(startingPoint2, endingPoint2);
        }
コード例 #11
0
        public static void DrawRays(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.Green);

            for (int i = 0; i < 12; i++)
            {
                var startPoint = new Point(i * 25 + 25, 300);
                var endPoint   = new Point(300, i * 25 + 325);
                foxDraw.DrawLine(startPoint, endPoint);
            }
            for (int i = 0; i < 12; i++)
            {
                var startPoint = new Point(300, i * 25 + 25);
                var endPoint   = new Point(275 - i * 25, 300);
                foxDraw.DrawLine(startPoint, endPoint);
            }
            for (int i = 0; i < 12; i++)
            {
                var startPoint = new Point(300, i * 25 + 25);
                var endPoint   = new Point(325 + i * 25, 300);
                foxDraw.DrawLine(startPoint, endPoint);
            }
        }
コード例 #12
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);
            // Draw a green 10x10 square to the canvas' center.

            int centerPointX = 800;
            int centerPointY = 400;
            int rectCornerAX = centerPointX - 5;
            int rectCornerAY = centerPointY - 5;
            int rectCornerBX = centerPointX - 5;
            int rectCornerBY = centerPointY + 5;
            int rectCornerCX = centerPointX + 5;
            int rectCornerCY = centerPointY + 5;
            int rectCornerDX = centerPointX + 5;
            int rectCornerDY = centerPointY - 5;

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(rectCornerAX, rectCornerAY, rectCornerBX, rectCornerBY);
            foxDraw.DrawLine(rectCornerBX, rectCornerBY, rectCornerCX, rectCornerCY);
            foxDraw.DrawLine(rectCornerCX, rectCornerCY, rectCornerDX, rectCornerDY);
            foxDraw.DrawLine(rectCornerDX, rectCornerDY, rectCornerAX, rectCornerAY);
        }