void DrawShapes() { Random rand = new Random(); graphics.Clear(true); int radius = 10; int originX = displayWidth / 2; int originY = displayHeight / 2; for (int i = 1; i < 5; i++) { graphics.DrawCircle ( centerX: originX, centerY: originY, radius: radius, color: Color.FromRgb(rand.Next(128, 255), rand.Next(128, 255), rand.Next(128, 255)) ); graphics.Show(); radius += 30; } int sideLength = 30; for (int i = 1; i < 5; i++) { graphics.DrawRectangle ( x: (displayWidth - sideLength) / 2, y: (displayHeight - sideLength) / 2, width: sideLength, height: sideLength, color: Color.FromRgb(rand.Next(128, 255), rand.Next(128, 255), rand.Next(128, 255)) ); graphics.Show(); sideLength += 60; } graphics.DrawLine(0, displayHeight / 2, displayWidth, displayHeight / 2, Color.FromRgb(rand.Next(128, 255), rand.Next(128, 255), rand.Next(128, 255))); graphics.DrawLine(displayWidth / 2, 0, displayWidth / 2, displayHeight, Color.FromRgb(rand.Next(128, 255), rand.Next(128, 255), rand.Next(128, 255))); graphics.DrawLine(0, 0, displayWidth, displayHeight, Color.FromRgb(rand.Next(128, 255), rand.Next(128, 255), rand.Next(128, 255))); graphics.DrawLine(0, displayHeight, displayWidth, 0, Color.FromRgb(rand.Next(128, 255), rand.Next(128, 255), rand.Next(128, 255))); graphics.Show(); //Thread.Sleep(5000); }
void LoadScreen() { Console.WriteLine("LoadScreen..."); graphics.Clear(); int radius = 225; int originX = graphics.Width / 2; int originY = graphics.Height / 2 + 130; graphics.Stroke = 3; for (int i = 1; i < 5; i++) { graphics.DrawCircle ( centerX: originX, centerY: originY, radius: radius, color: colors[i - 1], filled: true ); graphics.Show(); radius -= 20; } graphics.DrawLine(0, 220, 240, 220, Color.White); graphics.DrawLine(0, 230, 240, 230, Color.White); graphics.CurrentFont = new Font12x20(); graphics.DrawText(54, 130, "TEMPERATURE", Color.White); graphics.Show(); }
void DrawDashOrDot(int x, int y, bool isDash, Color color) { if (isDash) { graphics.DrawRectangle(x + 3, y + 6, 20, 8, color, true); } else { graphics.DrawCircle(x + 11, y + 10, 10, color, true); } graphics.Show(); }
void LoadScreen() { Console.WriteLine("LoadScreen..."); graphics.Clear(true); graphics.Stroke = 1; graphics.DrawRectangle( x: 0, y: 0, width: graphics.Width, height: graphics.Height, color: Color.White); graphics.DrawRectangle( x: 5, y: 5, width: graphics.Width - 10, height: graphics.Height - 10, color: Color.White); graphics.DrawCircle( centerX: graphics.Width / 2, centerY: graphics.Height / 2, radius: (graphics.Width / 2) - 10, color: Color.FromHex("#EF7D3B"), filled: true); DisplayJPG(55, 40); graphics.CurrentFont = new Font8x12(); string textMotion = "MOTION"; graphics.DrawText( (graphics.Width - textMotion.Length * 16) / 2, 140, textMotion, Color.Black, ScaleFactor.X2); string textDetector = "DETECTOR"; graphics.DrawText( (graphics.Width - textDetector.Length * 16) / 2, 165, textDetector, Color.Black, ScaleFactor.X2); graphics.Show(); }
void Draw() { int angle = 160; int increment = 4; int x, y = 0; while (true) { graphics.Clear(); DrawRadar(); graphics.DrawLine(120, 170, 105, (float)(angle * Math.PI / 180), Color.Yellow); if (angle >= 180) { increment = -4; } if (angle <= 0) { increment = 4; } angle += increment; servo.RotateTo(new Angle(angle, AU.Degrees)); graphics.DrawText(0, 0, $"{180 - angle}°", Color.Yellow); if (sensor.Distance != null && sensor.Distance >= new Length(0, LU.Millimeters)) { graphics.DrawText(170, 0, $"{sensor.Distance?.Millimeters}mm", Color.Yellow); radarData[angle] = (float)(sensor.Distance?.Millimeters / 2); } else { radarData[angle] = 0; } for (int i = 0; i < 180; i++) { x = 120 + (int)(radarData[i] * MathF.Cos(i * MathF.PI / 180f)); y = 170 - (int)(radarData[i] * MathF.Sin(i * MathF.PI / 180f)); graphics.DrawCircle(x, y, 2, Color.Yellow, true); } graphics.Show(); Thread.Sleep(100); } }
void DrawChip(int xCenter, int yCenter, int radius, bool isFilled) { graphics.DrawCircle(xCenter, yCenter, radius, isFilled ? Color.Red : Color.Yellow, true, true); }
void DrawChip(int xCenter, int yCenter, bool isFilled) { graphics.DrawCircle(xCenter, yCenter, 3, true, isFilled, true); }