public static void DrawCheckerBoard(FoxDraw foxDraw) { int x = 30; int i = 1; foxDraw.FillColor(Colors.Purple); foxDraw.DrawRectangle(0, 0, x, x); while (i * x < 600) { foxDraw.FillColor(Colors.Purple); foxDraw.DrawRectangle(i * x, i * x, x, x); i++; } }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); // draw four different size and color rectangles. foxDraw.DrawRectangle(10, 10, 100, 100); foxDraw.FillColor(Colors.Red); foxDraw.DrawRectangle(30, 10, 80, 100); foxDraw.FillColor(Colors.Black); foxDraw.DrawRectangle(10, 40, 100, 120); foxDraw.FillColor(Colors.Blue); foxDraw.DrawRectangle(20, 10, 60, 60); foxDraw.FillColor(Colors.Green); }
public MainWindow() { InitializeComponent(); var container = new FoxDraw(canvas); container.FillColor(Colors.Transparent); container.StrokeColor(Colors.Black); container.DrawRectangle(0, 0, 600, 600); var index = 0; for (int i = 15; i <= Width; i += 15) { var PointsOnA = new Point[600 / i]; var PointsOnB = new Point[600 / i]; var PointsOnC = new Point[600 / i]; var PointsOnD = new Point[600 / i]; PointsOnA[index] = new Point(i, Height); PointsOnB[index] = new Point(Width, Height - i); PointsOnC[index] = new Point(Width - i, 0); PointsOnD[index] = new Point(0, 0 + i); var linesOnLeft = new FoxDraw(canvas); var linesOnRight = new FoxDraw(canvas); linesOnLeft.DrawLine(PointsOnC[index], PointsOnD[index]); linesOnRight.DrawLine(PointsOnA[index], PointsOnB[index]); } }
private void DrawRainbowBoxes(double sizeX, double sizeY) { var foxDraw = new FoxDraw(canvas); foxDraw.FillColor(Colors.Transparent); foxDraw.DrawRectangle(canvas.Width / 2 - sizeX / 2, canvas.Height / 2 - sizeY / 2, sizeX, sizeY); }
static void SquarePorn(FoxDraw foxDraw, Point start, Point end, int count) { foxDraw.StrokeColor(Colors.Black); foxDraw.FillColor(Colors.Transparent); List <Point> list = new List <Point>(); list.Add(new Point(start.X + (end.X - start.X) / 4, start.Y + (end.Y - start.Y) / 4)); list.Add(new Point(start.X + (end.X - start.X) * 3 / 4, start.Y + (end.Y - start.Y) / 4)); list.Add(new Point(start.X + (end.X - start.X) * 3 / 4, start.Y + (end.Y - start.Y) * 3 / 4)); list.Add(new Point(start.X + (end.X - start.X) / 4, start.Y + (end.Y - start.Y) * 3 / 4)); foxDraw.DrawPolygon(list); count--; if (count > 0) { Point point1 = new Point(start.X + (end.X - start.X) / 2, start.Y); Point point2 = new Point(start.X, start.Y + (end.Y - start.Y) / 2); Point point3 = new Point(start.X + (end.X - start.X) / 2, start.Y + (end.Y - start.Y) / 2); Point point4 = new Point(end.X, start.Y + (end.Y - start.Y) / 2); Point point5 = new Point(start.X + (end.X - start.X) / 2, end.Y); SquarePorn(foxDraw, start, point3, count); SquarePorn(foxDraw, point1, point4, count); SquarePorn(foxDraw, point2, point5, count); SquarePorn(foxDraw, point3, end, count); } }
public static void DrawSquare(FoxDraw foxDraw, double coordinatex, double coordinatey, double size, double count) { if (size > 0) { if(count < 6) { foxDraw.FillColor(Colors.Yellow); foxDraw.StrokeColor(Colors.Black); foxDraw.DrawRectangle(coordinatex, coordinatey, size, size); count ++; DrawSquare(foxDraw, coordinatex, (coordinatey + size / 3), size / 3, count); DrawSquare(foxDraw, (coordinatex + size / 3), (coordinatey + 2 * (size / 3)), size / 3, count); DrawSquare(foxDraw, (coordinatex + 2 * (size / 3)), (coordinatey + size / 3), size / 3, count); DrawSquare(foxDraw, (coordinatex + size / 3), coordinatey, size / 3, count); } else { return; } } else { return; } }
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); } }
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); } }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); double x = 0; double y = 0; double a = canvas.Width / 10; for (int i = 0; y < canvas.Height; i++) { if (i % 2 != 0) { x += a; } for (int j = 0; x < canvas.Width; j++) { foxDraw.FillColor(Colors.Black); foxDraw.DrawRectangle(x, y, a, a); x += 2 * a; } x = 0; y += a; } }
private void LayCarpet(FoxDraw foxDraw, Point offset, double h) { if (h <= 1) { return; } else { int colorNumber = (int)h % myColors.Length; foxDraw.FillColor(myColors[colorNumber]); foxDraw.DrawRectangle(offset.X, offset.Y, h, h); } LayCarpet(foxDraw, new Point(offset.X - 2 * h / 3, offset.Y - 2 * h / 3), h / 3); LayCarpet(foxDraw, new Point(offset.X - 2 * h / 3, offset.Y + h / 3), h / 3); LayCarpet(foxDraw, new Point(offset.X - 2 * h / 3, offset.Y + 4 * h / 3), h / 3); LayCarpet(foxDraw, new Point(offset.X + h / 3, offset.Y - 2 * h / 3), h / 3); //LayCarpet(foxDraw, new Point(offset.X + h / 3, offset.Y + h / 3), h / 3); LayCarpet(foxDraw, new Point(offset.X + h / 3, offset.Y + 4 * h / 3), h / 3); LayCarpet(foxDraw, new Point(offset.X + 4 * h / 3, offset.Y - 2 * h / 3), h / 3); LayCarpet(foxDraw, new Point(offset.X + 4 * h / 3, offset.Y + h / 3), h / 3); LayCarpet(foxDraw, new Point(offset.X + 4 * h / 3, offset.Y + 4 * h / 3), h / 3); }
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); } }
public void DrawBrutalSquare(FoxDraw foxDraw, int level, Rect rect) { Random rnd = new Random(); if (level == 0) { foxDraw.FillColor(Color.FromRgb((byte)rnd.Next(255), (byte)rnd.Next(255), (byte)rnd.Next(255))); foxDraw.DrawRectangle(rect.X, rect.Y, rect.Width, rect.Height); } else { float width = (float)rect.Width / 3f; float x0 = (float)rect.Left; float x1 = x0 + width; float x2 = x0 + width * 2f; float height = (float)rect.Height / 3f; float y0 = (float)rect.Top; float y1 = y0 + height; float y2 = y0 + height * 2f; DrawBrutalSquare(foxDraw, level - 1, new Rect(x0, y0, width, height)); DrawBrutalSquare(foxDraw, level - 1, new Rect(x1, y0, width, height)); DrawBrutalSquare(foxDraw, level - 1, new Rect(x2, y0, width, height)); DrawBrutalSquare(foxDraw, level - 1, new Rect(x0, y1, width, height)); DrawBrutalSquare(foxDraw, level - 1, new Rect(x2, y1, width, height)); DrawBrutalSquare(foxDraw, level - 1, new Rect(x0, y2, width, height)); DrawBrutalSquare(foxDraw, level - 1, new Rect(x1, y2, width, height)); DrawBrutalSquare(foxDraw, level - 1, new Rect(x2, y2, width, height)); } }
public void TripTheFckOut(FoxDraw foxDraw, int size, Color x) { List <Color> list = new List <Color>(); list.Add(Colors.Red); list.Add(Colors.Orange); list.Add(Colors.Yellow); list.Add(Colors.Green); list.Add(Colors.Blue); list.Add(Colors.Purple); while (list[0] != x) { list.Add(list[0]); list.Remove(list[0]); } for (; size > 0; size -= 10) { foxDraw.FillColor(list[0]); foxDraw.DrawRectangle(150 - size / 2, 150 - size / 2, size, size); list.Add(list[0]); list.Remove(list[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); } }
public static void DrawTriangle(FoxDraw foxDraw) { int x = 25; double setStartPointX = 0; double setStartPointY = 600; for (int k = 12; k >= 0; k--) { double startPointX = setStartPointX; double startPointY = setStartPointY; for (int i = 0; i < k; i++) { var points = new List <Point>(); points.Add(new Point(startPointX, startPointY)); points.Add(new Point(startPointX + 2 * x, startPointY)); points.Add(new Point(startPointX + x, startPointY - x * System.Math.Sqrt(3))); foxDraw.FillColor(Colors.White); foxDraw.DrawPolygon(points); startPointX = startPointX + x; startPointY = startPointY - x * System.Math.Sqrt(3); } setStartPointX = setStartPointX + 2 * x; } }
private void CheckerIt(FoxDraw foxDraw, int boxes) { foxDraw.FillColor(Colors.Black); double size = canvas.Height / boxes; foxDraw.DrawLine(0, 0, 0, size * boxes); foxDraw.DrawLine(0, 0, size * boxes, 0); foxDraw.DrawLine(size * boxes, 0, size * boxes, size * boxes); foxDraw.DrawLine(0, size * boxes, size * boxes, size * boxes); for (int i = 0; i < boxes / 2; i++) { for (int j = 0; j < boxes; j++) { if (j % 2 == 1) // odd lines { foxDraw.DrawRectangle(2 * i * size + size, j * size, size, size); } if (j % 2 == 0)// even lines { foxDraw.DrawRectangle(2 * i * size, j * size, size, size); } } } }
public MainWindow() { InitializeComponent(); var background = new FoxDraw(canvas); background.FillColor(Colors.Black); background.DrawRectangle(0, 0, 700, 700); Random generalrandom = new Random(); double numofstars = generalrandom.Next(300, 500); Color[] starcolors = { Colors.Wheat, Colors.LightBlue, Colors.LightGoldenrodYellow, Colors.LightYellow }; for (int i = 0; i <= numofstars; i++) { InitializeComponent(); double sizex = generalrandom.Next(1, 3); double sizey = sizex; double posx = generalrandom.Next(0, 700); double posy = generalrandom.Next(0, 700); var star = new FoxDraw(canvas); star.FillColor(starcolors[generalrandom.Next(0, starcolors.Length - 1)]); star.StrokeColor(Colors.White); star.DrawEllipse(posx, posy, sizex, sizey); } int transOrionx = generalrandom.Next(0, 700); int transOriony = generalrandom.Next(0, 700); Orion(transOrionx, transOriony, starcolors[generalrandom.Next(0, starcolors.Length - 1)]); }
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); } }
private void PurpleSteps(FoxDraw foxDraw, double size, int many) { foxDraw.FillColor(Colors.Purple); for (int i = 0; i < many; i++) { foxDraw.DrawRectangle(i * size, i * size, size, size); } }
private void FourRectangles(FoxDraw foxDraw, int[] p1, int[] p2, int[] height, int[] width, Color[] colorSet) { for (int i = 0; i < p1.Length; i++) { foxDraw.FillColor(colorSet[i]); foxDraw.DrawRectangle(p1[i], p2[i], height[i], width[i]); } }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); foxDraw.FillColor(Colors.CornflowerBlue); foxDraw.DrawRectangle(20, 20, 90, 50); foxDraw.FillColor(Colors.DarkCyan); foxDraw.DrawRectangle(60, 60, 110, 80); foxDraw.FillColor(Colors.DarkSlateBlue); foxDraw.DrawRectangle(210, 170, 55, 70); foxDraw.FillColor(Colors.YellowGreen); foxDraw.DrawRectangle(80, 100, 150, 67); }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); // create a square drawing function that takes 2 parameters: // the x and y coordinates of the square's top left corner // and draws a 50x50 square from that point. // draw 3 squares with that function. foxDraw.FillColor(Colors.Yellow); RectangleDraw(foxDraw, 50, 50); foxDraw.FillColor(Colors.Green); RectangleDraw(foxDraw, 100, 100); foxDraw.FillColor(Colors.Blue); RectangleDraw(foxDraw, 150, 150); }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); // draw four different size and color rectangles. foxDraw.FillColor(Colors.AliceBlue); foxDraw.DrawRectangle(10, 10, 120, 120); foxDraw.FillColor(Colors.DarkSalmon); foxDraw.DrawRectangle(150, 100, 80, 190); foxDraw.FillColor(Colors.Indigo); foxDraw.DrawRectangle(0, 200, 100, 100); foxDraw.FillColor(Colors.HotPink); foxDraw.DrawRectangle(83, 94, 170, 170); }
public static void DrawSquares(FoxDraw foxDraw) { foxDraw.FillColor(Colors.Purple); for (int i = 0; i < 19; i++) { foxDraw.DrawRectangle(i * 10, i * 10, 10, 10); } }
static void DrawChessBoard(FoxDraw foxDraw) { for (int i = 0; i < 18; i++) { for (int j = 0; j < 18; j++) { if ((i + j) % 2 == 0) { foxDraw.FillColor(Colors.Black); } else { foxDraw.FillColor(Colors.White); } foxDraw.DrawRectangle(10 + 15 * j, 10 + 15 * i, 15, 15); } } }
public KochLineDrawer(FoxDraw foxDraw, Canvas canvas) { this.foxDraw = foxDraw; this.canvas = canvas; foxDraw.FillColor(Colors.FloralWhite); foxDraw.StrokeColor(Colors.FloralWhite); foxDraw.DrawRectangle(0, 0, canvas.Width, canvas.Height); }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); foxDraw.FillColor(Colors.Red); Triangles(foxDraw, new Point(0, 0), new Point(canvas.Height, 0), new Point(canvas.Height / 2, canvas.Height), canvas.Height); }
private void DrawBackGround(int xPosition, int yPosition, int edge, FoxDraw foxDraw) { foxDraw.StrokeColor(Colors.Aquamarine); foxDraw.FillColor(Colors.Aquamarine); foxDraw.DrawRectangle(xPosition, yPosition, edge, edge); }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); // draw four different size and color rectangles. foxDraw.FillColor(Colors.Green); foxDraw.DrawRectangle(10, 10, 150, 50); foxDraw.FillColor(Colors.Magenta); foxDraw.DrawRectangle(50, 30, 300, 80); foxDraw.FillColor(Colors.Gold); foxDraw.DrawRectangle(230, 70, 250, 50); foxDraw.FillColor(Colors.MediumAquamarine); foxDraw.DrawRectangle(180, 200, 180, 280); }
public void DrawCircle(double startX, double startY, double radius1, double radius2) { FoxDraw foxDraw = new FoxDraw(canvas); foxDraw.StrokeColor(Colors.Orange); foxDraw.FillColor(Colors.Transparent); foxDraw.DrawEllipse(startX, startY, radius1, radius1); }