Fixed bug in last commit when image was rotated

This commit is contained in:
heckflosse 2017-02-05 19:03:34 +01:00
parent b720a67328
commit d570459f1e
5 changed files with 20 additions and 5 deletions

View File

@ -160,7 +160,7 @@ public:
{ {
return this; return this;
} }
virtual void getRawValues(int x, int y, int &R, int &G, int &B) = 0; virtual void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) = 0;
}; };
} }
#endif #endif

View File

@ -5460,10 +5460,25 @@ void RawImageSource::init ()
} }
} }
void RawImageSource::getRawValues(int x, int y, int &R, int &G, int &B) void RawImageSource::getRawValues(int x, int y, int rotate, int &R, int &G, int &B)
{ {
int xnew = x + border; int xnew = x + border;
int ynew = y + border; int ynew = y + border;
rotate += ri->get_rotateDegree();
rotate %= 360;
if (rotate == 90) {
std::swap(xnew,ynew);
ynew = H - 1 - ynew;
} else if (rotate == 180) {
xnew = W - 1 - xnew;
ynew = H - 1 - ynew;
} else if (rotate == 270) {
std::swap(xnew,ynew);
ynew = H - 1 - ynew;
xnew = W - 1 - xnew;
ynew = H - 1 - ynew;
}
int c = FC(ynew,xnew); int c = FC(ynew,xnew);
int val = round(rawData[ynew][xnew] / scale_mul[c]); int val = round(rawData[ynew][xnew] / scale_mul[c]);
if(c == 0) { if(c == 0) {

View File

@ -264,7 +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 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 hflip (Imagefloat* im);
void vflip (Imagefloat* im); void vflip (Imagefloat* im);
void getRawValues(int x, int y, int &R, int &G, int &B); void getRawValues(int x, int y, int rotate, int &R, int &G, int &B);
}; };
} }

View File

@ -97,7 +97,7 @@ public:
} }
void setCurrentFrame(unsigned int frameNum) {} void setCurrentFrame(unsigned int frameNum) {}
void getRawValues(int x, int y, int &R, int &G, int &B) { R = G = B = 0;} void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) { R = G = B = 0;}
}; };

View File

@ -1045,7 +1045,7 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
ipc->getParams(&params); ipc->getParams(&params);
if(params.raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none]) { if(params.raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none]) {
ImageSource *isrc = static_cast<ImageSource*>(ipc->getInitialImage()); ImageSource *isrc = static_cast<ImageSource*>(ipc->getInitialImage());
isrc->getRawValues(mx, my, rval, gval, bval); isrc->getRawValues(mx, my, params.coarse.rotate, rval, gval, bval);
} }
} }
// pmlistener->pointerMoved (true, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]); // pmlistener->pointerMoved (true, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]);