示例#1
0
        public static void DrawLines(FoxDraw foxDraw, int sirka, int vyska)
        {
            sirka = 0;
            vyska = 20;

            foxDraw.SetStrokeThicknes(3);
            int horizontal = 50;
            int vertical   = 20;

            Console.Write("How many lines do you want? : ");
            int lines = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < lines; i++)
            {
                foxDraw.DrawLine(sirka, vyska, horizontal, vertical);
                vyska      += 20;
                horizontal += 50;
                vertical   += 20;

                if (i % 2 == 0)
                {
                    foxDraw.SetStrokeColor(Colors.Blue);
                }
                else
                {
                    foxDraw.SetStrokeColor(Colors.Black);
                }
            }
        }
示例#2
0
 public static void DrawSquare(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.SetFillColor(Colors.Transparent);
     foxDraw.SetStrokeColor(Colors.Orange);
     foxDraw.SetStrokeThicknes(2);
     foxDraw.DrawRectangle(250 - x / 2, 250 - y / 2, x, y); // 250 = half of canvas size
 }
示例#3
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);
            canvas.Width  = 600;
            canvas.Height = 600;

            foxDraw.SetFillColor(Colors.Transparent);
            foxDraw.SetStrokeThicknes(2);


            DrawSquare(foxDraw, 20);

            // foxDraw.DrawRectangle(300, 300, 20, 20);

            // create a function that draws one square and takes 2 parameters:
            // the square size and the foxDraw
            // and draws a square of that size to the center of the canvas.
            // draw 3 squares with that function.
            // avoid code duplication.
        }
示例#4
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);

            canvas.Width  = 500;
            canvas.Height = 500;

            double triangleSize = 20;

            double center = canvas.Width / 2;


            for (double i = 0; i <= canvas.Height; i += triangleSize)
            {
                foxDraw.SetStrokeColor(Colors.Black);
                foxDraw.SetStrokeThicknes(1);
                //lines point to right bottom
                foxDraw.DrawLine(center - i / 2, i, canvas.Width - i, canvas.Height);
                //lines point to left bottom
                foxDraw.DrawLine(center + i / 2, i, 0 + i, canvas.Height);
                //horizontal Lines
                foxDraw.DrawLine(center - (i / 2), i, center + (i / 2), i);
            }
        }
示例#5
0
        public static void ConnectTheDots(FoxDraw foxDraw, int[,] pointsToConnect)
        {
            int max  = pointsToConnect.GetLength(0);
            int endX = 0;
            int endY = 0;

            for (int i = 0; i < max; i++)
            {
                int originX = pointsToConnect[i, 0];
                int originY = pointsToConnect[i, 1];
                //detect if it's the last element of the array so that you can tell the line to connect to the start
                if (i == max - 1)
                {
                    endX = pointsToConnect[0, 0];
                    endY = pointsToConnect[0, 1];
                }
                else
                {
                    endX = pointsToConnect[i + 1, 0];
                    endY = pointsToConnect[i + 1, 1];
                }

                foxDraw.SetStrokeThicknes(1);
                foxDraw.SetStrokeColor(Colors.Green);
                foxDraw.DrawLine(originX, originY, endX, endY);
            }
        }
        public void drawBox(FoxDraw foxDraw, double boxSize, Point startingPoint)
        {
            var xAdjustment = (Math.Sqrt(3) / 2) * boxSize;

            Point a = new Point(startingPoint.X, startingPoint.Y);
            Point b = new Point(xAdjustment + startingPoint.X, 0.5 * boxSize + startingPoint.Y);
            Point c = new Point(xAdjustment + startingPoint.X, 1.5 * boxSize + startingPoint.Y);
            Point d = new Point(startingPoint.X, 2 * boxSize + startingPoint.Y);
            Point e = new Point(-xAdjustment + startingPoint.X, 1.5 * boxSize + startingPoint.Y);
            Point f = new Point(-xAdjustment + startingPoint.X, 0.5 * boxSize + startingPoint.Y);

            Point center = new Point(startingPoint.X, boxSize + startingPoint.Y);

            foxDraw.SetStrokeThicknes(0);

            // #4EB99F
            foxDraw.SetFillColor(Colors.Beige);
            foxDraw.DrawPolygon(new List <Point> {
                a, b, center, f
            });

            // #078388
            foxDraw.SetFillColor(Colors.Black);
            foxDraw.DrawPolygon(new List <Point> {
                b, c, d, center
            });

            // #122F41
            foxDraw.SetFillColor(Colors.DimGray);
            foxDraw.DrawPolygon(new List <Point> {
                center, d, e, f
            });
        }
示例#7
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);
            // Draw a box that has different colored lines on each edge.

            foxDraw.SetStrokeThicknes(3);

            // line a
            foxDraw.SetStrokeColor(Colors.Aqua);
            foxDraw.DrawLine(10, 10, 200, 10);

            // line b
            foxDraw.SetStrokeColor(Colors.Blue);
            foxDraw.DrawLine(200, 10, 200, 200);

            // line c
            foxDraw.SetStrokeColor(Colors.Chartreuse);
            foxDraw.DrawLine(10, 200, 200, 200);

            // line d
            foxDraw.SetStrokeColor(Colors.DarkGreen);
            foxDraw.DrawLine(10, 10, 10, 200);
        }
示例#8
0
        public void Triangle(FoxDraw foxdraw, Canvas canvas, int lineLength)
        {
            foxdraw.SetStrokeThicknes(1);
            foxdraw.SetStrokeColor(Colors.Black);

            for (int i = 0; i < 200; i += 10) // Lines Horizontal
            {
                var startPoint = new Point(95 - i / 2, lineLength + i);
                var endPoint   = new Point(105 + i / 2, lineLength + i);
                foxdraw.DrawLine(startPoint, endPoint);
            }

            for (int i = 0; i < 200; i += 10) // Lines Diagonal | Left to Right
            {
                var startPoint = new Point(i, canvas.Height);
                var endPoint   = new Point(100 + i / 2, i);
                foxdraw.DrawLine(startPoint, endPoint);
            }

            for (int i = 0; i <= 200; i += 10) // Lines Diagonal | Right to Left
            {
                var startPoint = new Point(i, canvas.Height);
                var endPoint   = new Point(0 + i / 2, canvas.Height - i);
                foxdraw.DrawLine(startPoint, endPoint);
            }
        }
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);
            canvas.Width  = 600;
            canvas.Height = 600;


            foxDraw.SetStrokeThicknes(1);
            foxDraw.SetStrokeColor(Colors.Black);


            DrawSquare(foxDraw, 4, Colors.DarkViolet);

            /*double startingPoints = 0;
             * double rectangleSize = 10;
             *
             * foxDraw.SetFillColor(Colors.Purple);
             * for (int i = 0; i < 7; i++)
             * {
             *  foxDraw.DrawRectangle(startingPoints, startingPoints, rectangleSize, rectangleSize);
             *  startingPoints = startingPoints + rectangleSize;
             *  rectangleSize = rectangleSize * 2;
             * }
             */
        }
        public void Line(FoxDraw foxdraw, int quarter)
        {
            foxdraw.SetStrokeThicknes(1);
            foxdraw.SetStrokeColor(Colors.Green);

            for (int i = 10; i < 150; i += 10) // Lines Top Right
            {
                var startPoint = new Point(quarter, i);
                var endPoint   = new Point(quarter + i, quarter);
                foxdraw.DrawLine(startPoint, endPoint);
            }
            for (int i = 10; i < 150; i += 10) // Lines Top Left
            {
                var startPoint = new Point(quarter, i);
                var endPoint   = new Point(quarter - i, quarter);
                foxdraw.DrawLine(startPoint, endPoint);
            }
            for (int i = 10; i < 150; i += 10) // Bottom Right
            {
                var startPoint = new Point(quarter + i, quarter);
                var endPoint   = new Point(quarter, 300 - i);
                foxdraw.DrawLine(startPoint, endPoint);
            }
            for (int i = 10; i < 150; i += 10) // Bottom Left
            {
                var startPoint = new Point(i, quarter);
                var endPoint   = new Point(quarter, quarter + i);
                foxdraw.DrawLine(startPoint, endPoint);
            }
        }
        public static void LinesToTheCenter(FoxDraw foxDraw, int originX, int originY)
        {
            double center = 500 / 2;

            foxDraw.SetStrokeThicknes(1);
            foxDraw.SetStrokeColor(Colors.LightSeaGreen);
            foxDraw.DrawLine(originX, originY, center, center);
        }
        public static void CenteredRainbow(FoxDraw foxDraw, double size, Color color)
        {
            double center = (100 / 2) - (size / 2);

            foxDraw.SetStrokeThicknes(0);
            foxDraw.SetFillColor(color);
            foxDraw.DrawRectangle(center, center, size, size);
        }
示例#13
0
        public static void Lines(FoxDraw foxDraw)
        {
            List <Point> StartPoints = new List <Point>();

            StartPoints.Add(new Point(10, 10));
            StartPoints.Add(new Point(290, 290));

            List <Point> EndPoints = new List <Point>();

            EndPoints.Add(new Point(10, 290));
            EndPoints.Add(new Point(290, 10));


            List <Point> StartPoints2 = new List <Point>();

            StartPoints2.Add(new Point(50, 100));
            StartPoints2.Add(new Point(70, 70));
            StartPoints2.Add(new Point(80, 90));
            StartPoints2.Add(new Point(90, 90));
            StartPoints2.Add(new Point(100, 70));
            StartPoints2.Add(new Point(120, 100));
            StartPoints2.Add(new Point(85, 130));
            StartPoints2.Add(new Point(50, 100)); // 7


            foxDraw.SetStrokeColor(Colors.Green);
            foxDraw.SetStrokeThicknes(2);
            for (int i = 0; i < StartPoints2.Count; i++)
            {
                foxDraw.DrawLine(StartPoints2[i], StartPoints2[i + 1]);
                if (i == 6)
                {
                    break;
                }
            }

            foreach (var start in StartPoints)
            {
                foreach (var end in EndPoints)
                {
                    foxDraw.DrawLine(start, end);
                }
            }

            //int x = 0;
            // foreach (var start in StartPoints)
            //{
            // foreach (var end in EndPoints)
            //{
            //x++;
            //foxDraw.DrawLine(start, end);
            //if (x == 2)
            //{
            // return;
            //}
            //}
            //}
        }
示例#14
0
        public static void DrawSquaresInCenter(FoxDraw foxDraw, int size, Color color)
        {
            double center = (100 / 2) - (size / 2);

            foxDraw.SetFillColor(Colors.Transparent);
            foxDraw.SetStrokeColor(color);
            foxDraw.SetStrokeThicknes(3);
            foxDraw.DrawRectangle(center, center, size, size);
        }
        public static void DrawLine(FoxDraw foxDraw, int x, int y)
        {
            var startPoint = new Point(x, y);
            var endPoint   = new Point(x + 50, y); // End point makes the line 50 px long

            foxDraw.SetStrokeThicknes(2);
            foxDraw.SetStrokeColor(Colors.Green);
            foxDraw.DrawLine(startPoint, endPoint);
        }
示例#16
0
        private void EnvelopeStar2(FoxDraw foxDraw)
        {
            int lineTchickness = 2;

            for (int i = 0; i <= 800; i += 20)
            {
                foxDraw.SetStrokeThicknes(lineTchickness);
                foxDraw.SetStrokeColor(Color.Parse("#232528"));
                foxDraw.DrawLine(400, 0, i, 400);
                foxDraw.SetStrokeColor(Color.Parse("#232528"));
                foxDraw.DrawLine(400, 800, i, 400);
                if (i != 400)
                {
                    foxDraw.SetStrokeThicknes(lineTchickness);
                    foxDraw.SetStrokeColor(Color.Parse("#232528"));
                    foxDraw.DrawLine(0, 400, 400, i);
                    foxDraw.SetStrokeColor(Color.Parse("#232528"));
                    foxDraw.DrawLine(800, 400, 400, i);
                }

                foxDraw.SetStrokeThicknes(lineTchickness);
                int circleSize        = 800;
                int circleMiddlePoint = 400;
                foxDraw.SetStrokeColor(Color.Parse("#232528"));
                foxDraw.SetFillColor(Colors.White);
                foxDraw.DrawEllipse(-circleMiddlePoint, -circleMiddlePoint, circleSize, circleSize);

                foxDraw.SetStrokeThicknes(lineTchickness);
                foxDraw.SetStrokeColor(Color.Parse("#232528"));
                foxDraw.SetFillColor(Colors.White);
                foxDraw.DrawEllipse(circleMiddlePoint, -circleMiddlePoint, circleSize, circleSize);


                foxDraw.SetStrokeColor(Color.Parse("#232528"));
                foxDraw.SetFillColor(Colors.White);
                foxDraw.DrawEllipse(-circleMiddlePoint, circleMiddlePoint, circleSize, circleSize);

                foxDraw.SetStrokeColor(Color.Parse("#232528"));
                foxDraw.SetFillColor(Colors.White);
                foxDraw.DrawEllipse(circleMiddlePoint, circleMiddlePoint, circleSize, circleSize);
            }
        }
        public static void DrawLine(FoxDraw foxDraw)
        {
            foxDraw.SetFillColor(Colors.Purple);
            foxDraw.SetStrokeThicknes(1);
            int square = 10;

            for (int shape = 0; shape < 20; shape++)
            {
                square += 10;
                foxDraw.DrawRectangle(square, square, 10, 10);
            }
        }
示例#18
0
 public void DrawFourColoredRectangle(FoxDraw foxDraw, double canvasSize)
 {
     foxDraw.SetStrokeThicknes(2);
     foxDraw.SetStrokeColor(Colors.DarkGreen);
     foxDraw.DrawLine(canvasSize / 10, canvasSize / 10, (canvasSize / 10) * 2, canvasSize / 10);
     foxDraw.SetStrokeColor(Colors.DarkOrange);
     foxDraw.DrawLine(canvasSize / 10, (canvasSize / 10) * 2, canvasSize / 10, canvasSize / 10);
     foxDraw.SetStrokeColor(Colors.DarkMagenta);
     foxDraw.DrawLine((canvasSize / 10) * 2, canvasSize / 10, (canvasSize / 10) * 2, (canvasSize / 10) * 2);
     foxDraw.SetStrokeColor(Colors.DarkViolet);
     foxDraw.DrawLine(canvasSize / 10, (canvasSize / 10) * 2, (canvasSize / 10) * 2, (canvasSize / 10) * 2);
 }
        public static void DrawLine(FoxDraw foxDraw)
        {
            foxDraw.SetStrokeThicknes(2);
            foxDraw.SetStrokeColor(Colors.Green);
            var startPoint = new Point(0, 0);
            var endPoint   = new Point(250, 250);

            for (int i = 0; i <= 500; i += 250)
            {
                startPoint = new Point(i, 0);
                foxDraw.DrawLine(startPoint, endPoint);
            }
        }
示例#20
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);

            canvas.Width  = 800;
            canvas.Height = 800;
            foxDraw.SetBackgroundColor(Colors.LightBlue);
            foxDraw.SetStrokeColor(Colors.Black);
            foxDraw.SetStrokeThicknes(1);

            UpShape(foxDraw, (Width / 2), (Height / 2) - 140); //first line

            for (int w = -30; w <= 30; w = w + 60)             // second line
            {
                UpShape(foxDraw, (Width / 2) + w, (Height / 2) - 120);
            }

            for (int w = -60; w <= 60; w = w + 60)      // third line copied multiple times
            {
                for (int h = -60; h <= 100; h = h + 40)
                {
                    UpShape(foxDraw, (Width / 2) + w, (Height / 2) - h);
                }
            }

            for (int h = -80; h < 80; h = h + 40)   //middle part
            {
                for (int w = -90; w <= 90; w = w + 60)
                {
                    UpShape(foxDraw, (Width / 2) + w, (Height / 2) + h);
                    DownShape(foxDraw, (Width / 2) + w, ((Height / 2) + h) + 40);
                }
            }

            for (int w = -60; w <= 60; w = w + 60)      // third to last
            {
                DownShape(foxDraw, (Width / 2) + w, (Height / 2) + 100);
            }

            for (int w = -30; w <= 30; w = w + 60)      // second to last
            {
                DownShape(foxDraw, (Width / 2) + w, (Height / 2) + 120);
            }

            DownShape(foxDraw, (Width / 2), (Height / 2) + 140);  //last line
        }
示例#21
0
        private void LinePlay(FoxDraw foxDraw)
        {
            int lineThickness = 2;

            foxDraw.SetStrokeThicknes(lineThickness);
            foxDraw.SetStrokeColor(Color.Parse("#02111B"));
            // top-left to bottom right
            for (int i = 0; i <= 800; i += 30)
            {
                foxDraw.DrawLine(0, 0, 800, i);
            }
            // bottom right to top-left
            for (int i = 0; i <= 800; i += 30)
            {
                foxDraw.DrawLine(800, 800, i, 0);
            }

            foxDraw.SetStrokeThicknes(lineThickness);
            foxDraw.SetStrokeColor(Color.Parse("#5D737E"));
            // left top to bottom right
            for (int i = 0; i <= 800; i += 30)
            {
                foxDraw.DrawLine(0, 0, i, 800);
            }

            // left top to bottom right
            for (int i = 0; i <= 800; i += 30)
            {
                foxDraw.DrawLine(800, 800, 0, i);
            }

            // middle Ellipse

            // Draw ellipse to screen.
            //foxDraw.DrawEllipse( 0, 0, 100, 100);
        }
示例#22
0
        public static void Strokes(FoxDraw foxdraw, int x, int y)
        {
            foxdraw.SetStrokeThicknes(1);

            for (int i = 0; i < 250; i++)
            {
                foxdraw.SetStrokeColor(Colors.DarkViolet);
                foxdraw.DrawLine(500, x, y, 0);
                foxdraw.SetStrokeColor(Colors.LightGreen);
                foxdraw.DrawLine(x, 500, 0, y);

                x += 20;
                y += 20;
            }
        }
示例#23
0
        public void DrawLinePlay(FoxDraw foxDraw, double lines)
        {
            double numberOfPoints = lines;
            double distance       = Height / numberOfPoints;

            foxDraw.SetStrokeThicknes(2);

            for (int i = 0; i < numberOfPoints; i++)
            {
                foxDraw.SetStrokeColor(Colors.MediumPurple);
                foxDraw.DrawLine(distance * i, 0, Height, distance * i);
                foxDraw.SetStrokeColor(Colors.LimeGreen);
                foxDraw.DrawLine(0, distance * i, distance * i, Height);
            }
        }
示例#24
0
        public void DrawEnvelopeStar(FoxDraw foxDraw, double x)
        {
            double lines      = x;
            double halfWindow = Height / 2;
            double distance   = halfWindow / lines;

            foxDraw.SetStrokeColor(Colors.Lime);
            foxDraw.SetStrokeThicknes(2);
            for (int i = 0; i < lines; i++)
            {
                foxDraw.DrawLine(halfWindow, distance * i, halfWindow + distance * i, halfWindow);
                foxDraw.DrawLine(halfWindow, distance * i, halfWindow - distance * i, halfWindow);
                foxDraw.DrawLine(halfWindow, Height - distance * i, halfWindow - distance * i, halfWindow);
                foxDraw.DrawLine(halfWindow, Height - distance * i, halfWindow + distance * i, halfWindow);
            }
        }
示例#25
0
        public void DrawRow(FoxDraw foxdraw)
        {
            int x = 0;
            int y = 0;

            for (int i = 0; i < 20; i++)
            {
                x += 15;
                y += 15;

                foxdraw.SetFillColor(Colors.DarkViolet);
                foxdraw.SetStrokeThicknes(1);
                foxdraw.SetStrokeColor(Colors.Black);
                foxdraw.DrawRectangle(x, y, 15, 15);
            }
        }
示例#26
0
        public static void DrawLine(FoxDraw foxDraw)
        {
            foxDraw.SetStrokeThicknes(2);
            var startPoint = new Point(0, 0);
            var endPoint   = new Point(500, 500);

            if (startPoint == new Point(0, 0))
            {
                foxDraw.SetStrokeColor(Colors.Green);
            }
            else
            {
                foxDraw.SetStrokeColor(Colors.Red);
            }
            foxDraw.DrawLine(startPoint, endPoint);
        }
示例#27
0
        public void DrawRow(FoxDraw foxdraw)
        {
            int x    = 15;
            int y    = 15;
            int size = 15;

            for (int i = 0; i < 7; i++)
            {
                x    += size;
                y    += size;
                size += 10;

                foxdraw.SetFillColor(Colors.DarkViolet);
                foxdraw.SetStrokeThicknes(1);
                foxdraw.SetStrokeColor(Colors.Black);
                foxdraw.DrawRectangle(x, y, size, size);
            }
        }
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);
            canvas.Width  = 600;
            canvas.Height = 600;


            foxDraw.SetStrokeThicknes(2);
            foxDraw.SetStrokeColor(Colors.Black);


            DrawSquare(foxDraw, 20, Colors.DarkViolet);
        }
        public void Line(FoxDraw foxdraw)
        {
            foxdraw.SetStrokeThicknes(1);

            for (int i = 20; i < 300; i += 20) // Lines Top Left
            {
                var startPoint = new Point(0, i);
                var endPoint   = new Point(i, 300);
                foxdraw.SetStrokeColor(Colors.Green);
                foxdraw.DrawLine(startPoint, endPoint);
            }
            for (int i = 20; i < 300; i += 20) // Lines Top Right
            {
                var startPointTwo = new Point(i, 0);
                var endPointTwo   = new Point(300, i);
                foxdraw.SetStrokeColor(Colors.Purple);
                foxdraw.DrawLine(startPointTwo, endPointTwo);
            }
        }
示例#30
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            var canvas  = this.Get <Canvas>("canvas");
            var foxDraw = new FoxDraw(canvas);
            // Create a square drawing function that takes 3 parameters:
            // The square size, and the fill color, foxDraw
            // and draws a square of that size and color to the center of the canvas.
            // Create a loop that fills the canvas with rainbow colored squares (red, orange, yellow, green, blue, indigo, violet).

            canvas.Width  = 700;
            canvas.Height = 700;

            Color[] colorsFill =
            {
                Colors.Red,
                Colors.Orange,
                Colors.Green,
                Colors.Yellow,
                Colors.Blue,
                Colors.Indigo,
                Colors.Violet,
            };

            int size           = 700;
            int CalculationOne = size / colorsFill.Length;
            int CalculationTwo = CalculationOne / 2;
            int position       = 0;

            foreach (var color in colorsFill)
            {
                foxDraw.SetStrokeThicknes(0);
                foxDraw.SetFillColor(color);
                foxDraw.DrawRectangle(position, position, size, size);
                size     -= CalculationOne;
                position += CalculationTwo;
            }
        }