private void image1_MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { int x = (int)e.GetPosition((IInputElement)sender).X; int y = (int)(255 - e.GetPosition((IInputElement)sender).Y); this.Title = string.Format("{0},{1}", x, y); var array = sender == image1 ? _transformR : sender == image2 ? _transformG : _transformB; var bmp = sender == image1 ? wbmapR : sender == image2 ? wbmapG : wbmapB; var color = sender == image1 ? Colors.Red : sender == image2 ? Colors.Green : Colors.Blue; array[x] = y; bmp.update(array, color); MainMain.CustomRamp(_transformR, _transformG, _transformB); } }
private void apply() { string methodName = (string)cboMethod.SelectedItem; if (methodName == null) { return; // nothing selected } int[] sliderValues = new[] { (int)slider1.Value, (int)slider2.Value, (int)slider3.Value, (int)slider4.Value }; var values = _posterise.ApplyMethod(methodName, sliderValues); _transformR = values.Red; _transformG = values.Green; _transformB = values.Blue; wbmapR.update(_transformR, Colors.Red); wbmapG.update(_transformG, Colors.Green); wbmapB.update(_transformB, Colors.Blue); MainMain.CustomRamp(_transformR, _transformG, _transformB); }