/// <summary> /// Raise the event "the asynchrone computation has ended". /// </summary> public void ComputationEnds() { _iterateForPictureArt = _iterate; Scheduler.GrandScheduler.Exemplar.ComputeOneStepEnds(); try { this.Invoke(new OneStepEndsDelegate(OneStepEnds)); } catch { } }
/// <summary> /// Neuzeichnen. /// </summary> protected virtual void StartDrawing() { _forceRedraw = false; lock (_inDrawingMutex) _inDrawing = true; System.Diagnostics.Debug.WriteLine("_inDrawing = true (6)"); SetPictureBoxSize(); _iterate = new Iterate(_maxx, _maxy, this, IsRightView); AssignParameters(); _iterate.StartAsync(_parameter, ParameterDict.Current.GetInt("Formula.Static.Cycles"), 1, ParameterDict.Current.GetBool("Formula.Static.Julia"), !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); }
/// <summary> /// Create a draw image. /// </summary> public virtual void Draw() { System.Diagnostics.Debug.WriteLine("Draw() _inDrawing=" + _inDrawing.ToString()); lock (_smallPreviewCurrentDrawStepMutex) _smallPreviewCurrentDrawStep = 0; _fixedRenderer = -1; if (!_inDrawing) { StartDrawing(); } else { if (_iterate != null) { _iterate.Abort(); } _iterate = null; _forceRedraw = true; } }
/// <summary> /// Paint image with fixed renderer and reuse an iterate object after computation. /// </summary> public virtual void Redraw(Iterate otherIterate, int renderer) { _fixedRenderer = renderer; _iterate = otherIterate; OneStepEnds(); }
/// <summary> /// Start Computing. Is called while rendering an animation. /// </summary> public void Run(int updateSteps) { _currentProgress = 0; _master.Progress(_currentProgress); System.Diagnostics.Debug.WriteLine("PaintJob.Run " + updateSteps.ToString()); _parameters = ParameterDict.Current.Clone(); _updateSteps = updateSteps; _currentProgressd = 100.0 / (double)(_updateSteps); for (int i = 0; i < _updateSteps; i++) { if (_abort) return; _iterate = new Iterate(_parameters, this, false); if (_lastIterate != null) { _iterate.SetOldData(_lastIterate.GraphicInfo,_lastIterate.PictureData,i); } if (_abort) return; _iterate.StartAsync(); _iterate.Wait(); if (_abort) return; _lastIterate = _iterate; _currentProgress += _currentProgressd; _master.Progress(_currentProgress); } Renderer renderer = PictureArtFactory.Create(_iterate.PictureData, _iterate.LastUsedFormulas); renderer.Paint(_graphics); if (_abort) return; _master.Progress(0); }
/// <summary> /// Neuzeichnen. /// </summary> protected override void StartDrawing() { ResultImageView.PublicForm.Stop(); _forceRedraw = false; if (btnPreview.Width < 1 && btnPreview.Height < 1) { ResultImageView.PublicForm.CurrentUpdateStep = 0; return; } lock (_inDrawingMutex) _inDrawing = true; System.Diagnostics.Debug.WriteLine("_inDrawing = true (1)"); if (_iterate != null) { if (_iterate.Running) { _iterate.Abort(); } } lock (_smallPreviewCurrentDrawStepMutex) { try { //btnPreview.Enabled = false; } catch (InvalidOperationException ex) { lock (_inDrawingMutex) _inDrawing = false; System.Diagnostics.Debug.WriteLine(ex.ToString()); return; } if (_smallPreviewCurrentDrawStep == 0 || _smallPreviewCurrentDrawStep == 1 || _smallPreviewCurrentDrawStep == 2 || _smallPreviewCurrentDrawStep == 4) { _iterate = new Iterate(btnPreview.Width / 2, btnPreview.Height / 2, this, false); _smallPreviewCurrentDrawStep = 2; } else if (_smallPreviewCurrentDrawStep == 3) { _iterate = new Iterate(btnPreview.Width, btnPreview.Height, this, false); _iterate.SetOldData(null, null, 2); _smallPreviewCurrentDrawStep = 4; } else { if (_iterate != null) { if (_iterate.Running) { _iterate.Abort(); } } _iterate = null; lock (_inDrawingMutex) _inDrawing = false; _smallPreviewCurrentDrawStep = 1; } } if (_iterate != null) { _iterate._oneStepProgress = false; AssignParameters(); _iterate.StartAsync(_parameter, ParameterDict.Current.GetInt("Formula.Static.Cycles"), 1, ParameterDict.Current.GetBool("Formula.Static.Julia"), !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } }
/// <summary> /// Neuzeichnen. /// </summary> protected override void StartDrawing() { ResultImageView.PublicForm.Stop(); _forceRedraw = false; if (btnPreview.Width < 1 && btnPreview.Height < 1) { ResultImageView.PublicForm.CurrentUpdateStep = 0; return; } lock (_inDrawingMutex) _inDrawing = true; System.Diagnostics.Debug.WriteLine("_inDrawing = true (1)"); if (_iterate != null) { if(_iterate.Running) _iterate.Abort(); } lock (_smallPreviewCurrentDrawStepMutex) { try { btnPreview.Enabled = false; } catch(InvalidOperationException ex) { lock (_inDrawingMutex) _inDrawing = false; System.Diagnostics.Debug.WriteLine(ex.ToString()); return; } if (_smallPreviewCurrentDrawStep == 0 || _smallPreviewCurrentDrawStep == 1 || _smallPreviewCurrentDrawStep == 2 || _smallPreviewCurrentDrawStep == 4) { _iterate = new Iterate(btnPreview.Width / 2, btnPreview.Height / 2, this, false); _smallPreviewCurrentDrawStep = 2; } else if (_smallPreviewCurrentDrawStep == 3) { _iterate = new Iterate(btnPreview.Width, btnPreview.Height, this, false); _iterate.SetOldData(null, null, 2); _smallPreviewCurrentDrawStep = 4; } else { if (_iterate != null) if (_iterate.Running) _iterate.Abort(); _iterate = null; lock (_inDrawingMutex) _inDrawing = false; _smallPreviewCurrentDrawStep = 1; } } if (_iterate != null) { _iterate._oneStepProgress = false; AssignParameters(); _iterate.StartAsync(_parameter, ParameterDict.Current.GetInt("Formula.Static.Cycles"), 1, ParameterDict.Current.GetBool("Formula.Static.Julia"), !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } }
/// <summary> /// Create surface model. /// </summary> public void ComputeOneStep() { ImageCreationStarts(); if (_paras != null) _paras.InComputing = true; this.WindowState = FormWindowState.Normal; if (Scheduler.GrandScheduler.Exemplar.inComputeOneStep) return; try { Scheduler.GrandScheduler.Exemplar.inComputeOneStep = true; SetPictureBoxSize(); string tempParameterHash = GetParameterHashWithoutPictureArt(); _paras.Assign(); if (_oldParameterHashWithoutPictureArt == tempParameterHash) { // Update last render for better quality _currentUpdateStep++; DataTypes.GraphicData oldData = null; DataTypes.PictureData oldPictureData = null; if (_iterate != null && !_iterate.InAbort) { oldData = _iterate.GraphicInfo; oldPictureData = _iterate.PictureData; } _iterate = new Iterate(_width, _height, this, false); _updateCount++; _iterate.SetOldData(oldData, oldPictureData, _updateCount); if (!ParameterDict.Current.GetBool("View.Pipeline.UpdatePreview")) _iterate._oneStepProgress = _inPreview; else _iterate._oneStepProgress = false; if (_updateCount > ParameterDict.Current.GetDouble("View.UpdateSteps") + 1) _iterate._oneStepProgress = true; _iterate.StartAsync(_paras.Parameter, _paras.Cycles, _paras.ScreenSize, _paras.Formula==-2, !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } else { // Initiate new rendering { // Stop subrendering, if some formula parameters changed if (_currentUpdateStep > 0) { _currentUpdateStep = 0; if (_paras != null) _paras.InComputing = false; Scheduler.GrandScheduler.Exemplar.inComputeOneStep = false; _oldParameterHashWithoutPictureArt = ""; _updateCount = 1; } _oldParameterHashWithoutPictureArt = tempParameterHash; _paras.Assign(); _updateCount = 1; _iterate = new Iterate(_width, _height, this, false); _iterate._oneStepProgress = false; _iterate.StartAsync(_paras.Parameter, _paras.Cycles, _paras.ScreenSize, _paras.Formula==-2, !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); if (_paras != null) _paras.InComputing = false; Scheduler.GrandScheduler.Exemplar.inComputeOneStep = false; } }
/// <summary> /// Neuzeichnen. /// </summary> protected virtual void StartDrawing() { _forceRedraw = false; _inDrawing = true; SetPictureBoxSize(); _iterate = new Iterate(_maxx, _maxy, this, IsRightView); AssignParameters(); _iterate.StartAsync(_parameter, ParameterDict.Current.GetInt("Formula.Static.Cycles"), 1, ParameterDict.Current.GetInt("Formula.Static.Formula"), ParameterDict.Current.GetBool("View.Perspective")); }
/// <summary> /// Paint image with fixed renderer and reuse an iterate object after computation. /// </summary> /// <param name="otherIterate"></param> /// <param name="renderer"></param> public virtual void Redraw(Iterate otherIterate, int renderer) { _fixedRenderer = renderer; _iterate = otherIterate; OneStepEnds(); }
/// <summary> /// Create a draw image. /// </summary> public virtual void Draw() { _smallPreviewCurrentDrawStep = 1; _fixedRenderer = -1; if (!_inDrawing) StartDrawing(); else { if (_iterate != null) { _iterate.Abort(); } _iterate = null; _forceRedraw = true; } }
/// <summary> /// Create surface model. /// </summary> public void ComputeOneStep() { ImageCreationStarts(); if (_paras != null) { _paras.InComputing = true; } this.WindowState = FormWindowState.Normal; if (Scheduler.GrandScheduler.Exemplar.inComputeOneStep) { return; } try { Scheduler.GrandScheduler.Exemplar.inComputeOneStep = true; SetPictureBoxSize(); string tempParameterHash = GetParameterHashWithoutPictureArt(); _paras.Assign(); if (_oldParameterHashWithoutPictureArt == tempParameterHash) { // Update last render for better quality _currentUpdateStep++; DataTypes.GraphicData oldData = null; DataTypes.PictureData oldPictureData = null; if (_iterate != null && !_iterate.InAbort) { oldData = _iterate.GraphicInfo; oldPictureData = _iterate.PictureData; } _iterate = new Iterate(_width, _height, this, false); _updateCount++; _iterate.SetOldData(oldData, oldPictureData, _updateCount); if (!ParameterDict.Current.GetBool("View.Pipeline.UpdatePreview")) { _iterate._oneStepProgress = _inPreview; } else { _iterate._oneStepProgress = false; } if (_updateCount > ParameterDict.Current.GetDouble("View.UpdateSteps") + 1) { _iterate._oneStepProgress = true; } _iterate.StartAsync(_paras.Parameter, _paras.Cycles, _paras.ScreenSize, _paras.Formula == -2, !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } else { // Initiate new rendering { // Stop subrendering, if some formula parameters changed if (_currentUpdateStep > 0) { _currentUpdateStep = 0; if (_paras != null) { _paras.InComputing = false; } Scheduler.GrandScheduler.Exemplar.inComputeOneStep = false; _oldParameterHashWithoutPictureArt = ""; _updateCount = 1; } _oldParameterHashWithoutPictureArt = tempParameterHash; _paras.Assign(); _updateCount = 1; _iterate = new Iterate(_width, _height, this, false); _iterate._oneStepProgress = false; _iterate.StartAsync(_paras.Parameter, _paras.Cycles, _paras.ScreenSize, _paras.Formula == -2, !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); if (_paras != null) { _paras.InComputing = false; } Scheduler.GrandScheduler.Exemplar.inComputeOneStep = false; } }
/// <summary> /// Create a draw image. /// </summary> public virtual void Draw() { System.Diagnostics.Debug.WriteLine("Draw() _inDrawing=" + _inDrawing.ToString()); lock (_smallPreviewCurrentDrawStepMutex) _smallPreviewCurrentDrawStep = 0; _fixedRenderer = -1; if (!_inDrawing) StartDrawing(); else { if (_iterate != null) { _iterate.Abort(); } _iterate = null; _forceRedraw = true; } }
/// <summary> /// Neuzeichnen. /// </summary> protected override void StartDrawing() { ResultImageView.PublicForm.Stop(); _forceRedraw = false; btnPreview.Enabled = false; _inDrawing = true; if (btnPreview.Width < 1 && btnPreview.Height < 1) { ResultImageView.PublicForm.CurrentUpdateStep = 0; return; } if (_iterate != null) _iterate.Abort(); if (_smallPreviewCurrentDrawStep == 1) { _iterate = new Iterate(btnPreview.Width / 2, btnPreview.Height / 2, this, false); } else { _iterate = new Iterate(btnPreview.Width, btnPreview.Height, this, false); } _iterate._oneStepProgress = false; AssignParameters(); _iterate.StartAsync(_parameter, ParameterDict.Current.GetInt("Formula.Static.Cycles"), 1, ParameterDict.Current.GetInt("Formula.Static.Formula"), ParameterDict.Current.GetBool("View.Perspective")); }