コード例 #1
0
 static void LineToCenter(FoxDraw foxDraw, int x1, int x2)
 {
     foxDraw.StrokeColor(Colors.Green);
     foxDraw.DrawLine(x1, x2, 263, 175);
 }
コード例 #2
0
 public static void LineDrawFunction(FoxDraw canvas, Point start, Point middle)
 {
     canvas.DrawLine(start, middle);
 }
コード例 #3
0
        private static void LinesToCenter(FoxDraw foxDraw, double x, double y)
        {
            double canvasSize = 400;

            foxDraw.DrawLine(x, y, canvasSize / 2, canvasSize / 2);
        }
コード例 #4
0
        /// Don't kill me for this code ///
        public static void linePlay4(FoxDraw foxDraw)
        {
            var startPoint = new Point(0, 0);
            var endPoint   = new Point(0, 400);

            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0, 0 + (i * 40), 0 + (i * 40), 400);
                foxDraw.SetStrokeColor(Colors.DarkViolet);
            }
            startPoint = new Point(0, 0);
            endPoint   = new Point(400, 0);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.AntiqueWhite);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0 + (i * 40), 0, 400, 0 + (i * 40));
            }

            startPoint = new Point(400, 0);
            endPoint   = new Point(400, 400);
            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400, 0 + (i * 40), 400 + (i * 40), 400);
                foxDraw.SetStrokeColor(Colors.Blue);
            }
            startPoint = new Point(400, 0);
            endPoint   = new Point(800, 0);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.IndianRed);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400 + (i * 40), 0, 800, 0 + (i * 40));
            }
            startPoint = new Point(0, 400);
            endPoint   = new Point(0, 800);
            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0, 400 + (i * 40), 0 + (i * 40), 800);
                foxDraw.SetStrokeColor(Colors.BurlyWood);
            }
            startPoint = new Point(0, 400);
            endPoint   = new Point(400, 400);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.Aquamarine);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(0 + (i * 40), 400, 400, 400 + (i * 40));
            }
            startPoint = new Point(400, 400);
            endPoint   = new Point(400, 800);
            foxDraw.DrawLine(startPoint, endPoint);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400, 400 + (i * 40), 400 + (i * 40), 800);
                foxDraw.SetStrokeColor(Colors.Firebrick);
            }
            startPoint = new Point(400, 400);
            endPoint   = new Point(800, 400);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.LawnGreen);
            for (int i = 0; i < 11; i++)
            {
                foxDraw.DrawLine(400 + (i * 40), 400, 800, 400 + (i * 40));
            }
        }
コード例 #5
0
 public void  HorLine(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.DrawLine(x, y, x + 50, y);
 }
コード例 #6
0
 public void DownShape(FoxDraw foxDraw, double x, double y)
 {
     foxDraw.DrawLine(x - 20, y - 20, x - 10, y);
     foxDraw.DrawLine(x + 10, y, x - 10, y);
     foxDraw.DrawLine(x + 10, y, x + 20, y - 20);
 }
コード例 #7
0
        public MainWindow()
        {
            InitializeComponent();


            var a      = new FoxDraw(canvas);
            var astart = new Point(0, Height);
            var aend   = new Point(Width, Height);

            a.StrokeColor(Colors.Black);
            a.FillColor(Colors.Black);
            a.DrawLine(astart, aend);

            var b      = new FoxDraw(canvas);
            var bstart = new Point(Width, Height);
            var bend   = new Point((Width / 2), (Height - Math.Sqrt(270000)));

            b.StrokeColor(Colors.Black);
            b.FillColor(Colors.Black);
            b.DrawLine(bstart, bend);

            var c      = new FoxDraw(canvas);
            var cstart = new Point((Width / 2), (Height - Math.Sqrt(270000)));
            var cend   = new Point(0, Height);

            c.StrokeColor(Colors.Black);
            c.FillColor(Colors.Black);
            c.DrawLine(cstart, cend);

            var pointsOnA = new Point[20];
            var pointsOnB = new Point[20];
            var pointsOnC = new Point[20];
            int index     = 0;

            for (int i = 30; i <= Width; i += 30)
            {
                pointsOnA[index] = new Point(i, Height);

                pointsOnB[index] = new Point(600 - (i / 2), Height - Math.Sqrt((Math.Pow(i, 2) - Math.Pow((i / 2), 2))));

                pointsOnC[index] = new Point(0 + (i / 2), Height - Math.Sqrt((Math.Pow(i, 2) - Math.Pow((i / 2), 2))));
                index++;
            }

            //for (int i = 60; i < 61; i++)
            //{
            //
            //var g = new Point(60, Height);
            //var h = new Point(30, Height - Math.Sqrt((Math.Pow(i,2) - Math.Pow((i/2),2))));
            //var tester = new FoxDraw(canvas);
            //tester.DrawLine(g, h);
            //}

            int testindex = 18;

            for (int i = 0; i < 19; i++)
            {
                var test = new FoxDraw(canvas);
                test.DrawLine(pointsOnA[i], pointsOnC[i]);
                var test2 = new FoxDraw(canvas);
                test2.DrawLine(pointsOnB[i], pointsOnC[i]);
                var test3 = new FoxDraw(canvas);
                test2.DrawLine(pointsOnA[i], pointsOnB[testindex]);
                testindex--;
            }
        }
コード例 #8
0
        public static void DrawBox(FoxDraw foxDraw)
        {
            var dict = new Dictionary <Color, List <int> >()
            {
                // Horizontal
                { Colors.DarkRed, new List <int> ()
                  {
                      20, 20, 120, 20
                  } },
                { Colors.LimeGreen, new List <int> ()
                  {
                      70, 70, 170, 70
                  } },
                { Colors.CadetBlue, new List <int> ()
                  {
                      20, 120, 120, 120
                  } },
                { Colors.Gray, new List <int> ()
                  {
                      70, 170, 170, 170
                  } },

                // Vertical
                { Colors.Gold, new List <int> ()
                  {
                      20, 20, 20, 120
                  } },
                { Colors.HotPink, new List <int> ()
                  {
                      70, 70, 70, 170
                  } },
                { Colors.Orange, new List <int> ()
                  {
                      120, 20, 120, 120
                  } },
                { Colors.Turquoise, new List <int> ()
                  {
                      170, 70, 170, 170
                  } },

                // Diagonal
                { Colors.Violet, new List <int> {
                      20, 20, 70, 70
                  } },
                { Colors.Yellow, new List <int> {
                      120, 20, 170, 70
                  } },
                { Colors.Tan, new List <int> {
                      20, 120, 70, 170
                  } },
                { Colors.Black, new List <int> {
                      120, 120, 170, 170
                  } }
            };

            foreach (var line in dict)
            {
                foxDraw.SetStrokeColor(line.Key);
                foxDraw.SetStrokeThicknes(3);
                foxDraw.DrawLine(line.Value[0], line.Value[1], line.Value[2], line.Value[3]);
            }
        }
コード例 #9
0
 public static void DrawLines(FoxDraw foxDraw, int x1, int y1, int x2, int y2)
 {
     foxDraw.DrawLine(x1, y1, x2, y2);
 }
コード例 #10
0
        private void DrawHorizonatlLines(double x, double y)
        {
            var foxDraw = new FoxDraw(canvas);

            foxDraw.DrawLine(x, y, x + 50, y);
        }
コード例 #11
0
        public void HorizontalLine(double x, double y, FoxDraw foxdraw)

        {
            foxdraw.DrawLine(x, y, x + 50, y);
        }
コード例 #12
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);
            foxDraw.SetBackgroundColor(Colors.Teal);

            ///Exercises////
            ///Lines///
            var halfHeight = Height / 2;
            var halfWidth  = Width / 2;
            foxDraw.SetStrokeColor(Colors.DarkRed);

            var startPoint = new Point(0, 400);
            var endPoint   = new Point(800, 400);
            foxDraw.DrawLine(startPoint, endPoint);
            startPoint = new Point(400, 0);
            endPoint   = new Point(400, 800);
            foxDraw.DrawLine(startPoint, endPoint);

            ///Box///
            foxDraw.SetStrokeColor(Colors.Violet);
            startPoint = new Point(200, 200);
            endPoint   = new Point(200, 600);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.LightSteelBlue);
            startPoint = new Point(200, 200);
            endPoint   = new Point(600, 200);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.BlanchedAlmond);
            startPoint = new Point(600, 200);
            endPoint   = new Point(600, 600);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.DarkSlateGray);
            startPoint = new Point(200, 600);
            endPoint   = new Point(600, 600);
            foxDraw.DrawLine(startPoint, endPoint);
            ///Diogonals///
            foxDraw.SetStrokeColor(Colors.DarkGreen);
            startPoint = new Point(0, 0);
            endPoint   = new Point(800, 800);
            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.SetStrokeColor(Colors.Red);
            startPoint = new Point(800, 0);
            endPoint   = new Point(0, 800);
            foxDraw.DrawLine(startPoint, endPoint);

            /* ToTheCenter(foxDraw, startPoint, endPoint);
             * HorizontalLines(foxDraw, startPoint, endPoint);
             * SquareInTheCenter(foxDraw);
             * DrawFour(foxDraw);
             * PositionSquare(foxDraw);*/
            CenterBoxFunction(foxDraw);

            /*RainbowBoxes(foxDraw);*//*
             * PurpleSteps(foxDraw);*/
            /*PurpleSteps3D(foxDraw);*/
        }
コード例 #13
0
 public static void Triangle(FoxDraw foxDraw, double height, double side, double[] startP)
 {
     foxDraw.DrawLine(startP[0], startP[1], startP[0] + side, startP[1], 2.5);
     foxDraw.DrawLine(startP[0] + side, startP[1], startP[0] + (side / 2), startP[1] + height, 2.5);
     foxDraw.DrawLine(startP[0] + (side / 2), startP[1] + height, startP[0], startP[1], 2.5);
 }
コード例 #14
0
        void DrawLine(int x, int y)
        {
            var foxDraw = new FoxDraw(canvas);

            foxDraw.DrawLine(x, y, canvas.Width / 2, canvas.Height / 2);
        }
コード例 #15
0
 public void LineDraw(FoxDraw Line, int p1, int p2)
 {
     Line.StrokeColor(Colors.Red);
     Line.DrawLine(new Point(p1, p2), new Point(p1 + 50, p2));
 }
コード例 #16
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, 10 + i * 15, 10 + i * 15, 150);
            }

            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.MediumPurple);
                foxDraw.DrawLine(10 + i * 15, 0, 150, 10 + i * 15);
            }

            //-----------------------------------------------------------------
            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(150, 160 + i * 15, 160 + i * 15, 300);
            }

            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.MediumPurple);
                foxDraw.DrawLine(160 + i * 15, 150, 300, 160 + i * 15);
            }

            //------------------------------------------------------------------
            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(150, 10 + i * 15, 160 + i * 15, 150);
            }

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

            //-------------------------------------------------------------------
            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.Lime);
                foxDraw.DrawLine(0, 160 + i * 15, 10 + i * 15, 300);
            }

            for (int i = 0; i < 10; i++)
            {
                foxDraw.StrokeColor(Colors.MediumPurple);
                foxDraw.DrawLine(10 + i * 15, 150, 150, 160 + i * 15);
            }
        }
コード例 #17
0
 public void LineDraw(FoxDraw Line, int p1, int p2)
 {
     Line.StrokeColor(Colors.Red);
     Line.DrawLine(new Point(p1, p2), new Point(canvas.Width / 2, canvas.Height / 2));
 }
コード例 #18
0
 public void GoToCenter(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.SetStrokeColor(Colors.Red);
     foxDraw.DrawLine(x, y, Height / 2, Width / 2);
 }
コード例 #19
0
 private void DrawLine(FoxDraw Horizontal, int x, int y)
 {
     Horizontal.StrokeColor(Colors.Magenta);
     Horizontal.DrawLine(new Point(x, y), new Point(x + 50, y));
 }
コード例 #20
0
        private void LineDraw(FoxDraw canvas, Point pairstart)
        {
            var pairend = new Point(pairstart.X + 50, pairstart.Y);

            canvas.DrawLine(pairstart, pairend);
        }
コード例 #21
0
        public void Drawer(FoxDraw foxDraw)
        {
            List <List <Point> > list = new List <List <Point> >();

            for (int i = 0; i < 15; i++)
            {
                List <Point> sublist = new List <Point>();
                switch (i)
                {
                case 0:
                case 14:
                    Point myPoint = new Point(8 * i, 5 * 10);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 12);
                    sublist.Add(myPoint);
                    break;

                case 1:
                case 13:
                    myPoint = new Point(8 * i, 5 * 7);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 9);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 13);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 15);
                    sublist.Add(myPoint);
                    break;

                case 2:
                case 12:
                    myPoint = new Point(8 * i, 5 * 4);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 6);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 10);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 12);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 16);
                    sublist.Add(myPoint);
                    myPoint = new Point(8 * i, 5 * 18);
                    sublist.Add(myPoint);
                    break;

                default:

                    for (int j = 0; j < 22;)
                    {
                        myPoint = new Point(5 * j, 8 * i);
                        sublist.Add(myPoint);
                        if (j % 3 == 0)
                        {
                            j += 4;
                        }
                        else
                        {
                            j += 2;
                        }
                    }

                    if (i % 2 == 0)
                    {
                        myPoint = new Point(5 * 22, 8 * i);
                        sublist.Add(myPoint);
                    }
                    break;
                }
                list.Add(sublist);
            }

            foxDraw.StrokeColor(Colors.Black);
            for (int i = 0; i < 14; i++)
            {
                for (int j = 0; j < list[i].Count; j += 2)
                {
                    switch (i)
                    {
                    case 0:
                    case 14:
                        i = i + 1 - 1;
                        break;

                    case 1:
                    case 13:
                        i = i + 1 - 1;
                        break;

                    case 2:
                    case 12:
                        i = i + 1 - 1;
                        break;

                    default:
                        if (i % 2 == 0)
                        {
                            if (i > 0)
                            {
                                foxDraw.DrawLine(list[i][j], list[i - 1][j]);
                            }
                            if (i < 11)
                            {
                                foxDraw.DrawLine(list[i][j], list[i + 1][j]);
                            }
                            if (j < list[i].Count - 1)
                            {
                                foxDraw.DrawLine(list[i][j], list[i][j + 1]);
                            }
                        }
                        else
                        {
                            if (j < list[i].Count - 1)
                            {
                                if (i < 0)
                                {
                                    foxDraw.DrawLine(list[i][j + 1], list[i - 1][j]);
                                }
                                if (i < 13)
                                {
                                    foxDraw.DrawLine(list[i][j + 1], list[i + 1][j]);
                                }
                                if (j < list[i].Count - 1)
                                {
                                    foxDraw.DrawLine(list[i][j + 1], list[i][j + 1]);
                                }
                            }
                        }
                        break;
                    }
                }
            }
        }
コード例 #22
0
        public MainWindow()
        {
            InitializeComponent();          // začátek nevim?
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");      //vytvoření canvasu
            var foxDraw = new FoxDraw(canvas);              //vytvoření canvasu

            double canvasWidth  = canvas.Width = 600;       //zadefinování canvasu, protože to je jinak nekonečno
            double canvasHeight = canvas.Height = 600;      //zadefinování canvasu, protože to je jinak nekonečno
                                                            //foxDraw.SetBackgroundColor(Colors.Black);

            foxDraw.SetStrokeColor(Colors.Black);
            /*----------------------------------------------------------------------------------------------------------*/
            //Line play
            int strana = 80;
            int prurez = strana * 2;


            foxDraw.DrawLine(300, 0, 300, 600);         // ref osa
            foxDraw.DrawLine(0, 300, 600, 300);         // ref osa


            foxDraw.SetStrokeColor(Colors.Red);
            foxDraw.DrawLine(260, 600, 340, 600);         // spodní

            for (int i = 0; i < 4; i++)
            {
                foxDraw.SetStrokeColor(Colors.Red);
                foxDraw.DrawLine(260, 600, 340, 600);         // spodní
            }

            /*
             * for (int i = 0; i <20; i++)
             * {
             *  foxDraw.SetStrokeColor(Colors.Purple);
             *  foxDraw.DrawLine(a, 600, 300+b, a);
             *
             *  foxDraw.SetStrokeColor(Colors.Cyan);
             *  foxDraw.DrawLine(600-a, 600, 300 -b, a);
             *
             *  foxDraw.SetStrokeColor(Colors.Yellow);
             *  foxDraw.DrawLine(b, 600-a, 600-b, 600-a);
             *
             *
             *
             *  foxDraw.SetStrokeColor(Colors.Cyan);
             *  foxDraw.DrawLine(300, a, 300 - a, 300);
             *
             *  foxDraw.SetStrokeColor(Colors.Yellow);
             *  foxDraw.DrawLine(300, 600-a, 300-a, 300);
             *
             *  foxDraw.SetStrokeColor(Colors.LightPink);
             *  foxDraw.DrawLine(300, 600-a, 300+a, 300);
             *
             *  a += 30;
             *  b += 15;
             *
             *  foxDraw.DrawLine()
             *
             *
             * }*/
        }
コード例 #23
0
 public void ToTheCenter(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.DrawLine(x, y, Width / 2, Height / 2);
 }
コード例 #24
0
 public void horizontalLines(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.SetStrokeColor(Colors.Red);
     foxDraw.DrawLine(x, y, x, y + 50);
 }
コード例 #25
0
 public void DrawHorizontalLine(FoxDraw foxDraw, double x1, double y1)
 {
     foxDraw.SetStrokeColor(Colors.Green);
     foxDraw.DrawLine(x1, y1, x1 + 50, y1);
 }
コード例 #26
0
 public static void DrawLines(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.DrawLine(x, y, 262, 175);
 }
コード例 #27
0
 public void DrawHorizontal(FoxDraw foxdraw, double x, double y)
 {
     foxdraw.DrawLine(x, y, x + 50, y);
 }
コード例 #28
0
 public void LineDrawer(FoxDraw foxDraw, int x1, int y1, int x2, int y2)
 {
     foxDraw.StrokeColor(Colors.Green);
     foxDraw.DrawLine(x1, y1, x2, y2);
 }
コード例 #29
0
 public void DrawLineToCentre(FoxDraw foxDraw, double x, double y)
 {
     foxDraw.DrawLine(x, y, Width / 2, Height / 2);
 }
コード例 #30
0
 public void LineToCentre(double posx, double posy, FoxDraw foxdraw)
 {
     foxdraw.DrawLine(posx, posy, 400, 400);
 }