/// <summary> /// Handles the Click event of RemoveOutputGrayscaleButton object. /// </summary> private void removeOutputGrayscaleButton_Click(object sender, EventArgs e) { // get output grayscale profile IccProfile profile = _colorManagementSettings.OutputGrayscaleProfile; // if grayscale profile is exist if (profile != null) { // remove output grayscale profile _colorManagementSettings.OutputGrayscaleProfile = null; profile.Dispose(); } // update user interface RemoveProfileDescription(outputGrayscaleTextBox); }
/// <summary> /// Handles the Click event of RemoveInputRgbButton object. /// </summary> private void removeInputRgbButton_Click(object sender, EventArgs e) { // get input RGB profile IccProfile profile = _colorManagementSettings.InputRgbProfile; // if RGB profile is exist if (profile != null) { // remove input RGB profile _colorManagementSettings.InputRgbProfile = null; profile.Dispose(); } // update user interface RemoveProfileDescription(inputRgbTextBox); }
/// <summary> /// Handles the Click event of SetInputProfileButton object. /// </summary> private void setInputProfileButton_Click(object sender, EventArgs e) { // if input ICC profile is selected if (_openIccFileDialog.ShowDialog() == DialogResult.OK) { try { // create ICC profile IccProfile iccProfile = new IccProfile(_openIccFileDialog.FileName); _openIccFileDialog.InitialDirectory = Path.GetDirectoryName(_openIccFileDialog.FileName); IccProfile oldIccProfile = null; switch (iccProfile.DeviceColorSpace) { case ColorSpaceType.CMYK: oldIccProfile = _colorManagementSettings.InputCmykProfile; _colorManagementSettings.InputCmykProfile = iccProfile; ShowProfileDescription(inputCmykTextBox, iccProfile); break; case ColorSpaceType.sRGB: oldIccProfile = _colorManagementSettings.InputRgbProfile; _colorManagementSettings.InputRgbProfile = iccProfile; ShowProfileDescription(inputRgbTextBox, iccProfile); break; case ColorSpaceType.Gray: oldIccProfile = _colorManagementSettings.InputGrayscaleProfile; _colorManagementSettings.InputGrayscaleProfile = iccProfile; ShowProfileDescription(inputGrayscaleTextBox, iccProfile); break; default: iccProfile.Dispose(); throw new Exception(string.Format("Unexpected profile color space: {0}.", iccProfile.DeviceColorSpace)); } if (oldIccProfile != null) { oldIccProfile.Dispose(); } } catch (Exception ex) { DemosTools.ShowErrorMessage(ex); } } }
/// <summary> /// Handles the Click event of OutputProfileButton object. /// </summary> private void outputProfileButton_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string filePath = openFileDialog1.FileName; openFileDialog1.InitialDirectory = Path.GetDirectoryName(filePath); IccProfile iccProfile = new IccProfile(filePath); IccProfile oldProfile = null; if (iccProfile.DeviceColorSpace != _imageColorSpaceFormat.ColorSpace) { DemosTools.ShowErrorMessage(string.Format("Unexpected profile color space: {0}.\nRequired profile color space: {1}.", iccProfile.DeviceColorSpace, _imageColorSpaceFormat.ColorSpace)); oldProfile = iccProfile; } else { if (iccProfile.DeviceColorSpace == ColorSpaceType.sRGB) { oldProfile = _settings.InputRgbProfile; _settings.OutputRgbProfile = iccProfile; } else { oldProfile = _settings.InputGrayscaleProfile; _settings.OutputGrayscaleProfile = iccProfile; } ExecuteProcessing(); } if (iccProfile != oldProfile) { outputProfileTextBox.Text = filePath; } if (oldProfile != null) { oldProfile.Dispose(); } } }
/// <summary> /// Handles the Click event of RemoveOutputProfileButton object. /// </summary> private void removeOutputProfileButton_Click(object sender, EventArgs e) { IccProfile profile = null; if (_settings.OutputRgbProfile != null) { profile = _settings.OutputRgbProfile; _settings.OutputRgbProfile = null; } else if (_settings.OutputGrayscaleProfile != null) { profile = _settings.OutputGrayscaleProfile; _settings.OutputGrayscaleProfile = null; } if (profile != null) { profile.Dispose(); } outputProfileTextBox.Text = string.Empty; ExecuteProcessing(); }