public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            for (int i = 0; i < 15; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(150, 0 + i * 10, 150 + i * 10, 150);
            }
            for (int i = 0; i < 15; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(150, 300 - i * 10, 150 - i * 10, 150);
            }
            for (int i = 0; i < 15; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(150, 0 + i * 10, 150 - i * 10, 150);
            }
            for (int i = 0; i < 15; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(150, 300 - i * 10, 150 + i * 10, 150);
            }
        }
示例#2
0
        public static void DrawDiagonals(FoxDraw foxDraw)
        {
            int x = 30;

            for (int i = 0; i <= 10; i++)
            {
                foxDraw.StrokeColor(Colors.ForestGreen);
                foxDraw.DrawLine(i * x, 300, 300, 300 - (i * x));
            }

            for (int i = 0; i <= 10; i++)
            {
                foxDraw.StrokeColor(Colors.ForestGreen);
                foxDraw.DrawLine(300, i * x, 300 + (i * x), 300);
            }

            for (int i = 0; i <= 10; i++)
            {
                foxDraw.StrokeColor(Colors.ForestGreen);
                foxDraw.DrawLine(i * x, 300, 300, 300 + (i * x));
            }

            for (int i = 0; i <= 10; i++)
            {
                foxDraw.StrokeColor(Colors.ForestGreen);
                foxDraw.DrawLine(300, 300 + (i * x), 600 - (i * x), 300);
            }
        }
        public static void FunctionToCenter(FoxDraw foxDraw, int number, int suchnumber)
        {
            for (int i = 0; i < 300; i += 20)
            {
                foxDraw.StrokeColor(Colors.DarkCyan);
                foxDraw.DrawLine(suchnumber, suchnumber + i, 150, 150);
            }

            for (int i = 0; i < 300; i += 20)
            {
                foxDraw.StrokeColor(Colors.Cyan);
                foxDraw.DrawLine(number, number - i, 150, 150);
            }

            for (int i = 0; i < 300; i += 20)
            {
                foxDraw.StrokeColor(Colors.Green);
                foxDraw.DrawLine(suchnumber + i, number, 150, 150);
            }

            for (int i = 0; i < 300; i += 20)
            {
                foxDraw.StrokeColor(Colors.YellowGreen);
                foxDraw.DrawLine(number - i, suchnumber, 150, 150);
            }

            /* for (int i = 0; i < 11; i++)
             * {
             *   foxDraw.StrokeColor(Colors.Green);
             *   foxDraw.DrawLine(0 + (i * 20), 0, 100, 100);
             *   foxDraw.DrawLine(200, 0 + (i * 20), 100, 100);
             *   foxDraw.DrawLine(0, 0 + (i * 20), 100, 100);
             *   foxDraw.DrawLine(0 + (i * 20), 200, 100, 100);
             * }*/
        }
示例#4
0
 public void DrawPlus(Canvas canvas, FoxDraw foxDraw)
 {
     foxDraw.StrokeColor(Colors.Red);
     foxDraw.DrawLine(0, canvas.Width / 2, canvas.Height, canvas.Width / 2, 10);
     foxDraw.StrokeColor(Colors.Green);
     foxDraw.DrawLine(canvas.Width / 2, 0, canvas.Width / 2, canvas.Height, 10);
 }
示例#5
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            // divide the canvas into 4 parts
            // and repeat this pattern in each quarter:
            // [https://github.com/greenfox-academy/teaching-materials/blob/master/workshop/drawing/line-play/r1.png]

            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(0, 150 + i * 15, 10 + i * 15, 300);
            }
            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.MediumPurple);
                foxDraw.DrawLine(150 + i * 15, 0, 300, 10 + i * 15);
            }
            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.CadetBlue);
                foxDraw.DrawLine(300, 150 + i * 15, 300 - i * 15, 300);
            }
            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.Crimson);
                foxDraw.DrawLine(0, 150 - i * 15, 10 + i * 15, 0);
            }
        }
示例#6
0
 public static void LineInTheMiddle(FoxDraw foxDraw)
 {
     foxDraw.StrokeColor(Colors.Red);
     foxDraw.DrawLine(100, 300, 500, 300);
     foxDraw.StrokeColor(Colors.Green);
     foxDraw.DrawLine(300, 100, 300, 500);
 }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);
            // draw a box that has different colored lines on each edge.

            var pointList = new List <Point>()
            {
                new Point(canvas.Width / 3, canvas.Height / 3),
                new Point(canvas.Width / 3 * 2, canvas.Height / 3),
                new Point(canvas.Width / 3 * 2, canvas.Height / 3 * 2),
                new Point(canvas.Width / 3, canvas.Height / 3 * 2),
            };

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(pointList[0], pointList[1]);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(pointList[1], pointList[2]);

            foxDraw.StrokeColor(Colors.Blue);
            foxDraw.DrawLine(pointList[2], pointList[3]);

            foxDraw.StrokeColor(Colors.Yellow);
            foxDraw.DrawLine(pointList[3], pointList[0]);
        }
示例#8
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            // reproduce this:
            // [https://github.com/greenfox-academy/teaching-materials/blob/master/workshop/drawing/line-play/r1.png]


            for (int i = 0; i < canvas.Width; i++)
            {
                foxDraw.StrokeColor(Colors.Crimson);
                var startPoint = new Point(0, i);
                var endPoint   = new Point(i, canvas.Height);
                foxDraw.DrawLine(startPoint, endPoint);
                i += 20;
            }
            for (int i = 0; i < canvas.Width; i++)
            {
                foxDraw.StrokeColor(Colors.DarkMagenta);
                var startPoint = new Point(i, 0);
                var endPoint   = new Point(canvas.Width, i);
                foxDraw.DrawLine(startPoint, endPoint);
                i += 20;
            }
        }
        public static void DrawDiagonals(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.ForestGreen);
            foxDraw.DrawLine(0, 0, 600, 600);

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(600, 0, 0, 600);
        }
示例#10
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);
        }
示例#11
0
        public static void DrawLines(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(0, 175, 525, 175);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(263, 0, 263, 350);
        }
示例#12
0
 public void DrawDiagonal(Canvas canvas, FoxDraw foxDraw)
 {
     // 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, canvas.Width, canvas.Height, 10);
     foxDraw.StrokeColor(Colors.Red);
     foxDraw.DrawLine(canvas.Width, 0, 0, canvas.Height, 10);
 }
示例#13
0
 public void WidenedGape(FoxDraw foxDraw, int x, int y)
 {
     for (int i = 0; i <= 150; i += 10)
     {
         foxDraw.StrokeColor(Colors.Green);
         foxDraw.DrawLine(x + 0, y + i, x + i, y + 150);
         foxDraw.StrokeColor(Colors.Purple);
         foxDraw.DrawLine(x + i, y + 0, x + 150, y + i);
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(0, 0, 300, 300);
            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(300, 0, 0, 300);
        }
示例#15
0
 private void PlayWithLines(FoxDraw foxDraw, double distance, List <Color> colour)
 {
     for (double i = 0; i < canvas.Width - distance; i += distance)
     {
         foxDraw.StrokeColor(colour[0]);
         foxDraw.DrawLine(i + distance, 0, canvas.Width, i + distance);
         foxDraw.StrokeColor(colour[1]);
         foxDraw.DrawLine(0, i + distance, i + distance, canvas.Width);
     }
 }
示例#16
0
 public void WidenedGape(FoxDraw foxDraw)
 {
     for (int i = 0; i <= 300; i += 20)
     {
         foxDraw.StrokeColor(Colors.Green);
         foxDraw.DrawLine(0, i, i, 300);
         foxDraw.StrokeColor(Colors.Purple);
         foxDraw.DrawLine(i, 0, 300, i);
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.Aqua);
            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(0, 150, 300, 150);
            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(150, 0, 150, 300);
        }
示例#18
0
 public void LineDrawer(FoxDraw draw, double x, double y)
 {
     for (int i = 0; i < canvas.Width / 2; i++)
     {
         draw.StrokeColor(Colors.Crimson);
         draw.DrawLine(x + 0, y + i, x + i, y + canvas.Height / 2);
         draw.StrokeColor(Colors.Gold);
         draw.DrawLine(x + i, y + 0, x + canvas.Width / 2, +y + i);
         i += 10;
     }
 }
示例#19
0
 public static void GoToCenter(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.BackgroundColor(Colors.Gray);
     foxDraw.StrokeColor(Colors.Green);
     for (int i = 0; i < 3; i++)
     {
         foxDraw.DrawLine(x, y, 300, 300);
         x *= 3;
         y *= 3;
         foxDraw.StrokeColor(Colors.Aquamarine);
     }
 }
示例#20
0
        public static void DrawLines(FoxDraw foxDraw)
        {
            var startPoint1 = new Point(0, 150);
            var endPoint1   = new Point(300, 150);
            var startPoint2 = new Point(150, 0);
            var endPoint2   = new Point(150, 300);

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(startPoint1, endPoint1);

            foxDraw.StrokeColor(Colors.Blue);
            foxDraw.DrawLine(startPoint2, endPoint2);
        }
示例#21
0
 static void DrawStuff(FoxDraw foxDraw, double[][] parameterBox, double[][] parameterWhat)
 {
     for (int i = 0; i < parameterBox.Length; i++)
     {
         foxDraw.StrokeColor(Colors.Green);
         foxDraw.DrawLine(parameterBox[i][0], parameterBox[i][1], parameterBox[i][2], parameterBox[i][3]);
     }
     for (int i = 0; i < parameterWhat.Length; i++)
     {
         foxDraw.StrokeColor(Colors.Green);
         foxDraw.DrawLine(parameterWhat[i][0], parameterWhat[i][1], parameterWhat[i][2], parameterWhat[i][3]);
     }
 }
示例#22
0
        public static void DrawGreenLines(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(50, 50, 550, 50);

            foxDraw.StrokeColor(Colors.Blue);
            foxDraw.DrawLine(50, 550, 550, 550);

            foxDraw.StrokeColor(Colors.Yellow);
            foxDraw.DrawLine(50, 50, 50, 550);

            foxDraw.StrokeColor(Colors.Black);
            foxDraw.DrawLine(550, 50, 550, 550);
        }
        public static void DrawColorfulSquare(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.DeepPink);
            foxDraw.DrawLine(200, 200, 400, 200);

            foxDraw.StrokeColor(Colors.Turquoise);
            foxDraw.DrawLine(200, 200, 200, 400);

            foxDraw.StrokeColor(Colors.DarkOrange);
            foxDraw.DrawLine(400, 200, 400, 400);

            foxDraw.StrokeColor(Colors.CornflowerBlue);
            foxDraw.DrawLine(200, 400, 400, 400);
        }
示例#24
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw     = new FoxDraw(canvas);
            var startpoint  = new Point(0, 0);
            var endpoint    = new Point(canvas.Width, canvas.Height);
            var startpoint2 = new Point(canvas.Width, 0);
            var endpoint2   = new Point(0, canvas.Height);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(startpoint, endpoint);
            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(startpoint2, endpoint2);
        }
        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(50, 100, 50, 200, 10.0);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(100, 150, 200, 150, 10.0);
        }
示例#26
0
        public void Optical(FoxDraw foxDraw)
        {
            foxDraw.StrokeColor(Colors.Green);

            for (int i = 0; i < canvas.Width; i += 25)
            {
                foxDraw.DrawLine(i, 0, canvas.Width, i + 25, 3);
            }

            foxDraw.StrokeColor(Colors.Purple);

            for (int i = 0; i < canvas.Width; i += 25)
            {
                foxDraw.DrawLine(0, i, i + 25, canvas.Width, 3);
            }
        }
示例#27
0
        public void IterateTrianglePyramid(double triangleHeight)
        {
            foxDraw = new FoxDraw(canvas);

            double aSide       = Math.Sqrt(4 / 3 * triangleHeight * triangleHeight);
            double aSideDivTwo = aSide / 2;

            double aSideDivTwoShaper = 0;
            double aSideShaper       = 0;

            foxDraw.StrokeColor(Color.FromRgb(160, 20, 100));

            for (double i = canvas.Height; i >= 0; i -= triangleHeight)
            {
                foxDraw.DrawLine(0 + aSideDivTwoShaper, i, canvas.Width - aSideDivTwoShaper, i, 2);

                foxDraw.DrawLine(0 + aSideShaper, canvas.Height,
                                 canvas.Width / 2 + aSideDivTwoShaper, canvas.Height - i, 2);

                foxDraw.DrawLine(canvas.Width / 2 - aSideDivTwoShaper, canvas.Height - i,
                                 canvas.Width - aSideShaper, canvas.Height, 2);

                aSideDivTwoShaper += aSideDivTwo;
                aSideShaper       += aSide;
            }
        }
示例#28
0
        public void Triangle(double coor1, double coor2, double size, int n)
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            var left  = new Point(coor1, coor2);
            var right = new Point(coor1 + size / 2, coor2);
            var top   = new Point(coor1 + size / 4, coor2 + size / 2);

            Point[] points = { left, right, top };
            foxDraw.StrokeColor(Colors.Black);
            foxDraw.FillColor(Colors.Transparent);
            foxDraw.DrawPolygon(points);

            var left2   = new Point(coor1 + size / 2, coor2);
            var bottom2 = new Point(coor1 + size, coor2);
            var top2    = new Point(coor1 + size - (size / 4), coor2 + size / 2);

            Point[] points2 = { left2, bottom2, top2 };
            foxDraw.DrawPolygon(points2);

            var left3   = new Point(coor1 + size / 4, coor2 + size / 2);
            var bottom3 = new Point(coor1 + size - (size / 4), coor2 + size / 2);
            var top3    = new Point(coor1 + size / 2, coor2 + size);

            Point[] points3 = { left3, bottom3, top3 };
            foxDraw.DrawPolygon(points3);

            if (n > 0)
            {
                Triangle(coor1, coor2, size / 2, n - 1);
                Triangle(coor1 + size / 2, coor2, size / 2, n - 1);
                Triangle(coor1 + size / 4, coor2 + size / 2, size / 2, n - 1);
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            canvas.Background = Brushes.Black;
            Random rnd    = new Random();
            Random random = new Random();

            // Draw the night sky:
            //  - The background should be black
            //  - The stars can be small squares
            //  - The stars should have random positions on the canvas
            //  - The stars should have random color (some shade of grey)

            for (int i = 0; i < 200; i++)
            {
                byte randomNumber = (byte)random.Next(150, 200);
                foxDraw.StrokeColor(Color.FromRgb(randomNumber, randomNumber, randomNumber));
                foxDraw.FillColor(Color.FromRgb(randomNumber, randomNumber, randomNumber));
                int x = rnd.Next(5, 955);
                int y = rnd.Next(5, 995);
                foxDraw.DrawRectangle(x, y, 5, 5);
            }
        }
示例#30
0
        public void Drawer(FoxDraw foxDraw)
        {
            List <List <Point> > list = new List <List <Point> >();

            for (int i = 0; i < 22; i++)
            {
                List <Point> sublist = new List <Point>();
                for (int j = 22 - i; j < 23 + i; j += 2)
                {
                    Point myPoint = new Point(6 * j, 10 * i);
                    sublist.Add(myPoint);
                }
                list.Add(sublist);
            }

            foxDraw.StrokeColor(Colors.Black);
            for (int i = 1; i < 22; i++)
            {
                for (int j = 0; j < list[i].Count; j++)
                {
                    if (j < list[i].Count - 1)
                    {
                        foxDraw.DrawLine(list[i - 1][j], list[i][j]);
                    }
                    if (j > 0)
                    {
                        foxDraw.DrawLine(list[i - 1][j - 1], list[i][j]);
                    }
                    if (j < list[i].Count - 1)
                    {
                        foxDraw.DrawLine(list[i][j], list[i][j + 1]);
                    }
                }
            }
        }