From 812bf40d176b21f412b951610720aad76fd8fa5a Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 5 Feb 2017 16:06:57 +0100 Subject: [PATCH] Show raw values in navigator when demosaic 'none' is used --- rtengine/imagesource.h | 1 + rtengine/rawimagesource.cc | 15 +++++++++++++++ rtengine/rawimagesource.h | 1 + rtengine/stdimagesource.h | 3 +++ rtgui/cropwindow.cc | 14 +++++++++++++- 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 98e5446a1..e8740edf4 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -160,6 +160,7 @@ public: { return this; } + virtual void getRawValues(int x, int y, int &R, int &G, int &B) = 0; }; } #endif diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 327c6e3ba..fa433e98c 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -5460,6 +5460,21 @@ void RawImageSource::init () } } +void RawImageSource::getRawValues(int x, int y, int &R, int &G, int &B) +{ + int xnew = x + border; + int ynew = y + border; + int c = FC(ynew,xnew); + int val = rawData[ynew][xnew] / scale_mul[c]; + if(c == 0) { + R = val; G = 0; B = 0; + } else if(c == 2) { + R = 0; G = 0; B = val; + } else { + R = 0; G = val; B = 0; + } +} + void RawImageSource::cleanup () { delete phaseOneIccCurve; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 280b546f4..99363d9e0 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -264,6 +264,7 @@ protected: void pixelshift(int winx, int winy, int winw, int winh, const RAWParams::BayerSensor &bayerParams, unsigned int frame, const std::string &model, float rawWpCorrection); void hflip (Imagefloat* im); void vflip (Imagefloat* im); + void getRawValues(int x, int y, int &R, int &G, int &B); }; } diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 733a44c42..775bd484d 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -97,6 +97,9 @@ public: } void setCurrentFrame(unsigned int frameNum) {} + void getRawValues(int x, int y, int &R, int &G, int &B) { R = G = B = 0;} + + }; } #endif diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 2513bb137..c021886fb 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -1035,9 +1035,21 @@ void CropWindow::pointerMoved (int bstate, int x, int y) int imheight = cropHandler.cropPixbuf->get_height(); guint8* pix = cropHandler.cropPixbuftrue->get_pixels() + vy * cropHandler.cropPixbuf->get_rowstride() + vx * 3; + int rval = pix[0]; + int gval = pix[1]; + int bval = pix[2]; if (vx < imwidth && vy < imheight) { + rtengine::StagedImageProcessor* ipc = iarea->getImProcCoordinator(); + if(ipc) { + procparams::ProcParams params; + ipc->getParams(¶ms); + if(params.raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none]) { + ImageSource *isrc = static_cast(ipc->getInitialImage()); + isrc->getRawValues(mx, my, rval, gval, bval); + } + } // pmlistener->pointerMoved (true, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]); - pmlistener->pointerMoved (true, cropHandler.colorParams.output, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]); + pmlistener->pointerMoved (true, cropHandler.colorParams.output, cropHandler.colorParams.working, mx, my, rval, gval, bval); if (pmhlistener) // pmhlistener->pointerMoved (true, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]);