コード例 #1
0
 //Displays the new image when one was being generated in the bg
 private void MMandelbrotGenerator_MandlebrotReady(Bitmap mandelbrot, bool is2Times)
 {
     //Wait for the animation to be finished (to prevent problems)
     while (mMandlebrotZoomer != null && !mMandlebrotZoomer.IsFinished)
     {
         ;
     }
     mMandlebrotZoomer   = null;
     mWaitingForBrot     = false;
     mMandelbrotBitmapX2 = is2Times;
     mMandelbrotBitmap   = mandelbrot;
     panel1.Invalidate();
     //When the 2 times bigger picture hasn't been generated yet,
     //do so
     if (!is2Times)
     {
         mMandelbrotGenerator.StartGenerateMandelbrot(true);
     }
 }
コード例 #2
0
 //Zoom the mandelbrot with a nice animation
 private void AnimateZoom(int x1, int y1, int x2, int y2)
 {
     if (x1 == x2 || y1 == y2)
     {
         return;
     }
     //Make sure the top-left and bottom-right coords are not reversed
     CoordinateUtilities.FixRect(ref x1, ref y1, ref x2, ref y2);
     mMandelbrotGenerator.Crop(x1, y1, x2, y2);
     //Setup the RectangleAnimator
     mMandlebrotZoomer =
         new RectangleAnimator(
             new Rectangle(0, 0, panel1.Width, panel1.Height),
             new Rectangle(x1, y1, x2 - x1, y2 - y1), 10);
     //Start the animation thread with a high priority to get the smoothest animation possible
     new Thread(AnimThread)
     {
         Priority = ThreadPriority.Highest
     }.Start();
     UpdateMandelbrot();
 }