public void generateBitmap(int flag) { int s = Math.Max(40, flag); bitmap = new Bitmap(s * 2, s * 2); for (int x = 0; x < s * 2; x += 4) { for (int y = 0; y < s + 20; y += 4) { Random random = new Random(Guid.NewGuid().GetHashCode()); int seed = random.Next(0, s); bool draw = MathExt.Distance(new Point(x, y), new Point(s, s)) < seed; if (draw) { Random col = new Random(Guid.NewGuid().GetHashCode()); int a = col.Next(50, 100); int slide = col.Next(-50, 50); int r = MathExt.Bounded(0, color.R + slide, 255); slide = col.Next(-50, 50); int g = MathExt.Bounded(0, color.G + slide, 255); slide = col.Next(-50, 50); int b = MathExt.Bounded(0, color.B + slide, 255); Graphics.FromImage(bitmap).FillRectangle( new SolidBrush(Color.FromArgb(a, r, g, b)), x, y, 4, 4); } } } }
public void changeSpeed(int inc) { speed = MathExt.Bounded(2, speed + inc, 14); }