Ejemplo n.º 1
0
        private void blurToolStripMenuItem_Click(object sender, EventArgs e)
        {
            currentImage = pictureBoxMain.Image.Clone() as Bitmap;

            toolStripProgressBar.Minimum = 0;
            toolStripProgressBar.Maximum = currentImage.Width * currentImage.Height;
            toolStripProgressBar.Step    = currentImage.Width;

            undoImage = currentImage.Clone() as Bitmap;

            BackgroundWorker BW = new BackgroundWorker();

            BW.WorkerReportsProgress      = true;
            BW.WorkerSupportsCancellation = true;
            BW.DoWork += delegate(object s, DoWorkEventArgs ev)
            {
                currentImage = ImageEditor.Blur(pictureBoxMain.Image as Bitmap, ref BW);
            };
            BW.ProgressChanged    += BW_ProgressChanged;
            BW.RunWorkerCompleted += BW_RunWorkerCompleted;
            BW.RunWorkerAsync();
        }
Ejemplo n.º 2
0
        void Effect(ImageEditor.Effect effect)
        {
            currentImage = pictureBoxMain.Image.Clone() as Bitmap;

            toolStripProgressBar.Minimum = 0;
            toolStripProgressBar.Maximum = currentImage.Width * currentImage.Height;
            toolStripProgressBar.Step    = currentImage.Width;

            undoImage = currentImage.Clone() as Bitmap;

            BackgroundWorker BW = new BackgroundWorker();

            BW.WorkerReportsProgress      = true;
            BW.WorkerSupportsCancellation = true;
            BW.DoWork += delegate(object s, DoWorkEventArgs ev)
            {
                ImageEditor.ApplyEffect(ref currentImage, effect, ref BW);
            };
            BW.ProgressChanged    += BW_ProgressChanged;
            BW.RunWorkerCompleted += BW_RunWorkerCompleted;
            BW.RunWorkerAsync();
        }
Ejemplo n.º 3
0
 private void trackBarHue_Scroll(object sender, EventArgs e)
 {
     textBoxHue.Text      = trackBarHue.Value.ToString();
     pictureBoxMini.Image = ImageEditor.Correction((Bitmap)currentImage, ImageEditor.SetHue, (short)((TrackBar)sender).Value);
 }
Ejemplo n.º 4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            artist = new FreeDraw(drawCanvas);
            drawCanvas.MouseLeftButtonDown += artist.StartDrawing;
            drawCanvas.MouseMove += artist.Drawing;
            drawCanvas.MouseLeftButtonUp += artist.EndDrawing;

            fileWorker = new FileWorker(drawCanvas);
            openFile.Click += fileWorker.OpenFile;
            saveFile.Click += fileWorker.SaveFile;
            editor = new ImageEditor(drawCanvas, statusBar);
            colorInvert.Click += SlowImageOperation;
            vertical.Click += SlowImageOperation;
            horizontal.Click += SlowImageOperation;
            rotation90.Click += SlowImageOperation;
            rotation180.Click += SlowImageOperation;
            this.Closing += MainWindow_Closing;
            exit.Click += (n, m) =>
            {
                this.Close();
            };
        }