private void DrawTriangels(FoxDraw foxDraw, int widthOfTriangles)
        {
            double startingPointX  = 0 - widthOfTriangles;
            double startingPointY  = canvas.Height;
            double heightOfTriagle = widthOfTriangles * Math.Sqrt(3) / 2;

            foxDraw.FillColor(Colors.White);
            foxDraw.BackgroundColor(Colors.White);
            int counter = (int)canvas.Width / widthOfTriangles;

            for (int j = 0; j < (int)canvas.Width / widthOfTriangles; j++)
            {
                for (int i = 0; i < counter; i++)
                {
                    var points = new List <Point>();
                    points.Add(new Point(startingPointX += widthOfTriangles, startingPointY));
                    points.Add(new Point(startingPointX + widthOfTriangles, startingPointY));
                    points.Add(new Point(startingPointX + widthOfTriangles / 2, startingPointY - heightOfTriagle));
                    foxDraw.StrokeColor(Colors.Black);
                    foxDraw.DrawPolygon(points);
                }
                counter--;
                startingPointX  = j * widthOfTriangles / 2 - widthOfTriangles / 2;
                startingPointY -= heightOfTriagle;
            }
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            Random r = new Random();

            foxDraw.BackgroundColor(Colors.GhostWhite);
            int edge            = 50;
            int numOfRectangles = 4;

            for (int i = 0; i < numOfRectangles; i++)
            {
                int x_coordinates = r.Next(edge, (int)canvas.Width - edge);
                int y_coordinates = r.Next(edge, (int)canvas.Height - edge);
                int recWidth      = r.Next(20, 50);
                int recHeight     = r.Next(20, 50);

                Color randomColor = Color.FromRgb((byte)r.Next(255), (byte)r.Next(255), (byte)r.Next(255));
                foxDraw.FillColor(randomColor);
                foxDraw.DrawRectangle(x_coordinates, y_coordinates, recWidth, recHeight);
            }


            // draw four different size and color rectangles.
            // avoid code duplication.
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.White);
            int squareSize = 20;

            DrawCheckBoard(foxDraw, squareSize);
        }
Beispiel #4
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.White);
            int xStartingPoint = 0;
            int yStartingPoint = 0;

            DrawLinesToTheCenter(foxDraw, xStartingPoint, yStartingPoint);
        }
Beispiel #5
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.White);
            int gridLength = 20;

            DrawTheGreenLines(foxDraw, gridLength);
            DrawThePurpleLines(foxDraw, gridLength);
        }
Beispiel #6
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.White);

            int gridLength = 20;

            DrawTheEnvelopeStar(foxDraw, gridLength);
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.White);
            int squareSize = 300;

            for (int i = 0; i < 3; i++)
            {
                squareSize -= 50;
                DrawSquares(foxDraw, squareSize);
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.FillColor(Colors.Yellow);
            foxDraw.BackgroundColor(Colors.Yellow);
            foxDraw.StrokeColor(Colors.Black);
            double x        = 0;
            double y        = 0;
            double baseSide = canvas.Width;

            DrawSquare(foxDraw, x, y, baseSide);
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.GhostWhite);

            int x = 10;
            int y = 10;

            foxDraw.DrawRectangle(canvas.Width / 2 - x / 2, canvas.Height / 2 - y / 2, x, y);


            // Draw a green 10x10 square to the canvas' center.
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.Beige);

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(0, 100, canvas.Width / 2, 100);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(100, 0, 100, canvas.Height / 2);

            // draw a red horizontal line to the canvas' middle.
            // draw a green vertical line to the canvas' middle.
        }
Beispiel #11
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.GhostWhite);

            int x = 100;
            int y = 100;

            Drawing(foxDraw, x, y);

            // Create a line drawing function that takes 2 parameters:
            // The x and y coordinates of the line's starting point
            // and draws a 50 long horizontal line from that point.
            // Draw 3 lines with that function. Use loop for that.
        }
Beispiel #12
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.GhostWhite);

            foxDraw.StrokeColor(Colors.Green);
            foxDraw.DrawLine(0, 0, canvas.Width, canvas.Height);

            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(0, canvas.Height, canvas.Width, 0);


            // Draw the canvas' diagonals.
            // If it starts from the upper-left corner it should be green, otherwise it should be red.
        }
        public void DrawStars(FoxDraw foxDraw, int numberOfStars)
        {
            Random r = new Random();

            foxDraw.BackgroundColor(Colors.Black);

            int edge = 1;

            for (int i = 0; i < numberOfStars; i++)
            {
                int  randomSize = r.Next(1, 10);
                byte grayColor  = (byte)r.Next(255);

                Color randomColor = Color.FromRgb(grayColor, grayColor, grayColor);
                foxDraw.FillColor(randomColor);
                foxDraw.StrokeColor(randomColor);
                foxDraw.DrawEllipse(r.Next(edge, (int)canvas.Width - edge), r.Next(edge, (int)canvas.Height - edge), randomSize, randomSize);
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.GhostWhite);
            foxDraw.StrokeColor(Colors.Red);
            foxDraw.DrawLine(100, 100, 200, 100);

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

            foxDraw.StrokeColor(Colors.Yellow);
            foxDraw.DrawLine(200, 200, 100, 200);

            foxDraw.StrokeColor(Colors.Blue);
            foxDraw.DrawLine(100, 200, 100, 100);

            // Draw a box that has different colored lines on each edge.
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.GhostWhite);

            int x = 0;
            int y = 100;

            for (int i = 0; i < 3; i++)
            {
                Drawing(foxDraw, x, y);
                x *= 2;
                y *= 2;
            }


            // Create a line drawing function that takes 2 parameters:
            // The x and y coordinates of the line's starting point
            // and draws a line from that point to the center of the canvas.
            // Draw 3 lines with that function. Use loop for that.
        }