private void blackWhite_click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new BlackWhiteEffect(); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }
private void InvertColors_Click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new InvertColorsEffect(); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }
private void HistogramStretching_Click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new HistogramStretchingEffect(); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }
private void ChangeExposure_Click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new ChangeExposureEffect(); bool correctInput = false; double exposureValue = 0; do { string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter value of Exposure Value between -8 and 8", "Enter value", "2", -1, -1); input = input.Replace(".", ","); try { exposureValue = Double.Parse(input); correctInput = true; } catch (Exception exception) { MessageBox.Show("An error occured: " + exception.Message, "Error!"); correctInput = false; } if (correctInput == true) { if (exposureValue < -8 || exposureValue > 8) { MessageBox.Show("Entered value isn't in range between -8 and 8. Please try again!", "Wrong value!"); correctInput = false; } } }while (correctInput == false); ChangeExposureEffect.setExposureCorrectnessRatio(Math.Pow(2.0, exposureValue)); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }
private void GammaCorrection_Click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new GammaCorrectionEffect(); bool correctInput = false; double gammaValue = 0; do { string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter value of gamma filter ratio between 0,2 and 5.", "Enter value of gamma", "1", -1, -1); input = input.Replace('.', ','); try { gammaValue = Double.Parse(input); correctInput = true; } catch (Exception exception) { MessageBox.Show("An error occured: " + exception.Message, "Error!"); correctInput = false; } if (correctInput == true) { if (gammaValue < 0.2 || gammaValue > 5) { MessageBox.Show("Entered value isn't in range between 0,2 and 5. Please try again!", "Wrong value!"); correctInput = false; } } }while (correctInput == false); GammaCorrectionEffect.setGammaValue(gammaValue); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }
private void Color_Click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new ColorEffect(); bool correctInput = true; do { string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter color to edit image (red, green or blue)", "Enter color", "red", -1, -1); input = input.ToLower(); correctInput = true; switch (input) { case "red": ColorEffect.setColorOption((int)colors.Red); break; case "green": ColorEffect.setColorOption((int)colors.Green); break; case "blue": ColorEffect.setColorOption((int)colors.Blue); break; default: MessageBox.Show("Wrong color entered! Please try again.", "Wrong choice!"); correctInput = false; break; } } while (correctInput == false); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }
private void Brightness_Click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new BrightnessEffect(); bool correctInput = false; int brightnessValue = 0; do { string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter value of brigthness between -255 and 255", "Enter value", "255", -1, -1); try { brightnessValue = Int32.Parse(input); correctInput = true; } catch (Exception exception) { MessageBox.Show("An error occured: " + exception.Message, "Error!"); correctInput = false; } if (correctInput == true) { if (brightnessValue < -255 || brightnessValue > 255) { MessageBox.Show("Entered value isn't in range between -255 and 255. Please try again!", "Wrong value!"); correctInput = false; } } }while (correctInput == false); BrightnessEffect.setBrightnessValue(brightnessValue); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }
private void Contrast_Click(object sender, RoutedEventArgs e) { Bitmap imageToEdit = EffectSelector.prepareImageToEdit(); IEditImage imageEditor = new ChangeContrastEffect(); bool correctInput = false; double contrastValue = 0; do { string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter value of contrast to adjust between -100 and 100.", "Enter value of contrast adjustment", "50", -1, -1); input = input.Replace(".", ","); try { contrastValue = Double.Parse(input); correctInput = true; } catch (Exception exception) { MessageBox.Show("An error occured: " + exception.Message, "Error!"); correctInput = false; } if (correctInput == true) { if (contrastValue < -100 || contrastValue > 100) { MessageBox.Show("Entered value isn't in range between -100 and 100. Please try again!", "Wrong value!"); correctInput = false; } } }while (correctInput == false); ChangeContrastEffect.setContrastValue(contrastValue); imageEditor.editImage(imageToEdit); EffectSelector.showEditionResults(); this.Close(); }