private void gradientFloatTrackbarControlb_ValueChanged(FloatTrackbarControl _Sender, float _fFormerValue) { float3 Lab = AdobeColors.RGB2Lab_D65((float3)m_RGB); Lab.z = _Sender.Value; RGB = AdobeColors.HSB2RGB(Lab); }
private void floatTrackbarControlLuminance_ValueChanged(FloatTrackbarControl _Sender, float _fFormerValue) { float3 HSL = AdobeColors.RGB2HSB((float3)m_RGB); HSL.z = _Sender.Value; RGB = AdobeColors.HSB2RGB(HSL); }
protected void sliderControlHSL_Scroll(object sender, System.EventArgs e) { m_dontRefresh = DONT_REFRESH.COLOR_SLIDER; RGB = AdobeColors.HSB2RGB(sliderControlHSL.HSL); // Handle special cases where saturation is 0 (shades of gray) and it's not possible to devise a hue // Simply use the hue dictated by the color slider... if (sliderControlHSL.HSL.y < 1e-4f) { float3 TempHSL = AdobeColors.RGB2HSB((float3)m_RGB); TempHSL.x = sliderControlHSL.HSL.x; colorBoxControl.HSL = TempHSL; } }
/// <summary> /// Resets the controls color (both HSL and RGB variables) based on the current slider position /// </summary> protected void ResetHSLRGB() { float3 HSL = this.HSL; float InvHeight = 1.0f / (Height - 9); switch (m_DrawStyle) { case ColorPickerForm.DRAW_STYLE.Hue: HSL.x = 1.0f - m_iMarker_Start_Y * InvHeight; m_RGB = AdobeColors.HSB2RGB(HSL); break; case ColorPickerForm.DRAW_STYLE.Saturation: HSL.y = 1.0f - m_iMarker_Start_Y * InvHeight; m_RGB = AdobeColors.HSB2RGB(HSL); break; case ColorPickerForm.DRAW_STYLE.Brightness: HSL.z = 1.0f - m_iMarker_Start_Y * InvHeight; m_RGB = AdobeColors.HSB2RGB(HSL); break; case ColorPickerForm.DRAW_STYLE.Red: m_RGB = new float3(1.0f - (float)(m_iMarker_Start_Y * InvHeight), m_RGB.y, m_RGB.z); break; case ColorPickerForm.DRAW_STYLE.Green: m_RGB = new float3(m_RGB.x, 1.0f - (float)(m_iMarker_Start_Y * InvHeight), m_RGB.z); break; case ColorPickerForm.DRAW_STYLE.Blue: m_RGB = new float3(m_RGB.x, m_RGB.y, 1.0f - (float)(m_iMarker_Start_Y * InvHeight)); break; } }
/// <summary> /// Resets the controls color (both HSL and RGB variables) based on the current marker position /// </summary> protected void ResetHSLRGB() { float3 HSL = GetColor(m_iMarker_X, m_iMarker_Y); m_RGB = AdobeColors.HSB2RGB(HSL); }
// protected void m_cmd_OK_Click(object sender, System.EventArgs e) { // this.DialogResult = DialogResult.OK; // this.Close(); // } // // // protected void m_cmd_Cancel_Click(object sender, System.EventArgs e) { // this.DialogResult = DialogResult.Cancel; // this.Close(); // } #endregion protected void colorBoxControl_Scroll(object sender, System.EventArgs e) { m_dontRefresh = DONT_REFRESH.COLOR_BOX; RGB = AdobeColors.HSB2RGB(colorBoxControl.HSL); }
public static Color HSL_to_RGB_LDR(float3 _HSL) { float3 RGB = AdobeColors.HSB2RGB(new float3(_HSL.x, _HSL.y, Math.Min(1.0f, _HSL.z))); return(Color.FromArgb((int)Math.Max(0.0f, Math.Min(255.0f, RGB.x * 255.0f)), (int)Math.Max(0.0f, Math.Min(255.0f, RGB.y * 255.0f)), (int)Math.Max(0.0f, Math.Min(255.0f, RGB.z * 255.0f)))); }