public override Color BlendColor(Color l, Color r) { bool ctrlIng = (Control.ModifierKeys & Keys.Shift) != 0; bool switchTools = (!Editor.MainForm.DarkenLightenOptions.Inverted && ctrlIng) || (Editor.MainForm.DarkenLightenOptions.Inverted && !ctrlIng); HSL hsl = ColorSpaceHelper.RGBtoHSL(r); float mod = l.A / 255.0f; if (switchTools) { hsl.Luminance -= (GlobalSettings.DarkenLightenExposure * mod) / 5.0f; } else { hsl.Luminance += (GlobalSettings.DarkenLightenExposure * mod) / 5.0f; } if (hsl.Luminance < 0) { hsl.Luminance = 0; } if (hsl.Luminance > 1) { hsl.Luminance = 1; } return(Color.FromArgb(r.A, ColorSpaceHelper.HSLtoColor(hsl))); }
private void numericUpDown7_ValueChanged(object sender, EventArgs e) { if (_skipSet) { return; } System.Drawing.Color asRGB = System.Drawing.Color.FromArgb((int)numericUpDown5.Value, (int)numericUpDown6.Value, (int)numericUpDown7.Value); HSL hsl = ColorSpaceHelper.RGBtoHSL(asRGB); _skipSet = true; numericUpDown1.Value = (int)hsl.Hue; numericUpDown2.Value = (int)(hsl.Saturation * 240.0f); numericUpDown3.Value = (int)(hsl.Luminance * 240.0f); colorSquare1.CurrentHue = (int)numericUpDown1.Value; colorSquare1.CurrentSat = (int)numericUpDown2.Value; saturationSlider1.CurrentLum = (int)numericUpDown3.Value; saturationSlider1.Color = new HSL(colorSquare1.CurrentHue, (double)colorSquare1.CurrentSat / 240.0f, 0); panel1.BackColor = asRGB; _skipSet = false; }