/// <summary>
 /// Kill running PictureArt process.
 /// </summary>
 private void StopRunningPictureArt()
 {
     if (_currentPicturArt != null)
     {
         _currentPicturArt.Stop();
         _currentPicturArt = null;
     }
 }
 /// <summary>
 /// Create PictureArt and use it to paint the current picture according to iter.
 /// </summary>
 void DrawPicture()
 {
     if (_inPaint)
     {
         lock (_firstPaintMutex)
         {
             if (_currentPicturArt != null)
             {
                 if (!IsSubStepRendering())
                 {
                     _currentPicturArt.StopAndWait();
                     _lastPicturArt = _currentPicturArt;
                     _currentPicturArt = null;
                 }
                 else
                 {
                     return;
                 }
             }
         }
     }
     lock (_paintMutex)
     {
         _inPaint = true;
         try
         {
             if (_currentPicturArt != null)
             {
                 System.Diagnostics.Debug.WriteLine("Error in DrawPicture() currentPicturArt != null");
             }
             if (IsFirstSubStepRendering())
             {
                 FastRenderingFilter fastRenderingFilter = null;
                 if (!Fractrace.Animation.AnimationControl.InAnimation)
                 {
                     fastRenderingFilter = new FastRenderingFilter();
                     fastRenderingFilter.Apply();
                 }
                 _currentPicturArt = PictureArtFactory.Create(_iterateForPictureArt.PictureData, _iterateForPictureArt.LastUsedFormulas);
                 _currentPicturArt.Paint(_graphics);
                 if (fastRenderingFilter != null)
                     fastRenderingFilter.Restore();
                 if(_currentPicturArt.Valid)
                 {
                 _lastPicturArt = _currentPicturArt;
                 _currentPicturArt = null;
                 CallDrawImage();
                 }
                 else
                 {
                     _currentPicturArt = null;
                 }
             }
             else if (!IsSubStepRendering())
             {
                 ImageCreationStarts();
                 _currentPicturArt = PictureArtFactory.Create(_iterateForPictureArt.PictureData, _iterateForPictureArt.LastUsedFormulas);
                 _currentPicturArt.Paint(_graphics);
                 if (_currentPicturArt.Valid)
                 {
                     _lastPicturArt = _currentPicturArt;
                     _currentPicturArt = null;
                     CallDrawImage();
                 }
                 else
                 {
                     _currentPicturArt = null;
                     ImageCreationEnds();
                 }
             }
         }
         catch (System.Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex.ToString());
         }
         _inPaint = false;
     }
     if (_needRepaintPictureArt)
     {
         _needRepaintPictureArt = false;
         DrawPicture();
     }
 }