private void brightnessToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //copy Undo Image
            imgUndo = img.Copy();

            InputBox form = new InputBox("brilho?");

            form.ShowDialog();
            int brilho = Convert.ToInt32(form.ValueTextBox.Text);
            // form2.ResetText();


            InputBox form2 = new InputBox("Contraste?");

            form2.ShowDialog();
            double cont = Convert.ToDouble(form.ValueTextBox.Text);


            ImageClass.BrightContrast(img, brilho, cont);


            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Esempio n. 2
0
        private void BrightnessToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //input boxes
            InputBox form = new InputBox("brightness?");

            form.ShowDialog();
            int brightness = Convert.ToInt32(form.ValueTextBox.Text);

            InputBox formc = new InputBox("contrast?");

            formc.ShowDialog();
            float contrast = Convert.ToInt32(formc.ValueTextBox.Text);


            //copy Undo Image
            imgUndo = img.Copy();



            ImageClass.BrightContrast(img, brightness, contrast);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Esempio n. 3
0
        private void ContrastBrightnessToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            InputBox input = new InputBox("Contrast (0 to 3):");

            input.ShowDialog();
            double contrast_value = Convert.ToDouble(input.ValueTextBox.Text);


            input = new InputBox("Brightness (0 to 255):");
            input.ShowDialog();
            int brightness_value = Convert.ToInt32(input.ValueTextBox.Text);

            //copy Undo Image
            imgUndo = img.Copy();

            ImageClass.BrightContrast(img, brightness_value, contrast_value);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
        private void brilhoEContrasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }

            InputBox form = new InputBox("brilho?");

            form.ShowDialog();
            int    bright   = Convert.ToInt32(form.textBoxBright.Text);
            double contrast = Convert.ToInt64(form.textBoxConstrast.Text);


            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            ImageClass.BrightContrast(img, bright, contrast);

            //copy Undo Image
            imgUndo = img.Copy();

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Esempio n. 5
0
        private void brightnessContrastToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputBox form = new InputBox("brilho?");

            form.ShowDialog();
            int bright = Convert.ToInt32(form.ValueTextBox.Text);

            InputBox form2 = new InputBox("contraste?");

            form2.ShowDialog();
            double contrast = Convert.ToDouble(form2.ValueTextBox.Text);

            ImageClass.BrightContrast(img, bright, contrast);
        }
Esempio n. 6
0
        private void brightContrastToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)
            {
                return;
            }
            Cursor = Cursors.WaitCursor;

            //copy Undo Image
            imgUndo = img.Copy();

            InputBox brightnessForm = new InputBox("Brightness [0-255]?");

            brightnessForm.ShowDialog();
            int brightness = Convert.ToInt32(brightnessForm.ValueTextBox.Text);

            if (brightness > 255)
            {
                brightness = 255;
            }
            if (brightness < 0)
            {
                brightness = 0;
            }

            InputBox contrastForm = new InputBox("Contrast [0-3]?");

            contrastForm.ShowDialog();
            float contrast = Convert.ToInt32(contrastForm.ValueTextBox.Text);

            if (contrast > 3)
            {
                contrast = 3;
            }
            if (contrast < 0)
            {
                contrast = 0;
            }

            ImageClass.BrightContrast(img, brightness, contrast);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Esempio n. 7
0
        private void BrightnessContrasttoolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //copy Undo Image
            imgUndo = img.Copy();

            InputBox formb = new InputBox("Brightness?");

            formb.ShowDialog();
            string brightness = formb.ValueTextBox.Text;
            bool   successb   = int.TryParse(brightness, out int i);

            if (successb && i >= 0 && i <= 255)
            {
                InputBox formc = new InputBox("Contrast?");
                formc.ShowDialog();
                string contrast = formc.ValueTextBox.Text;
                bool   successc = int.TryParse(contrast, out int j);
                if (successc && j >= 0 && j <= 3)
                {
                    ImageClass.BrightContrast(img, i, j);

                    ImageViewer.Image = img.Bitmap;
                    ImageViewer.Refresh();    // refresh image on the screen

                    Cursor = Cursors.Default; // normal cursor
                }
                else
                {
                    MessageBox.Show("Value for Contrast must be from 0 to 3.", "Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error); // for Error
                }
            }
            else
            {
                MessageBox.Show("Value for Brightness must be an integer from 0 to 255.", "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error); // for Error
            }
        }
Esempio n. 8
0
        private void brightnessContrastToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }

            //copy Undo Image
            imgUndo = img.Copy();

            int            brilho;
            double         cont;
            DoubleInputBox dib = new DoubleInputBox("Brightness:", "Contrast:", "Brightness/Contrast", numberTextBox, decimalTextBox);

            dib.ShowDialog();

            do
            {
                if (dib.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
                brilho = Convert.ToInt32(dib.textBox1.Text);
                cont   = Convert.ToSingle(dib.textBox2.Text);
            } while (Math.Abs(brilho) > 255 && (cont < 0 || cont > 3));

            Cursor = Cursors.WaitCursor; // clock cursor

            if (dib.DialogResult == DialogResult.OK)
            {
                ImageClass.BrightContrast(img, brilho, cont);

                ImageViewer.Image = img.Bitmap;
                ImageViewer.Refresh(); // refresh image on the screen
            }

            Cursor = Cursors.Default; // normal cursor
        }
Esempio n. 9
0
        private void brightnessContrastToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)             // verify if the image is already opened
            {
                return;
            }

            using (BrightContrastForm form = new BrightContrastForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Cursor = Cursors.WaitCursor;                     // clock cursor
                    //copy Undo Image
                    imgUndo = img.Copy();

                    ImageClass.BrightContrast(img, form.brightness, form.contrast);

                    ImageViewer.Image = img.Bitmap;
                    ImageViewer.Refresh();                     // refresh image on the screen

                    Cursor = Cursors.Default;                  // normal cursor
                }
            }
        }