public static void UnsharpMask(RasterImage image, params string[] parameters) { if (parameters.Length >= 3) { int amount, radius, threshold; UnsharpMaskCommand cmd = new UnsharpMaskCommand(); if (!int.TryParse(parameters[0], out amount)) { return; } if (!int.TryParse(parameters[1], out radius)) { return; } if (!int.TryParse(parameters[2], out threshold)) { return; } cmd.Amount = amount; cmd.Radius = radius; cmd.Threshold = threshold; cmd.Run(image); } }
private void UnsharpMaskDialog_Load(object sender, System.EventArgs e) { if (_firstTimer) { _firstTimer = false; UnsharpMaskCommand command = new UnsharpMaskCommand(); _initialAmount = command.Amount; _initialRadius = command.Radius; _initialThreshold = command.Threshold; _initialColorSpace = command.ColorType; } Amount = _initialAmount; Radius = _initialRadius; Threshold = _initialThreshold; ColorSpace = _initialColorSpace; _numAmount.Value = Amount; _numRadius.Value = Radius; _numThreshold.Value = Threshold; _cbColorSpace.Items.AddRange(Enum.GetNames(typeof(UnsharpMaskCommandColorType))); _cbColorSpace.Items.RemoveAt(0); _cbColorSpace.SelectedIndex = 0; }
public UnsharpMaskDialog() { InitializeComponent(); _UnsharpMaskCommand = new UnsharpMaskCommand(); //Set command default values _Amount = 0; _Radius = 1; _Threshold = 0; InitializeUI(); }
private void ApplyFilter() { UnsharpMaskCommandColorType type = UnsharpMaskCommandColorType.None; switch (_cbColorSpace.SelectedIndex) { case 0: type = UnsharpMaskCommandColorType.Rgb; break; case 1: type = UnsharpMaskCommandColorType.Yuv; break; } UnsharpMaskCommand command = new UnsharpMaskCommand(Convert.ToInt32(_numAmount.Value), Convert.ToInt32(_numRadius.Value), Convert.ToInt32(_numThreshold.Value), type); _mainForm.FilterRunCommand(command, true, false); }
private void UnSharpenDailog_Load(object sender, EventArgs e) { UnsharpMaskCommand command = new UnsharpMaskCommand(); _initialAmount = command.Amount; _initialRadius = command.Radius; _initialThreshold = command.Threshold; _initialColorSpace = command.ColorType; Amount = _initialAmount; Radius = _initialRadius; Threshold = _initialThreshold; ColorSpace = _initialColorSpace; _numAmount.Value = Amount; _numRadius.Value = Radius; _numThreshold.Value = Threshold; Tools.FillComboBoxWithEnum(_cbColorSpace, typeof(UnsharpMaskCommandColorType), ColorSpace, new object[] { UnsharpMaskCommandColorType.None }); }