private void Mandelbrot_Click(object sender, EventArgs e) { Mandelbrot m = new Mandelbrot(rName); m.ShowDialog(); m.Dispose(); }
private void DrawImage() { Text = $"Fractals - Mandelbrot - Zoom {_zoom}"; tableLayoutPanel1.ColumnStyles[1].Width = ImageWidth; tableLayoutPanel1.RowStyles[1].Height = ImageHeight; var bitmap = new Bitmap(ImageWidth, ImageHeight); var visibleWidth = _visibleArea.Width; var visibleHeight = _visibleArea.Height; var maxIterations = 100 * _zoom; Parallel.For(0, ImageWidth, x => { Parallel.For(0, ImageHeight, y => { var xScaled = (x * visibleWidth / ImageWidth) + _visibleArea.X1; var yScaled = (y * visibleHeight / ImageHeight) + _visibleArea.Y1; var value = Mandelbrot.GetValue(xScaled, yScaled, maxIterations); if (value == maxIterations) { lock (_lockObject) { bitmap.SetPixel(x, y, Color.Black); } } else { var redColor = value * 255 / maxIterations; var blueColor = redColor / 3; var greenColor = redColor / 2; lock (_lockObject) { bitmap.SetPixel(x, y, Color.FromArgb(redColor, greenColor, blueColor)); } } }); }); pictureBox1.Image = bitmap; }
public ImageUtility(Mandelbrot uInstance) { InitializeComponent(); this.Image = (Bitmap)uInstance.Canvas.Clone(); this.UserInstance = uInstance; }
private void btnFractalsTEAReset_Click(object sender, EventArgs e) { mandelbrot = new Mandelbrot(Fractal.Width, Fractal.Height); double? cre = (checkFractalsTEAConstant.Checked) ? (double?)(numFractalsTEACre.Value) : null; double? cim = (checkFractalsTEAConstant.Checked) ? (double?)(numFractalsTEACim.Value) : null; mandelbrot.Recompute(cmbFractalsTEAColor.Text, cre, cim); picFractalsPicture.Image = mandelbrot.Picture; }