private void drawToImage() { using (Graphics g = Graphics.FromImage(_canvas)) { g.Clear(System.Drawing.Color.White); //changed this fgsfed Fern f = new Fern(size.Value, redux.Value, Turnbias.Value, g, (int)this.Width, (int)this.Height); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); MemoryStream pngStream = new MemoryStream(); _canvas.Save(pngStream, ImageFormat.Png); pngStream.Position = 0; bitmapImage.StreamSource = pngStream; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); CanvasImage.Source = bitmapImage; } }
private void drawToImage() { using (Graphics g = Graphics.FromImage(_canvas)) { if (g == null) { return; } g.Clear(System.Drawing.Color.White); Fern f = new Fern(ageSlider.Value, lengthFallOffSlider.Value, turnSlider.Value, g, (int)this.Width, (int)this.Height); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); MemoryStream pngStream = new MemoryStream(); _canvas.Save(pngStream, ImageFormat.Png); pngStream.Position = 0; bitmapImage.StreamSource = pngStream; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); CanvasImage.Source = bitmapImage; } }
private void button1_Click(object sender, RoutedEventArgs e) { Fern f = new Fern(sizeSlider.Value, reduxSlider.Value, biasSlider.Value, canvas); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Fern f = new Fern(sizeSlider.Value, reduxSlider.Value, biasSlider.Value, canvas); }
private void button1_Click(object sender, RoutedEventArgs e) { ChooseBackground(); Fern f = new Fern(sizeSlider.Value, sporesSlider.Value, biasSlider.Value, branchSlider.Value, canvas); }
private void Window_Loaded(object sender, RoutedEventArgs e) { ChooseBackground(); Fern f = new Fern(sizeSlider.Value, sporesSlider.Value, biasSlider.Value, branchSlider.Value, canvas); }