Exemplo n.º 1
0
        private void Rotate(object sender, EventArgs e)
        {
            using var rotateDialog = new InputTextDialog("Rotate", "The angle at which to rotate the image:");

            if (rotateDialog.ShowDialog() == DialogResult.OK)
            {
                var degrees = rotateDialog.Result;

                _state.Rotate(degrees);
                _lastCommand = new Action(() => _state.Rotate(degrees));
            }

            RefreshImageState();
        }
Exemplo n.º 2
0
        private void RoundedCorners(object sender, EventArgs e)
        {
            using var cornersDialog = new InputTextDialog(
                      "Rounded Corners", "The radius at which the corner will be rounded:", 1);

            if (cornersDialog.ShowDialog() == DialogResult.OK)
            {
                int radius = cornersDialog.Result;

                _state.RoundedCorners(radius);
                _lastCommand = new Action(() => _state.RoundedCorners(radius));
            }

            RefreshImageState();
        }
Exemplo n.º 3
0
        private void Pixelate(object sender, EventArgs e)
        {
            using var pixelateDialog = new InputTextDialog(
                      "Pixelate", "The size of the pixels to create:", 0);

            if (pixelateDialog.ShowDialog() == DialogResult.OK)
            {
                int size = pixelateDialog.Result;

                _state.Pixelate(size);
                _lastCommand = new Action(() => _state.Pixelate(size));
            }

            RefreshImageState();
        }
Exemplo n.º 4
0
        //TODO: Large Performance Calculation
        private void GaussianSharpen(object sender, EventArgs e)
        {
            using var sharpenDialog = new InputTextDialog(
                      "Gaussian Sharpen", "The size of the kernel by which to sharpen the image:", 0);

            if (sharpenDialog.ShowDialog() == DialogResult.OK)
            {
                int size = sharpenDialog.Result;

                _state.GaussianSharpen(size);
                _lastCommand = new Action(() => _state.GaussianSharpen(size));
            }

            RefreshImageState();
        }
Exemplo n.º 5
0
        private void Contrast(object sender, EventArgs e)
        {
            using var contrastDialog = new InputTextDialog(
                      "Contrast", "The percentage (-100 to 100) by which to alter the image's contrast.",
                      -100, 100);

            if (contrastDialog.ShowDialog() == DialogResult.OK)
            {
                var percentage = contrastDialog.Result;

                _state.Contrast(percentage);
                _lastCommand = new Action(() => _state.Contrast(percentage));
            }

            RefreshImageState();
        }
Exemplo n.º 6
0
        private void Saturation(object sender, EventArgs e)
        {
            using var saturationDialog = new InputTextDialog(
                      "Saturation", "The percentage (-100 to 100) by which to alter the image's saturation.",
                      -100, 100);

            if (saturationDialog.ShowDialog() == DialogResult.OK)
            {
                int percentage = saturationDialog.Result;

                _state.Saturation(percentage);
                _lastCommand = new Action(() => _state.Saturation(percentage));
            }

            RefreshImageState();
        }
Exemplo n.º 7
0
        private void Brightness(object sender, EventArgs e)
        {
            using var brightnessDialog = new InputTextDialog(
                      "Brightness", "The percentage (-100 to 100) by which to alter the image's brightness:",
                      -100, 100);

            if (brightnessDialog.ShowDialog() == DialogResult.OK)
            {
                var percentage = brightnessDialog.Result;

                _state.Brightness(percentage);
                _lastCommand = new Action(() => _state.Brightness(percentage));
            }

            RefreshImageState();
        }
Exemplo n.º 8
0
        private void Alpha(object sender, EventArgs e)
        {
            using var alphaDialog = new InputTextDialog(
                      "Alpha", "The percentage (0 to 100) by which to alter the image's opacity:",
                      0, 100);

            if (alphaDialog.ShowDialog() == DialogResult.OK)
            {
                var percentage = alphaDialog.Result;

                _state.Alpha(percentage);
                _lastCommand = new Action(() => _state.Alpha(percentage));
            }

            RefreshImageState();
        }
Exemplo n.º 9
0
        private void Hue(object sender, EventArgs e)
        {
            using var hueDialog = new InputTextDialog(
                      "Hue", "The angle (0 - 360) by which to alter the image's hue.",
                      0, 360, true, "Rotate");

            if (hueDialog.ShowDialog() == DialogResult.OK)
            {
                var degrees = hueDialog.Result;
                var rotate  = hueDialog.CheckboxResult;

                _state.Hue(degrees, rotate);
                _lastCommand = new Action(() => _state.Hue(degrees, rotate));
            }

            RefreshImageState();
        }