private void cmdAdjustColorBalance_Click(object sender, System.EventArgs e) { try { processor1.Image = imageXView1.Image; processor1.AdjustColorBalance((short)(hscrColor.Value), (short)(hscrRed.Value), (short)hscrGreen.Value, (short)hscrBlue.Value); } catch (Accusoft.ImagXpressSdk.ImagXpressException ex) { AccusoftError(ex, lblError); } }
protected override bool PerformProcessingAction() { Processor proc = null; try { proc = new Processor(imagXpress1, imageXView1.Image.Copy()); Helper.TransformIfGrayscale(proc.Image); Point currentScrollPosition; if (imageXView2.Image == null) { currentScrollPosition = imageXView1.ScrollPosition; } else { currentScrollPosition = imageXView2.ScrollPosition; } if (adjustAction == AdjustAction.AdjustHSL) { proc.AdjustHSL((AdjustType)AdjustTypeComboBox.SelectedIndex, (int)HueNumericUpDown.Value, (int)SaturationNumericUpDown.Value, (int)LuminanceNumericUpDown.Value); } else if (adjustAction == AdjustAction.AdjustRGB) { proc.AdjustRGB((AdjustType)AdjustTypeComboBox.SelectedIndex, (int)RedNumericUpDown.Value, (int)GreenNumericUpDown.Value, (int)BlueNumericUpDown.Value); } else if (adjustAction == AdjustAction.AdjustColorBalance) { proc.AdjustColorBalance((short)ColorNumericUpDown.Value, (short)RedNumericUpDown.Value, (short)GreenNumericUpDown.Value, (short)BlueNumericUpDown.Value); } UpdateOutputImage(proc.Image.Copy()); imageXView2.ScrollPosition = currentScrollPosition; return(true); } catch (ProcessorException ex) { MessageBox.Show(ex.Message, Constants.processingErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } catch (ImageXException ex) { MessageBox.Show(ex.Message, Constants.processingErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } finally { if (proc != null) { if (proc.Image != null) { proc.Image.Dispose(); proc.Image = null; } proc.Dispose(); proc = null; } } }