private void Button_Imaging_ImportGif_Click(object sender, RoutedEventArgs e) { var s = new System.Diagnostics.Stopwatch(); s.Start(); OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Image Files(*.GIF)|*.GIF"; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { GifPlayPause = false; ImageProcesser.DisposeGif(); ImageProcesser.DisposeStill(); if (ImageProcesser.LoadGifFromDisk(openFileDialog.FileName)) { ContentBitmap = MatrixFrame.CreateBitmapSourceFromBitmap(ImageProcesser.WorkingBitmap); MatrixFrame.BitmapToFrame(ImageProcesser.WorkingBitmap, ImageProcesser.InterpMode); IMXMax = IMX2 = ImageProcesser.LoadedGifImage.Width; IMYMax = IMY2 = ImageProcesser.LoadedGifImage.Height; IMX1 = 0; IMY1 = 0; //FrameToPreview(); //SerialManager.PushFrame(); ImageProcesser.ImageLoadState = ImageProcesser.LoadState.Gif; ResetSliders(); } else { System.Windows.MessageBox.Show("Cannot load image."); } } // System.Windows.MessageBox.Show(s.ElapsedMilliseconds.ToString()); }
private void Button_Imaging_ImportImage_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Image Files(*.BMP;*.JPG;*.PNG;*.GIF)|*.BMP;*.JPG;*.PNG;*.GIF"; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IMLockDim = false; GifPlayPause = false; ImageProcesser.DisposeStill(); ImageProcesser.DisposeGif(); if (ImageProcesser.LoadBitmapFromDisk(openFileDialog.FileName)) { ContentBitmap = MatrixFrame.CreateBitmapSourceFromBitmap(ImageProcesser.WorkingBitmap); MatrixFrame.BitmapToFrame(ImageProcesser.WorkingBitmap, ImageProcesser.InterpMode); IMXMax = IMX2 = ImageProcesser.WorkingBitmap.Width; IMYMax = IMY2 = ImageProcesser.WorkingBitmap.Height; IMX1 = 0; IMY1 = 0; //FrameToPreview(); //SerialManager.PushFrame(); ImageProcesser.ImageLoadState = ImageProcesser.LoadState.Still; ResetSliders(); } else { System.Windows.MessageBox.Show("Cannot load image."); } } }