Ejemplo n.º 1
0
        static void HexaDrawer(FoxDraw foxDraw, Point start, Point end, int count)
        {
            foxDraw.StrokeColor(Colors.Black);
            foxDraw.FillColor(Colors.White);
            foxDraw.BackgroundColor(Colors.Gray);

            var points = new List <Point>();

            points.Add(new Point(start.X + (end.X - start.X) / 4, start.Y));
            points.Add(new Point(start.X + (end.X - start.X) * 3 / 4, start.Y));
            points.Add(new Point(end.X, start.Y + (end.Y - start.Y) / 2));
            points.Add(new Point(start.X + (end.X - start.X) * 3 / 4, end.Y));
            points.Add(new Point(start.X + (end.X - start.X) / 4, end.Y));
            points.Add(new Point(start.X, start.Y + (end.Y - start.Y) / 2));

            foxDraw.DrawPolygon(points);

            count--;
            if (count > 0)
            {
                HexaDrawer(foxDraw, new Point(start.X + (end.X - start.X) / 6, start.Y), new Point(start.X + (end.X - start.X) / 2, start.Y + (end.Y - start.Y) / 3), count);
                HexaDrawer(foxDraw, new Point(start.X + (end.X - start.X) / 2, start.Y), new Point(start.X + (end.X - start.X) * 5 / 6, start.Y + (end.Y - start.Y) / 3), count);
                HexaDrawer(foxDraw, new Point(start.X, start.Y + (end.Y - start.Y) / 3), new Point(start.X + (end.X - start.X) / 3, start.Y + (end.Y - start.Y) * 2 / 3), count);
                HexaDrawer(foxDraw, new Point(start.X + (end.X - start.X) * 2 / 3, start.Y + (end.Y - start.Y) / 3), new Point(end.X, start.Y + (end.Y - start.Y) * 2 / 3), count);
                HexaDrawer(foxDraw, new Point(start.X + (end.X - start.X) / 6, start.Y + (end.Y - start.Y) * 2 / 3), new Point(start.X + (end.X - start.X) / 2, end.Y), count);
                HexaDrawer(foxDraw, new Point(start.X + (end.X - start.X) / 2, start.Y + (end.Y - start.Y) * 2 / 3), new Point(start.X + (end.X - start.X) * 5 / 6, end.Y), count);
            }
        }
Ejemplo n.º 2
0
        public double DrawCircles(double x, double y, double diameter)
        {
            var    foxdraw = new FoxDraw(canvas);
            Random rnd     = new Random();

            Byte[] b = new Byte[3];
            rnd.NextBytes(b);
            Color color = Color.FromRgb(b[0], b[1], b[2]);

            foxdraw.BackgroundColor(Colors.Beige);
            foxdraw.FillColor(Color.FromArgb(0, 255, 255, 255));
            foxdraw.DrawEllipse(x, y, diameter, diameter);
            foxdraw.DrawEllipse(x + (diameter * 0.25), y, diameter / 2, diameter / 2);
            foxdraw.DrawEllipse(x + (diameter * 0.05), y + (diameter * 0.4), diameter / 2, diameter / 2);
            foxdraw.FillColor(color);
            foxdraw.DrawEllipse(x + (diameter * 0.45), y + (diameter * 0.4), diameter / 2, diameter / 2);
            if (diameter > 50)
            {
                DrawCircles(x + (diameter / 2.7), y, diameter / 4);
                DrawCircles(x + (diameter * 0.26), y + (diameter * 0.18), diameter / 4);
                DrawCircles(x + (diameter * 0.49), y + (diameter * 0.18), diameter / 4);
                DrawCircles(x + (diameter * 0.18), y + (diameter * 0.4), diameter / 4);
                DrawCircles(x + (diameter * 0.06), y + (diameter * 0.58), diameter / 4);
                DrawCircles(x + (diameter * 0.29), y + (diameter * 0.58), diameter / 4);
                DrawCircles(x + (diameter * 0.57), y + (diameter * 0.4), diameter / 4);
                DrawCircles(x + (diameter * 0.46), y + (diameter * 0.58), diameter / 4);
                DrawCircles(x + (diameter * 0.69), y + (diameter * 0.58), diameter / 4);
            }
            return(0);
        }
Ejemplo n.º 3
0
        public static void DrawCarpet(FoxDraw drawer, int level, double Height, double Width, double x, double y)
        {
            if (level == 0)
            {
                drawer.DrawRectangle(x, y, Height, Width);
            }
            else
            {
                double wid = Width / 3f;
                double hgt = Height / 3f;
                double x1  = x + wid;
                double y1  = y + hgt;
                double x2  = x + wid * 2f;
                double y2  = y + hgt * 2f;

                drawer.BackgroundColor(Colors.IndianRed);
                drawer.FillColor(Colors.Blue);
                drawer.StrokeColor(Colors.White);

                DrawCarpet(drawer, level - 1, wid, hgt, x, y);
                DrawCarpet(drawer, level - 1, wid, hgt, x1, y);
                DrawCarpet(drawer, level - 1, wid, hgt, x2, y);
                DrawCarpet(drawer, level - 1, wid, hgt, x, y1);
                DrawCarpet(drawer, level - 1, wid, hgt, x2, y1);
                DrawCarpet(drawer, level - 1, wid, hgt, x, y2);
                DrawCarpet(drawer, level - 1, wid, hgt, x1, y2);
                DrawCarpet(drawer, level - 1, wid, hgt, x2, y2);
            }
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();
            foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.Black);
        }
Ejemplo n.º 5
0
        static void DrawTriangle(FoxDraw foxDraw, double startx, double starty, double endx, double endy, int count)
        {
            foxDraw.StrokeColor(Colors.Black);
            foxDraw.FillColor(Colors.White);
            foxDraw.BackgroundColor(Colors.Gray);

            var points = new List <Point>();

            points.Add(new Point(startx, starty));
            points.Add(new Point(endx, starty));
            points.Add(new Point(startx + (endx - startx) / 2, endy));
            foxDraw.DrawPolygon(points);

            var points2 = new List <Point>();

            points2.Add(new Point(startx + (endx - startx) / 2, starty));
            points2.Add(new Point(startx + (endx - startx) / 4, starty + (endy - starty) / 2));
            points2.Add(new Point(startx + (endx - startx) * 3 / 4, starty + (endy - starty) / 2));
            foxDraw.DrawPolygon(points2);

            count--;
            if (count > 0)
            {
                DrawTriangle(foxDraw, startx + (endx - startx) / 2, starty, endx, starty + (endy - starty) / 2, count);
                DrawTriangle(foxDraw, startx, starty, startx + (endx - startx) / 2, starty + (endy - starty) / 2, count);
                DrawTriangle(foxDraw, startx + (endx - startx) / 4, starty + (endy - starty) / 2, startx + (endx - startx) * 3 / 4, endy, count);
            }
        }
Ejemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            Diagonal(foxDraw);
            foxDraw.BackgroundColor(Colors.Gray);
        }
Ejemplo n.º 7
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            CenteredSqare(foxDraw);
            foxDraw.BackgroundColor(Colors.LightGray);
        }
Ejemplo n.º 8
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            SnowFlake(foxDraw, canvas, 30, 220, 250, 4, 0);
            foxDraw.BackgroundColor(Colors.DeepSkyBlue);
        }
Ejemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.Yellow);
            DrawLines(foxDraw, 0, 0, 600, 600, 6);
        }
Ejemplo n.º 10
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.Black);

            DrawSquare(foxDraw, canvas, 0, 0, 100, 6);
        }
Ejemplo n.º 11
0
 public static void FourSquare(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.BackgroundColor(Colors.LightGray);
     for (int i = 0; i < 3; i++)
     {
         foxDraw.DrawRectangle(x, y, 50, 50);
         x += 50;
         y += 50;
     }
 }
Ejemplo n.º 12
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Color.FromArgb(255, 0, 0, 255));
            foxDraw.FillColor(Color.FromArgb(0, 0, 0, 0));
            foxDraw.StrokeColor(Colors.White);
            //foxDraw.DrawEllipse(0, 0, 600, 600);
            Circle(foxDraw, 600, 5);
        }
Ejemplo n.º 13
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            DrawGreenPolygon(foxDraw, canvas);
            DrawGreenPolygon2(foxDraw, canvas);
            DrawGreenPolygon3(foxDraw, canvas);
            DrawGreenPolygon4(foxDraw, canvas);
            foxDraw.BackgroundColor(Colors.Black);
        }
Ejemplo n.º 14
0
        public static void FourSquare(FoxDraw foxDraw, int x)
        {
            foxDraw.BackgroundColor(Colors.LightGray);
            var random = new Random();

            for (int i = 0; i < 3; i++)
            {
                foxDraw.DrawRectangle((250 - x / 2), (250 - x / 2), x, x);
                foxDraw.FillColor(Color.FromRgb((byte)random.Next(), (byte)random.Next(), (byte)random.Next()));
            }
        }
Ejemplo n.º 15
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            double BasicWidth = canvas.Width;       // Az alapparametert a Canvas meretehez igazitom. A Canvas amugy negyzet alaku, 600 * 600-asra parameterezve.

            foxDraw.BackgroundColor(Colors.Yellow); // A Canvas sarga hatter szinenek beallitasa.
            foxDraw.StrokeColor(Colors.Black);      // A vonalak szinenek beallitasa.
            Drawing(foxDraw, 0, 0, BasicWidth, 6);  // A fuggveny meghivasa. Mivel nullra allitottam be az x es y alapparameteret. Ezert a fuggveny a BasicWidth-bol szarmaztatott eltolasabol hatarozza meg a vonalak parameteret. A level 6-os erteken kerult meghatarozasra. Hat felett mar nagyon letompul a gep. Bar az is lehet, hogy 1 keppont ala csokken a BasicWidth es azert nem tud vele mit kezdeni.
        }
Ejemplo n.º 16
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            //DrawColumn(foxDraw, ReadData("file"));
            foxDraw.BackgroundColor(Colors.Black);
            foxDraw.FillColor(Colors.Black);
            //foxDraw.DrawRectangle(20, 100, 300, 200);
            DrawColumn(foxDraw, listOfNumbers);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        public MainWindow()
        {
            InitializeComponent();
            var    foxDraw = new FoxDraw(canvas);
            double line    = canvas.Width;
            int    depth   = 5;

            foxDraw.BackgroundColor(Colors.LightYellow);
            foxDraw.StrokeColor(Colors.DarkMagenta);
            Drawer(foxDraw, 0, 0, line, depth);
        }
Ejemplo n.º 19
0
 public static void Horizontal(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.BackgroundColor(Colors.LightGray);
     foxDraw.StrokeColor(Colors.Black);
     for (int i = 0; i < 3; i++)
     {
         foxDraw.DrawLine(x, y, x + 50, y);
         x *= 2;
         y *= 2;
     }
 }
Ejemplo n.º 20
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            double size = canvas.Width;

            foxDraw.BackgroundColor(Colors.Yellow);
            foxDraw.StrokeColor(Colors.Black);
            Drawing(foxDraw, 0, 0, size, 4);
        }
Ejemplo n.º 21
0
        public static void DrawPolygon(FoxDraw foxDraw, int x, int y)
        {
            int half = 150;
            //int rei = 0;
            //int full = 300;
            var startPoint = new Point(x, y);
            var endPoint   = new Point(half, half);

            foxDraw.DrawLine(startPoint, endPoint);
            foxDraw.StrokeColor(Colors.Magenta);
            foxDraw.BackgroundColor(Colors.Black);
        }
Ejemplo n.º 22
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.Gold);
            double size   = 600;
            int    level  = 4;
            Random random = new Random();

            DrawSquare(foxDraw, canvas, 0, 0, 200, level, RandomColor(random), random);
        }
Ejemplo n.º 23
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);
     }
 }
Ejemplo n.º 24
0
        public static void FourSquare(FoxDraw foxDraw, int x, int y)
        {
            foxDraw.BackgroundColor(Colors.LightGray);
            foxDraw.FillColor(Colors.Purple);
            var random = new Random();

            for (int i = 0; i < 19; i++)
            {
                foxDraw.DrawRectangle(x, y, 10, 10);
                x = (x + 10);
                y = (y + 10);
            }
        }
Ejemplo n.º 25
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.White);
            foxDraw.StrokeColor(Colors.Black);
            double x    = canvas.Width / 2;;
            double y    = canvas.Height / 2;;
            double side = canvas.Width / 2;

            DrawGridSquares(foxDraw, x, y, side, 5);
        }
Ejemplo n.º 26
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            double xCoord1 = 0;
            double yCoord1 = 0;
            double xCoord2 = 0;
            double yCoord2 = 0;
            double width   = canvas.Width;

            foxDraw.BackgroundColor(Colors.LightYellow);
            KochLineDrawer(foxDraw, xCoord1, yCoord2, xCoord2, yCoord2, width, 3);
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

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

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

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

            DrawSierpinskiTriangle(foxDraw, x, y, baseSide, false);
        }
Ejemplo n.º 29
0
        public static void FourSquare(FoxDraw foxDraw, int x, int y, int height, int width)
        {
            foxDraw.BackgroundColor(Colors.LightGray);
            var random = new Random();

            for (int i = 0; i < 4; i++)
            {
                foxDraw.DrawRectangle(x, y, height, width);
                x       = (x + 5) * 2;
                y       = (y + 5) * 2;
                height *= 2;
                width  *= 2;
                foxDraw.FillColor(Color.FromRgb((byte)random.Next(), (byte)random.Next(), (byte)random.Next()));
            }
        }
Ejemplo n.º 30
0
        static void DrawLinesEx11(FoxDraw foxDraw, double startingX, double startingY, double size, int levels)
        {
            if (levels > 0)
            {
                foxDraw.BackgroundColor(Colors.Yellow);
                foxDraw.StrokeColor(Colors.Black);
                foxDraw.DrawLine(startingX + (size / 3), startingY, startingX + (size / 3), startingY + size);
                foxDraw.DrawLine(startingX + (size * 2 / 3), startingY, startingX + (size * 2 / 3), startingY + size);
                foxDraw.DrawLine(startingX, startingY + (size / 3), startingX + size, startingY + (size / 3));
                foxDraw.DrawLine(startingX, startingY + (size * 2 / 3), startingX + size, startingY + (size * 2 / 3));

                DrawLinesEx11(foxDraw, startingX + (size / 3), startingY, size / 3, levels - 1);
                DrawLinesEx11(foxDraw, startingX, startingY + (size / 3), size / 3, levels - 1);
                DrawLinesEx11(foxDraw, startingX + (size / 3), startingY + (size * 2 / 3), (size / 3), levels - 1);
                DrawLinesEx11(foxDraw, startingX + (size * 2 / 3), startingY + (size / 3), (size / 3), levels - 1);
            }
        }