Gestaltlupe default Renderer for fast previews.
Inheritance: Fractrace.PictureArt.ScienceRendererBase
Exemplo n.º 1
0
        /// <summary>
        /// Hier können eigene Renderer zugeschaltet werden:
        /// </summary>
        /// <returns></returns>
        public static Renderer Create(PictureData pdata,Formulas formula)
        {
            Renderer retVal = null;

              switch (ParameterDict.Current["Composite.Renderer"]) {

            case "":
            case "PlasicRenderer":
            case "6":
                    //retVal = new PlasicRenderer(pdata.Clone());
                    retVal = new FloatPlasicRenderer(pdata.Clone());
                    break;

            case "FastPreviewRenderer":
            case "8":
              retVal = new FastPreviewRenderer(pdata.Clone());
              break;

            default:
                    //retVal = new PlasicRenderer(pdata.Clone());
                    retVal = new FloatPlasicRenderer(pdata.Clone());
                    break;
              }

              if (retVal != null)
              retVal.Init(formula);

            return retVal;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Berechnung wurde beendet.
        /// </summary>
        protected override void OneStepEnds()
        {
            if (_iterate != null)
            {
                lock (_iterate)
                {
                    if (_iterate.InAbort)
                        return;
                    try
                    {
                        Fractrace.PictureArt.Renderer pArt;
                        if (_fixedRenderer == -1)
                        {
                            if (IsSmallPreview())
                            {
                                lock (_smallPreviewCurrentDrawStepMutex)
                                {
                                   
                                    if (_smallPreviewCurrentDrawStep == 1 || _smallPreviewCurrentDrawStep == 2)
                                    {
                                        if (_iterate.Height < 60)
                                        {
                                            pArt = new PictureArt.FastPreviewRenderer(_iterate.PictureData);
                                            pArt.Init(_iterate.LastUsedFormulas);
                                        }
                                        else
                                        {
                                            pArt = PictureArt.PictureArtFactory.Create(_iterate.PictureData, _iterate.LastUsedFormulas);
                                        }
                                        
                                    }

                                    else if (_smallPreviewCurrentDrawStep == 4 || _smallPreviewCurrentDrawStep == 3)
                                    {
                                        pArt = PictureArt.PictureArtFactory.Create(_iterate.PictureData, _iterate.LastUsedFormulas);
                                        _smallPreviewCurrentDrawStep = 5;
                                    }
                                    else
                                    {
                                        if (_smallPreviewCurrentDrawStep == 5)
                                            _smallPreviewCurrentDrawStep = 1;
                                        pArt = null;
                                    }
                                }
                                   
                            }
                            else
                            {
                                pArt = PictureArt.PictureArtFactory.Create(_iterate.PictureData, _iterate.LastUsedFormulas);
                            }
                            btnPreview.BackgroundImage = new Bitmap((int)(_iterate.Width), (int)(_iterate.Height));
                            _graphics = Graphics.FromImage(btnPreview.BackgroundImage);
                            pArt.Paint(_graphics);
                            Application.DoEvents();
                            this.Refresh();
                        }
                        else
                        {
                            DrawFromView();
                        }
                       
                        if (IsSmallPreview())
                        {
                            lock (_smallPreviewCurrentDrawStepMutex)
                            {
                                // _smallPreviewCurrentDrawStep++;

                                if (_smallPreviewCurrentDrawStep == 5)
{
                                    _smallPreviewCurrentDrawStep = 1;

                                }
                                else if ( (_smallPreviewCurrentDrawStep == 1 || _smallPreviewCurrentDrawStep == 2) && _fixedRenderer == -1)

                                //                  if (_smallPreviewCurrentDrawStep == 2 && _fixedRenderer == -1)
                                {
                                    if (RenderingEnds != null)
                                        RenderingEnds();

                                    // Uncomment following line for more accurate small preview rendering in next iteration. 
                                    if (_smallPreviewCurrentDrawStep == 2 && _updateSteps>0)
                                    {
                                        if (!_iterate.Running)
                                        {
                                            _smallPreviewCurrentDrawStep = 3;
                                            lock (_inDrawingMutex)
                                                _inDrawing = false;
                                            System.Diagnostics.Debug.WriteLine("_inDrawing = false (3)");

                                            StartDrawing();
                                        }
                                    }
                                }
                                else
                                {
                                    if (_fixedRenderer == -1)
                                    {
                                        if (RenderingEnds != null)
                                            RenderingEnds();
                                    }
                                }
                               // if (_smallPreviewCurrentDrawStep > 1)
                               //     _smallPreviewCurrentDrawStep = 0;
                            }
                        }
                        else
                        {
                            if (RenderingEnds != null)
                                RenderingEnds();
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.ToString());
                    }
                }
            }
            btnPreview.Enabled = true;
            lock (_inDrawingMutex)
                _inDrawing = false;
            System.Diagnostics.Debug.WriteLine("_inDrawing = false (4)");
            if (ParameterDict.Current.GetBool("View.Pipeline.Preview") && this == ParameterInput.MainParameterInput.MainPreviewControl)
            {
                ParameterInput.MainParameterInput.ComputePreview();
            }
            if (_forceRedraw)
                StartDrawing();
        }