private void ParseInput() { double width = Double.Parse(options[WidthString].Text.ToString()); double height = Double.Parse(options[HeightString].Text.ToString()); double xStart = Double.Parse(options[XstartString].Text.ToString()); double yStart = Double.Parse(options[YstartString].Text.ToString()); int rows = Int32.Parse(options[RowString].Text.ToString()); int columns = Int32.Parse(options[ColumnString].Text.ToString()); int maxIteration = Int32.Parse(options[MaxIterationString].Text.ToString()); double maxModulus = Double.Parse(options[MaxModulusString].Text.ToString()); complexGrid = new ComplexGrid(xStart, yStart, width, height, rows, columns, maxIteration, maxModulus); complexGrid.GenerateIterationCounts(); dataGridFlag = true; }
// Generates the fractal, then displays it. private void createImage() { compGrid = new ComplexGrid(xStart, yStart, width, height, rows, cols, maxIters, maxModulus); bmp = compGrid.generateImage(); // Generates image. // Displays image. img = new Image(); canvas.Children.Add(img); img.Source = bmp; Canvas.SetTop(img, 10); Canvas.SetLeft(img, 10); canvas.Height = rows; canvas.Width = cols; }
private void LoadGridItemClick(object sender, RoutedEventArgs args) { openFileDialog.Filter = "Text File|*.text"; openFileDialog.Title = "Load a grid text file"; openFileDialog.ShowDialog(); if (openFileDialog.FileName != "") { int row = 0; int column = 0; using (var stream = new StreamReader(openFileDialog.FileName)) { row = int.Parse(stream.ReadLine()); column = int.Parse(stream.ReadLine()); complexGrid = new ComplexGrid(-2.0, -2.0, WIDTH, HEIGHT, row, column, 100, 2.0); string s = ""; string[] split = null; for (int i = 0; (s = stream.ReadLine()) != null; i++) { split = s.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); for (int j = 0; j < column; j++) { complexGrid.Data[i, j] = int.Parse(split[j]); } } } bitmapSource = GenerateImageSource(row, column); image.Source = bitmapSource; } }