Пример #1
0
        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());
        }
Пример #2
0
        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.");
                }
            }
        }
Пример #3
0
 private void RefreshStillImage()
 {
     if (ImageProcesser.ImageLoadState == ImageProcesser.LoadState.Still)
     {
         ImageProcesser.DisposeWorkingBitmap();
         ImageProcesser.WorkingBitmap = ImageProcesser.CropBitmap(ImageProcesser.LoadedStillBitmap, ImageProcesser.ImageRect);
         ContentBitmap = MatrixFrame.CreateBitmapSourceFromBitmap(ImageProcesser.WorkingBitmap);
         MatrixFrame.BitmapToFrame(ImageProcesser.WorkingBitmap, ImageProcesser.InterpMode);
         //FrameToPreview();
         //SerialManager.PushFrame();
     }
 }
Пример #4
0
        public MainWindow()
        {
            DataContext = this;
            InitializeComponent();
            MatrixFrame.DimensionsChanged += OnMatrixDimensionsChanged;

            MatrixFrame.FrameChanged += OnFrameChanged;
            MatrixFrame.SetDimensions(MatrixFrame.Width, MatrixFrame.Height);
            InitializeScreenCaptureUI();
            InitializeAudioCaptureUI();
            MatrixFrame.BitmapToFrame(Properties.Resources.Icon16, System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor);
            //FrameToPreview();
        }
Пример #5
0
 private void GifTimer_Tick(object sender, EventArgs e)
 {
     ImageProcesser.DisposeWorkingBitmap();
     if (_gifFrameIndex >= ImageProcesser.LoadedGifFrameCount - 1)
     {
         _gifFrameIndex = 0;
     }
     else
     {
         _gifFrameIndex++;
     }
     ImageProcesser.LoadedGifImage.SelectActiveFrame(ImageProcesser.LoadedGifFrameDim, _gifFrameIndex);
     ImageProcesser.WorkingBitmap = ImageProcesser.CropBitmap(new Bitmap(ImageProcesser.LoadedGifImage), ImageProcesser.ImageRect);
     ContentBitmap = MatrixFrame.CreateBitmapSourceFromBitmap(ImageProcesser.WorkingBitmap);
     MatrixFrame.BitmapToFrame(ImageProcesser.WorkingBitmap, ImageProcesser.InterpMode);
     ImageProcesser.DisposeWorkingBitmap();
     //SerialManager.PushFrame();
 }
Пример #6
0
        private void RefreshGifImages()
        {
            if (ImageProcesser.ImageLoadState == ImageProcesser.LoadState.Gif)
            {
                ImageProcesser.DisposeWorkingBitmap();

                if (GifPlayPause != true) //if gif is not playing
                {
                    if (_gifFrameIndex > ImageProcesser.LoadedGifFrameCount - 1)
                    {
                        _gifFrameIndex = 0;
                    }

                    ImageProcesser.WorkingBitmap = ImageProcesser.CropBitmap(new Bitmap(ImageProcesser.LoadedGifImage), ImageProcesser.ImageRect);
                    ContentBitmap = MatrixFrame.CreateBitmapSourceFromBitmap(ImageProcesser.WorkingBitmap);
                    MatrixFrame.BitmapToFrame(ImageProcesser.WorkingBitmap, ImageProcesser.InterpMode);
                    //FrameToPreview();
                    //SerialManager.PushFrame();
                }
            }
        }