void CColorPage2::OnColour() { m_bInUpdate = TRUE; COLORREF ref = m_wndColorPicker.GetRGB (); m_r = GetRValue(ref); m_g = GetGValue(ref); m_b = GetBValue(ref); double saturation = m_wndColorPicker.GetSaturation(); double hue = m_wndColorPicker.GetHue(); m_wndLuminance.SetHue(hue); m_wndLuminance.SetSaturation(saturation); m_wndLuminance.Invalidate(); double H,L,S; m_wndColorPicker.GetHLS(&H,&L,&S); m_h = HLS2Int (H); m_l = HLS2Int (L); m_s = HLS2Int (S); // Set actual color. m_pDialog->SetNewColor(CBCGDrawManager::HLStoRGB_ONE(H, L, S)); m_pDialog->SetPageOne((BYTE) m_r, (BYTE) m_g, (BYTE) m_b); UpdateData(FALSE); m_bInUpdate = FALSE; }
void CColorPage2::OnLuminance() { m_bInUpdate = TRUE; double luminance = m_wndLuminance.GetLuminance(); m_wndColorPicker.SetLuminance(luminance); double H,L,S; m_wndColorPicker.GetHLS(&H,&L,&S); m_h = HLS2Int (H); m_l = HLS2Int (L); m_s = HLS2Int (S); COLORREF color = CBCGDrawManager::HLStoRGB_ONE(H, L, S); m_pDialog->SetNewColor (color); m_r = GetRValue (color); m_g = GetGValue (color); m_b = GetBValue (color); m_pDialog->SetPageOne ((BYTE) m_r, (BYTE) m_g, (BYTE) m_b); UpdateData(FALSE); m_bInUpdate = FALSE; }
void CColorPage2::OnRGBChanged() { if (m_bInUpdate || !m_bIsReady || !UpdateData ()) { return; } m_bInUpdate = TRUE; COLORREF color = RGB (m_r, m_g, m_b); m_pDialog->SetNewColor (color); m_pDialog->SetPageOne ((BYTE) m_r, (BYTE) m_g, (BYTE) m_b); double hue; double luminance; double saturation; CBCGDrawManager::RGBtoHSL (color, &hue, &saturation, &luminance); m_h = HLS2Int (hue); m_l = HLS2Int (luminance); m_s = HLS2Int (saturation); UpdateData(FALSE); m_wndColorPicker.SetHLS(hue, luminance, saturation, TRUE); m_wndLuminance.SetHLS(hue, luminance, saturation, TRUE); m_bInUpdate = FALSE; }
void CBCGPColorPage2::OnRGBChanged() { if (m_bInUpdate || !m_bIsReady) { return; } CString str; GetDlgItemText (IDC_BCGBARRES_R, str); if (str.IsEmpty ()) { return; } GetDlgItemText (IDC_BCGBARRES_G, str); if (str.IsEmpty ()) { return; } GetDlgItemText (IDC_BCGBARRES_B, str); if (str.IsEmpty ()) { return; } if (!UpdateData ()) { return; } m_bInUpdate = TRUE; COLORREF color = RGB (m_r, m_g, m_b); m_r = min (m_r, 255); m_g = min (m_g, 255); m_b = min (m_b, 255); m_pDialog->SetNewColor (color); m_pDialog->SetPageOne ((BYTE) m_r, (BYTE) m_g, (BYTE) m_b); double hue; double luminance; double saturation; CBCGPDrawManager::RGBtoHSL (color, &hue, &saturation, &luminance); m_h = HLS2Int (hue); m_l = HLS2Int (luminance); m_s = HLS2Int (saturation); UpdateData(FALSE); m_wndColorPicker.SetHLS(hue, luminance, saturation, TRUE); m_wndLuminance.SetHLS(hue, luminance, saturation, TRUE); m_bInUpdate = FALSE; }
void CColorPage2::Setup (BYTE R, BYTE G, BYTE B) { double hue; double luminance; double saturation; CBCGDrawManager::RGBtoHSL((COLORREF)RGB(R, G, B), &hue, &saturation, &luminance); m_wndColorPicker.SetHLS(hue, luminance, saturation); m_wndLuminance.SetHLS(hue, luminance, saturation); m_r = R; m_g = G; m_b = B; m_h = HLS2Int (hue); m_l = HLS2Int (luminance); m_s = HLS2Int (saturation); if (GetSafeHwnd () != NULL) { UpdateData(FALSE); } }