color toning: properly draw hue and strength gradients for the highlights and shadows sliders
Fixes #4209
This commit is contained in:
@@ -954,36 +954,34 @@ void ColorToning::colorForValue (double valX, double valY, enum ColorCaller::Ele
|
|||||||
if (callerId == 1) { // ch - main curve
|
if (callerId == 1) { // ch - main curve
|
||||||
Color::hsv2rgb01(float(valY), 1.0f, 0.5f, R, G, B);
|
Color::hsv2rgb01(float(valY), 1.0f, 0.5f, R, G, B);
|
||||||
} else if (callerId == 2) { // Slider 1 background
|
} else if (callerId == 2) { // Slider 1 background
|
||||||
if (valY > 0.5)
|
if (valY <= 0.5)
|
||||||
// the hue range
|
// the hue range
|
||||||
{
|
{
|
||||||
Color::hsv2rgb01(float(valX), 1.0f, 0.5f, R, G, B);
|
Color::hsv2rgb01(float(valX), 1.0f, 0.5f, R, G, B);
|
||||||
} else {
|
} else {
|
||||||
// the strength applied to the current hue
|
// the strength applied to the current hue
|
||||||
double strength, hue;
|
double strength, hue;
|
||||||
float r_, g_, b_;
|
|
||||||
hlColSat->getValue(strength, hue);
|
hlColSat->getValue(strength, hue);
|
||||||
Color::hsv2rgb01(valY * 2.f, 1.f, 1.f, r_, g_, b_);
|
|
||||||
Color::hsv2rgb01(hue / 360.f, 1.f, 1.f, R, G, B);
|
Color::hsv2rgb01(hue / 360.f, 1.f, 1.f, R, G, B);
|
||||||
R = r_ + (R - r_) * valX;
|
const double gray = 0.46;
|
||||||
G = g_ + (G - g_) * valX;
|
R = (gray * (1.0 - valX)) + R * valX;
|
||||||
B = b_ + (B - b_) * valX;
|
G = (gray * (1.0 - valX)) + G * valX;
|
||||||
|
B = (gray * (1.0 - valX)) + B * valX;
|
||||||
}
|
}
|
||||||
} else if (callerId == 3) { // Slider 2 background
|
} else if (callerId == 3) { // Slider 2 background
|
||||||
if (valY > 0.5)
|
if (valY <= 0.5)
|
||||||
// the hue range
|
// the hue range
|
||||||
{
|
{
|
||||||
Color::hsv2rgb01(float(valX), 1.0f, 0.5f, R, G, B);
|
Color::hsv2rgb01(float(valX), 1.0f, 0.5f, R, G, B);
|
||||||
} else {
|
} else {
|
||||||
// the strength applied to the current hue
|
// the strength applied to the current hue
|
||||||
double strength, hue;
|
double strength, hue;
|
||||||
float r_, g_, b_;
|
|
||||||
shadowsColSat->getValue(strength, hue);
|
shadowsColSat->getValue(strength, hue);
|
||||||
Color::hsv2rgb01(valY * 2.f, 1.f, 1.f, r_, g_, b_);
|
|
||||||
Color::hsv2rgb01(hue / 360.f, 1.f, 1.f, R, G, B);
|
Color::hsv2rgb01(hue / 360.f, 1.f, 1.f, R, G, B);
|
||||||
R = r_ + (R - r_) * valX;
|
const double gray = 0.46;
|
||||||
G = g_ + (G - g_) * valX;
|
R = (gray * (1.0 - valX)) + R * valX;
|
||||||
B = b_ + (B - b_) * valX;
|
G = (gray * (1.0 - valX)) + G * valX;
|
||||||
|
B = (gray * (1.0 - valX)) + B * valX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -284,6 +284,9 @@ void ThresholdSelector::updateBackBuffer()
|
|||||||
cr->set_line_cap(Cairo::LINE_CAP_BUTT);
|
cr->set_line_cap(Cairo::LINE_CAP_BUTT);
|
||||||
|
|
||||||
if (is_sensitive() && coloredBar.canGetColors()) {
|
if (is_sensitive() && coloredBar.canGetColors()) {
|
||||||
|
if (updatePolicy == RTUP_DYNAMIC) {
|
||||||
|
coloredBar.setDirty(true);
|
||||||
|
}
|
||||||
// this will eventually create/update the off-screen Surface for the gradient area only !
|
// this will eventually create/update the off-screen Surface for the gradient area only !
|
||||||
coloredBar.setDrawRectangle(hb + hwslider, int(float(h) * 1.5f / 7.f + 0.5f), iw + 1, int(float(h) * 4.f / 7.f + 0.5f));
|
coloredBar.setDrawRectangle(hb + hwslider, int(float(h) * 1.5f / 7.f + 0.5f), iw + 1, int(float(h) * 4.f / 7.f + 0.5f));
|
||||||
// that we're displaying here
|
// that we're displaying here
|
||||||
|
Reference in New Issue
Block a user