Perspective correction implemented

This commit is contained in:
gabor
2010-05-28 16:19:56 +02:00
parent bc9e8cb61d
commit 44ac689d11
30 changed files with 796 additions and 361 deletions

View File

@@ -1,6 +1,6 @@
file (GLOB IMAGEFILES "images/*.png") file (GLOB IMAGEFILES "images/*.png")
file (GLOB PROFILEFILES "profiles/*.pp2") file (GLOB PROFILEFILES "profiles/*.pp3")
file (GLOB LANGUAGEFILES "languages/*") file (GLOB LANGUAGEFILES "languages/*")
# THEMEDIR includes subfolders for image resources for some themes; doing the normal glob won't work. # THEMEDIR includes subfolders for image resources for some themes; doing the normal glob won't work.
set (THEMEDIR "themes") set (THEMEDIR "themes")

View File

@@ -180,7 +180,7 @@ HISTORY_MSG_58;Horizontal Flipping
HISTORY_MSG_59;Vertical Flipping HISTORY_MSG_59;Vertical Flipping
HISTORY_MSG_5;Brightness HISTORY_MSG_5;Brightness
HISTORY_MSG_60;Rotation HISTORY_MSG_60;Rotation
HISTORY_MSG_61;Rotation HISTORY_MSG_61;Auto Fill
HISTORY_MSG_62;Lens Distortion Correction HISTORY_MSG_62;Lens Distortion Correction
HISTORY_MSG_63;Snapshot Selected HISTORY_MSG_63;Snapshot Selected
HISTORY_MSG_64;Crop Photo HISTORY_MSG_64;Crop Photo
@@ -203,6 +203,9 @@ HISTORY_MSG_79;Resize width
HISTORY_MSG_7;Black HISTORY_MSG_7;Black
HISTORY_MSG_80;Resize height HISTORY_MSG_80;Resize height
HISTORY_MSG_81;Resize enabled HISTORY_MSG_81;Resize enabled
HISTORY_MSG_82;Profile Changed
HISTORY_MSG_83;High quality shadows/highlights
HISTORY_MSG_84;Perspective correction
HISTORY_MSG_8;Exposure Compensation HISTORY_MSG_8;Exposure Compensation
HISTORY_MSG_9;Highlight Compression HISTORY_MSG_9;Highlight Compression
HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT;Add
@@ -543,6 +546,9 @@ TP_ICM_OUTPUTDLGLABEL;Select Output ICC Profile...
TP_ICM_OUTPUTPROFILE;Output Profile TP_ICM_OUTPUTPROFILE;Output Profile
TP_ICM_SAVEREFERENCE;Save reference image for profiling TP_ICM_SAVEREFERENCE;Save reference image for profiling
TP_ICM_WORKINGPROFILE;Working Profile TP_ICM_WORKINGPROFILE;Working Profile
TP_LENSGEOM_AUTOCROP;Auto Crop
TP_LENSGEOM_FILL;Auto Fill
TP_LENSGEOM_LABEL;Lens / Geometry
TP_LUMACURVE_BLACKLEVEL;Black TP_LUMACURVE_BLACKLEVEL;Black
TP_LUMACURVE_BRIGHTNESS;Brightness TP_LUMACURVE_BRIGHTNESS;Brightness
TP_LUMACURVE_COMPRHIGHLIGHTS;Highlight compression TP_LUMACURVE_COMPRHIGHLIGHTS;Highlight compression
@@ -553,6 +559,9 @@ TP_LUMACURVE_LABEL;Luminance Curve
TP_LUMADENOISE_EDGETOLERANCE;Edge Tolerance TP_LUMADENOISE_EDGETOLERANCE;Edge Tolerance
TP_LUMADENOISE_LABEL;Luminance Noise Reduction TP_LUMADENOISE_LABEL;Luminance Noise Reduction
TP_LUMADENOISE_RADIUS;Radius TP_LUMADENOISE_RADIUS;Radius
TP_PERSPECTIVE_LABEL;Perspective
TP_PERSPECTIVE_HORIZONTAL;Horizontal
TP_PERSPECTIVE_VERTICAL;Vertical
TP_RESIZE_BICUBIC;Bicubic TP_RESIZE_BICUBIC;Bicubic
TP_RESIZE_BICUBICSF;Bicubic (Softer) TP_RESIZE_BICUBICSF;Bicubic (Softer)
TP_RESIZE_BICUBICSH;Bicubic (Sharper) TP_RESIZE_BICUBICSH;Bicubic (Sharper)
@@ -564,9 +573,7 @@ TP_RESIZE_METHOD;Method:
TP_RESIZE_NEAREST;Nearest TP_RESIZE_NEAREST;Nearest
TP_RESIZE_SCALE;Scale TP_RESIZE_SCALE;Scale
TP_RESIZE_W;W: TP_RESIZE_W;W:
TP_ROTATE_AUTOCROP;Auto Crop
TP_ROTATE_DEGREE;Degree TP_ROTATE_DEGREE;Degree
TP_ROTATE_FILL;Fill
TP_ROTATE_LABEL;Rotate TP_ROTATE_LABEL;Rotate
TP_ROTATE_SELECTLINE; Select Straight Line TP_ROTATE_SELECTLINE; Select Straight Line
TP_SHADOWSHLIGHTS_HIGHLIGHTS;Highlights TP_SHADOWSHLIGHTS_HIGHLIGHTS;Highlights

View File

@@ -180,7 +180,7 @@ HISTORY_MSG_58;Horizontal Flipping
HISTORY_MSG_59;Vertical Flipping HISTORY_MSG_59;Vertical Flipping
HISTORY_MSG_5;Brightness HISTORY_MSG_5;Brightness
HISTORY_MSG_60;Rotation HISTORY_MSG_60;Rotation
HISTORY_MSG_61;Rotation HISTORY_MSG_61;Auto Fill
HISTORY_MSG_62;Lens Distortion Correction HISTORY_MSG_62;Lens Distortion Correction
HISTORY_MSG_63;Snapshot Selected HISTORY_MSG_63;Snapshot Selected
HISTORY_MSG_64;Crop Photo HISTORY_MSG_64;Crop Photo
@@ -203,6 +203,9 @@ HISTORY_MSG_79;Resize width
HISTORY_MSG_7;Black HISTORY_MSG_7;Black
HISTORY_MSG_80;Resize height HISTORY_MSG_80;Resize height
HISTORY_MSG_81;Resize enabled HISTORY_MSG_81;Resize enabled
HISTORY_MSG_82;Profile Changed
HISTORY_MSG_83;High quality shadows/highlights
HISTORY_MSG_84;Perspective correction
HISTORY_MSG_8;Exposure Compensation HISTORY_MSG_8;Exposure Compensation
HISTORY_MSG_9;Highlight Compression HISTORY_MSG_9;Highlight Compression
HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT;Add
@@ -545,6 +548,9 @@ TP_ICM_OUTPUTDLGLABEL;Select Output ICC Profile...
TP_ICM_OUTPUTPROFILE;Output Profile TP_ICM_OUTPUTPROFILE;Output Profile
TP_ICM_SAVEREFERENCE;Save reference image for profiling TP_ICM_SAVEREFERENCE;Save reference image for profiling
TP_ICM_WORKINGPROFILE;Working Profile TP_ICM_WORKINGPROFILE;Working Profile
TP_LENSGEOM_AUTOCROP;Auto Crop
TP_LENSGEOM_FILL;Auto Fill
TP_LENSGEOM_LABEL;Lens / Geometry
TP_LUMACURVE_BLACKLEVEL;Black TP_LUMACURVE_BLACKLEVEL;Black
TP_LUMACURVE_BRIGHTNESS;Brightness TP_LUMACURVE_BRIGHTNESS;Brightness
TP_LUMACURVE_COMPRHIGHLIGHTS;Highlight compression TP_LUMACURVE_COMPRHIGHLIGHTS;Highlight compression
@@ -555,6 +561,9 @@ TP_LUMACURVE_LABEL;Luminance Curve
TP_LUMADENOISE_EDGETOLERANCE;Edge Tolerance TP_LUMADENOISE_EDGETOLERANCE;Edge Tolerance
TP_LUMADENOISE_LABEL;Luminance Noise Reduction TP_LUMADENOISE_LABEL;Luminance Noise Reduction
TP_LUMADENOISE_RADIUS;Radius TP_LUMADENOISE_RADIUS;Radius
TP_PERSPECTIVE_LABEL;Perspective
TP_PERSPECTIVE_HORIZONTAL;Horizontal
TP_PERSPECTIVE_VERTICAL;Vertical
TP_RESIZE_BICUBIC;Bicubic TP_RESIZE_BICUBIC;Bicubic
TP_RESIZE_BICUBICSF;Bicubic (Softer) TP_RESIZE_BICUBICSF;Bicubic (Softer)
TP_RESIZE_BICUBICSH;Bicubic (Sharper) TP_RESIZE_BICUBICSH;Bicubic (Sharper)
@@ -568,9 +577,7 @@ TP_RESIZE_METHOD;Method:
TP_RESIZE_NEAREST;Nearest TP_RESIZE_NEAREST;Nearest
TP_RESIZE_SCALE;Scale TP_RESIZE_SCALE;Scale
TP_RESIZE_W;W: TP_RESIZE_W;W:
TP_ROTATE_AUTOCROP;Auto Crop
TP_ROTATE_DEGREE;Degree TP_ROTATE_DEGREE;Degree
TP_ROTATE_FILL;Fill
TP_ROTATE_LABEL;Rotate TP_ROTATE_LABEL;Rotate
TP_ROTATE_SELECTLINE; Select Straight Line TP_ROTATE_SELECTLINE; Select Straight Line
TP_SHADOWSHLIGHTS_HIGHLIGHTS;Highlights TP_SHADOWSHLIGHTS_HIGHLIGHTS;Highlights

View File

@@ -76,19 +76,34 @@ bool ImProcFunctions::transCoord (int W, int H, std::vector<Coord2D> &src, std::
double oW = W*params->resize.scale; double oW = W*params->resize.scale;
double oH = H*params->resize.scale; double oH = H*params->resize.scale;
double w2 = (double) oW / 2.0 - 0.5; double w2 = (double) oW / 2.0 - 0.5;
double h2 = (double) oH / 2.0 - 0.5; double h2 = (double) oH / 2.0 - 0.5;
double a = params->distortion.amount; double a = params->distortion.amount;
double cost = cos(params->rotate.degree * 3.14/180.0); double cost = cos(params->rotate.degree * 3.14/180.0);
double sint = sin(params->rotate.degree * 3.14/180.0); double sint = sin(params->rotate.degree * 3.14/180.0);
double maxRadius = sqrt( (double)( oW*oW + oH*oH ) ) / 2; double maxRadius = sqrt( (double)( oW*oW + oH*oH ) ) / 2;
double ascale = ascaleDef>0 ? ascaleDef : (params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0); double vpdeg = params->perspective.vertical / 100.0 * 45.0;
double vpalpha = (90.0 - vpdeg) / 180.0 * 3.14;
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
double hpalpha = (90.0 - hpdeg) / 180.0 * 3.14;
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
double ascale = ascaleDef>0 ? ascaleDef : (params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0);
for (int i=0; i<src.size(); i++) { for (int i=0; i<src.size(); i++) {
double y_d = ascale * (src[i].y - h2); double y_d = ascale * (src[i].y - h2);
double x_d = ascale * (src[i].x - w2); double x_d = ascale * (src[i].x - w2);
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
double Dx = x_d * cost - y_d * sint; double Dx = x_d * cost - y_d * sint;
double Dy = x_d * sint + y_d * cost; double Dy = x_d * sint + y_d * cost;
@@ -197,14 +212,10 @@ void ImProcFunctions::transform (Image16* original, Image16* transformed, int cx
if (!(needsCA() || needsDistortion() || needsRotation() || needsPerspective()) && needsVignetting()) if (!(needsCA() || needsDistortion() || needsRotation() || needsPerspective()) && needsVignetting())
vignetting (original, transformed, cx, cy, oW, oH); vignetting (original, transformed, cx, cy, oW, oH);
else if (!needsCA()) { else if (!needsCA()) {
MyTime t1,t2;
t1.set ();
if (scale==1) if (scale==1)
transformNonSep (original, transformed, cx, cy, sx, sy, oW, oH); transformNonSep (original, transformed, cx, cy, sx, sy, oW, oH);
else else
simpltransform (original, transformed, cx, cy, sx, sy, oW, oH); simpltransform (original, transformed, cx, cy, sx, sy, oW, oH);
t2.set ();
printf ("transform time=%d\n", t2.etime(t1));
} }
else else
transformSep (original, transformed, cx, cy, sx, sy, oW, oH); transformSep (original, transformed, cx, cy, sx, sy, oW, oH);
@@ -260,14 +271,34 @@ void ImProcFunctions::transformNonSep (Image16* original, Image16* transformed,
double mul = (1.0-v) / tanh(b); double mul = (1.0-v) / tanh(b);
bool dovign = params->vignetting.amount != 0; bool dovign = params->vignetting.amount != 0;
double ascale = params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0; // auxiliary variables for vertical perspective correction
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
double vpalpha = (90.0 - vpdeg) / 180.0 * 3.14;
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
// auxiliary variables for horizontal perspective correction
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
double hpalpha = (90.0 - hpdeg) / 180.0 * 3.14;
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0;
// main cycle // main cycle
#pragma omp parallel for if (multiThread) #pragma omp parallel for if (multiThread)
for (int y=0; y<transformed->height; y++) { for (int y=0; y<transformed->height; y++) {
double y_d = ascale * (y + cy - h2); // centering y coord & scale
for (int x=0; x<transformed->width; x++) { for (int x=0; x<transformed->width; x++) {
double x_d = ascale * (x + cx - w2); // centering x coord & scale double x_d = ascale * (x + cx - w2); // centering x coord & scale
double y_d = ascale * (y + cy - h2); // centering y coord & scale
// horizontal perspective transformation
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
// vertical perspective transformation
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
// rotate // rotate
double Dx = x_d * cost - y_d * sint; double Dx = x_d * cost - y_d * sint;
@@ -354,16 +385,36 @@ void ImProcFunctions::transformSep (Image16* original, Image16* transformed, int
double mul = (1.0-v) / tanh(b); double mul = (1.0-v) / tanh(b);
bool dovign = params->vignetting.amount != 0; bool dovign = params->vignetting.amount != 0;
double ascale = params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0; // auxiliary variables for vertical perspective correction
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
double vpalpha = (90.0 - vpdeg) / 180.0 * 3.14;
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
// auxiliary variables for horizontal perspective correction
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
double hpalpha = (90.0 - hpdeg) / 180.0 * 3.14;
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0;
// main cycle // main cycle
#pragma omp parallel for if (multiThread) #pragma omp parallel for if (multiThread)
for (int y=0; y<transformed->height; y++) { for (int y=0; y<transformed->height; y++) {
double y_d = ascale * (y + cy - h2); // centering y coord & scale
for (int x=0; x<transformed->width; x++) { for (int x=0; x<transformed->width; x++) {
double x_d = ascale * (x + cx - w2); // centering x coord & scale double x_d = ascale * (x + cx - w2); // centering x coord & scale
double y_d = ascale * (y + cy - h2); // centering y coord & scale
// rotate // horizontal perspective transformation
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
// vertical perspective transformation
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
// rotate
double Dxc = x_d * cost - y_d * sint; double Dxc = x_d * cost - y_d * sint;
double Dyc = x_d * sint + y_d * cost; double Dyc = x_d * sint + y_d * cost;
@@ -430,15 +481,35 @@ void ImProcFunctions::simpltransform (Image16* original, Image16* transformed, i
double mul = (1.0-v) / tanh(b); double mul = (1.0-v) / tanh(b);
bool dovign = params->vignetting.amount != 0; bool dovign = params->vignetting.amount != 0;
double ascale = params->rotate.fill ? getTransformAutoFill (oW, oH) : 1.0; // auxiliary variables for vertical perspective correction
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
double vpalpha = (90 - vpdeg) / 180.0 * 3.14;
double vpteta = fabs(vpalpha-3.14/2)<1e-3 ? 0.0 : acos ((vpdeg>0 ? 1.0 : -1.0) * sqrt((-oW*oW*tan(vpalpha)*tan(vpalpha) + (vpdeg>0 ? 1.0 : -1.0) * oW*tan(vpalpha)*sqrt(16*maxRadius*maxRadius+oW*oW*tan(vpalpha)*tan(vpalpha)))/(maxRadius*maxRadius*8)));
double vpcospt = (vpdeg>=0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
// auxiliary variables for horizontal perspective correction
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
double hpalpha = (90 - hpdeg) / 180.0 * 3.14;
double hpteta = fabs(hpalpha-3.14/2)<1e-3 ? 0.0 : acos ((hpdeg>0 ? 1.0 : -1.0) * sqrt((-oH*oH*tan(hpalpha)*tan(hpalpha) + (hpdeg>0 ? 1.0 : -1.0) * oH*tan(hpalpha)*sqrt(16*maxRadius*maxRadius+oH*oH*tan(hpalpha)*tan(hpalpha)))/(maxRadius*maxRadius*8)));
double hpcospt = (hpdeg>=0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0;
// main cycle // main cycle
#pragma omp parallel for if (multiThread) #pragma omp parallel for if (multiThread)
for (int y=0; y<transformed->height; y++) { for (int y=0; y<transformed->height; y++) {
double y_d = ascale * (y + cy - h2); // centering y coord & scale
for (int x=0; x<transformed->width; x++) { for (int x=0; x<transformed->width; x++) {
double y_d = ascale * (y + cy - h2); // centering y coord & scale
double x_d = ascale * (x + cx - w2); // centering x coord & scale double x_d = ascale * (x + cx - w2); // centering x coord & scale
// horizontal perspective transformation
y_d = y_d * maxRadius / (maxRadius + x_d*hptanpt);
x_d = x_d * maxRadius * hpcospt / (maxRadius + x_d*hptanpt);
// vertical perspective transformation
x_d = x_d * maxRadius / (maxRadius - y_d*vptanpt);
y_d = y_d * maxRadius * vpcospt / (maxRadius - y_d*vptanpt);
// rotate // rotate
double Dx = x_d * cost - y_d * sint; double Dx = x_d * cost - y_d * sint;
double Dy = x_d * sint + y_d * cost; double Dy = x_d * sint + y_d * cost;
@@ -498,8 +569,6 @@ void ImProcFunctions::simpltransform (Image16* original, Image16* transformed, i
double ImProcFunctions::getTransformAutoFill (int oW, int oH) { double ImProcFunctions::getTransformAutoFill (int oW, int oH) {
MyTime t1,t2;
t1.set ();
double scaleU = 1.0; double scaleU = 1.0;
double scaleL = 0.001; double scaleL = 0.001;
while (scaleU - scaleL > 0.001) { while (scaleU - scaleL > 0.001) {
@@ -513,8 +582,6 @@ double ImProcFunctions::getTransformAutoFill (int oW, int oH) {
else else
scaleL = scale; scaleL = scale;
} }
t2.set ();
printf ("autofill time=%d\n", t2.etime(t1));
return scaleL; return scaleL;
} }
@@ -532,11 +599,11 @@ bool ImProcFunctions::needsRotation () {
} }
bool ImProcFunctions::needsPerspective () { bool ImProcFunctions::needsPerspective () {
return false; return params->perspective.horizontal || params->perspective.vertical;
} }
bool ImProcFunctions::needsVignetting () { bool ImProcFunctions::needsVignetting () {
return params->vignetting.amount != 0; return params->vignetting.amount;
} }
bool ImProcFunctions::needsTransform () { bool ImProcFunctions::needsTransform () {

View File

@@ -21,7 +21,7 @@
#include <rtengine.h> #include <rtengine.h>
#define NUMOFEVENTS 83 #define NUMOFEVENTS 84
namespace rtengine { namespace rtengine {
@@ -86,7 +86,7 @@ enum ProcEvent {
EvCTHFlip=57, EvCTHFlip=57,
EvCTVFlip=58, EvCTVFlip=58,
EvROTDegree=59, EvROTDegree=59,
EvROTFill=60, EvTransAutoFill=60,
EvDISTAmount=61, EvDISTAmount=61,
EvBookmarkSelected=62, EvBookmarkSelected=62,
EvCrop=63, EvCrop=63,
@@ -108,7 +108,8 @@ enum ProcEvent {
EvResizeHeight=79, EvResizeHeight=79,
EvResizeEnabled=80, EvResizeEnabled=80,
EvProfileChangeNotification=81, EvProfileChangeNotification=81,
EvSHHighQuality=82 EvSHHighQuality=82,
EvPerspCorr=83
}; };
} }
#endif #endif

View File

@@ -117,9 +117,15 @@ void ProcParams::setDefaults () {
coarse.hflip = false; coarse.hflip = false;
coarse.vflip = false; coarse.vflip = false;
commonTrans.autofill = true;
rotate.degree = 0; rotate.degree = 0;
rotate.fill = true;
distortion.amount = 0; distortion.amount = 0;
distortion.uselensfun = false;
perspective.horizontal = 0;
perspective.vertical = 0;
cacorrection.red = 0; cacorrection.red = 0;
cacorrection.blue = 0; cacorrection.blue = 0;
@@ -259,12 +265,19 @@ int ProcParams::save (Glib::ustring fname) const {
keyFile.set_boolean ("Coarse Transformation", "HorizontalFlip", coarse.hflip); keyFile.set_boolean ("Coarse Transformation", "HorizontalFlip", coarse.hflip);
keyFile.set_boolean ("Coarse Transformation", "VerticalFlip", coarse.vflip); keyFile.set_boolean ("Coarse Transformation", "VerticalFlip", coarse.vflip);
// save commonTrans
keyFile.set_boolean ("Common Properties for Transformations", "AutoFill", commonTrans.autofill);
// save rotate // save rotate
keyFile.set_double ("Rotation", "Degree", rotate.degree); keyFile.set_double ("Rotation", "Degree", rotate.degree);
keyFile.set_double ("Rotation", "Fill", rotate.fill);
// save distortion // save distortion
keyFile.set_double ("Distortion", "Amount", distortion.amount); keyFile.set_double ("Distortion", "Amount", distortion.amount);
keyFile.set_boolean ("Distortion", "UseLensFun", distortion.uselensfun);
// save perspective correction
keyFile.set_integer ("Perspective", "Horizontal", perspective.horizontal);
keyFile.set_integer ("Perspective", "Vertical", perspective.vertical);
// save C/A correction // save C/A correction
keyFile.set_double ("CACorrection", "Red", cacorrection.red); keyFile.set_double ("CACorrection", "Red", cacorrection.red);
@@ -464,15 +477,25 @@ if (keyFile.has_group ("Coarse Transformation")) {
// load rotate // load rotate
if (keyFile.has_group ("Rotation")) { if (keyFile.has_group ("Rotation")) {
if (keyFile.has_key ("Rotation", "Degree")) rotate.degree = keyFile.get_double ("Rotation", "Degree"); if (keyFile.has_key ("Rotation", "Degree")) rotate.degree = keyFile.get_double ("Rotation", "Degree");
if (keyFile.has_key ("Rotation", "Fill")) rotate.fill = keyFile.get_double ("Rotation", "Fill"); }
// load commonTrans
if (keyFile.has_group ("Common Properties for Transformations")) {
if (keyFile.has_key ("Common Properties for Transformations", "AutoFill")) commonTrans.autofill = keyFile.get_boolean ("Common Properties for Transformations", "AutoFill");
} }
// load distortion // load distortion
if (keyFile.has_group ("Distortion")) { if (keyFile.has_group ("Distortion")) {
if (keyFile.has_key ("Distortion", "Amount")) distortion.amount = keyFile.get_double ("Distortion", "Amount"); if (keyFile.has_key ("Distortion", "Amount")) distortion.amount = keyFile.get_double ("Distortion", "Amount");
if (keyFile.has_key ("Distortion", "UseLensFun")) distortion.uselensfun = keyFile.get_boolean ("Distortion", "UseLensFun");
} }
// load c/a correction // load perspective correction
if (keyFile.has_group ("Perspective")) {
if (keyFile.has_key ("Perspective", "Horizontal")) perspective.horizontal = keyFile.get_integer ("Perspective", "Horizontal");
if (keyFile.has_key ("Perspective", "Vertical")) perspective.vertical = keyFile.get_integer ("Perspective", "Vertical");
}
// load c/a correction
if (keyFile.has_group ("CACorrection")) { if (keyFile.has_group ("CACorrection")) {
if (keyFile.has_key ("CACorrection", "Red")) cacorrection.red = keyFile.get_double ("CACorrection", "Red"); if (keyFile.has_key ("CACorrection", "Red")) cacorrection.red = keyFile.get_double ("CACorrection", "Red");
if (keyFile.has_key ("CACorrection", "Blue")) cacorrection.blue = keyFile.get_double ("CACorrection", "Blue"); if (keyFile.has_key ("CACorrection", "Blue")) cacorrection.blue = keyFile.get_double ("CACorrection", "Blue");
@@ -534,7 +557,7 @@ if (keyFile.has_group ("IPTC")) {
printf ("-->%s\n", e.what().c_str()); printf ("-->%s\n", e.what().c_str());
} }
catch (...) { catch (...) {
printf ("-->ismeretlen exception!\n"); printf ("-->unknown exception!\n");
return 1; return 1;
} }
} }
@@ -614,8 +637,11 @@ bool ProcParams::operator== (const ProcParams& other) {
&& coarse.hflip == other.coarse.hflip && coarse.hflip == other.coarse.hflip
&& coarse.vflip == other.coarse.vflip && coarse.vflip == other.coarse.vflip
&& rotate.degree == other.rotate.degree && rotate.degree == other.rotate.degree
&& rotate.fill == other.rotate.fill && commonTrans.autofill == other.commonTrans.autofill
&& distortion.uselensfun == other.distortion.uselensfun
&& distortion.amount == other.distortion.amount && distortion.amount == other.distortion.amount
&& perspective.horizontal == other.perspective.horizontal
&& perspective.vertical == other.perspective.vertical
&& cacorrection.red == other.cacorrection.red && cacorrection.red == other.cacorrection.red
&& cacorrection.blue == other.cacorrection.blue && cacorrection.blue == other.cacorrection.blue
&& vignetting.amount == other.vignetting.amount && vignetting.amount == other.vignetting.amount

View File

@@ -177,6 +177,15 @@ class CoarseTransformParams {
bool vflip; bool vflip;
}; };
/**
* Common transformation parameters
*/
class CommonTransformParams {
public:
bool autofill;
};
/** /**
* Parameters of the rotation * Parameters of the rotation
*/ */
@@ -184,7 +193,6 @@ class RotateParams {
public: public:
double degree; double degree;
bool fill;
}; };
/** /**
@@ -193,9 +201,20 @@ class RotateParams {
class DistortionParams { class DistortionParams {
public: public:
bool uselensfun;
double amount; double amount;
}; };
/**
* Parameters of the perspective correction
*/
class PerspectiveParams {
public:
int horizontal;
int vertical;
};
/** /**
* Parameters of the vignetting correction * Parameters of the vignetting correction
*/ */
@@ -300,8 +319,10 @@ class ProcParams {
SHParams sh; ///< Shadow/highlight enhancement parameters SHParams sh; ///< Shadow/highlight enhancement parameters
CropParams crop; ///< Crop parameters CropParams crop; ///< Crop parameters
CoarseTransformParams coarse; ///< Coarse transformation (90, 180, 270 deg rotation, h/v flipping) parameters CoarseTransformParams coarse; ///< Coarse transformation (90, 180, 270 deg rotation, h/v flipping) parameters
CommonTransformParams commonTrans; ///< Common transformation parameters (autofill)
RotateParams rotate; ///< Rotation parameters RotateParams rotate; ///< Rotation parameters
DistortionParams distortion; ///< Lens distortion correction parameters DistortionParams distortion; ///< Lens distortion correction parameters
PerspectiveParams perspective; ///< Perspective correction parameters
CACorrParams cacorrection; ///< Lens c/a correction parameters CACorrParams cacorrection; ///< Lens c/a correction parameters
VignettingParams vignetting; ///< Lens vignetting correction parameters VignettingParams vignetting; ///< Lens vignetting correction parameters
ChannelMixerParams chmixer; ///< Channel mixer parameters ChannelMixerParams chmixer; ///< Channel mixer parameters

View File

@@ -79,7 +79,7 @@ ALL, // EvCTRotate,
ALL, // EvCTHFlip, ALL, // EvCTHFlip,
ALL, // EvCTVFlip, ALL, // EvCTVFlip,
TRANSFORM, // EvROTDegree, TRANSFORM, // EvROTDegree,
TRANSFORM, // EvROTFill, TRANSFORM, // EvTransAutoFill,
TRANSFORM, // EvDISTAmount, TRANSFORM, // EvDISTAmount,
ALL, // EvBookmarkSelected, ALL, // EvBookmarkSelected,
CROP, // EvCrop, CROP, // EvCrop,
@@ -101,6 +101,7 @@ ALL, // EvResizeWidth
ALL, // EvResizeHeight ALL, // EvResizeHeight
ALL, // EvResizeEnabled ALL, // EvResizeEnabled
ALL, // EvProfileChangeNotification ALL, // EvProfileChangeNotification
RETINEX // EvShrHighQuality RETINEX, // EvShrHighQuality
}; TRANSFORM // EvPerspCorr
};

View File

@@ -21,8 +21,6 @@
#include <glibmm.h> #include <glibmm.h>
#define NUMOFEVENTS 83
#define FIRST 65535 #define FIRST 65535
#define ALL 65535 #define ALL 65535
#define TRANSFORM 127 #define TRANSFORM 127

View File

@@ -3,8 +3,8 @@ set (BASESOURCEFILES
batchtoolpanelcoord.cc paramsedited.cc cropwindow.cc previewhandler.cc previewwindow.cc navigator.cc indclippedpanel.cc filterpanel.cc batchtoolpanelcoord.cc paramsedited.cc cropwindow.cc previewhandler.cc previewwindow.cc navigator.cc indclippedpanel.cc filterpanel.cc
cursormanager.cc rtwindow.cc renamedlg.cc recentbrowser.cc placesbrowser.cc filepanel.cc editorpanel.cc batchqueuepanel.cc cursormanager.cc rtwindow.cc renamedlg.cc recentbrowser.cc placesbrowser.cc filepanel.cc editorpanel.cc batchqueuepanel.cc
ilabel.cc thumbbrowserbase.cc adjuster.cc filebrowserentry.cc filebrowser.cc filethumbnailbuttonset.cc ilabel.cc thumbbrowserbase.cc adjuster.cc filebrowserentry.cc filebrowser.cc filethumbnailbuttonset.cc
cachemanager.cc cacheimagedata.cc shcselector.cc cachemanager.cc cacheimagedata.cc shcselector.cc perspective.cc
clipboard.cc thumbimageupdater.cc bqentryupdater.cc clipboard.cc thumbimageupdater.cc bqentryupdater.cc lensgeom.cc
coarsepanel.cc cacorrection.cc colorshift.cc hlrec.cc chmixer.cc coarsepanel.cc cacorrection.cc colorshift.cc hlrec.cc chmixer.cc
colorboost.cc resize.cc icmpanel.cc crop.cc shadowshighlights.cc colorboost.cc resize.cc icmpanel.cc crop.cc shadowshighlights.cc
colordenoise.cc colordenoise.cc

View File

@@ -19,8 +19,8 @@
#define ADDSET_CS_GREENMAGENTA 15 #define ADDSET_CS_GREENMAGENTA 15
#define ADDSET_ROTATE_DEGREE 16 #define ADDSET_ROTATE_DEGREE 16
#define ADDSET_DIST_AMOUNT 17 #define ADDSET_DIST_AMOUNT 17
#define ADDSET_CA_BLUE 18 #define ADDSET_PERSPECTIVE 18
#define ADDSET_CA_RED 19 #define ADDSET_CA 19
#define ADDSET_VIGN_AMOUNT 20 #define ADDSET_VIGN_AMOUNT 20
#define ADDSET_PARAM_NUM 21 #define ADDSET_PARAM_NUM 21

View File

@@ -126,7 +126,8 @@ void BatchToolPanelCoordinator::initSession () {
vignetting->setAdjusterBehavior (options.baBehav[ADDSET_VIGN_AMOUNT]); vignetting->setAdjusterBehavior (options.baBehav[ADDSET_VIGN_AMOUNT]);
rotate->setAdjusterBehavior (options.baBehav[ADDSET_ROTATE_DEGREE]); rotate->setAdjusterBehavior (options.baBehav[ADDSET_ROTATE_DEGREE]);
distortion->setAdjusterBehavior (options.baBehav[ADDSET_DIST_AMOUNT]); distortion->setAdjusterBehavior (options.baBehav[ADDSET_DIST_AMOUNT]);
cacorrection->setAdjusterBehavior (options.baBehav[ADDSET_CA_RED], options.baBehav[ADDSET_CA_BLUE]); perspective->setAdjusterBehavior (options.baBehav[ADDSET_PERSPECTIVE]);
cacorrection->setAdjusterBehavior (options.baBehav[ADDSET_CA]);
colorshift->setAdjusterBehavior (options.baBehav[ADDSET_CS_BLUEYELLOW], options.baBehav[ADDSET_CS_GREENMAGENTA]); colorshift->setAdjusterBehavior (options.baBehav[ADDSET_CS_BLUEYELLOW], options.baBehav[ADDSET_CS_GREENMAGENTA]);
colorboost->setAdjusterBehavior (options.baBehav[ADDSET_CBOOST_AMOUNT]); colorboost->setAdjusterBehavior (options.baBehav[ADDSET_CBOOST_AMOUNT]);
lumadenoise->setAdjusterBehavior (options.baBehav[ADDSET_LD_EDGETOLERANCE]); lumadenoise->setAdjusterBehavior (options.baBehav[ADDSET_LD_EDGETOLERANCE]);
@@ -158,8 +159,9 @@ void BatchToolPanelCoordinator::initSession () {
if (options.baBehav[ADDSET_ROTATE_DEGREE]) pparams.rotate.degree = 0; if (options.baBehav[ADDSET_ROTATE_DEGREE]) pparams.rotate.degree = 0;
if (options.baBehav[ADDSET_DIST_AMOUNT]) pparams.distortion.amount = 0; if (options.baBehav[ADDSET_DIST_AMOUNT]) pparams.distortion.amount = 0;
if (options.baBehav[ADDSET_CA_RED]) pparams.cacorrection.red = 0; if (options.baBehav[ADDSET_PERSPECTIVE]) pparams.perspective.horizontal = pparams.perspective.vertical = 0;
if (options.baBehav[ADDSET_CA_BLUE]) pparams.cacorrection.blue = 0; if (options.baBehav[ADDSET_CA]) pparams.cacorrection.red = 0;
if (options.baBehav[ADDSET_CA]) pparams.cacorrection.blue = 0;
if (options.baBehav[ADDSET_VIGN_AMOUNT]) pparams.vignetting.amount = 0; if (options.baBehav[ADDSET_VIGN_AMOUNT]) pparams.vignetting.amount = 0;
for (int i=0; i<toolPanels.size(); i++) { for (int i=0; i<toolPanels.size(); i++) {

View File

@@ -22,7 +22,7 @@
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;
CACorrection::CACorrection () : valaAdd(false), valbAdd(false) { CACorrection::CACorrection () : vAdd(false) {
red = Gtk::manage (new Adjuster (M("TP_CACORRECTION_RED"), -0.005, 0.005, 0.0001, 0)); red = Gtk::manage (new Adjuster (M("TP_CACORRECTION_RED"), -0.005, 0.005, 0.0001, 0));
red->setAdjusterListener (this); red->setAdjusterListener (this);
@@ -83,16 +83,14 @@ void CACorrection::adjusterChanged (Adjuster* a, double newval) {
listener->panelChanged (EvCACorr, Glib::ustring::compose ("%1=%3\n%2=%4", M("TP_CACORRECTION_RED"), M("TP_CACORRECTION_BLUE"), Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(4), red->getValue()), Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(4), blue->getValue()))); listener->panelChanged (EvCACorr, Glib::ustring::compose ("%1=%3\n%2=%4", M("TP_CACORRECTION_RED"), M("TP_CACORRECTION_BLUE"), Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(4), red->getValue()), Glib::ustring::format (std::setw(5), std::fixed, std::setprecision(4), blue->getValue())));
} }
void CACorrection::setAdjusterBehavior (bool baadd, bool bbadd) { void CACorrection::setAdjusterBehavior (bool badd) {
if (!valaAdd && baadd || valaAdd && !baadd) if (!vAdd && badd || vAdd && !badd) {
red->setLimits (-0.005, 0.005, 0.0001, 0); red->setLimits (-0.005, 0.005, 0.0001, 0);
if (!valbAdd && bbadd || valbAdd && !bbadd)
blue->setLimits (-0.005, 0.005, 0.0001, 0); blue->setLimits (-0.005, 0.005, 0.0001, 0);
}
valaAdd = baadd; vAdd = badd;
valbAdd = bbadd;
} }
void CACorrection::setBatchMode (bool batchMode) { void CACorrection::setBatchMode (bool batchMode) {

View File

@@ -28,7 +28,7 @@ class CACorrection : public Gtk::VBox, public AdjusterListener, public ToolPanel
protected: protected:
Adjuster* red; Adjuster* red;
Adjuster* blue; Adjuster* blue;
bool valaAdd, valbAdd; bool vAdd;
public: public:
@@ -40,7 +40,7 @@ class CACorrection : public Gtk::VBox, public AdjusterListener, public ToolPanel
void setBatchMode (bool batchMode); void setBatchMode (bool batchMode);
void adjusterChanged (Adjuster* a, double newval); void adjusterChanged (Adjuster* a, double newval);
void setAdjusterBehavior (bool baadd, bool bbadd); void setAdjusterBehavior (bool badd);
}; };
#endif #endif

104
rtgui/lensgeom.cc Normal file
View File

@@ -0,0 +1,104 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <lensgeom.h>
#include <guiutils.h>
extern Glib::ustring argv0;
using namespace rtengine;
using namespace rtengine::procparams;
LensGeometry::LensGeometry () : ToolPanel(), rlistener(NULL) {
fill = Gtk::manage (new Gtk::CheckButton (M("TP_LENSGEOM_FILL")));
pack_start (*fill);
autoCrop = Gtk::manage (new Gtk::Button (M("TP_LENSGEOM_AUTOCROP")));
pack_start (*autoCrop, Gtk::PACK_SHRINK, 2);
packBox = Gtk::manage (new Gtk::VBox ());
pack_start (*packBox);
autoCrop->signal_pressed().connect( sigc::mem_fun(*this, &LensGeometry::autoCropPressed) );
fillConn = fill->signal_toggled().connect( sigc::mem_fun(*this, &LensGeometry::fillPressed) );
fill->set_active (true);
show_all ();
}
void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener ();
if (pedited)
fill->set_inconsistent (!pedited->commonTrans.autofill);
fillConn.block (true);
fill->set_active (pp->commonTrans.autofill);
fillConn.block (false);
lastFill = pp->commonTrans.autofill;
enableListener ();
}
void LensGeometry::write (ProcParams* pp, ParamsEdited* pedited) {
pp->commonTrans.autofill = fill->get_active ();
if (pedited)
pedited->commonTrans.autofill = !fill->get_inconsistent();
}
void LensGeometry::autoCropPressed () {
if (rlistener)
rlistener->autoCropRequested ();
}
void LensGeometry::fillPressed () {
if (batchMode) {
if (fill->get_inconsistent()) {
fill->set_inconsistent (false);
fillConn.block (true);
fill->set_active (false);
fillConn.block (false);
}
else if (lastFill)
fill->set_inconsistent (true);
lastFill = fill->get_active ();
}
else
autoCrop->set_sensitive (!fill->get_active());
if (listener) {
if (fill->get_active ())
listener->panelChanged (EvTransAutoFill, M("TP_LENSGEOM_AUTOFILL")+' '+M("GENERAL_ENABLED"));
else
listener->panelChanged (EvTransAutoFill, M("TP_LENSGEOM_AUTOFILL")+' '+M("GENERAL_DISABLED"));
}
}
void LensGeometry::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode);
removeIfThere (this, autoCrop);
}

51
rtgui/lensgeom.h Normal file
View File

@@ -0,0 +1,51 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LENSGEOM_H_
#define _LENSGEOM_H_
#include <gtkmm.h>
#include <toolpanel.h>
#include <lensgeomlistener.h>
class LensGeometry : public Gtk::VBox, public ToolPanel {
protected:
Gtk::Button* autoCrop;
LensGeomListener* rlistener;
Gtk::CheckButton* fill;
bool lastFill;
sigc::connection fillConn;
Gtk::VBox* packBox;
public:
LensGeometry ();
Gtk::Box* getPackBox () { return packBox; }
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void fillPressed ();
void autoCropPressed ();
void setLensGeomListener (LensGeomListener* l) { rlistener = l; }
};
#endif

29
rtgui/lensgeomlistener.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LENSGEOMLISTENER_H_
#define _LENSGEOMLISTENER_H_
class LensGeomListener {
public:
virtual void straightenRequested ()=0;
virtual void autoCropRequested ()=0;
};
#endif

View File

@@ -27,7 +27,7 @@
Options options; Options options;
Glib::ustring versionString = "v3.0 alpha 1"; Glib::ustring versionString = "v3.0 alpha 1";
Glib::ustring paramFileExtension = ".pp2"; Glib::ustring paramFileExtension = ".pp3";
Options::Options () { Options::Options () {

View File

@@ -88,9 +88,12 @@ void ParamsEdited::set (bool v) {
coarse.rotate = v; coarse.rotate = v;
coarse.hflip = v; coarse.hflip = v;
coarse.vflip = v; coarse.vflip = v;
commonTrans.autofill = v;
rotate.degree = v; rotate.degree = v;
rotate.fill = v; distortion.uselensfun = v;
distortion.amount = v; distortion.amount = v;
perspective.horizontal = v;
perspective.vertical = v;
cacorrection.red = v; cacorrection.red = v;
cacorrection.blue = v; cacorrection.blue = v;
vignetting.amount = v; vignetting.amount = v;
@@ -192,9 +195,12 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
coarse.rotate = coarse.rotate && p.coarse.rotate == other.coarse.rotate; coarse.rotate = coarse.rotate && p.coarse.rotate == other.coarse.rotate;
coarse.hflip = coarse.hflip && p.coarse.hflip == other.coarse.hflip; coarse.hflip = coarse.hflip && p.coarse.hflip == other.coarse.hflip;
coarse.vflip = coarse.vflip && p.coarse.vflip == other.coarse.vflip; coarse.vflip = coarse.vflip && p.coarse.vflip == other.coarse.vflip;
commonTrans.autofill = commonTrans.autofill && p.commonTrans.autofill == other.commonTrans.autofill;
rotate.degree = rotate.degree && p.rotate.degree == other.rotate.degree; rotate.degree = rotate.degree && p.rotate.degree == other.rotate.degree;
rotate.fill = rotate.fill && p.rotate.fill == other.rotate.fill; distortion.uselensfun = distortion.uselensfun && p.distortion.uselensfun == other.distortion.uselensfun;
distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount; distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount;
perspective.horizontal = perspective.horizontal && p.perspective.horizontal == other.perspective.horizontal;
perspective.vertical = perspective.vertical && p.perspective.vertical == other.perspective.vertical;
cacorrection.red = cacorrection.red && p.cacorrection.red == other.cacorrection.red; cacorrection.red = cacorrection.red && p.cacorrection.red == other.cacorrection.red;
cacorrection.blue = cacorrection.blue && p.cacorrection.blue == other.cacorrection.blue; cacorrection.blue = cacorrection.blue && p.cacorrection.blue == other.cacorrection.blue;
vignetting.amount = vignetting.amount && p.vignetting.amount == other.vignetting.amount; vignetting.amount = vignetting.amount && p.vignetting.amount == other.vignetting.amount;
@@ -267,33 +273,36 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (lumaDenoise.edgetolerance) toEdit.lumaDenoise.edgetolerance = options.baBehav[ADDSET_LD_EDGETOLERANCE] ? toEdit.lumaDenoise.edgetolerance + mods.lumaDenoise.edgetolerance : mods.lumaDenoise.edgetolerance; if (lumaDenoise.edgetolerance) toEdit.lumaDenoise.edgetolerance = options.baBehav[ADDSET_LD_EDGETOLERANCE] ? toEdit.lumaDenoise.edgetolerance + mods.lumaDenoise.edgetolerance : mods.lumaDenoise.edgetolerance;
if (colorDenoise.enabled) toEdit.colorDenoise.enabled = mods.colorDenoise.enabled; if (colorDenoise.enabled) toEdit.colorDenoise.enabled = mods.colorDenoise.enabled;
if (colorDenoise.amount) toEdit.colorDenoise.amount = mods.colorDenoise.amount; if (colorDenoise.amount) toEdit.colorDenoise.amount = mods.colorDenoise.amount;
if (sh.enabled) toEdit.sh.enabled = mods.sh.enabled; if (sh.enabled) toEdit.sh.enabled = mods.sh.enabled;
if (sh.hq) toEdit.sh.hq = mods.sh.hq; if (sh.hq) toEdit.sh.hq = mods.sh.hq;
if (sh.highlights) toEdit.sh.highlights = options.baBehav[ADDSET_SH_HIGHLIGHTS] ? toEdit.sh.highlights + mods.sh.highlights : mods.sh.highlights; if (sh.highlights) toEdit.sh.highlights = options.baBehav[ADDSET_SH_HIGHLIGHTS] ? toEdit.sh.highlights + mods.sh.highlights : mods.sh.highlights;
if (sh.htonalwidth) toEdit.sh.htonalwidth = mods.sh.htonalwidth; if (sh.htonalwidth) toEdit.sh.htonalwidth = mods.sh.htonalwidth;
if (sh.shadows) toEdit.sh.shadows = options.baBehav[ADDSET_SH_SHADOWS] ? toEdit.sh.shadows + mods.sh.shadows : mods.sh.shadows; if (sh.shadows) toEdit.sh.shadows = options.baBehav[ADDSET_SH_SHADOWS] ? toEdit.sh.shadows + mods.sh.shadows : mods.sh.shadows;
if (sh.stonalwidth) toEdit.sh.stonalwidth = mods.sh.stonalwidth; if (sh.stonalwidth) toEdit.sh.stonalwidth = mods.sh.stonalwidth;
if (sh.localcontrast) toEdit.sh.localcontrast = options.baBehav[ADDSET_SH_LOCALCONTRAST] ? toEdit.sh.localcontrast + mods.sh.localcontrast : mods.sh.localcontrast; if (sh.localcontrast) toEdit.sh.localcontrast = options.baBehav[ADDSET_SH_LOCALCONTRAST] ? toEdit.sh.localcontrast + mods.sh.localcontrast : mods.sh.localcontrast;
if (sh.radius) toEdit.sh.radius = mods.sh.radius; if (sh.radius) toEdit.sh.radius = mods.sh.radius;
if (crop.enabled) toEdit.crop.enabled = mods.crop.enabled; if (crop.enabled) toEdit.crop.enabled = mods.crop.enabled;
if (crop.x) toEdit.crop.x = mods.crop.x; if (crop.x) toEdit.crop.x = mods.crop.x;
if (crop.y) toEdit.crop.y = mods.crop.y; if (crop.y) toEdit.crop.y = mods.crop.y;
if (crop.w) toEdit.crop.w = mods.crop.w; if (crop.w) toEdit.crop.w = mods.crop.w;
if (crop.h) toEdit.crop.h = mods.crop.h; if (crop.h) toEdit.crop.h = mods.crop.h;
if (crop.fixratio) toEdit.crop.fixratio = mods.crop.fixratio; if (crop.fixratio) toEdit.crop.fixratio = mods.crop.fixratio;
if (crop.ratio) toEdit.crop.ratio = mods.crop.ratio; if (crop.ratio) toEdit.crop.ratio = mods.crop.ratio;
if (crop.orientation) toEdit.crop.orientation = mods.crop.orientation; if (crop.orientation) toEdit.crop.orientation = mods.crop.orientation;
if (crop.guide) toEdit.crop.guide = mods.crop.guide; if (crop.guide) toEdit.crop.guide = mods.crop.guide;
if (coarse.rotate) toEdit.coarse.rotate = (toEdit.coarse.rotate + mods.coarse.rotate) % 360; if (coarse.rotate) toEdit.coarse.rotate = (toEdit.coarse.rotate + mods.coarse.rotate) % 360;
if (coarse.hflip) toEdit.coarse.hflip = mods.coarse.hflip ? !toEdit.coarse.hflip : toEdit.coarse.hflip; if (coarse.hflip) toEdit.coarse.hflip = mods.coarse.hflip ? !toEdit.coarse.hflip : toEdit.coarse.hflip;
if (coarse.vflip) toEdit.coarse.vflip = mods.coarse.vflip ? !toEdit.coarse.vflip : toEdit.coarse.vflip; if (coarse.vflip) toEdit.coarse.vflip = mods.coarse.vflip ? !toEdit.coarse.vflip : toEdit.coarse.vflip;
if (rotate.degree) toEdit.rotate.degree = options.baBehav[17] ? toEdit.rotate.degree + mods.rotate.degree : mods.rotate.degree; if (commonTrans.autofill) toEdit.commonTrans.autofill = mods.commonTrans.autofill;
if (rotate.fill) toEdit.rotate.fill = mods.rotate.fill; if (rotate.degree) toEdit.rotate.degree = options.baBehav[17] ? toEdit.rotate.degree + mods.rotate.degree : mods.rotate.degree;
if (distortion.amount) toEdit.distortion.amount = options.baBehav[ADDSET_DIST_AMOUNT] ? toEdit.distortion.amount + mods.distortion.amount : mods.distortion.amount; if (distortion.uselensfun) toEdit.distortion.uselensfun = mods.distortion.uselensfun;
if (cacorrection.red) toEdit.cacorrection.red = options.baBehav[ADDSET_CA_RED] ? toEdit.cacorrection.red + mods.cacorrection.red : mods.cacorrection.red; if (distortion.amount) toEdit.distortion.amount = options.baBehav[ADDSET_DIST_AMOUNT] ? toEdit.distortion.amount + mods.distortion.amount : mods.distortion.amount;
if (cacorrection.blue) toEdit.cacorrection.blue = options.baBehav[ADDSET_CA_BLUE] ? toEdit.cacorrection.blue + mods.cacorrection.blue : mods.cacorrection.blue; if (perspective.horizontal) toEdit.perspective.horizontal = options.baBehav[ADDSET_PERSPECTIVE] ? toEdit.perspective.horizontal + mods.perspective.horizontal : mods.perspective.horizontal;
if (vignetting.amount) toEdit.vignetting.amount = options.baBehav[ADDSET_VIGN_AMOUNT] ? toEdit.vignetting.amount + mods.vignetting.amount : mods.vignetting.amount; if (perspective.vertical) toEdit.perspective.vertical = options.baBehav[ADDSET_PERSPECTIVE] ? toEdit.perspective.vertical + mods.perspective.vertical : mods.perspective.vertical;
if (vignetting.radius) toEdit.vignetting.radius = mods.vignetting.radius; if (cacorrection.red) toEdit.cacorrection.red = options.baBehav[ADDSET_CA] ? toEdit.cacorrection.red + mods.cacorrection.red : mods.cacorrection.red;
if (cacorrection.blue) toEdit.cacorrection.blue = options.baBehav[ADDSET_CA] ? toEdit.cacorrection.blue + mods.cacorrection.blue : mods.cacorrection.blue;
if (vignetting.amount) toEdit.vignetting.amount = options.baBehav[ADDSET_VIGN_AMOUNT] ? toEdit.vignetting.amount + mods.vignetting.amount : mods.vignetting.amount;
if (vignetting.radius) toEdit.vignetting.radius = mods.vignetting.radius;
if (chmixer.red[0]) toEdit.chmixer.red[0] = mods.chmixer.red[0]; if (chmixer.red[0]) toEdit.chmixer.red[0] = mods.chmixer.red[0];
if (chmixer.red[1]) toEdit.chmixer.red[1] = mods.chmixer.red[1]; if (chmixer.red[1]) toEdit.chmixer.red[1] = mods.chmixer.red[1];
if (chmixer.red[2]) toEdit.chmixer.red[2] = mods.chmixer.red[2]; if (chmixer.red[2]) toEdit.chmixer.red[2] = mods.chmixer.red[2];

View File

@@ -140,19 +140,32 @@ class CoarseTransformParamsEdited {
bool vflip; bool vflip;
}; };
class CommonTransformParamsEdited {
public:
bool autofill;
};
class RotateParamsEdited { class RotateParamsEdited {
public: public:
bool degree; bool degree;
bool fill;
}; };
class DistortionParamsEdited { class DistortionParamsEdited {
public: public:
bool uselensfun;
bool amount; bool amount;
}; };
class PerspectiveParamsEdited {
public:
bool horizontal;
bool vertical;
};
class VignettingParamsEdited { class VignettingParamsEdited {
public: public:
@@ -230,8 +243,10 @@ class ParamsEdited {
SHParamsEdited sh; SHParamsEdited sh;
CropParamsEdited crop; CropParamsEdited crop;
CoarseTransformParamsEdited coarse; CoarseTransformParamsEdited coarse;
CommonTransformParamsEdited commonTrans;
RotateParamsEdited rotate; RotateParamsEdited rotate;
DistortionParamsEdited distortion; DistortionParamsEdited distortion;
PerspectiveParamsEdited perspective;
CACorrParamsEdited cacorrection; CACorrParamsEdited cacorrection;
VignettingParamsEdited vignetting; VignettingParamsEdited vignetting;
ChannelMixerParamsEdited chmixer; ChannelMixerParamsEdited chmixer;

100
rtgui/perspective.cc Normal file
View File

@@ -0,0 +1,100 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <perspective.h>
using namespace rtengine;
using namespace rtengine::procparams;
PerspCorrection::PerspCorrection () : vAdd(false) {
horiz = Gtk::manage (new Adjuster (M("TP_PERSPECTIVE_HORIZONTAL"), -100, 100, 1, 0));
horiz->setAdjusterListener (this);
vert = Gtk::manage (new Adjuster (M("TP_PERSPECTIVE_VERTICAL"), -100, 100, 1, 0));
vert->setAdjusterListener (this);
pack_start (*horiz);
pack_start (*vert);
show_all();
}
void PerspCorrection::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener ();
if (pedited) {
horiz->setEditedState (pedited->perspective.horizontal ? Edited : UnEdited);
vert->setEditedState (pedited->perspective.vertical ? Edited : UnEdited);
}
horiz->setValue (pp->perspective.horizontal);
vert->setValue (pp->perspective.vertical);
enableListener ();
}
void PerspCorrection::write (ProcParams* pp, ParamsEdited* pedited) {
pp->perspective.horizontal = horiz->getValue ();
pp->perspective.vertical = vert->getValue ();
if (pedited) {
pedited->perspective.horizontal = horiz->getEditedState ();
pedited->perspective.vertical = vert->getEditedState ();
}
}
void PerspCorrection::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
horiz->setDefault (defParams->perspective.horizontal);
vert->setDefault (defParams->perspective.vertical);
if (pedited) {
horiz->setDefaultEditedState (pedited->perspective.horizontal ? Edited : UnEdited);
vert->setDefaultEditedState (pedited->perspective.vertical ? Edited : UnEdited);
}
else {
horiz->setDefaultEditedState (Irrelevant);
vert->setDefaultEditedState (Irrelevant);
}
}
void PerspCorrection::adjusterChanged (Adjuster* a, double newval) {
if (listener)
listener->panelChanged (EvPerspCorr, Glib::ustring::compose ("%1=%3\n%2=%4", M("TP_PERSPECTIVE_HORIZONTAL"), M("TP_PERSPECTIVE_VERTICAL"), horiz->getValue(), vert->getValue()));
}
void PerspCorrection::setAdjusterBehavior (bool badd) {
if (!vAdd && badd || vAdd && !badd) {
// horiz->setLimits (-0.005, 0.005, 0.0001, 0);
// vert->setLimits (-0.005, 0.005, 0.0001, 0);
}
vAdd = badd;
}
void PerspCorrection::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode);
horiz->showEditedCB ();
vert->showEditedCB ();
}

46
rtgui/perspective.h Normal file
View File

@@ -0,0 +1,46 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _PERSPECTIVE_PANEL_H_
#define _PERSPECTIVE_PANEL_H_
#include <gtkmm.h>
#include <adjuster.h>
#include <toolpanel.h>
class PerspCorrection : public Gtk::VBox, public AdjusterListener, public ToolPanel {
protected:
Adjuster* horiz;
Adjuster* vert;
bool vAdd;
public:
PerspCorrection ();
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL);
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void adjusterChanged (Adjuster* a, double newval);
void setAdjusterBehavior (bool badd);
};
#endif

View File

@@ -173,10 +173,13 @@ Gtk::Widget* Preferences::getBatchProcPanel () {
mi->set_value (behavColumns.label, M("TP_DISTORTION_LABEL")); mi->set_value (behavColumns.label, M("TP_DISTORTION_LABEL"));
appendBehavList (mi, M("TP_DISTORTION_AMOUNT"), ADDSET_DIST_AMOUNT, false); appendBehavList (mi, M("TP_DISTORTION_AMOUNT"), ADDSET_DIST_AMOUNT, false);
mi = behModel->append ();
mi->set_value (behavColumns.label, M("TP_PERSPECTIVE_LABEL"));
appendBehavList (mi, M("TP_PERSPECTIVE_HORIZONTAL")+", "+M("TP_PERSPECTIVE_VERTICAL"), ADDSET_PERSPECTIVE, false);
mi = behModel->append (); mi = behModel->append ();
mi->set_value (behavColumns.label, M("TP_CACORRECTION_LABEL")); mi->set_value (behavColumns.label, M("TP_CACORRECTION_LABEL"));
appendBehavList (mi, M("TP_CACORRECTION_BLUE"), ADDSET_CA_BLUE, true); appendBehavList (mi, M("TP_CACORRECTION_BLUE")+", "+M("TP_CACORRECTION_RED"), ADDSET_CA, true);
appendBehavList (mi, M("TP_CACORRECTION_RED"), ADDSET_CA_RED, true);
mi = behModel->append (); mi = behModel->append ();
mi->set_value (behavColumns.label, M("TP_VIGNETTING_LABEL")); mi->set_value (behavColumns.label, M("TP_VIGNETTING_LABEL"));

View File

@@ -33,22 +33,13 @@ Rotate::Rotate () : ToolPanel (), degAdd(false) {
degree->setAdjusterListener (this); degree->setAdjusterListener (this);
pack_start (*degree); pack_start (*degree);
fill = Gtk::manage (new Gtk::CheckButton (M("TP_ROTATE_FILL")));
pack_start (*fill);
selectStraight = Gtk::manage (new Gtk::Button (M("TP_ROTATE_SELECTLINE"))); selectStraight = Gtk::manage (new Gtk::Button (M("TP_ROTATE_SELECTLINE")));
Gtk::Image* selimg = Gtk::manage (new Gtk::Image (argv0+"/images/straighten16.png")); Gtk::Image* selimg = Gtk::manage (new Gtk::Image (argv0+"/images/straighten16.png"));
selectStraight->set_image (*selimg); selectStraight->set_image (*selimg);
pack_start (*selectStraight, Gtk::PACK_SHRINK, 2); pack_start (*selectStraight, Gtk::PACK_SHRINK, 2);
autoCrop = Gtk::manage (new Gtk::Button (M("TP_ROTATE_AUTOCROP")));
pack_start (*autoCrop, Gtk::PACK_SHRINK, 2);
selectStraight->signal_pressed().connect( sigc::mem_fun(*this, &Rotate::selectStraightPressed) ); selectStraight->signal_pressed().connect( sigc::mem_fun(*this, &Rotate::selectStraightPressed) );
autoCrop->signal_pressed().connect( sigc::mem_fun(*this, &Rotate::autoCropPressed) );
fillConn = fill->signal_toggled().connect( sigc::mem_fun(*this, &Rotate::fillPressed) );
fill->set_active (true);
show_all (); show_all ();
} }
@@ -56,17 +47,10 @@ void Rotate::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener (); disableListener ();
if (pedited) { if (pedited)
degree->setEditedState (pedited->rotate.degree ? Edited : UnEdited); degree->setEditedState (pedited->rotate.degree ? Edited : UnEdited);
fill->set_inconsistent (!pedited->rotate.fill);
}
degree->setValue (pp->rotate.degree); degree->setValue (pp->rotate.degree);
fillConn.block (true);
fill->set_active (pp->rotate.fill);
fillConn.block (false);
lastFill = pp->rotate.fill;
enableListener (); enableListener ();
} }
@@ -74,12 +58,9 @@ void Rotate::read (const ProcParams* pp, const ParamsEdited* pedited) {
void Rotate::write (ProcParams* pp, ParamsEdited* pedited) { void Rotate::write (ProcParams* pp, ParamsEdited* pedited) {
pp->rotate.degree = degree->getValue (); pp->rotate.degree = degree->getValue ();
pp->rotate.fill = fill->get_active ();
if (pedited) { if (pedited)
pedited->rotate.degree = degree->getEditedState (); pedited->rotate.degree = degree->getEditedState ();
pedited->rotate.fill = !fill->get_inconsistent();
}
} }
void Rotate::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { void Rotate::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
@@ -112,40 +93,10 @@ void Rotate::selectStraightPressed () {
rlistener->straightenRequested (); rlistener->straightenRequested ();
} }
void Rotate::autoCropPressed () {
if (rlistener)
rlistener->autoCropRequested ();
}
void Rotate::fillPressed () {
if (batchMode) {
if (fill->get_inconsistent()) {
fill->set_inconsistent (false);
fillConn.block (true);
fill->set_active (false);
fillConn.block (false);
}
else if (lastFill)
fill->set_inconsistent (true);
lastFill = fill->get_active ();
}
if (listener) {
if (fill->get_active())
listener->panelChanged (EvROTDegree, M("TP_ROTATE_FILL")+' '+M("GENERAL_ENABLED"));
else
listener->panelChanged (EvROTFill, M("TP_ROTATE_FILL")+' '+M("GENERAL_DISABLED"));
}
}
void Rotate::setBatchMode (bool batchMode) { void Rotate::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode); ToolPanel::setBatchMode (batchMode);
degree->showEditedCB (); degree->showEditedCB ();
removeIfThere (this, autoCrop);
} }
void Rotate::setAdjusterBehavior (bool brotadd) { void Rotate::setAdjusterBehavior (bool brotadd) {

View File

@@ -22,25 +22,15 @@
#include <gtkmm.h> #include <gtkmm.h>
#include <adjuster.h> #include <adjuster.h>
#include <toolpanel.h> #include <toolpanel.h>
#include <lensgeomlistener.h>
class RotateListener {
public:
virtual void straightenRequested () {}
virtual void autoCropRequested () {}
};
class Rotate : public Gtk::VBox, public AdjusterListener, public ToolPanel { class Rotate : public Gtk::VBox, public AdjusterListener, public ToolPanel {
protected: protected:
Adjuster* degree; Adjuster* degree;
Gtk::Button* selectStraight; Gtk::Button* selectStraight;
Gtk::Button* autoCrop; LensGeomListener* rlistener;
RotateListener* rlistener;
Gtk::CheckButton* fill;
bool degAdd; bool degAdd;
bool lastFill;
sigc::connection fillConn;
public: public:
@@ -56,9 +46,7 @@ class Rotate : public Gtk::VBox, public AdjusterListener, public ToolPanel {
void adjusterChanged (Adjuster* a, double newval); void adjusterChanged (Adjuster* a, double newval);
void setAdjusterBehavior (bool brotadd); void setAdjusterBehavior (bool brotadd);
void selectStraightPressed (); void selectStraightPressed ();
void fillPressed (); void setLensGeomListener (LensGeomListener* l) { rlistener = l; }
void autoCropPressed ();
void setRotateListener (RotateListener* l) { rlistener = l; }
}; };
#endif #endif

View File

@@ -39,10 +39,12 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
lcurve = Gtk::manage (new LCurve ()); lcurve = Gtk::manage (new LCurve ());
colorboost = Gtk::manage (new ColorBoost ()); colorboost = Gtk::manage (new ColorBoost ());
colorshift = Gtk::manage (new ColorShift ()); colorshift = Gtk::manage (new ColorShift ());
lensgeom = Gtk::manage (new LensGeometry ());
distortion = Gtk::manage (new Distortion ()); distortion = Gtk::manage (new Distortion ());
rotate = Gtk::manage (new Rotate ()); rotate = Gtk::manage (new Rotate ());
whitebalance = Gtk::manage (new WhiteBalance ()); whitebalance = Gtk::manage (new WhiteBalance ());
vignetting = Gtk::manage (new Vignetting ()); vignetting = Gtk::manage (new Vignetting ());
perspective = Gtk::manage (new PerspCorrection ());
cacorrection = Gtk::manage (new CACorrection ()); cacorrection = Gtk::manage (new CACorrection ());
hlrecovery = Gtk::manage (new HLRecovery ()); hlrecovery = Gtk::manage (new HLRecovery ());
chmixer = Gtk::manage (new ChMixer ()); chmixer = Gtk::manage (new ChMixer ());
@@ -64,11 +66,13 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
addPanel (detailsPanel, lumadenoise, M("TP_LUMADENOISE_LABEL")); toolPanels.push_back (lumadenoise); addPanel (detailsPanel, lumadenoise, M("TP_LUMADENOISE_LABEL")); toolPanels.push_back (lumadenoise);
addPanel (detailsPanel, colordenoise, M("TP_COLORDENOISE_LABEL")); toolPanels.push_back (colordenoise); addPanel (detailsPanel, colordenoise, M("TP_COLORDENOISE_LABEL")); toolPanels.push_back (colordenoise);
addPanel (transformPanel, crop, M("TP_CROP_LABEL")); toolPanels.push_back (crop); addPanel (transformPanel, crop, M("TP_CROP_LABEL")); toolPanels.push_back (crop);
addPanel (transformPanel, rotate, M("TP_ROTATE_LABEL")); toolPanels.push_back (rotate);
addPanel (transformPanel, distortion, M("TP_DISTORTION_LABEL")); toolPanels.push_back (distortion);
addPanel (transformPanel, cacorrection, M("TP_CACORRECTION_LABEL")); toolPanels.push_back (cacorrection);
addPanel (transformPanel, vignetting, M("TP_VIGNETTING_LABEL")); toolPanels.push_back (vignetting);
addPanel (transformPanel, resize, M("TP_RESIZE_LABEL")); toolPanels.push_back (resize); addPanel (transformPanel, resize, M("TP_RESIZE_LABEL")); toolPanels.push_back (resize);
addPanel (transformPanel, lensgeom, M("TP_LENSGEOM_LABEL")); toolPanels.push_back (lensgeom);
addPanel (lensgeom->getPackBox(), rotate, M("TP_ROTATE_LABEL")); toolPanels.push_back (rotate);
addPanel (lensgeom->getPackBox(), perspective, M("TP_PERSPECTIVE_LABEL")); toolPanels.push_back (perspective);
addPanel (lensgeom->getPackBox(), distortion, M("TP_DISTORTION_LABEL")); toolPanels.push_back (distortion);
addPanel (lensgeom->getPackBox(), cacorrection, M("TP_CACORRECTION_LABEL")); toolPanels.push_back (cacorrection);
addPanel (lensgeom->getPackBox(), vignetting, M("TP_VIGNETTING_LABEL")); toolPanels.push_back (vignetting);
addPanel (colorPanel, icm, M("TP_ICM_LABEL")); toolPanels.push_back (icm); addPanel (colorPanel, icm, M("TP_ICM_LABEL")); toolPanels.push_back (icm);
toolPanels.push_back (coarse); toolPanels.push_back (coarse);
@@ -110,7 +114,8 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
whitebalance->setWBProvider (this); whitebalance->setWBProvider (this);
whitebalance->setSpotWBListener (this); whitebalance->setSpotWBListener (this);
rotate->setRotateListener (this); lensgeom->setLensGeomListener (this);
rotate->setLensGeomListener (this);
crop->setCropPanelListener (this); crop->setCropPanelListener (this);
icm->setICMPanelListener (this); icm->setICMPanelListener (this);

View File

@@ -45,16 +45,20 @@
#include <colorshift.h> #include <colorshift.h>
#include <cacorrection.h> #include <cacorrection.h>
#include <distortion.h> #include <distortion.h>
#include <perspective.h>
#include <rotate.h> #include <rotate.h>
#include <vignetting.h> #include <vignetting.h>
#include <toolbar.h> #include <toolbar.h>
#include <lensgeom.h>
#include <lensgeomlistener.h>
class ImageEditorCoordinator; class ImageEditorCoordinator;
class ToolPanelCoordinator : public ToolPanelListener, class ToolPanelCoordinator : public ToolPanelListener,
public ProfileChangeListener, public ProfileChangeListener,
public WBProvider, public WBProvider,
public RotateListener, public LensGeomListener,
public SpotWBListener, public SpotWBListener,
public CropPanelListener, public CropPanelListener,
public ICMPanelListener, public ICMPanelListener,
@@ -64,8 +68,10 @@ class ToolPanelCoordinator : public ToolPanelListener,
WhiteBalance* whitebalance; WhiteBalance* whitebalance;
Vignetting* vignetting; Vignetting* vignetting;
LensGeometry* lensgeom;
Rotate* rotate; Rotate* rotate;
Distortion* distortion; Distortion* distortion;
PerspCorrection* perspective;
CACorrection* cacorrection; CACorrection* cacorrection;
ColorShift* colorshift; ColorShift* colorshift;
HLRecovery* hlrecovery; HLRecovery* hlrecovery;