Ejemplo n.º 1
0
 private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (IsLoaded)
     {
         IsLoaded = false;
         Picture  = MandelbrotService.GenerateBitmapSource(MandelbrotService.Calculate(Args), Args);
         IsLoaded = true;
     }
 }
Ejemplo n.º 2
0
 private void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     Args = new MandelBrotArgs {
         ZoomBase   = 2,
         ZoomFactor = 7,
         Iterations = 255,
         Size       = new Size(512, 512)
     };
     Picture  = MandelbrotService.GenerateBitmapSource(MandelbrotService.Calculate(Args), Args);
     IsLoaded = true;
 }
Ejemplo n.º 3
0
        private void Image_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            var pos = e.GetPosition((IInputElement)sender);

            MouseX = Args.Center.X + (((decimal)pos.X - (Args.Size.Width / 2)) * Args.RealZoom);
            MouseY = Args.Center.Y - (((decimal)pos.Y - (Args.Size.Height / 2)) * Args.RealZoom);

            if (IsLoaded)
            {
                IsLoaded      = false;
                Args.Center.X = MouseX;
                Args.Center.Y = MouseY;
                if (e.Delta > 0)
                {
                    Args.ZoomFactor++;
                }
                else
                {
                    Args.ZoomFactor--;
                }
                Picture  = MandelbrotService.GenerateBitmapSource(MandelbrotService.Calculate(Args), Args);
                IsLoaded = true;
            }
        }