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

@ -1053,12 +1053,14 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
int rval = pix[0];
int gval = pix[1];
int bval = pix[2];
bool isRaw = false;
if (vx < imwidth && vy < imheight) {
rtengine::StagedImageProcessor* ipc = iarea->getImProcCoordinator();
if(ipc) {
procparams::ProcParams params;
ipc->getParams(&params);
if(params.raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) || params.raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) {
isRaw = params.raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) || params.raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE);
if(isRaw) {
ImageSource *isrc = static_cast<ImageSource*>(ipc->getInitialImage());
isrc->getRawValues(mx, my, params.coarse.rotate, rval, gval, bval);
}
@ -1066,7 +1068,7 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
// Updates the Navigator
// TODO: possible double color conversion if rval, gval, bval come from cropHandler.cropPixbuftrue ? see issue #4583
pmlistener->pointerMoved (true, cropHandler.colorParams.outputProfile, cropHandler.colorParams.workingProfile, mx, my, rval, gval, bval);
pmlistener->pointerMoved (true, cropHandler.colorParams.outputProfile, cropHandler.colorParams.workingProfile, mx, my, rval, gval, bval, isRaw);
if (pmhlistener) {
// Updates the HistogramRGBArea

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);
}
}
}

View File

@ -55,10 +55,10 @@ public:
// pointermotionlistener interface
// void pointerMoved (bool validPos, int x, int y, int r, int g, int b);
void pointerMoved (bool validPos, Glib::ustring profile, Glib::ustring profileW, int x, int y, int r, int g, int b);
void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool raw = false);
void setInvalid (int fullWidth = -1, int fullHeight = -1);
void getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB);
void getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB, bool isRaw = false);
void getHSVText (float h, float s, float v, Glib::ustring &sH, Glib::ustring &sS, Glib::ustring &sV);
void getLABText (float l, float a, float b, Glib::ustring &sL, Glib::ustring &sA, Glib::ustring &sB);

View File

@ -27,9 +27,9 @@ protected:
public:
virtual ~PointerMotionListener() {}
virtual void pointerMoved (bool validPos, Glib::ustring profile, Glib::ustring profileW, int x, int y, int r, int g, int b) {}
virtual void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false) {}
virtual void toggleFreeze () {}
virtual void getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB) { sR = "--"; sG = "--"; sB = "--"; }
virtual void getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB, bool isRaw = false) { sR = "--"; sG = "--"; sB = "--"; }
virtual void getHSVText (float h, float s, float v, Glib::ustring &sH, Glib::ustring &sS, Glib::ustring &sV) { sH = "--"; sS = "--"; sV = "--"; }
virtual void getLABText (float l, float a, float b, Glib::ustring &sL, Glib::ustring &sA, Glib::ustring &sB) { sL = "--"; sA = "--"; sB = "--"; }