Esempio n. 1
0
        private void edit(object sender, EventArgs e)
        {
            PhotoEditor pe = new PhotoEditor(openFile);

            StudioContext.getCurrentInstance().formOpened(pe);
            pe.Show();
            StudioContext.getCurrentInstance().formClosed(this);
            Close();
        }
Esempio n. 2
0
        public static void Run()
        {
            PhotoEditor canvas = new PhotoEditor();

            canvas.CurrentFilter = new Blur();
            canvas.Apply();

            canvas.CurrentFilter = new BlackAndWhite();
            canvas.Apply();

            canvas.CurrentFilter = new Sharpen();
            canvas.Apply();
        }
 public PhotoController(PhotoEditor photoEditor)
 {
     _photoEditor = photoEditor;
 }
Esempio n. 4
0
        private void Button_PhotoEditor_Click(object sender, RoutedEventArgs e)
        {
            if (lfvm.ShowImages.Count() > 0)
            {
                PhotoEditor pe;
                if (lfvm.ShowImages.Where(i => i.IsSelected).Count() > 0)
                {
                    pe = new PhotoEditor(new ObservableCollection <ImageInfo>(lfvm.ShowImages.Where(i => i.IsSelected).OrderBy(o => o.Registration_Date).OrderBy(o2 => o2.Image_ID)));
                }
                else
                {
                    pe = new PhotoEditor(new ObservableCollection <ImageInfo>(lfvm.ShowImages.OrderBy(o => o.Registration_Date).OrderBy(o2 => o2.Image_ID)));
                }
                if (pe.ShowDialog() == true)
                {
                    try
                    {
                        pd = new ProgressDialog();

                        pd.Dispatcher.Invoke(() =>
                        {
                            pd.PText    = "圖片載入中( 0 / " + lfvm.ShowImages.Count() + " )";
                            pd.PMinimum = 0;
                            pd.PValue   = 0;
                            pd.PMaximum = lfvm.ShowImages.Count();
                            pd.Show();
                        });

                        //multi - thread
                        Task t = Task.Factory.StartNew(() =>
                        {
                            Parallel.ForEach(lfvm.ShowImages, imgs =>
                            {
                                BitmapImage bi = new BitmapImage();

                                if (File.Exists(imgs.Image_FullPath))
                                {
                                    FileStream fs = new FileStream(imgs.Image_FullPath, FileMode.Open);
                                    bi.BeginInit();
                                    bi.StreamSource     = fs;
                                    bi.DecodePixelWidth = 800;
                                    bi.CacheOption      = BitmapCacheOption.OnLoad;
                                    bi.EndInit();
                                    bi.Freeze();
                                    fs.Close();
                                }
                                imgs.BitmapImageSet = bi;

                                pd.Dispatcher.Invoke(() =>
                                {
                                    pd.PValue++;
                                    pd.PText = "圖片載入中( " + pd.PValue + " / " + lfvm.ShowImages.Count() + " )";
                                });
                            });
                        }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).ContinueWith(cw =>
                        {
                            pd.Dispatcher.Invoke(() =>
                            {
                                pd.PText = "載入完成";
                                pd.Close();
                            });
                            GC.Collect();
                        });
                    }
                    catch (Exception ex)
                    {
                        Error_Log.ErrorMessageOutput(ex.ToString());
                    }
                }
                lbImages.UnselectAll();
            }
            else
            {
                MessageBox.Show("尚未載入圖片", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
 // Instantiate editor and history with every photo
 public PhotoEditorAdapter(Photo photo)
 {
     _editor  = new PhotoEditor(photo);
     _history = new PhotoEditorStateHistory();
 }
Esempio n. 6
0
        /// <summary>
        /// Click event to show the crop images form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _CropImage_Click_1(object sender, RoutedEventArgs e)
        {
            //grabs the selected document
            UIElement u = SeekSelection();
            //if the selected element is an image control
            if (u is Image)
            {
                Image img = u as Image;
                //opens the new form with the bitmapsource from the image
                PhotoEditor croper = new PhotoEditor((BitmapSource)img.Source);
                croper.ShowDialog();
                //changes the source to the cropped image
                img.Source = croper.Image;

            }
        }