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 }); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); canvas.Width = 800; canvas.Height = 600; //here //foxDraw.DrawLine(50, 50, 100, 100); // Fill the canvas with a checkerboard pattern. foxDraw.SetFillColor(Colors.Violet); for (int row = 0; row < 8; row++) { for (int column = 0; column < 8; column++) { if ((row + column) % 2 == 0) { foxDraw.SetFillColor(Colors.Black); } else { foxDraw.SetFillColor(Colors.White); } DrawSquare(foxDraw, column * Convert.ToInt32(canvas.Height) / 8, row * Convert.ToInt32(canvas.Height) / 8, Convert.ToInt32(canvas.Height) / 8); } } }
private void EnvelopeStar(FoxDraw foxDraw) { for (int i = 0; i <= 800; i += 20) { 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.SetStrokeColor(Color.Parse("#232528")); foxDraw.DrawLine(0, 400, 400, i); foxDraw.SetStrokeColor(Color.Parse("#232528")); foxDraw.DrawLine(800, 400, 400, i); } foxDraw.SetStrokeColor(Color.Parse("#232528")); foxDraw.SetFillColor(Colors.White); foxDraw.DrawEllipse(-400, -400, 800, 800); foxDraw.SetStrokeColor(Color.Parse("#232528")); foxDraw.SetFillColor(Colors.White); foxDraw.DrawEllipse(400, -400, 800, 800); foxDraw.SetStrokeColor(Color.Parse("#232528")); foxDraw.SetFillColor(Colors.White); foxDraw.DrawEllipse(-400, 400, 800, 800); foxDraw.SetStrokeColor(Color.Parse("#232528")); foxDraw.SetFillColor(Colors.White); foxDraw.DrawEllipse(400, 400, 800, 800); } }
public void DrawMoon(FoxDraw foxDraw, int x, int y) { foxDraw.SetStrokeColor(Colors.Silver); foxDraw.SetFillColor(Colors.Silver); foxDraw.DrawEllipse(x - 50, y - 50, 100, 100); foxDraw.SetStrokeColor(Colors.Black); foxDraw.SetFillColor(Colors.Black); foxDraw.DrawEllipse(x - 100, y - 60, 120, 120); }
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); /*----------------------------------------------------------------------------------------------------------*/ // Fill the canvas with a checkerboard pattern. foxDraw.SetStrokeColor(Colors.Black); for (int j = 0; j < 8; j++) // loop for adding rows { if (j % 2 != 0) { for (int i = 0; i < 8; i++) // loop na změnu barvy kostek { if (i % 2 == 0) { foxDraw.SetFillColor(Colors.Black); foxDraw.DrawRectangle(i * 75, j * 75, 75, 75); } else { foxDraw.SetFillColor(Colors.White); foxDraw.DrawRectangle(i * 75, j * 75, 75, 75); } } } else { for (int i = 0; i < 8; i++) // loop na změnu barvy kostek { if (i % 2 != 0) { foxDraw.SetFillColor(Colors.Black); foxDraw.DrawRectangle(i * 75, j * 75, 75, 75); } else { foxDraw.SetFillColor(Colors.White); foxDraw.DrawRectangle(i * 75, j * 75, 75, 75); } } } } }
private void Sierpinski(FoxDraw foxDraw) { Point figureShift = new Point(0, 0); double baseSize = 200; int baseLevel = 5; // foxDraw.SetFillColor(Colors.LightSeaGreen); foxDraw.SetStrokeColor(Colors.Black); foxDraw.DrawRectangle(figureShift.X, figureShift.Y, 3 * baseSize, 3 * baseSize); // foxDraw.SetFillColor(Colors.Black); Sierpinski(foxDraw, figureShift, baseSize, baseLevel); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); //// // draw four different size and color rectangles. // avoid code duplication. /* var size = 10; * var offset = 10;*/ var rnd = new Random(); var randColor = new List <Color>(); randColor.Add(Colors.AliceBlue); randColor.Add(Colors.Purple); randColor.Add(Colors.Orange); randColor.Add(Colors.Green); for (int i = 1; i < 5; i++) { foxDraw.SetFillColor(randColor[rnd.Next(0, 4)]); foxDraw.DrawRectangle(rnd.Next(0, 400), rnd.Next(0, 400), rnd.Next(10, 100), rnd.Next(10, 100)); } #endif }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); canvas.Width = 800; canvas.Height = 600; //here //foxDraw.DrawLine(50, 50, 100, 100); // draw four different size and color rectangles. // avoid code duplication. List <Color> colorsOfRectangles = new List <Color> { Colors.Black, Colors.Blue, Colors.Red, Colors.Green }; for (int i = 0; i < 4; i++) { foxDraw.SetFillColor(colorsOfRectangles[i]); foxDraw.DrawRectangle(10 + 100 * i, 10 + 50 * i, 50 + 10 * i, 100 - 10 * i); } }
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); /*----------------------------------------------------------------------------------------------------------*/ // 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) List <Color> barvy = new List <Color> { Colors.Blue, Colors.Cyan, Colors.DarkBlue, Colors.Yellow, Colors.Orange }; foxDraw.SetBackgroundColor(Colors.Black); for (int i = 0; i < RandomNumber(20, 100); i++) { foxDraw.SetFillColor(barvy[RandomNumber(0, 4)]); foxDraw.DrawRectangle(RandomNumber(0, 600), RandomNumber(0, 600), 5, 5); // vytvoření random hvězdy 5x5 } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); canvas.Width = 800; canvas.Height = 600; //here //foxDraw.DrawLine(50, 50, 100, 100); // 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. List <Color> colorsOfRectangles = new List <Color> { Colors.Blue, Colors.Red, Colors.Green }; for (int i = 0; i < 3; i++) { foxDraw.SetFillColor(colorsOfRectangles[i]); DrawSquare(foxDraw, 100 - 20 * i); } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); // draw four different size and color rectangles. // avoid code duplication. double startingPointX = 10; double startingPointY = 10; double squareWidth = 30; double squareHeight = 30; List <Color> colorList = new List <Color> { Colors.Red, Colors.Blue, Colors.Green, Colors.Yellow }; //foxDraw.DrawRectangle(startingPointX, startingPointY, squareWidth, squareHeight); for (int j = 0; j < colorList.Count; j++) { foxDraw.SetFillColor(colorList[j]); foxDraw.DrawRectangle(startingPointX, startingPointY, squareWidth, squareHeight); startingPointX += 60; squareWidth += 10; squareHeight += 10; } }
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); /*----------------------------------------------------------------------------------------------------------*/ // draw four different size and color rectangles. // avoid code duplication. List <Color> barvy = new List <Color>() { Colors.Red, Colors.Blue, Colors.Green, Colors.Yellow }; int i = 1; foreach (var barva in barvy) { foxDraw.SetFillColor(barva); foxDraw.DrawRectangle(50, 50 * i, 10 * i, 5 * i); ++i; } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); double canvasHeight = canvas.Height = 600; double canvasWidth = canvas.Width = 600; // draw four different size and color rectangles. // avoid code duplication. List <Color> colors = new List <Color> { Colors.Blue, Colors.Pink, Colors.Red, Colors.Green, Colors.Yellow }; int i = 0; int j = 0; foreach (var color in colors) { i += 30; j += 30; foxDraw.SetFillColor(color); foxDraw.DrawRectangle(i, 30, 20, 20); } }
public static void RectangleInCenter(FoxDraw foxDraw, double x, double y) { double canvasSize = 400; foxDraw.SetFillColor(Colors.Transparent); foxDraw.DrawRectangle(canvasSize / 2 - x / 2, canvasSize / 2 - y / 2, x, y); }
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. }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); foxDraw.SetBackgroundColor(Colors.Wheat); var colors = new List <Color> { Colors.Red, Colors.Blue, Colors.Yellow, Colors.Pink, Colors.Black }; var colorindex = 0; for (int i = 10; i < 180; i += 30) { foxDraw.SetFillColor(colors[colorindex]); foxDraw.DrawRectangle(i, 0, 20, 20); colorindex++; if (colorindex == colors.Count) { colorindex = 0; } } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); double posx = 230; double posy = 230; foxDraw.DrawLine(400, 0, 400, 800); foxDraw.DrawLine(0, 400, 800, 400); double size = 350; Avalonia.Media.Color[] colour_palette = { Colors.Green, Colors.Blue, Colors.Yellow }; for (int i = 0; i < 3; i++) { foxDraw.SetFillColor(colour_palette[0 + i]); CreateSquare(posx, posy, size, foxDraw); size -= 100; posx += 50; posy += 50; } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); //// int size = 10; int offset = 10; int increment = 0; foxDraw.SetFillColor(Colors.Purple); for (int i = 1; i < 10; i++) { foxDraw.DrawRectangle(offset, offset, size * i, size * i); increment = i * size; offset += increment; } #endif /* foxDraw.DrawRectangle(size, size, size, size); * foxDraw.DrawRectangle(size*2, size*2, size*2, size*2); * foxDraw.DrawRectangle(size*4, size*4, size*3, size*3); * foxDraw.DrawRectangle(size*7, size*7, size*4, size*4);*/ }
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 }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); //foxDraw.DrawLine(50, 50, 100, 100); //var values = new List<int>() { 100, 150, 50 }; //foreach (var value in values) //{ // foxDraw.DrawLine(50, 50, 100, 100); //}; ////colors.[built in color] //var dict = new Dictionary<Color, List<int>>(); //dict.Add(Colors.Pink, new List<int> { 50, 100 }); // 50x100 rectangle, with color of pink //dict.Add(Colors.Green, new List<int> { 300, 350 }); // 300x250 rectangle, with color of green //var position = 50; // set initial position of the elements that are rendered below //foreach (var pair in dict) //{ // foxDraw.SetFillColor(pair.Key);//set all fills to the color // foreach (var coord in pair.Value)//loop through list to get the items from the list // { // foxDraw.DrawRectangle(position, position, coord, coord); // } // position += 50; //} //draw this tunnel thing foxDraw.SetStrokeColor(Colors.Black); //set stroke color var fillColor = Colors.White; // set alternate fill color for (int i = 0; i < 400; i += 20) //start it at 400 { var size = 400 - i * 2; //calculate the initial size, multiply by two because we need to reduce it in both dimensions if (i % 40 == 0) { fillColor = Colors.Black; } else { fillColor = Colors.White; } //Also the same thing as above: fillcolor = i %40 == 0 ? fillcolor = Colors.Black : Colors.White; foxDraw.SetFillColor(fillColor);//set color of the shape foxDraw.DrawRectangle(i, i, size, size); } foxDraw.DrawLine(0, 0, 400, 400); foxDraw.DrawLine(400, 0, 0, 400); }
public void DrawSquare(FoxDraw foxDraw, int size, Color color) { foxDraw.SetFillColor(color); for (int i = 0; i < 19 * size; i += size) { foxDraw.DrawRectangle(0 + i, 0 + i, size, size); } }
public static void CheckerBoardEven(FoxDraw foxDraw, int x, int y) { foxDraw.SetFillColor(Colors.Black); for (int i = 0; i < 16; i++) { foxDraw.DrawRectangle(x, y, 40, 40); x += 40; if (i % 2 == 1) { foxDraw.SetFillColor(Colors.Black); } else { foxDraw.SetFillColor(Colors.White); } } }
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); }
private void square(double size, Color rainbow, FoxDraw foxDraw) { foxDraw.SetFillColor(rainbow); double xCenter = Width / 2 - size / 2; double yCenter = Height / 2 - size / 2; foxDraw.DrawRectangle(xCenter, yCenter, size, size); }
public void PurpleSteps(FoxDraw foxDraw, int mnozstvi, double x) // i = kolikrát, x = size { for (int i = 1; i <= mnozstvi; i++) { foxDraw.SetFillColor(Colors.Purple); foxDraw.DrawRectangle(x * i, x * i, x, x); } }
public void DrawSquare(FoxDraw foxDraw) { double startX = (Width / 2) - 5; double startY = (Height / 2) - 5; foxDraw.SetFillColor(Colors.LightSeaGreen); foxDraw.DrawRectangle(startX, startY, 20, 20); }
/* public static void RainbowBoxes(FoxDraw foxDraw) * { * List<Color> colors = new List<Color> { Colors.LightSteelBlue, Colors.LightYellow, Colors.LightYellow, Colors.Indigo, Colors.Lavender }; * foxDraw.DrawRectangle(200, 400, 50, 50); * for (int i = 0; i < 10; i++) * { * foxDraw.DrawRectangle((i * 45) + 100, (i * 45) + 800, 50, 50); * foxDraw.SetFillColor(colors[i]); * } * }*/ public static void PurpleSteps(FoxDraw foxDraw) { foxDraw.DrawRectangle(0, 0, 20, 20); foxDraw.SetFillColor(Colors.Purple); for (int i = 0; i <= 40; i++) { foxDraw.DrawRectangle((i * 20) + 0, (i * 20) + 0, 20, 20); } }
public static void PurpleSteps(FoxDraw foxDraw, int origin, int size, int stepQty) { for (int i = 0; i < stepQty; i++) { foxDraw.SetFillColor(Colors.Purple); foxDraw.DrawRectangle(origin, origin, size, size); origin = origin + size; } }
public static void PositionSquare(FoxDraw foxDraw) { foxDraw.DrawRectangle(0, 0, 50, 50); foxDraw.SetFillColor(Colors.Tomato); for (int i = 0; i < 3; i++) { foxDraw.DrawRectangle((i * 40) + 0, (i * 40) + 0, 50, 50); } }
public static void PurpleSteps3D(FoxDraw foxDraw) { foxDraw.DrawRectangle(0, 0, 20, 20); foxDraw.SetFillColor(Colors.Purple); for (int i = 0; i <= 15; i++) { foxDraw.DrawRectangle((0 + (i * 30)) + (5 * i), (0 + (i * 30)) + (5 * i), 20 + (i * 5), 20 + (i * 5)); } }