public Image RenderFractal(RenderProperties properties, RenderColors colors) { IFractal fract = GetFractal(properties,colors); fract.RenderComplete += RenderCompleteCall; fract.RenderProgress += RenderProgressCall; return fract.GenerateImage(new Size(properties.Width,properties.Height),properties.Area); }
public void ShowFractal(RenderProperties properties, RenderColors colors) { Task.Factory.StartNew(()=> { RenderAndSetFractal(properties,colors); }); }
private IFractal GetFractal(RenderProperties properties, RenderColors colors) { IFractal fractal = null; if(properties.Fractal == FractalType.Mandelbrot) { if(properties.SingleIteration) { fractal = new MandelbrotSet(colors.FractalColor, colors.BackgroundColor, properties.Iterations); } else { fractal = new MandelbrotSet(colors.GetColorPalette(properties.Iterations), properties.Iterations); } } else if(properties.Fractal == FractalType.Julia) { if(properties.SingleIteration) { fractal = new JuliaSet(colors.FractalColor, colors.BackgroundColor, properties.RealConst, properties.ImaginaryConst, properties.Iterations); } else { fractal = new JuliaSet(colors.GetColorPalette(properties.Iterations), properties.RealConst, properties.ImaginaryConst, properties.Iterations); } } return fractal; }
private void RenderAndSetFractal(RenderProperties properties,RenderColors colors) { this._renderColors = colors; this._renderProperties = properties; var i = _renderEngine.RenderFractal(properties, colors); if (_renderViewThread == null || !_renderViewThread.IsAlive) { CreateRenderViewThread(i); _fractalsStack.Clear(); } else { _view.ShowImage(i); } _lastRender = new FractInfo() { Image = i, Area = properties.Area }; ActualFractalImage = i; }
public RenderColors GetRenderColors() { RenderColors colorInfo = new RenderColors{ RedStart = (byte)redStartvScrollBar.Value, RedEnd = (byte)redEndvScrollBar.Value, GreenStart = (byte)greenStartvScrollBar.Value, GreenEnd = (byte)greenEndvScrollBar.Value, BlueStart = (byte)blueStartvScrollBar.Value, BlueEnd = (byte)blueEndvScrollBar.Value, FractalColor = _fractalColor, BackgroundColor = _backgroundColor }; return colorInfo; }