When Demosaic/None is set, always show raw values and never show Lab/HSV values, #4584

This commit is contained in:
heckflosse
2018-08-20 21:54:21 +02:00
parent bd568ab957
commit b80abe60e8
4 changed files with 51 additions and 35 deletions

View File

@@ -224,24 +224,30 @@ void Navigator::setInvalid (int fullWidth, int fullHeight)
LAB_L->set_text (M("NAVIGATOR_NA"));
}
void Navigator::getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB)
void Navigator::getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB, bool isRaw)
{
switch (currentRGBUnit) {
case (Options::NavigatorUnit::R0_1):
sR = Glib::ustring::format(std::fixed, std::setprecision(4), r / 255.f);
sG = Glib::ustring::format(std::fixed, std::setprecision(4), g / 255.f);
sB = Glib::ustring::format(std::fixed, std::setprecision(4), b / 255.f);
break;
case (Options::NavigatorUnit::R0_255):
if (isRaw) {
sR = Glib::ustring::format(std::fixed, std::setprecision(0), r);
sG = Glib::ustring::format(std::fixed, std::setprecision(0), g);
sB = Glib::ustring::format(std::fixed, std::setprecision(0), b);
break;
case (Options::NavigatorUnit::PERCENT):
default:
sR = Glib::ustring::format(std::fixed, std::setprecision(1), r * 100.f / 255.f) + Glib::ustring("%");
sG = Glib::ustring::format(std::fixed, std::setprecision(1), g * 100.f / 255.f) + Glib::ustring("%");
sB = Glib::ustring::format(std::fixed, std::setprecision(1), b * 100.f / 255.f) + Glib::ustring("%");
} else {
switch (currentRGBUnit) {
case (Options::NavigatorUnit::R0_1):
sR = Glib::ustring::format(std::fixed, std::setprecision(4), r / 255.f);
sG = Glib::ustring::format(std::fixed, std::setprecision(4), g / 255.f);
sB = Glib::ustring::format(std::fixed, std::setprecision(4), b / 255.f);
break;
case (Options::NavigatorUnit::R0_255):
sR = Glib::ustring::format(std::fixed, std::setprecision(0), r);
sG = Glib::ustring::format(std::fixed, std::setprecision(0), g);
sB = Glib::ustring::format(std::fixed, std::setprecision(0), b);
break;
case (Options::NavigatorUnit::PERCENT):
default:
sR = Glib::ustring::format(std::fixed, std::setprecision(1), r * 100.f / 255.f) + Glib::ustring("%");
sG = Glib::ustring::format(std::fixed, std::setprecision(1), g * 100.f / 255.f) + Glib::ustring("%");
sB = Glib::ustring::format(std::fixed, std::setprecision(1), b * 100.f / 255.f) + Glib::ustring("%");
}
}
}
@@ -274,34 +280,42 @@ void Navigator::getLABText (float l, float a, float b, Glib::ustring &sL, Glib::
}
// if !validPos then x/y contain the full image size
void Navigator::pointerMoved (bool validPos, Glib::ustring profile, Glib::ustring profileW, int x, int y, int r, int g, int b)
void Navigator::pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw)
{
if (!validPos) {
setInvalid (x, y);
} else {
Glib::ustring s1, s2, s3;
float h, s, v;
float LAB_a, LAB_b, LAB_l;
position->set_text (Glib::ustring::compose ("x: %1, y: %2", x, y));
getRGBText (r, g, b, s1, s2, s3);
getRGBText (r, g, b, s1, s2, s3, isRaw);
R->set_text (s1);
G->set_text (s2);
B->set_text (s3);
if (isRaw) {
H->set_text ("--");
S->set_text ("--");
V->set_text ("--");
LAB_L->set_text ("--");
LAB_A->set_text ("--");
LAB_B->set_text ("--");
} else {
float h, s, v;
float LAB_a, LAB_b, LAB_l;
Color::rgb2hsv01(r / 255.f, g / 255.f, b / 255.f, h, s, v);
getHSVText (h, s, v, s1, s2, s3);
H->set_text (s1);
S->set_text (s2);
V->set_text (s3);
Color::rgb2hsv01(r / 255.f, g / 255.f, b / 255.f, h, s, v);
getHSVText (h, s, v, s1, s2, s3);
H->set_text (s1);
S->set_text (s2);
V->set_text (s3);
Color::rgb2lab01(profile, profileW, r / 255.f, g / 255.f, b / 255.f, LAB_l, LAB_a, LAB_b, options.rtSettings.HistogramWorking); // TODO: Really sure this function works?
getLABText (LAB_l, LAB_a, LAB_b, s1, s2, s3);
LAB_L->set_text (s1);
LAB_A->set_text (s2);
LAB_B->set_text (s3);
Color::rgb2lab01(profile, profileW, r / 255.f, g / 255.f, b / 255.f, LAB_l, LAB_a, LAB_b, options.rtSettings.HistogramWorking); // TODO: Really sure this function works?
getLABText (LAB_l, LAB_a, LAB_b, s1, s2, s3);
LAB_L->set_text (s1);
LAB_A->set_text (s2);
LAB_B->set_text (s3);
}
}
}