예제 #1
0
        private void menuItemInvert_Click(object sender, EventArgs e)
        {
            var histForm = new Histograms();

            Cursor = Cursors.WaitCursor;
            imageHandler.RestorePrevious();
            imageHandler.SetInvert();
            Bitmap bmp = imageHandler.CurrentBitmap;

            histForm.AddRedHistogram(bmp);
            histForm.AddGreenHistogram(bmp);
            histForm.AddBlueHistogram(bmp);
            histForm.Show();
            Invalidate();
            Cursor = Cursors.Default;
        }
예제 #2
0
        private void skalowanieHist_Click(object sender, EventArgs e)
        {
            var histForm = new Histograms();
            var sFrm     = new ScaleHistogram();

            if (sFrm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                imageHandler.RestorePrevious();
                imageHandler.HistogramScalling(sFrm.a, sFrm.b, sFrm.c, sFrm.d);
                Bitmap bmp = imageHandler.CurrentBitmap;
                histForm.AddRedHistogram(bmp);
                histForm.AddGreenHistogram(bmp);
                histForm.AddBlueHistogram(bmp);
                histForm.Show();
                Invalidate();
                Cursor = Cursors.Default;
            }
        }
예제 #3
0
        private void powerConstrast_Click(object sender, EventArgs e)
        {
            var histForm  = new Histograms();
            var powerForm = new PowerContrastForm();

            if (powerForm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                imageHandler.RestorePrevious();
                imageHandler.PowerContrast(powerForm.GammaValue);
                Bitmap bmp = imageHandler.CurrentBitmap;
                histForm.AddRedHistogram(bmp);
                histForm.AddGreenHistogram(bmp);
                histForm.AddBlueHistogram(bmp);
                histForm.Show();
                Invalidate();
                Cursor = Cursors.Default;
            }
        }
예제 #4
0
        private void menuItemBrightness_Click(object sender, EventArgs e)
        {
            var histForm = new Histograms();
            var bFrm     = new BrightnessForm();

            if (bFrm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                imageHandler.RestorePrevious();
                imageHandler.SetBrightness(bFrm.BrightnessValue);
                Bitmap bmp = imageHandler.CurrentBitmap;
                histForm.AddRedHistogram(bmp);
                histForm.AddGreenHistogram(bmp);
                histForm.AddBlueHistogram(bmp);
                histForm.Show();
                Invalidate();
                Cursor = Cursors.Default;
            }
        }
예제 #5
0
        private void menuItemGamma_Click(object sender, EventArgs e)
        {
            var histForm = new Histograms();
            var gFrm     = new GammaForm();

            if (gFrm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                imageHandler.RestorePrevious();
                imageHandler.SetGamma(gFrm.RedComponent, gFrm.GreenComponent, gFrm.BlueComponent);
                Bitmap bmp = imageHandler.CurrentBitmap;
                histForm.AddRedHistogram(bmp);
                histForm.AddGreenHistogram(bmp);
                histForm.AddBlueHistogram(bmp);
                histForm.Show();
                Invalidate();
                Cursor = Cursors.Default;
            }
        }
예제 #6
0
        private void menuItemSetColor_Click(object sender, EventArgs e)
        {
            var histForm = new Histograms();
            var cForm    = new ColorForm();

            if (cForm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                imageHandler.RestorePrevious();
                imageHandler.SetColor(cForm.GetRed, cForm.GetGreen, cForm.GetBlue);
                Bitmap bmp = imageHandler.CurrentBitmap;
                histForm.AddRedHistogram(bmp);
                histForm.AddGreenHistogram(bmp);
                histForm.AddBlueHistogram(bmp);
                histForm.Show();
                Invalidate();
                Cursor = Cursors.Default;
            }
        }
예제 #7
0
        private void menuItemOpen_Click(object sender, EventArgs e)
        {
            var histForm = new Histograms();

            if (DialogResult.OK == oDlg.ShowDialog())
            {
                imageHandler.CurrentBitmap = (Bitmap)Image.FromFile(oDlg.FileName);
                imageHandler.BitmapPath    = oDlg.FileName;

                if (imageHandler.GetBitmapSize().Width >= Screen.PrimaryScreen.Bounds.Width &&
                    imageHandler.GetBitmapSize().Height >= Screen.PrimaryScreen.Bounds.Height)
                {
                    TopMost           = true;
                    Location          = new Point(0, 0);
                    Bounds            = Screen.PrimaryScreen.Bounds;
                    WindowState       = FormWindowState.Maximized;
                    AutoScroll        = true;
                    AutoScrollMinSize = new Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width),
                                                 Convert.ToInt32(imageHandler.CurrentBitmap.Height));
                    Bitmap bmp = imageHandler.CurrentBitmap;
                    histForm.AddRedHistogram(bmp);
                    histForm.AddGreenHistogram(bmp);
                    histForm.AddBlueHistogram(bmp);
                    histForm.Show();
                    Invalidate();
                }
                else if (imageHandler.GetBitmapSize().Width >= Screen.PrimaryScreen.Bounds.Width)
                {
                    TopMost           = true;
                    Location          = new Point(0, 0);
                    Width             = Screen.PrimaryScreen.Bounds.Width;
                    Height            = imageHandler.GetBitmapSize().Height + 33;
                    AutoScroll        = true;
                    AutoScrollMinSize = new Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width),
                                                 Convert.ToInt32(imageHandler.CurrentBitmap.Height));
                    WindowState = FormWindowState.Normal;
                    Bitmap bmp = imageHandler.CurrentBitmap;
                    histForm.AddRedHistogram(bmp);
                    histForm.AddGreenHistogram(bmp);
                    histForm.AddBlueHistogram(bmp);
                    histForm.Show();
                    Invalidate();
                }
                else if (imageHandler.GetBitmapSize().Height >= Screen.PrimaryScreen.Bounds.Height)
                {
                    TopMost           = true;
                    Location          = new Point(0, 0);
                    Width             = imageHandler.GetBitmapSize().Width + 33;
                    Height            = Screen.PrimaryScreen.Bounds.Height;
                    AutoScroll        = true;
                    AutoScrollMinSize = new Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width),
                                                 Convert.ToInt32(imageHandler.CurrentBitmap.Height));
                    WindowState = FormWindowState.Normal;
                    Bitmap bmp = imageHandler.CurrentBitmap;
                    histForm.AddRedHistogram(bmp);
                    histForm.AddGreenHistogram(bmp);
                    histForm.AddBlueHistogram(bmp);
                    histForm.Show();
                    Invalidate();
                }
                else
                {
                    TopMost     = true;
                    Location    = new Point(0, 0);
                    Bounds      = RestoreBounds;
                    WindowState = FormWindowState.Normal;
                    AutoScroll  = false;
                    ClientSize  = imageHandler.GetBitmapSize();
                    Bitmap bmp = imageHandler.CurrentBitmap;
                    histForm.AddRedHistogram(bmp);
                    histForm.AddGreenHistogram(bmp);
                    histForm.AddBlueHistogram(bmp);
                    histForm.Show();
                    Invalidate();
                }
            }
        }