Exemplo n.º 1
0
        private void LoadImageMenu_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.InitialDirectory = "c:\\";
            dlg.Filter           = "Image files (*.jpg)|*.jpg|All Files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() == true)
            {
                string selectedFileName = dlg.FileName;
                MainImageTextBox.Text = selectedFileName;
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri(selectedFileName);
                bitmap.EndInit();
                MainImage.Source = bitmap;

                filterPanel.IsEnabled = true;
                //Reset filters and static values
                AnaglyphParameters.ResetParameters();
                SetFilterValues();
                ConvertedImage.Source = null;
            }
        }
Exemplo n.º 2
0
        private void LoadImage()
        {
            string      fullpath = baseURI + @"\ScreenShots\Capture" + n + ".jpg";
            BitmapImage bitmap   = new BitmapImage();

            bitmap.BeginInit();
            bitmap.UriSource = new Uri(fullpath);
            bitmap.EndInit();
            MainImageTextBox.Text = fullpath;
            MainImage.Source      = bitmap;
            ConvertedImage.Source = bitmap;


            AnaglyphParameters.ResetParameters();
            SetFilterValues();
            filterPanel.IsEnabled = true;
        }
Exemplo n.º 3
0
        private void ColorAnaglyphMenu_Click(dynamic sender, RoutedEventArgs e)
        {
            string selectedAlgorithm = "";

            if (sender.Name == "RegenerateButton")
            {
                selectedAlgorithm = CurrentAlgorythm;
            }
            else
            {
                selectedAlgorithm = sender.Header;
            }
            string imgLocation = "";
            Bitmap imagebmp;

            try
            {
                if (MainImage.Source == null)
                {
                    throw new Exception("Load image first.");
                }

                if (this.CurrentAlgorythm != selectedAlgorithm)
                {
                    AnaglyphParameters.ResetParameters();
                    SetFilterValues();
                    CurrentAlgorythm = selectedAlgorithm;
                }

                imagebmp = new Bitmap((string)MainImageTextBox.Text); // location for image

                BackgroundHelperRequest arguments = new BackgroundHelperRequest()
                {
                    image             = imagebmp,
                    selectedAlgorythm = selectedAlgorithm,
                };

                worker.RunWorkerAsync(argument: arguments);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                MessageBox.Show(exception.Message);
            }
        }