private void gradientOutput_ValueChanged(object sender, IndexEventArgs e) { if (ignore == 0) { int lo = gradientOutput.GetValue(0), md, hi = gradientOutput.GetValue(2); md = (int)(lo + (hi - lo) * Math.Pow(0.5, (double)outputGammaUpDown.Value)); ignore++; switch (e.Index) { case 0: outputLowUpDown.Text = lo.ToString(); break; case 1: md = gradientOutput.GetValue(1); outputGammaUpDown.Value = (decimal)Utility.Clamp(1 / Math.Log(0.5, (float)(md - lo) / (float)(hi - lo)), 0.1, 10.0); break; case 2: outputHiUpDown.Text = hi.ToString(); break; } gradientOutput.SetValue(1, md); UpdateLevels(); ignore--; } }
private void gradientInput_ValueChanged(object sender, IndexEventArgs e) { if (ignore == 0) { int lo = gradientInput.GetValue(0), hi = gradientInput.GetValue(1); ignore++; switch (e.Index) { case 0: inputLoUpDown.Text = lo.ToString(); break; case 1: inputHiUpDown.Text = hi.ToString(); break; } UpdateLevels(); ignore--; } }