diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85776d557..f94454b63 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,7 @@ The most useful feedback is based on the latest development code, and in the cas - Work in a new branch. Fork if necessary. - Keep branches small so that completed and working features can be merged into the "dev" branch often, and so that they can be abandoned if they head in the wrong direction. - Use C++11. +- To break header dependencies use forward declarations as much as possible. See [#5197](https://github.com/Beep6581/RawTherapee/pull/5197#issuecomment-468938190) for some tips. - The naming isn't homogeneous throughout the code but here is a rough guideline: - *Identifiers* (variables, functions, methods, keys, enums, etc.) should be clear and unambiguous. Make them as long as necessary to ensure that your code is understandable to others. - *Types* (classes, structs, enums, typedefs...) should be named with `UpperCamelCase`. diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 2a1a9fcb4..4e62e1c1f 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -38,6 +38,7 @@ #include "cplx_wavelet_dec.h" #include "median.h" #include "iccstore.h" +#include "procparams.h" #ifdef _OPENMP #include #endif diff --git a/rtengine/PF_correct_RT.cc b/rtengine/PF_correct_RT.cc index 57e4c2225..fe89a7b65 100644 --- a/rtengine/PF_correct_RT.cc +++ b/rtengine/PF_correct_RT.cc @@ -36,6 +36,7 @@ #include "median.h" #include "jaggedarray.h" #include "StopWatch.h" +#include "procparams.h" namespace rtengine { diff --git a/rtengine/ahd_demosaic_RT.cc b/rtengine/ahd_demosaic_RT.cc index 7931bf17d..d67c7b76b 100644 --- a/rtengine/ahd_demosaic_RT.cc +++ b/rtengine/ahd_demosaic_RT.cc @@ -27,6 +27,7 @@ #include "rtengine.h" #include "rawimagesource.h" #include "rt_math.h" +#include "procparams.h" #include "../rtgui/multilangmgr.h" #include "median.h" //#define BENCHMARK @@ -223,4 +224,4 @@ void RawImageSource::ahd_demosaic() } #undef TS -} \ No newline at end of file +} diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index fc36ff8b5..2b9775ac0 100644 --- a/rtengine/amaze_demosaic_RT.cc +++ b/rtengine/amaze_demosaic_RT.cc @@ -33,6 +33,7 @@ #include "sleef.c" #include "opthelper.h" #include "median.h" +#include "procparams.h" #include "StopWatch.h" namespace rtengine diff --git a/rtengine/clutstore.cc b/rtengine/clutstore.cc index 1a425d21b..9ee976907 100644 --- a/rtengine/clutstore.cc +++ b/rtengine/clutstore.cc @@ -5,6 +5,7 @@ #include "iccstore.h" #include "imagefloat.h" #include "opthelper.h" +#include "procparams.h" #include "rt_math.h" #include "stdimagesource.h" diff --git a/rtengine/curves.h b/rtengine/curves.h index 0d5e6374b..deed5d0fe 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -30,7 +30,6 @@ #include "../rtgui/myflatcurve.h" #include "../rtgui/mydiagonalcurve.h" #include "color.h" -#include "procparams.h" #include "pipettebuffer.h" #include "LUT.h" diff --git a/rtengine/dcp.h b/rtengine/dcp.h index bedc7f76d..dc6915d26 100644 --- a/rtengine/dcp.h +++ b/rtengine/dcp.h @@ -48,7 +48,7 @@ public: private: struct Data; - std::unique_ptr data; + const std::unique_ptr data; friend class DCPProfile; }; diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index e49e03329..0872049d8 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -17,9 +17,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "dcrop.h" #include "curves.h" +#include "dcrop.h" #include "mytime.h" +#include "procparams.h" #include "refreshmap.h" #include "rt_math.h" @@ -131,7 +132,7 @@ void Crop::update(int todo) { MyMutex::MyLock cropLock(cropMutex); - ProcParams& params = parent->params; + ProcParams& params = *parent->params; // CropGUIListener* cropgl; // No need to update todo here, since it has already been changed in ImprocCoordinator::updatePreviewImage, @@ -1116,7 +1117,7 @@ void Crop::freeAll() namespace { -bool check_need_larger_crop_for_lcp_distortion(int fw, int fh, int x, int y, int w, int h, const ProcParams ¶ms) +bool check_need_larger_crop_for_lcp_distortion(int fw, int fh, int x, int y, int w, int h, const procparams::ProcParams ¶ms) { if (x == 0 && y == 0 && w == fw && h == fh) { return false; @@ -1177,7 +1178,7 @@ bool Crop::setCropSizes(int rcx, int rcy, int rcw, int rch, int skip, bool inter parent->ipf.transCoord(parent->fw, parent->fh, bx1, by1, bw, bh, orx, ory, orw, orh); - if (check_need_larger_crop_for_lcp_distortion(parent->fw, parent->fh, orx, ory, orw, orh, parent->params)) { + if (check_need_larger_crop_for_lcp_distortion(parent->fw, parent->fh, orx, ory, orw, orh, *parent->params)) { // TODO - this is an estimate of the max distortion relative to the image size. ATM it is hardcoded to be 15%, which seems enough. If not, need to revise int dW = int (double (parent->fw) * 0.15 / (2 * skip)); int dH = int (double (parent->fh) * 0.15 / (2 * skip)); diff --git a/rtengine/dual_demosaic_RT.cc b/rtengine/dual_demosaic_RT.cc index d7f3a4c14..4873ee670 100644 --- a/rtengine/dual_demosaic_RT.cc +++ b/rtengine/dual_demosaic_RT.cc @@ -27,6 +27,7 @@ #include "rtengine.h" #include "rawimagesource.h" #include "rt_math.h" +#include "procparams.h" //#define BENCHMARK #include "StopWatch.h" #include "rt_algo.h" diff --git a/rtengine/gamutwarning.h b/rtengine/gamutwarning.h index be6d7b61b..19a27cdfd 100644 --- a/rtengine/gamutwarning.h +++ b/rtengine/gamutwarning.h @@ -31,6 +31,8 @@ namespace rtengine { +enum RenderingIntent : int; + class GamutWarning: public NonCopyable { public: GamutWarning(cmsHPROFILE iprof, cmsHPROFILE gamutprof, RenderingIntent intent, bool bpc); diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index 1b6dd133f..614e5368a 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -24,6 +24,7 @@ #include "color.h" #include "rt_math.h" #include "iccstore.h" +#include "procparams.h" #include "../rtgui/mydiagonalcurve.h" #include "improcfun.h" //#define BENCHMARK @@ -248,7 +249,7 @@ void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, st && a.dcpIlluminant == b.dcpIlluminant); }; - if (!histMatchingCache.empty() && same_profile(histMatchingParams, cp)) { + if (!histMatchingCache.empty() && same_profile(*histMatchingParams, cp)) { if (settings->verbose) { std::cout << "tone curve found in cache" << std::endl; } @@ -286,14 +287,14 @@ void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, st std::cout << "histogram matching: no thumbnail found, generating a neutral curve" << std::endl; } histMatchingCache = outCurve; - histMatchingParams = cp; + *histMatchingParams = cp; return; } else if (w * 10 < fw) { if (settings->verbose) { std::cout << "histogram matching: the embedded thumbnail is too small: " << w << "x" << h << std::endl; } histMatchingCache = outCurve; - histMatchingParams = cp; + *histMatchingParams = cp; return; } skip = LIM(skip * fh / h, 6, 10); // adjust the skip factor -- the larger the thumbnail, the less we should skip to get a good match @@ -316,7 +317,7 @@ void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, st std::cout << "histogram matching: raw decoding failed, generating a neutral curve" << std::endl; } histMatchingCache = outCurve; - histMatchingParams = cp; + *histMatchingParams = cp; return; } target.reset(thumb->processImage(neutral, sensor_type, fh / skip, TI_Nearest, getMetaData(), scale, false, true)); @@ -388,7 +389,7 @@ void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, st } histMatchingCache = outCurve; - histMatchingParams = cp; + *histMatchingParams = cp; } } // namespace rtengine diff --git a/rtengine/hphd_demosaic_RT.cc b/rtengine/hphd_demosaic_RT.cc index 5c15469ca..1d9aa0dd0 100644 --- a/rtengine/hphd_demosaic_RT.cc +++ b/rtengine/hphd_demosaic_RT.cc @@ -23,6 +23,7 @@ #include "jaggedarray.h" #include "rawimage.h" #include "rt_math.h" +#include "procparams.h" #include "../rtgui/multilangmgr.h" #include "opthelper.h" //#define BENCHMARK diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index b0248456a..268a6b1c2 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -32,7 +32,6 @@ #include "iccstore.h" #include "iccmatrices.h" -#include "procparams.h" #include "../rtgui/options.h" #include "../rtgui/threadutils.h" diff --git a/rtengine/iimage.cc b/rtengine/iimage.cc index adda06162..c9a4f223a 100644 --- a/rtengine/iimage.cc +++ b/rtengine/iimage.cc @@ -17,6 +17,7 @@ * along with RawTherapee. If not, see . */ +#include "procparams.h" #include "rtengine.h" const char rtengine::sImage8[] = "Image8"; diff --git a/rtengine/iimage.h b/rtengine/iimage.h index 3b518e223..a67c2051e 100644 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -26,7 +26,6 @@ #include "imagedimensions.h" #include "LUT.h" #include "coord2d.h" -#include "procparams.h" #include "color.h" #include "../rtgui/threadutils.h" @@ -43,12 +42,21 @@ namespace rtengine { +namespace procparams +{ + +struct CoarseTransformParams; + +} + +class ProgressListener; +class Color; + extern const char sImage8[]; extern const char sImage16[]; extern const char sImagefloat[]; -int getCoarseBitMask( const procparams::CoarseTransformParams &coarse); -class ProgressListener; -class Color; + +int getCoarseBitMask(const procparams::CoarseTransformParams& coarse); enum TypeInterpolation { TI_Nearest, TI_Bilinear }; diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index a7d2d157f..99df5083e 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -25,6 +25,8 @@ #include "iptcpairs.h" #include "imagesource.h" #include "rt_math.h" +#include "procparams.h" + #pragma GCC diagnostic warning "-Wextra" #define PRINT_HDR_PS_DETECTION 0 diff --git a/rtengine/imagedata.h b/rtengine/imagedata.h index 7aa4812d0..c6889e653 100644 --- a/rtengine/imagedata.h +++ b/rtengine/imagedata.h @@ -25,7 +25,6 @@ #include #include #include "../rtexif/rtexif.h" -#include "procparams.h" #include #include "rtengine.h" diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc index 74233741c..d98a817a2 100644 --- a/rtengine/imagefloat.cc +++ b/rtengine/imagefloat.cc @@ -27,6 +27,7 @@ #include "alignedbuffer.h" #include "rt_math.h" #include "color.h" +#include "procparams.h" using namespace rtengine; diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 76a6417ff..f1fa8dbef 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -26,6 +26,7 @@ #include #include #include "rt_math.h" +#include "procparams.h" #include "../rtgui/options.h" #include "../rtgui/version.h" @@ -103,8 +104,8 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr { // store exif info - exifChange.clear(); - exifChange = exif; + exifChange->clear(); + *exifChange = exif; if (exifRoot != nullptr) { delete exifRoot; @@ -185,6 +186,22 @@ void ImageIO::setOutputProfile (const char* pdata, int plen) profileLength = plen; } +ImageIO::ImageIO() : + pl(nullptr), + embProfile(nullptr), + profileData(nullptr), + profileLength(0), + loadedProfileData(nullptr), + loadedProfileDataJpg(false), + loadedProfileLength(0), + exifChange(new procparams::ExifPairs), + iptc(nullptr), + exifRoot(nullptr), + sampleFormat(IIOSF_UNKNOWN), + sampleArrangement(IIOSA_UNKNOWN) +{ +} + ImageIO::~ImageIO () { @@ -1055,7 +1072,7 @@ int ImageIO::savePNG (const Glib::ustring &fname, int bps) const iptcdata = nullptr; } - int size = rtexif::ExifManager::createPNGMarker(exifRoot, exifChange, width, height, bps, (char*)iptcdata, iptclen, buffer, bufferSize); + int size = rtexif::ExifManager::createPNGMarker(exifRoot, *exifChange, width, height, bps, (char*)iptcdata, iptclen, buffer, bufferSize); if (iptcdata) { iptc_data_free_buf (iptc, iptcdata); @@ -1205,7 +1222,7 @@ int ImageIO::saveJPEG (const Glib::ustring &fname, int quality, int subSamp) con // assemble and write exif marker if (exifRoot) { - int size = rtexif::ExifManager::createJPEGMarker (exifRoot, exifChange, cinfo.image_width, cinfo.image_height, buffer); + int size = rtexif::ExifManager::createJPEGMarker (exifRoot, *exifChange, cinfo.image_width, cinfo.image_height, buffer); if (size > 0 && size < 65530) { jpeg_write_marker(&cinfo, JPEG_APP0 + 1, buffer, size); @@ -1361,7 +1378,7 @@ int ImageIO::saveTIFF (const Glib::ustring &fname, int bps, bool isFloat, bool u // ------------------ Apply list of change ----------------- - for (auto currExifChange : exifChange) { + for (auto currExifChange : *exifChange) { cl->applyChange (currExifChange.first, currExifChange.second); } diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 60bf6bc43..05a11655a 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -28,11 +28,12 @@ #define IMIO_FILETYPENOTSUPPORTED 6 #define IMIO_CANNOTWRITEFILE 7 +#include + #include #include #include "rtengine.h" #include "imageformat.h" -#include "procparams.h" #include "../rtexif/rtexif.h" #include "imagedimensions.h" #include "iimage.h" @@ -55,7 +56,7 @@ protected: char* loadedProfileData; bool loadedProfileDataJpg; int loadedProfileLength; - procparams::ExifPairs exifChange; + const std::unique_ptr exifChange; IptcData* iptc; const rtexif::TagDirectory* exifRoot; MyMutex imutex; @@ -68,11 +69,8 @@ private: public: static Glib::ustring errorMsg[6]; - ImageIO () : pl (nullptr), embProfile(nullptr), profileData(nullptr), profileLength(0), loadedProfileData(nullptr), loadedProfileDataJpg(false), - loadedProfileLength(0), iptc(nullptr), exifRoot (nullptr), sampleFormat(IIOSF_UNKNOWN), - sampleArrangement(IIOSA_UNKNOWN) {} - - ~ImageIO () override; + ImageIO(); + ~ImageIO() override; void setProgressListener (ProgressListener* l); void setSampleFormat(IIOSampleFormat sFormat); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 6c39d8d42..a18cca9d7 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -23,7 +23,6 @@ #include #include "rtengine.h" #include "colortemp.h" -#include "procparams.h" #include "coord2d.h" #include "dcp.h" #include "LUT.h" @@ -35,7 +34,17 @@ namespace rtengine { -using namespace procparams; +namespace procparams +{ + +struct CoarseTransformParams; +struct ColorManagementParams; +struct LensProfParams; +struct RAWParams; +struct RetinexParams; +struct ToneCurveParams; + +} class ImageMatrices { @@ -67,14 +76,14 @@ public: ~ImageSource () override {} virtual int load (const Glib::ustring &fname) = 0; - virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse, bool prepareDenoise = true) {}; - virtual void demosaic (const RAWParams &raw, bool autoContrast, double &contrastThreshold) {}; - virtual void retinex (const ColorManagementParams& cmp, const RetinexParams &deh, const ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; - virtual void retinexPrepareCurves (const RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; - virtual void retinexPrepareBuffers (const ColorManagementParams& cmp, const RetinexParams &retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; + virtual void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) {}; + virtual void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold) {}; + virtual void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; + virtual void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; + virtual void retinexPrepareBuffers (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; - virtual void HLRecovery_Global (const ToneCurveParams &hrp) {}; + virtual void HLRecovery_Global (const procparams::ToneCurveParams &hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; virtual bool isRGBSourceModified () const = 0; // tracks whether cached rgb output of demosaic has been modified @@ -86,7 +95,7 @@ public: // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* - virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hlp, const RAWParams &raw) = 0; + virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hlp, const RAWParams &raw) = 0; virtual eSensorType getSensorType () const = 0; virtual bool isMono () const = 0; // true is ready to provide the AutoWB, i.e. when the image has been demosaiced for RawImageSource @@ -111,7 +120,7 @@ public: virtual ImageMatrices* getImageMatrices () = 0; virtual bool isRAW () const = 0; - virtual DCPProfile* getDCP (const ColorManagementParams &cmp, DCPProfile::ApplyState &as) + virtual DCPProfile* getDCP (const procparams::ColorManagementParams &cmp, DCPProfile::ApplyState &as) { return nullptr; }; @@ -140,7 +149,7 @@ public: } // for RAW files, compute a tone curve using histogram matching on the embedded thumbnail - virtual void getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector &outCurve) + virtual void getAutoMatchedToneCurve(const procparams::ColorManagementParams &cp, std::vector &outCurve) { outCurve = { 0.0 }; } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 6f0257064..ec047f853 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -24,6 +24,7 @@ #include "colortemp.h" #include "improcfun.h" #include "iccstore.h" +#include "procparams.h" #include #include #include @@ -36,70 +37,121 @@ namespace rtengine extern const Settings* settings; -ImProcCoordinator::ImProcCoordinator() - : orig_prev(nullptr), oprevi(nullptr), oprevl(nullptr), nprevl(nullptr), fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr), - ncie (nullptr), imgsrc (nullptr), lastAwbEqual (0.), lastAwbTempBias (0.0), ipf (¶ms, true), monitorIntent (RI_RELATIVE), - softProof(false), gamutCheck(false), sharpMask(false), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false), - allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN), +ImProcCoordinator::ImProcCoordinator() : + orig_prev(nullptr), + oprevi(nullptr), + oprevl(nullptr), + nprevl(nullptr), + fattal_11_dcrop_cache(nullptr), + previmg(nullptr), + workimg(nullptr), + ncie (nullptr), + imgsrc (nullptr), + lastAwbEqual (0.), + lastAwbTempBias (0.0), + monitorIntent (RI_RELATIVE), + softProof(false), + gamutCheck(false), + sharpMask(false), + scale(10), + highDetailPreprocessComputed(false), + highDetailRawComputed(false), + allocated(false), + bwAutoR(-9000.f), + bwAutoG(-9000.f), + bwAutoB(-9000.f), + CAMMean(NAN), + hltonecurve(65536), + shtonecurve(65536), + tonecurve(65536, 0), //,1); + lumacurve(32770, 0), // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation + chroma_acurve(65536, 0), + chroma_bcurve(65536, 0), + satcurve(65536, 0), + lhskcurve(65536, 0), + clcurve(65536, 0), + conversionBuffer(1, 1), + wavclCurve(65536, 0), + clToningcurve(65536, 0), + cl2Toningcurve(65536, 0), + Noisecurve(65536, 0), + NoiseCCcurve(65536, 0), + vhist16(65536), vhist16bw(65536), + lhist16CAM(65536), + lhist16CCAM(65536), + lhist16RETI(), + lhist16LClad(65536), + histRed(256), histRedRaw(256), + histGreen(256), histGreenRaw(256), + histBlue(256), histBlueRaw(256), + histLuma(256), + histToneCurve(256), + histToneCurveBW(256), + histLCurve(256), + histCCurve(256), + histLLCurve(256), - hltonecurve(65536), - shtonecurve(65536), - tonecurve(65536, 0), //,1); - lumacurve(32770, 0), // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation - chroma_acurve(65536, 0), - chroma_bcurve(65536, 0), - satcurve(65536, 0), - lhskcurve(65536, 0), - clcurve(65536, 0), - conversionBuffer(1, 1), - wavclCurve(65536, 0), - clToningcurve(65536, 0), - cl2Toningcurve(65536, 0), - Noisecurve(65536, 0), - NoiseCCcurve(65536, 0), - vhist16(65536), vhist16bw(65536), - lhist16CAM(65536), - lhist16CCAM(65536), - lhist16RETI(), - lhist16LClad(65536), - histRed(256), histRedRaw(256), - histGreen(256), histGreenRaw(256), - histBlue(256), histBlueRaw(256), - histLuma(256), - histToneCurve(256), - histToneCurveBW(256), - histLCurve(256), - histCCurve(256), - histLLCurve(256), + histLCAM(256), + histCCAM(256), + histClad(256), + bcabhist(256), + histChroma(256), - histLCAM(256), - histCCAM(256), - histClad(256), - bcabhist(256), - histChroma(256), + histLRETI(256), - histLRETI(256), + CAMBrightCurveJ(), CAMBrightCurveQ(), - CAMBrightCurveJ(), CAMBrightCurveQ(), - - rCurve(), - gCurve(), - bCurve(), - ctColorCurve(), - rcurvehist(256), rcurvehistCropped(256), rbeforehist(256), - gcurvehist(256), gcurvehistCropped(256), gbeforehist(256), - bcurvehist(256), bcurvehistCropped(256), bbeforehist(256), - fw(0), fh(0), tr(0), - fullw(1), fullh(1), - pW(-1), pH(-1), - plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), flatFieldAutoClipListener(nullptr), bayerAutoContrastListener(nullptr), xtransAutoContrastListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr), - resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), - butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), wavcontlutili(false), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), highQualityComputed(false), customTransformIn(nullptr), customTransformOut(nullptr) -{} - -void ImProcCoordinator::assign(ImageSource* imgsrc) + rCurve(), + gCurve(), + bCurve(), + ctColorCurve(), + rcurvehist(256), rcurvehistCropped(256), rbeforehist(256), + gcurvehist(256), gcurvehistCropped(256), gbeforehist(256), + bcurvehist(256), bcurvehistCropped(256), bbeforehist(256), + fw(0), fh(0), tr(0), + fullw(1), fullh(1), + pW(-1), pH(-1), + plistener(nullptr), + imageListener(nullptr), + aeListener(nullptr), + acListener(nullptr), + abwListener(nullptr), + awbListener(nullptr), + flatFieldAutoClipListener(nullptr), + bayerAutoContrastListener(nullptr), + xtransAutoContrastListener(nullptr), + frameCountListener(nullptr), + imageTypeListener(nullptr), + actListener(nullptr), + adnListener(nullptr), + awavListener(nullptr), + dehaListener(nullptr), + hListener(nullptr), + resultValid(false), + params(new procparams::ProcParams), + lastOutputProfile("BADFOOD"), + lastOutputIntent(RI__COUNT), + lastOutputBPC(false), + thread(nullptr), + changeSinceLast(0), + updaterRunning(false), + nextParams(new procparams::ProcParams), + destroying(false), + utili(false), + autili(false), + butili(false), + ccutili(false), + cclutili(false), + clcutili(false), + opautili(false), + wavcontlutili(false), + colourToningSatLimit(0.f), + colourToningSatLimitOpacity(0.f), + highQualityComputed(false), + customTransformIn(nullptr), + customTransformOut(nullptr), + ipf(params.get(), true) { - this->imgsrc = imgsrc; } ImProcCoordinator::~ImProcCoordinator() @@ -142,6 +194,16 @@ ImProcCoordinator::~ImProcCoordinator() updaterThreadStart.unlock(); } +void ImProcCoordinator::assign(ImageSource* imgsrc) +{ + this->imgsrc = imgsrc; +} + +void ImProcCoordinator::getParams(procparams::ProcParams* dst) +{ + *dst = *params; +} + DetailedCrop* ImProcCoordinator::createCrop(::EditDataProvider *editDataProvider, bool isDetailWindow) { @@ -177,9 +239,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) todo |= TRANSFORM; // Change about Crop does affect TRANSFORM } - RAWParams rp = params.raw; - ColorManagementParams cmp = params.icm; - LCurveParams lcur = params.labCurve; + RAWParams rp = params->raw; + ColorManagementParams cmp = params->icm; + LCurveParams lcur = params->labCurve; if (!highDetailNeeded) { // if below 100% magnification, take a fast path @@ -201,14 +263,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) progress("Applying white balance, color correction & sRGB conversion...", 100 * readyphase / numofphases); if (frameCountListener) { - frameCountListener->FrameCountChanged(imgsrc->getFrameCount(), params.raw.bayersensor.imageNum); + frameCountListener->FrameCountChanged(imgsrc->getFrameCount(), params->raw.bayersensor.imageNum); } // raw auto CA is bypassed if no high detail is needed, so we have to compute it when high detail is needed if ((todo & M_PREPROC) || (!highDetailPreprocessComputed && highDetailNeeded)) { - imgsrc->setCurrentFrame(params.raw.bayersensor.imageNum); + imgsrc->setCurrentFrame(params->raw.bayersensor.imageNum); - imgsrc->preprocess(rp, params.lensProf, params.coarse); + imgsrc->preprocess(rp, params->lensProf, params->coarse); if (flatFieldAutoClipListener && rp.ff_AutoClipControl) { flatFieldAutoClipListener->flatFieldAutoClipValueChanged(imgsrc->getFlatFieldAutoClipValue()); } @@ -235,8 +297,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if ((todo & M_RAW) || (!highDetailRawComputed && highDetailNeeded) - || (params.toneCurve.hrenabled && params.toneCurve.method != "Color" && imgsrc->isRGBSourceModified()) - || (!params.toneCurve.hrenabled && params.toneCurve.method == "Color" && imgsrc->isRGBSourceModified())) { + || (params->toneCurve.hrenabled && params->toneCurve.method != "Color" && imgsrc->isRGBSourceModified()) + || (!params->toneCurve.hrenabled && params->toneCurve.method == "Color" && imgsrc->isRGBSourceModified())) { if (settings->verbose) { if (imgsrc->getSensorType() == ST_BAYER) { @@ -246,16 +308,16 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } } if(imgsrc->getSensorType() == ST_BAYER) { - if(params.raw.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { - imgsrc->setBorder(params.raw.bayersensor.border); + if(params->raw.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { + imgsrc->setBorder(params->raw.bayersensor.border); } else { - imgsrc->setBorder(std::max(params.raw.bayersensor.border, 2)); + imgsrc->setBorder(std::max(params->raw.bayersensor.border, 2)); } } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { - imgsrc->setBorder(params.raw.xtranssensor.border); + imgsrc->setBorder(params->raw.xtranssensor.border); } - bool autoContrast = imgsrc->getSensorType() == ST_BAYER ? params.raw.bayersensor.dualDemosaicAutoContrast : params.raw.xtranssensor.dualDemosaicAutoContrast; - double contrastThreshold = imgsrc->getSensorType() == ST_BAYER ? params.raw.bayersensor.dualDemosaicContrast : params.raw.xtranssensor.dualDemosaicContrast; + bool autoContrast = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicAutoContrast : params->raw.xtranssensor.dualDemosaicAutoContrast; + double contrastThreshold = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicContrast : params->raw.xtranssensor.dualDemosaicContrast; imgsrc->demosaic(rp, autoContrast, contrastThreshold); //enabled demosaic if (imgsrc->getSensorType() == ST_BAYER && bayerAutoContrastListener && autoContrast) { @@ -274,24 +336,24 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) highDetailRawComputed = false; } - if (params.retinex.enabled) { + if (params->retinex.enabled) { lhist16RETI(32768); lhist16RETI.clear(); - imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, lhist16RETI); + imgsrc->retinexPrepareBuffers(params->icm, params->retinex, conversionBuffer, lhist16RETI); } } - if ((todo & (M_RETINEX | M_INIT)) && params.retinex.enabled) { + if ((todo & (M_RETINEX | M_INIT)) && params->retinex.enabled) { bool dehacontlutili = false; bool mapcontlutili = false; bool useHsl = false; LUTf cdcurve(65536, 0); LUTf mapcurve(65536, 0); - imgsrc->retinexPrepareCurves(params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, lhist16RETI, histLRETI); + imgsrc->retinexPrepareCurves(params->retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, lhist16RETI, histLRETI); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex(params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI); //enabled Retinex + imgsrc->retinex(params->icm, params->retinex, params->toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI); //enabled Retinex if (dehaListener) { dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); @@ -301,32 +363,32 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (todo & (M_INIT | M_LINDENOISE | M_HDR)) { MyMutex::MyLock initLock(minit); // Also used in crop window - imgsrc->HLRecovery_Global(params.toneCurve); // this handles Color HLRecovery + imgsrc->HLRecovery_Global(params->toneCurve); // this handles Color HLRecovery if (settings->verbose) { printf("Applying white balance, color correction & sRBG conversion...\n"); } - currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + currWB = ColorTemp(params->wb.temperature, params->wb.green, params->wb.equal, params->wb.method); - if (!params.wb.enabled) { + if (!params->wb.enabled) { currWB = ColorTemp(); - } else if (params.wb.method == "Camera") { + } else if (params->wb.method == "Camera") { currWB = imgsrc->getWB(); - } else if (params.wb.method == "Auto") { - if (lastAwbEqual != params.wb.equal || lastAwbTempBias != params.wb.tempBias) { + } else if (params->wb.method == "Auto") { + if (lastAwbEqual != params->wb.equal || lastAwbTempBias != params->wb.tempBias) { double rm, gm, bm; imgsrc->getAutoWBMultipliers(rm, gm, bm); if (rm != -1.) { - autoWB.update(rm, gm, bm, params.wb.equal, params.wb.tempBias); - lastAwbEqual = params.wb.equal; - lastAwbTempBias = params.wb.tempBias; + autoWB.update(rm, gm, bm, params->wb.equal, params->wb.tempBias); + lastAwbEqual = params->wb.equal; + lastAwbTempBias = params->wb.tempBias; } else { lastAwbEqual = -1.; lastAwbTempBias = 0.0; - autoWB.useDefaults(params.wb.equal); + autoWB.useDefaults(params->wb.equal); } //double rr,gg,bb; @@ -336,19 +398,19 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) currWB = autoWB; } - if (params.wb.enabled) { - params.wb.temperature = currWB.getTemp(); - params.wb.green = currWB.getGreen(); + if (params->wb.enabled) { + params->wb.temperature = currWB.getTemp(); + params->wb.green = currWB.getGreen(); } - if (params.wb.method == "Auto" && awbListener && params.wb.enabled) { - awbListener->WBChanged(params.wb.temperature, params.wb.green); + if (params->wb.method == "Auto" && awbListener && params->wb.enabled) { + awbListener->WBChanged(params->wb.temperature, params->wb.green); } /* GammaValues g_a; - double pwr = 1.0 / params.icm.gampos; - double ts = params.icm.slpos; + double pwr = 1.0 / params->icm.gampos; + double ts = params->icm.slpos; int mode = 0; @@ -369,7 +431,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } fou.close(); */ - int tr = getCoarseBitMask(params.coarse); + int tr = getCoarseBitMask(params->coarse); imgsrc->getFullSize(fw, fh, tr); @@ -379,13 +441,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // Tells to the ImProcFunctions' tools what is the preview scale, which may lead to some simplifications ipf.setScale(scale); - imgsrc->getImage(currWB, tr, orig_prev, pp, params.toneCurve, params.raw); + imgsrc->getImage(currWB, tr, orig_prev, pp, params->toneCurve, params->raw); denoiseInfoStore.valid = false; //ColorTemp::CAT02 (orig_prev, ¶ms) ; // printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale); /* Issue 2785, disabled some 1:1 tools if (todo & M_LINDENOISE) { - DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise; + DirPyrDenoiseParams denoiseParams = params->dirpyrDenoise; if (denoiseParams.enabled && (scale==1)) { Imagefloat *calclum = NULL ; @@ -416,7 +478,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) calclum->b(ii>>1,jj>>1) = orig_prev->b(ii,jj); } } - imgsrc->convertColorSpace(calclum, params.icm, currWB);//calculate values after colorspace conversion + imgsrc->convertColorSpace(calclum, params->icm, currWB);//calculate values after colorspace conversion } int kall=1; @@ -424,14 +486,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } } */ - imgsrc->convertColorSpace(orig_prev, params.icm, currWB); + imgsrc->convertColorSpace(orig_prev, params->icm, currWB); - ipf.firstAnalysis(orig_prev, params, vhist16); + ipf.firstAnalysis(orig_prev, *params, vhist16); } readyphase++; - if ((todo & M_HDR) && (params.fattal.enabled || params.dehaze.enabled)) { + if ((todo & M_HDR) && (params->fattal.enabled || params->dehaze.enabled)) { if (fattal_11_dcrop_cache) { delete fattal_11_dcrop_cache; fattal_11_dcrop_cache = nullptr; @@ -451,7 +513,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // Remove transformation if unneeded bool needstransform = ipf.needsTransform(); - if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled))) { + if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled))) { assert(oprevi); Imagefloat *op = oprevi; oprevi = new Imagefloat(pW, pH); @@ -464,13 +526,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } } - if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { + if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled) { const int W = oprevi->getWidth(); const int H = oprevi->getHeight(); LabImage labcbdl(W, H); - ipf.rgb2lab(*oprevi, labcbdl, params.icm.workingProfile); + ipf.rgb2lab(*oprevi, labcbdl, params->icm.workingProfile); ipf.dirpyrequalizer(&labcbdl, scale); - ipf.lab2rgb(labcbdl, *oprevi, params.icm.workingProfile); + ipf.lab2rgb(labcbdl, *oprevi, params->icm.workingProfile); } readyphase++; @@ -479,37 +541,37 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) readyphase++; if (todo & M_AUTOEXP) { - if (params.toneCurve.autoexp) { + if (params->toneCurve.autoexp) { LUTu aehist; int aehistcompr; imgsrc->getAutoExpHistogram(aehist, aehistcompr); - ipf.getAutoExp(aehist, aehistcompr, params.toneCurve.clip, params.toneCurve.expcomp, - params.toneCurve.brightness, params.toneCurve.contrast, params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh); + ipf.getAutoExp(aehist, aehistcompr, params->toneCurve.clip, params->toneCurve.expcomp, + params->toneCurve.brightness, params->toneCurve.contrast, params->toneCurve.black, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh); if (aeListener) - aeListener->autoExpChanged(params.toneCurve.expcomp, params.toneCurve.brightness, params.toneCurve.contrast, - params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.hrenabled); + aeListener->autoExpChanged(params->toneCurve.expcomp, params->toneCurve.brightness, params->toneCurve.contrast, + params->toneCurve.black, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, params->toneCurve.hrenabled); } - if (params.toneCurve.histmatching) { - if (!params.toneCurve.fromHistMatching) { - imgsrc->getAutoMatchedToneCurve(params.icm, params.toneCurve.curve); + if (params->toneCurve.histmatching) { + if (!params->toneCurve.fromHistMatching) { + imgsrc->getAutoMatchedToneCurve(params->icm, params->toneCurve.curve); } - if (params.toneCurve.autoexp) { - params.toneCurve.expcomp = 0.0; + if (params->toneCurve.autoexp) { + params->toneCurve.expcomp = 0.0; } - params.toneCurve.autoexp = false; - params.toneCurve.curveMode = ToneCurveParams::TcMode::FILMLIKE; - params.toneCurve.curve2 = { 0 }; - params.toneCurve.brightness = 0; - params.toneCurve.contrast = 0; - params.toneCurve.black = 0; - params.toneCurve.fromHistMatching = true; + params->toneCurve.autoexp = false; + params->toneCurve.curveMode = ToneCurveMode::FILMLIKE; + params->toneCurve.curve2 = { 0 }; + params->toneCurve.brightness = 0; + params->toneCurve.contrast = 0; + params->toneCurve.black = 0; + params->toneCurve.fromHistMatching = true; if (aeListener) { - aeListener->autoMatchedToneCurveChanged(params.toneCurve.curveMode, params.toneCurve.curve); + aeListener->autoMatchedToneCurveChanged(params->toneCurve.curveMode, params->toneCurve.curve); } } } @@ -517,13 +579,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) progress("Exposure curve & CIELAB conversion...", 100 * readyphase / numofphases); if (todo & (M_AUTOEXP | M_RGBCURVE)) { - if (params.icm.workingTRC == "Custom") { //exec TRC IN free + if (params->icm.workingTRC == "Custom") { //exec TRC IN free if (oprevi == orig_prev) { oprevi = new Imagefloat(pW, pH); orig_prev->copyData(oprevi); } - const Glib::ustring profile = params.icm.workingProfile; + const Glib::ustring profile = params->icm.workingProfile; if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") { const int cw = oprevi->getWidth(); @@ -533,13 +595,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) cmsDeleteTransform(customTransformIn); customTransformIn = nullptr; } - ipf.workingtrc(oprevi, oprevi, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310, customTransformIn, true, false, true); + ipf.workingtrc(oprevi, oprevi, cw, ch, -5, params->icm.workingProfile, 2.4, 12.92310, customTransformIn, true, false, true); //adjust TRC if(customTransformOut) { cmsDeleteTransform(customTransformOut); customTransformOut = nullptr; } - ipf.workingtrc(oprevi, oprevi, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope, customTransformOut, false, true, true); + ipf.workingtrc(oprevi, oprevi, cw, ch, 5, params->icm.workingProfile, params->icm.workingTRCGamma, params->icm.workingTRCSlope, customTransformOut, false, true, true); } } } @@ -549,43 +611,43 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // if (hListener) oprevi->calcCroppedHistogram(params, scale, histCropped); //complexCurve also calculated pre-curves histogram depending on crop - CurveFactory::complexCurve(params.toneCurve.expcomp, params.toneCurve.black / 65535.0, - params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, - params.toneCurve.shcompr, params.toneCurve.brightness, params.toneCurve.contrast, - params.toneCurve.curve, params.toneCurve.curve2, + CurveFactory::complexCurve(params->toneCurve.expcomp, params->toneCurve.black / 65535.0, + params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, + params->toneCurve.shcompr, params->toneCurve.brightness, params->toneCurve.contrast, + params->toneCurve.curve, params->toneCurve.curve2, vhist16, hltonecurve, shtonecurve, tonecurve, histToneCurve, customToneCurve1, customToneCurve2, 1); - CurveFactory::RGBCurve(params.rgbCurves.rcurve, rCurve, 1); - CurveFactory::RGBCurve(params.rgbCurves.gcurve, gCurve, 1); - CurveFactory::RGBCurve(params.rgbCurves.bcurve, bCurve, 1); + CurveFactory::RGBCurve(params->rgbCurves.rcurve, rCurve, 1); + CurveFactory::RGBCurve(params->rgbCurves.gcurve, gCurve, 1); + CurveFactory::RGBCurve(params->rgbCurves.bcurve, bCurve, 1); opautili = false; - if (params.colorToning.enabled) { - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params.icm.workingProfile); + if (params->colorToning.enabled) { + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); double wp[3][3] = { {wprof[0][0], wprof[0][1], wprof[0][2]}, {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, opautili); - CurveFactory::curveToning(params.colorToning.clcurve, clToningcurve, scale == 1 ? 1 : 16); - CurveFactory::curveToning(params.colorToning.cl2curve, cl2Toningcurve, scale == 1 ? 1 : 16); + params->colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, opautili); + CurveFactory::curveToning(params->colorToning.clcurve, clToningcurve, scale == 1 ? 1 : 16); + CurveFactory::curveToning(params->colorToning.cl2curve, cl2Toningcurve, scale == 1 ? 1 : 16); } - if (params.blackwhite.enabled) { - CurveFactory::curveBW(params.blackwhite.beforeCurve, params.blackwhite.afterCurve, vhist16bw, histToneCurveBW, beforeToneCurveBW, afterToneCurveBW, 1); + if (params->blackwhite.enabled) { + CurveFactory::curveBW(params->blackwhite.beforeCurve, params->blackwhite.afterCurve, vhist16bw, histToneCurveBW, beforeToneCurveBW, afterToneCurveBW, 1); } - colourToningSatLimit = float (params.colorToning.satProtectionThreshold) / 100.f * 0.7f + 0.3f; - colourToningSatLimitOpacity = 1.f - (float (params.colorToning.saturatedOpacity) / 100.f); + colourToningSatLimit = float (params->colorToning.satProtectionThreshold) / 100.f * 0.7f + 0.3f; + colourToningSatLimitOpacity = 1.f - (float (params->colorToning.saturatedOpacity) / 100.f); int satTH = 80; int satPR = 30; int indi = 0; - if (params.colorToning.enabled && params.colorToning.autosat && params.colorToning.method != "LabGrid") { //for colortoning evaluation of saturation settings + if (params->colorToning.enabled && params->colorToning.autosat && params->colorToning.method != "LabGrid") { //for colortoning evaluation of saturation settings float moyS = 0.f; float eqty = 0.f; ipf.moyeqt(oprevi, moyS, eqty); //return image : mean saturation and standard dev of saturation @@ -609,21 +671,21 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) satPR = (int) 100.f * (moyS - 0.85f * eqty); } - if (actListener && params.colorToning.enabled) { - if (params.blackwhite.enabled && params.colorToning.autosat) { + if (actListener && params->colorToning.enabled) { + if (params->blackwhite.enabled && params->colorToning.autosat) { actListener->autoColorTonChanged(0, satTH, satPR); //hide sliders only if autosat indi = 0; } else { - if (params.colorToning.autosat) { - if (params.colorToning.method == "Lab") { + if (params->colorToning.autosat) { + if (params->colorToning.method == "Lab") { indi = 1; - } else if (params.colorToning.method == "RGBCurves") { + } else if (params->colorToning.method == "RGBCurves") { indi = 1; - } else if (params.colorToning.method == "RGBSliders") { + } else if (params->colorToning.method == "RGBSliders") { indi = 1; - } else if (params.colorToning.method == "Splico") { + } else if (params->colorToning.method == "Splico") { indi = 2; - } else if (params.colorToning.method == "Splitlr") { + } else if (params->colorToning.method == "Splitlr") { indi = 2; } } @@ -638,12 +700,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) double bbm = 33.; DCPProfile::ApplyState as; - DCPProfile *dcpProf = imgsrc->getDCP(params.icm, as); + DCPProfile *dcpProf = imgsrc->getDCP(params->icm, as); - ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params.toneCurve.saturation, - rCurve, gCurve, bCurve, colourToningSatLimit, colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, dcpProf, as, histToneCurve); + ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params->toneCurve.saturation, + rCurve, gCurve, bCurve, colourToningSatLimit, colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, dcpProf, as, histToneCurve); - if (params.blackwhite.enabled && params.blackwhite.autoc && abwListener) { + if (params->blackwhite.enabled && params->blackwhite.autoc && abwListener) { if (settings->verbose) { printf("ImProcCoordinator / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", bwAutoR, bwAutoG, bwAutoB); } @@ -651,7 +713,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) abwListener->BWChanged((float) rrm, (float) ggm, (float) bbm); } - if (params.colorToning.enabled && params.colorToning.autosat && actListener) { + if (params->colorToning.enabled && params->colorToning.autosat && actListener) { actListener->autoColorTonChanged(indi, (int) colourToningSatLimit, (int)colourToningSatLimitOpacity); //change sliders autosat } @@ -660,7 +722,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // compute L channel histogram int x1, y1, x2, y2; - params.crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); + params->crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); } readyphase++; @@ -693,15 +755,15 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) #ifdef _OPENMP static_cast(numThreads); // to silence cppcheck warning #endif - CurveFactory::complexLCurve(params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, lhist16, lumacurve, histLCurve, scale == 1 ? 1 : 16, utili); + CurveFactory::complexLCurve(params->labCurve.brightness, params->labCurve.contrast, params->labCurve.lcurve, lhist16, lumacurve, histLCurve, scale == 1 ? 1 : 16, utili); } if (todo & M_LUMACURVE) { - CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, scale == 1 ? 1 : 16); + CurveFactory::curveCL(clcutili, params->labCurve.clcurve, clcurve, scale == 1 ? 1 : 16); - CurveFactory::complexsgnCurve(autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, - params.labCurve.lccurve, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, scale == 1 ? 1 : 16); + CurveFactory::complexsgnCurve(autili, butili, ccutili, cclutili, params->labCurve.acurve, params->labCurve.bcurve, params->labCurve.cccurve, + params->labCurve.lccurve, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, scale == 1 ? 1 : 16); } if (todo & (M_LUMINANCE + M_COLOR)) { @@ -715,7 +777,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ipf.vibrance(nprevl); ipf.labColorCorrectionRegions(nprevl); - if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + if ((params->colorappearance.enabled && !params->colorappearance.tonecie) || (!params->colorappearance.enabled)) { ipf.EPDToneMap(nprevl, 5, scale); } @@ -724,29 +786,29 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) /* Issue 2785, disabled some 1:1 tools if (scale==1) { - if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)){ + if((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)){ progress ("Denoising luminance impulse...",100*readyphase/numofphases); ipf.impulsedenoise (nprevl); readyphase++; } - if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)){ + if((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)){ progress ("Defringing...",100*readyphase/numofphases); ipf.defringe (nprevl); readyphase++; } - if (params.sharpenEdge.enabled) { + if (params->sharpenEdge.enabled) { progress ("Edge sharpening...",100*readyphase/numofphases); ipf.MLsharpen (nprevl); readyphase++; } - if (params.sharpenMicro.enabled) { - if(( params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)){ + if (params->sharpenMicro.enabled) { + if(( params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)){ progress ("Microcontrast...",100*readyphase/numofphases); ipf.MLmicrocontrast (nprevl); readyphase++; } } - if(((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) && params.sharpening.enabled) { + if(((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)) && params->sharpening.enabled) { progress ("Sharpening...",100*readyphase/numofphases); float **buffer = new float*[pH]; @@ -762,8 +824,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } } */ - if (params.dirpyrequalizer.cbdlMethod == "aft") { - if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled))) { + if (params->dirpyrequalizer.cbdlMethod == "aft") { + if (((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled))) { progress("Pyramid wavelet...", 100 * readyphase / numofphases); ipf.dirpyrequalizer(nprevl, scale); //ipf.Lanczoslab (ip_wavelet(LabImage * lab, LabImage * dst, const procparams::EqualizerParams & eqparams), nprevl, 1.f/scale); @@ -773,12 +835,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) wavcontlutili = false; - //CurveFactory::curveWavContL ( wavcontlutili,params.wavelet.lcurve, wavclCurve, LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,int skip); - CurveFactory::curveWavContL(wavcontlutili, params.wavelet.wavclCurve, wavclCurve, scale == 1 ? 1 : 16); + //CurveFactory::curveWavContL ( wavcontlutili,params->wavelet.lcurve, wavclCurve, LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,int skip); + CurveFactory::curveWavContL(wavcontlutili, params->wavelet.wavclCurve, wavclCurve, scale == 1 ? 1 : 16); - if ((params.wavelet.enabled)) { - WaveletParams WaveParams = params.wavelet; + if ((params->wavelet.enabled)) { + WaveletParams WaveParams = params->wavelet; // WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY); WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); @@ -790,16 +852,16 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } ipf.softLight(nprevl); - - if (params.colorappearance.enabled) { + + if (params->colorappearance.enabled) { //L histo and Chroma histo for ciecam // histogram well be for Lab (Lch) values, because very difficult to do with J,Q, M, s, C int x1, y1, x2, y2; - params.crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); + params->crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); lhist16CAM.clear(); lhist16CCAM.clear(); - if (!params.colorappearance.datacie) { + if (!params->colorappearance.datacie) { for (int x = 0; x < pH; x++) for (int y = 0; y < pW; y++) { int pos = CLIP((int)(nprevl->L[x][y])); @@ -809,7 +871,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } } - CurveFactory::curveLightBrightColor(params.colorappearance.curve, params.colorappearance.curve2, params.colorappearance.curve3, + CurveFactory::curveLightBrightColor(params->colorappearance.curve, params->colorappearance.curve2, params->colorappearance.curve3, lhist16CAM, histLCAM, lhist16CCAM, histCCAM, customColCurve1, customColCurve2, customColCurve3, 1); @@ -818,9 +880,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (imgsrc->isRAW()) { if (imgsrc->getSensorType() == ST_BAYER) { - imgNum = rtengine::LIM(params.raw.bayersensor.imageNum, 0, metaData->getFrameCount() - 1); + imgNum = rtengine::LIM(params->raw.bayersensor.imageNum, 0, metaData->getFrameCount() - 1); } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { - //imgNum = rtengine::LIM(params.raw.xtranssensor.imageNum, 0, metaData->getFrameCount() - 1); + //imgNum = rtengine::LIM(params->raw.xtranssensor.imageNum, 0, metaData->getFrameCount() - 1); } } @@ -834,8 +896,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) adap = 2000.; } else { double E_V = fcomp + log2(double ((fnum * fnum) / fspeed / (fiso / 100.f))); - E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV - E_V += log2(params.raw.expos); // exposure raw white point ; log2 ==> linear to EV + E_V += params->toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV + E_V += log2(params->raw.expos); // exposure raw white point ; log2 ==> linear to EV adap = powf(2.f, E_V - 3.f); // cd / m2 // end calculation adaptation scene luminosity } @@ -847,11 +909,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ncie = new CieImage(pW, pH); } - if (!CAMBrightCurveJ && (params.colorappearance.algo == "JC" || params.colorappearance.algo == "JS" || params.colorappearance.algo == "ALL")) { + if (!CAMBrightCurveJ && (params->colorappearance.algo == "JC" || params->colorappearance.algo == "JS" || params->colorappearance.algo == "ALL")) { CAMBrightCurveJ(32768, 0); } - if (!CAMBrightCurveQ && (params.colorappearance.algo == "QM" || params.colorappearance.algo == "ALL")) { + if (!CAMBrightCurveQ && (params->colorappearance.algo == "QM" || params->colorappearance.algo == "ALL")) { CAMBrightCurveQ(32768, 0); } @@ -860,17 +922,17 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) CAMBrightCurveJ.dirty = true; CAMBrightCurveQ.dirty = true; - ipf.ciecam_02float(ncie, float (adap), pW, 2, nprevl, ¶ms, customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, yb, 1); + ipf.ciecam_02float(ncie, float (adap), pW, 2, nprevl, params.get(), customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, yb, 1); - if ((params.colorappearance.autodegree || params.colorappearance.autodegreeout) && acListener && params.colorappearance.enabled) { + if ((params->colorappearance.autodegree || params->colorappearance.autodegreeout) && acListener && params->colorappearance.enabled) { acListener->autoCamChanged(100.* (double)d, 100.* (double)dj); } - if (params.colorappearance.autoadapscen && acListener && params.colorappearance.enabled) { + if (params->colorappearance.autoadapscen && acListener && params->colorappearance.enabled) { acListener->adapCamChanged(adap); //real value of adapt scene } - if (params.colorappearance.autoybscen && acListener && params.colorappearance.enabled) { + if (params->colorappearance.autoybscen && acListener && params->colorappearance.enabled) { acListener->ybCamChanged((int) yb); //real value Yb scene } @@ -894,10 +956,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } // Update the monitor color transform if necessary - if ((todo & M_MONITOR) || (lastOutputProfile != params.icm.outputProfile) || lastOutputIntent != params.icm.outputIntent || lastOutputBPC != params.icm.outputBPC) { - lastOutputProfile = params.icm.outputProfile; - lastOutputIntent = params.icm.outputIntent; - lastOutputBPC = params.icm.outputBPC; + if ((todo & M_MONITOR) || (lastOutputProfile != params->icm.outputProfile) || lastOutputIntent != params->icm.outputIntent || lastOutputBPC != params->icm.outputBPC) { + lastOutputProfile = params->icm.outputProfile; + lastOutputIntent = params->icm.outputIntent; + lastOutputBPC = params->icm.outputBPC; ipf.updateColorProfiles(monitorProfile, monitorIntent, softProof, gamutCheck); } } @@ -920,7 +982,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // Computing the internal image for analysis, i.e. conversion from WCS->Output profile delete workimg; - workimg = ipf.lab2rgb(nprevl, 0, 0, pW, pH, params.icm); + workimg = ipf.lab2rgb(nprevl, 0, 0, pW, pH, params->icm); } catch (char * str) { progress("Error converting file...", 0); return; @@ -931,14 +993,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) resultValid = true; if (imageListener) { - imageListener->setImage(previmg, scale, params.crop); + imageListener->setImage(previmg, scale, params->crop); } } if (imageListener) // TODO: The WB tool should be advertised too in order to get the AutoWB's temp and green values { - imageListener->imageReady(params.crop); + imageListener->imageReady(params->crop); } readyphase++; @@ -1001,7 +1063,7 @@ void ImProcCoordinator::freeAll() void ImProcCoordinator::setScale(int prevscale) { - tr = getCoarseBitMask(params.coarse); + tr = getCoarseBitMask(params->coarse); int nW, nH; imgsrc->getFullSize(fw, fh, tr); @@ -1048,7 +1110,7 @@ void ImProcCoordinator::updateLRGBHistograms() { int x1, y1, x2, y2; - params.crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); + params->crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); #ifdef _OPENMP #pragma omp parallel sections @@ -1170,10 +1232,10 @@ void ImProcCoordinator::getSpotWB(int x, int y, int rect, double& temp, double& ipf.transCoord(fw, fh, points, red, green, blue); - int tr = getCoarseBitMask(params.coarse); + int tr = getCoarseBitMask(params->coarse); - ret = imgsrc->getSpotWB(red, green, blue, tr, params.wb.equal); - currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + ret = imgsrc->getSpotWB(red, green, blue, tr, params->wb.equal); + currWB = ColorTemp(params->wb.temperature, params->wb.green, params->wb.equal, params->wb.method); //double rr,gg,bb; //currWB.getMultipliers(rr,gg,bb); @@ -1195,11 +1257,11 @@ void ImProcCoordinator::getAutoCrop(double ratio, int &x, int &y, int &w, int &h LensCorrection *pLCPMap = nullptr; - if (params.lensProf.useLcp() && imgsrc->getMetaData()->getFocalLen() > 0) { - const std::shared_ptr pLCPProf = LCPStore::getInstance()->getProfile(params.lensProf.lcpFile); + if (params->lensProf.useLcp() && imgsrc->getMetaData()->getFocalLen() > 0) { + const std::shared_ptr pLCPProf = LCPStore::getInstance()->getProfile(params->lensProf.lcpFile); if (pLCPProf) pLCPMap = new LCPMapper(pLCPProf, imgsrc->getMetaData()->getFocalLen(), imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), - 0, false, params.lensProf.useDist, fullw, fullh, params.coarse, imgsrc->getRotateDegree()); + 0, false, params->lensProf.useDist, fullw, fullh, params->coarse, imgsrc->getRotateDegree()); } double fillscale = ipf.getTransformAutoFill(fullw, fullh, pLCPMap); @@ -1257,34 +1319,34 @@ void ImProcCoordinator::saveInputICCReference(const Glib::ustring& fname, bool a int fW, fH; - int tr = getCoarseBitMask(params.coarse); + int tr = getCoarseBitMask(params->coarse); imgsrc->getFullSize(fW, fH, tr); PreviewProps pp(0, 0, fW, fH, 1); - ProcParams ppar = params; + ProcParams ppar = *params; ppar.toneCurve.hrenabled = false; ppar.icm.inputProfile = "(none)"; Imagefloat* im = new Imagefloat(fW, fH); imgsrc->preprocess(ppar.raw, ppar.lensProf, ppar.coarse); double dummy = 0.0; imgsrc->demosaic(ppar.raw, false, dummy); - ColorTemp currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + ColorTemp currWB = ColorTemp(params->wb.temperature, params->wb.green, params->wb.equal, params->wb.method); - if (params.wb.method == "Camera") { + if (params->wb.method == "Camera") { currWB = imgsrc->getWB(); - } else if (params.wb.method == "Auto") { - if (lastAwbEqual != params.wb.equal || lastAwbTempBias != params.wb.tempBias) { + } else if (params->wb.method == "Auto") { + if (lastAwbEqual != params->wb.equal || lastAwbTempBias != params->wb.tempBias) { double rm, gm, bm; imgsrc->getAutoWBMultipliers(rm, gm, bm); if (rm != -1.) { - autoWB.update(rm, gm, bm, params.wb.equal, params.wb.tempBias); - lastAwbEqual = params.wb.equal; - lastAwbTempBias = params.wb.tempBias; + autoWB.update(rm, gm, bm, params->wb.equal, params->wb.tempBias); + lastAwbEqual = params->wb.equal; + lastAwbTempBias = params->wb.tempBias; } else { lastAwbEqual = -1.; lastAwbTempBias = 0.0; - autoWB.useDefaults(params.wb.equal); + autoWB.useDefaults(params->wb.equal); } } @@ -1306,12 +1368,12 @@ void ImProcCoordinator::saveInputICCReference(const Glib::ustring& fname, bool a im = trImg; } - if (params.crop.enabled) { - Imagefloat *tmpim = new Imagefloat(params.crop.w, params.crop.h); - int cx = params.crop.x; - int cy = params.crop.y; - int cw = params.crop.w; - int ch = params.crop.h; + if (params->crop.enabled) { + Imagefloat *tmpim = new Imagefloat(params->crop.w, params->crop.h); + int cx = params->crop.x; + int cy = params->crop.y; + int cw = params->crop.w; + int ch = params->crop.h; #ifdef _OPENMP #pragma omp parallel for #endif @@ -1342,7 +1404,7 @@ void ImProcCoordinator::saveInputICCReference(const Glib::ustring& fname, bool a } int imw, imh; - double tmpScale = ipf.resizeScale(¶ms, fW, fH, imw, imh); + double tmpScale = ipf.resizeScale(params.get(), fW, fH, imw, imh); if (tmpScale != 1.0) { Imagefloat* tempImage = new Imagefloat(imw, imh); @@ -1415,41 +1477,41 @@ void ImProcCoordinator::process() while (changeSinceLast) { const bool panningRelatedChange = - params.toneCurve != nextParams.toneCurve - || params.labCurve != nextParams.labCurve - || params.localContrast != nextParams.localContrast - || params.rgbCurves != nextParams.rgbCurves - || params.colorToning != nextParams.colorToning - || params.vibrance != nextParams.vibrance - || params.wb != nextParams.wb - || params.colorappearance != nextParams.colorappearance - || params.epd != nextParams.epd - || params.fattal != nextParams.fattal - || params.sh != nextParams.sh - || params.crop != nextParams.crop - || params.coarse != nextParams.coarse - || params.commonTrans != nextParams.commonTrans - || params.rotate != nextParams.rotate - || params.distortion != nextParams.distortion - || params.lensProf != nextParams.lensProf - || params.perspective != nextParams.perspective - || params.gradient != nextParams.gradient - || params.pcvignette != nextParams.pcvignette - || params.cacorrection != nextParams.cacorrection - || params.vignetting != nextParams.vignetting - || params.chmixer != nextParams.chmixer - || params.blackwhite != nextParams.blackwhite - || params.icm != nextParams.icm - || params.hsvequalizer != nextParams.hsvequalizer - || params.filmSimulation != nextParams.filmSimulation - || params.softlight != nextParams.softlight - || params.raw != nextParams.raw - || params.retinex != nextParams.retinex - || params.wavelet != nextParams.wavelet - || params.dirpyrequalizer != nextParams.dirpyrequalizer - || params.dehaze != nextParams.dehaze; + params->toneCurve != nextParams->toneCurve + || params->labCurve != nextParams->labCurve + || params->localContrast != nextParams->localContrast + || params->rgbCurves != nextParams->rgbCurves + || params->colorToning != nextParams->colorToning + || params->vibrance != nextParams->vibrance + || params->wb != nextParams->wb + || params->colorappearance != nextParams->colorappearance + || params->epd != nextParams->epd + || params->fattal != nextParams->fattal + || params->sh != nextParams->sh + || params->crop != nextParams->crop + || params->coarse != nextParams->coarse + || params->commonTrans != nextParams->commonTrans + || params->rotate != nextParams->rotate + || params->distortion != nextParams->distortion + || params->lensProf != nextParams->lensProf + || params->perspective != nextParams->perspective + || params->gradient != nextParams->gradient + || params->pcvignette != nextParams->pcvignette + || params->cacorrection != nextParams->cacorrection + || params->vignetting != nextParams->vignetting + || params->chmixer != nextParams->chmixer + || params->blackwhite != nextParams->blackwhite + || params->icm != nextParams->icm + || params->hsvequalizer != nextParams->hsvequalizer + || params->filmSimulation != nextParams->filmSimulation + || params->softlight != nextParams->softlight + || params->raw != nextParams->raw + || params->retinex != nextParams->retinex + || params->wavelet != nextParams->wavelet + || params->dirpyrequalizer != nextParams->dirpyrequalizer + || params->dehaze != nextParams->dehaze; - params = nextParams; + *params = *nextParams; int change = changeSinceLast; changeSinceLast = 0; paramsUpdateMutex.unlock(); @@ -1474,7 +1536,7 @@ ProcParams* ImProcCoordinator::beginUpdateParams() { paramsUpdateMutex.lock(); - return &nextParams; + return nextParams.get(); } void ImProcCoordinator::endUpdateParams(ProcEvent change) diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index fb3012f62..c293f0c16 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -19,6 +19,8 @@ #ifndef _IMPROCCOORDINATOR_H_ #define _IMPROCCOORDINATOR_H_ +#include + #include "rtengine.h" #include "improcfun.h" #include "image8.h" @@ -70,8 +72,6 @@ protected: double lastAwbEqual; double lastAwbTempBias; - ImProcFunctions ipf; - Glib::ustring monitorProfile; RenderingIntent monitorIntent; bool softProof; @@ -185,7 +185,7 @@ protected: void updatePreviewImage (int todo, bool panningRelatedChange); MyMutex mProcessing; - ProcParams params; + const std::unique_ptr params; // for optimization purpose, the output profile, output rendering intent and // output BPC will trigger a regeneration of the profile on parameter change only @@ -200,7 +200,7 @@ protected: MyMutex paramsUpdateMutex; int changeSinceLast; bool updaterRunning; - ProcParams nextParams; + const std::unique_ptr nextParams; bool destroying; bool utili; bool autili; @@ -217,16 +217,16 @@ protected: bool highQualityComputed; cmsHTRANSFORM customTransformIn; cmsHTRANSFORM customTransformOut; + + ImProcFunctions ipf; + public: ImProcCoordinator (); ~ImProcCoordinator () override; void assign (ImageSource* imgsrc); - void getParams (procparams::ProcParams* dst) override - { - *dst = params; - } + void getParams (procparams::ProcParams* dst) override; void startProcessing (int changeCode) override; ProcParams* beginUpdateParams () override; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 9dec1740f..4e2523137 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -41,6 +41,7 @@ #include "clutstore.h" #include "ciecam02.h" #include "StopWatch.h" +#include "procparams.h" #include "../rtgui/ppversion.h" #include "../rtgui/guiutils.h" @@ -205,31 +206,31 @@ void proPhotoBlue(float *rtemp, float *gtemp, float *btemp, int istart, int tH, } } -void customToneCurve(const ToneCurve &customToneCurve, ToneCurveParams::TcMode curveMode, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize, PerceptualToneCurveState ptcApplyState) { +void customToneCurve(const ToneCurve &customToneCurve, ToneCurveMode curveMode, float *rtemp, float *gtemp, float *btemp, int istart, int tH, int jstart, int tW, int tileSize, PerceptualToneCurveState ptcApplyState) { - if (curveMode == ToneCurveParams::TcMode::STD) { // Standard + if (curveMode == ToneCurveMode::STD) { // Standard const StandardToneCurve& userToneCurve = static_cast (customToneCurve); for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize]); } - } else if (curveMode == ToneCurveParams::TcMode::FILMLIKE) { // Adobe like + } else if (curveMode == ToneCurveMode::FILMLIKE) { // Adobe like const AdobeToneCurve& userToneCurve = static_cast (customToneCurve); for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize]); } - } else if (curveMode == ToneCurveParams::TcMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels + } else if (curveMode == ToneCurveMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve); for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { userToneCurve.Apply(rtemp[ti * tileSize + tj], gtemp[ti * tileSize + tj], btemp[ti * tileSize + tj]); } } - } else if (curveMode == ToneCurveParams::TcMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted + } else if (curveMode == ToneCurveMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve); for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize]); } - } else if (curveMode == ToneCurveParams::TcMode::LUMINANCE) { // apply the curve to the luminance channel + } else if (curveMode == ToneCurveMode::LUMINANCE) { // apply the curve to the luminance channel const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -237,7 +238,7 @@ void customToneCurve(const ToneCurve &customToneCurve, ToneCurveParams::TcMode c userToneCurve.Apply(rtemp[ti * tileSize + tj], gtemp[ti * tileSize + tj], btemp[ti * tileSize + tj]); } } - } else if (curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { // apply curve while keeping color appearance constant + } else if (curveMode == ToneCurveMode::PERCEPTUAL) { // apply curve while keeping color appearance constant const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve); for (int i = istart, ti = 0; i < tH; i++, ti++) { userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], >emp[ti * tileSize], &btemp[ti * tileSize], ptcApplyState); @@ -320,7 +321,7 @@ void ImProcFunctions::updateColorProfiles (const Glib::ustring& monitorProfile, if (settings->printerBPC) { flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; } - outIntent = settings->printerIntent; + outIntent = RenderingIntent(settings->printerIntent); } else { oprof = ICCStore::getInstance()->getProfile(params->icm.outputProfile); if (params->icm.outputBPC) { @@ -2230,8 +2231,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer const float hlrange = 65536.0 - shoulder; const bool isProPhoto = (params->icm.workingProfile == "ProPhoto"); // extracting datas from 'params' to avoid cache flush (to be confirmed) - ToneCurveParams::TcMode curveMode = params->toneCurve.curveMode; - ToneCurveParams::TcMode curveMode2 = params->toneCurve.curveMode2; + ToneCurveMode curveMode = params->toneCurve.curveMode; + ToneCurveMode curveMode2 = params->toneCurve.curveMode2; bool highlight = params->toneCurve.hrenabled;//Get the value if "highlight reconstruction" is activated bool hasToneCurve1 = bool (customToneCurve1); bool hasToneCurve2 = bool (customToneCurve2); @@ -2243,12 +2244,12 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer PerceptualToneCurveState ptc1ApplyState, ptc2ApplyState; - if (hasToneCurve1 && curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { + if (hasToneCurve1 && curveMode == ToneCurveMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.initApplyState (ptc1ApplyState, params->icm.workingProfile); } - if (hasToneCurve2 && curveMode2 == ToneCurveParams::TcMode::PERCEPTUAL) { + if (hasToneCurve2 && curveMode2 == ToneCurveMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.initApplyState (ptc2ApplyState, params->icm.workingProfile); } diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 129cef533..75e8341b9 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -22,7 +22,6 @@ #include "imagefloat.h" #include "image16.h" #include "image8.h" -#include "procparams.h" #include "shmap.h" #include "coord2d.h" #include "color.h" @@ -39,12 +38,22 @@ namespace rtengine { -using namespace procparams; +namespace procparams +{ + +class ProcParams; + +struct DirPyrDenoiseParams; +struct SharpeningParams; +struct VignettingParams; +struct WaveletParams; + +} + +enum RenderingIntent : int; class ImProcFunctions { - - cmsHTRANSFORM monitorTransform; std::unique_ptr gamutWarning; @@ -52,7 +61,7 @@ class ImProcFunctions double scale; bool multiThread; - void calcVignettingParams(int oW, int oH, const VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul); + void calcVignettingParams(int oW, int oH, const procparams::VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul); void transformLuminanceOnly(Imagefloat* original, Imagefloat* transformed, int cx, int cy, int oW, int oH, int fW, int fH); void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); @@ -203,7 +212,7 @@ public: bool needsTransform(); bool needsPCVignetting(); - void firstAnalysis(const Imagefloat* const working, const ProcParams ¶ms, LUTu & vhist16); + void firstAnalysis(const Imagefloat* const working, const procparams::ProcParams ¶ms, LUTu & vhist16); void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, @@ -230,7 +239,7 @@ public: void chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve); void vibrance(LabImage* lab); //Jacques' vibrance // void colorCurve (LabImage* lold, LabImage* lnew); - void sharpening(LabImage* lab, const SharpeningParams &sharpenParam, bool showMask = false); + void sharpening(LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask = false); void sharpeningcam(CieImage* ncie, float** buffer, bool showMask = false); void transform(Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const FramesMetaData *metadata, int rawRotationDeg, bool fullImage); float resizeScale(const ProcParams* params, int fw, int fh, int &imw, int &imh); @@ -239,7 +248,7 @@ public: void Lanczos(const LabImage* src, LabImage* dst, float scale); void Lanczos(const Imagefloat* src, Imagefloat* dst, float scale); - void deconvsharpening(float** luminance, float** buffer, int W, int H, const SharpeningParams &sharpenParam); + void deconvsharpening(float** luminance, float** buffer, int W, int H, const procparams::SharpeningParams &sharpenParam); void MLsharpen(LabImage* lab); // Manuel's clarity / sharpening void MLmicrocontrast(float** luminance, int W, int H); //Manuel's microcontrast void MLmicrocontrast(LabImage* lab); //Manuel's microcontrast @@ -262,7 +271,7 @@ public: void EPDToneMapCIE(CieImage *ncie, float a_w, float c_, int Wid, int Hei, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); // pyramid denoise - procparams::DirPyrDenoiseParams dnparams; +// procparams::DirPyrDenoiseParams dnparams; void dirpyr(LabImage* data_fine, LabImage* data_coarse, int level, LUTf &rangefn_L, LUTf &rangefn_ab, int pitch, int scale, const int luma, int chroma); void idirpyr(LabImage* data_coarse, LabImage* data_fine, int level, LUTf &rangefn_L, LUTf & nrwt_l, LUTf & nrwt_ab, diff --git a/rtengine/init.cc b/rtengine/init.cc index 7d944fc0b..ee092ae8f 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -32,6 +32,7 @@ #include "profilestore.h" #include "../rtgui/threadutils.h" #include "rtlensfun.h" +#include "procparams.h" namespace rtengine { diff --git a/rtengine/ipdehaze.cc b/rtengine/ipdehaze.cc index 54dfa0cf6..c1092e335 100644 --- a/rtengine/ipdehaze.cc +++ b/rtengine/ipdehaze.cc @@ -28,13 +28,15 @@ * */ -#include "improcfun.h" -#include "guidedfilter.h" -#include "rt_math.h" -#include "rt_algo.h" #include #include +#include "guidedfilter.h" +#include "improcfun.h" +#include "procparams.h" +#include "rt_algo.h" +#include "rt_math.h" + extern Options options; namespace rtengine { diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 04358f6af..8790f003c 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -26,6 +26,8 @@ #include "curves.h" #include "alignedbuffer.h" #include "color.h" +#include "procparams.h" + namespace rtengine { diff --git a/rtengine/iplabregions.cc b/rtengine/iplabregions.cc index 28e7ddad3..5945398d2 100644 --- a/rtengine/iplabregions.cc +++ b/rtengine/iplabregions.cc @@ -24,6 +24,7 @@ #include "improcfun.h" #include "guidedfilter.h" +#include "procparams.h" //#define BENCHMARK #include "StopWatch.h" #include "sleef.c" diff --git a/rtengine/iplocalcontrast.cc b/rtengine/iplocalcontrast.cc index aa1eeff7d..1bf21829e 100644 --- a/rtengine/iplocalcontrast.cc +++ b/rtengine/iplocalcontrast.cc @@ -26,9 +26,10 @@ #include #endif -#include "improcfun.h" -#include "gauss.h" #include "array2D.h" +#include "gauss.h" +#include "improcfun.h" +#include "procparams.h" namespace rtengine { diff --git a/rtengine/ipresize.cc b/rtengine/ipresize.cc index a14115120..823beb23e 100644 --- a/rtengine/ipresize.cc +++ b/rtengine/ipresize.cc @@ -22,6 +22,7 @@ #include "alignedbuffer.h" #include "opthelper.h" #include "rt_math.h" +#include "procparams.h" #include "sleef.c" //#define PROFILE diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 6239575d6..9d94e9326 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -36,16 +36,18 @@ */ -#include -#include #include +#include +#include #include -#include "rtengine.h" + #include "gauss.h" -#include "rawimagesource.h" #include "improcfun.h" -#include "opthelper.h" #include "median.h" +#include "opthelper.h" +#include "procparams.h" +#include "rawimagesource.h" +#include "rtengine.h" #include "StopWatch.h" #define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) diff --git a/rtengine/ipshadowshighlights.cc b/rtengine/ipshadowshighlights.cc index 450aac221..6ce66d9b3 100644 --- a/rtengine/ipshadowshighlights.cc +++ b/rtengine/ipshadowshighlights.cc @@ -19,10 +19,12 @@ */ #include "improcfun.h" + #include "gauss.h" -#include "sleef.c" -#include "opthelper.h" #include "guidedfilter.h" +#include "opthelper.h" +#include "procparams.h" +#include "sleef.c" namespace rtengine { diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc index 84068ced9..9d7358fa9 100644 --- a/rtengine/ipsharpen.cc +++ b/rtengine/ipsharpen.cc @@ -22,6 +22,7 @@ #include "bilateral2.h" #include "jaggedarray.h" #include "rt_math.h" +#include "procparams.h" #include "sleef.c" #include "opthelper.h" //#define BENCHMARK diff --git a/rtengine/ipsoftlight.cc b/rtengine/ipsoftlight.cc index 74fb543aa..6aca9b8eb 100644 --- a/rtengine/ipsoftlight.cc +++ b/rtengine/ipsoftlight.cc @@ -24,6 +24,8 @@ #include "improcfun.h" +#include "procparams.h" + namespace rtengine { namespace { diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 8c06252c1..beca624a8 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -18,6 +18,7 @@ */ #include "rtengine.h" #include "improcfun.h" +#include "procparams.h" #ifdef _OPENMP #include #endif diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index 5f178b5c0..9bb4bc087 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -27,6 +27,7 @@ #include "../rtgui/thresholdselector.h" #include "curves.h" #include "color.h" +#include "procparams.h" #include "StopWatch.h" #ifdef _OPENMP #include diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 860823b3a..d3595b42c 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -40,6 +40,7 @@ #include "median.h" #include "EdgePreservingDecomposition.h" #include "iccstore.h" +#include "procparams.h" #ifdef _OPENMP #include diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index 34ad7a545..7156f17e2 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -29,6 +29,7 @@ #include "lcp.h" +#include "procparams.h" #include "settings.h" namespace rtengine diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index 1538ae5fa..e62a1adea 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -18,11 +18,13 @@ */ #include "previewimage.h" + #include "iimage.h" -#include "utils.h" #include "iimage.h" -#include "rtthumbnail.h" +#include "procparams.h" #include "rawimagesource.h" +#include "rtthumbnail.h" +#include "utils.h" using namespace rtengine; using namespace procparams; diff --git a/rtengine/processingjob.h b/rtengine/processingjob.h index 026bd4924..b2a81e4c2 100644 --- a/rtengine/processingjob.h +++ b/rtengine/processingjob.h @@ -20,6 +20,7 @@ #define _PROCESSINGJOB_ #include "rtengine.h" +#include "procparams.h" namespace rtengine { diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3ddf26c4d..6d914bb27 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -315,8 +315,8 @@ ToneCurveParams::ToneCurveParams() : curve2{ DCT_Linear }, - curveMode(ToneCurveParams::TcMode::STD), - curveMode2(ToneCurveParams::TcMode::STD), + curveMode(ToneCurveMode::STD), + curveMode2(ToneCurveMode::STD), brightness(0), black(0), contrast(0), @@ -2877,13 +2877,13 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->toneCurve.hrenabled, "HLRecovery", "Enabled", toneCurve.hrenabled, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.method, "HLRecovery", "Method", toneCurve.method, keyFile); - const std::map tc_mapping = { - {ToneCurveParams::TcMode::STD, "Standard"}, - {ToneCurveParams::TcMode::FILMLIKE, "FilmLike"}, - {ToneCurveParams::TcMode::SATANDVALBLENDING, "SatAndValueBlending"}, - {ToneCurveParams::TcMode::WEIGHTEDSTD, "WeightedStd"}, - {ToneCurveParams::TcMode::LUMINANCE, "Luminance"}, - {ToneCurveParams::TcMode::PERCEPTUAL, "Perceptual"} + const std::map tc_mapping = { + {ToneCurveMode::STD, "Standard"}, + {ToneCurveMode::FILMLIKE, "FilmLike"}, + {ToneCurveMode::SATANDVALBLENDING, "SatAndValueBlending"}, + {ToneCurveMode::WEIGHTEDSTD, "WeightedStd"}, + {ToneCurveMode::LUMINANCE, "Luminance"}, + {ToneCurveMode::PERCEPTUAL, "Perceptual"} }; saveToKeyfile(!pedited || pedited->toneCurve.curveMode, "Exposure", "CurveMode", tc_mapping, toneCurve.curveMode, keyFile); @@ -3662,13 +3662,13 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) toneCurve.shcompr = 100; // older pp3 files can have values above 100. } - const std::map tc_mapping = { - {"Standard", ToneCurveParams::TcMode::STD}, - {"FilmLike", ToneCurveParams::TcMode::FILMLIKE}, - {"SatAndValueBlending", ToneCurveParams::TcMode::SATANDVALBLENDING}, - {"WeightedStd", ToneCurveParams::TcMode::WEIGHTEDSTD}, - {"Luminance", ToneCurveParams::TcMode::LUMINANCE}, - {"Perceptual", ToneCurveParams::TcMode::PERCEPTUAL} + const std::map tc_mapping = { + {"Standard", ToneCurveMode::STD}, + {"FilmLike", ToneCurveMode::FILMLIKE}, + {"SatAndValueBlending", ToneCurveMode::SATANDVALBLENDING}, + {"WeightedStd", ToneCurveMode::WEIGHTEDSTD}, + {"Luminance", ToneCurveMode::LUMINANCE}, + {"Perceptual", ToneCurveMode::PERCEPTUAL} }; assignFromKeyfile(keyFile, "Exposure", "CurveMode", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index a359f1d53..0982fda48 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -28,7 +28,7 @@ #include "noncopyable.h" -class ParamsEdited; +struct ParamsEdited; namespace rtengine { @@ -44,7 +44,7 @@ class WavOpacityCurveRG; class WavOpacityCurveW; class WavOpacityCurveWL; -enum RenderingIntent { +enum RenderingIntent : int { RI_PERCEPTUAL = INTENT_PERCEPTUAL, RI_RELATIVE = INTENT_RELATIVE_COLORIMETRIC, RI_SATURATION = INTENT_SATURATION, @@ -249,35 +249,35 @@ private: bool is_double; }; +enum class ToneCurveMode : int { + STD, // Standard modes, the curve is applied on all component individually + WEIGHTEDSTD, // Weighted standard mode + FILMLIKE, // Film-like mode, as defined in Adobe's reference code + SATANDVALBLENDING, // Modify the Saturation and Value channel + LUMINANCE, // Modify the Luminance channel with coefficients from Rec 709's + PERCEPTUAL // Keep color appearance constant using perceptual modeling +}; + /** * Parameters of the tone curve */ struct ToneCurveParams { - enum class TcMode { - STD, // Standard modes, the curve is applied on all component individually - WEIGHTEDSTD, // Weighted standard mode - FILMLIKE, // Film-like mode, as defined in Adobe's reference code - SATANDVALBLENDING, // Modify the Saturation and Value channel - LUMINANCE, // Modify the Luminance channel with coefficients from Rec 709's - PERCEPTUAL // Keep color appearance constant using perceptual modeling - }; - - bool autoexp; - double clip; - bool hrenabled; // Highlight Reconstruction enabled - Glib::ustring method; // Highlight Reconstruction's method - double expcomp; - std::vector curve; - std::vector curve2; - TcMode curveMode; - TcMode curveMode2; - int brightness; - int black; - int contrast; - int saturation; - int shcompr; - int hlcompr; // Highlight Recovery's compression - int hlcomprthresh; // Highlight Recovery's threshold + bool autoexp; + double clip; + bool hrenabled; // Highlight Reconstruction enabled + Glib::ustring method; // Highlight Reconstruction's method + double expcomp; + std::vector curve; + std::vector curve2; + ToneCurveMode curveMode; + ToneCurveMode curveMode2; + int brightness; + int black; + int contrast; + int saturation; + int shcompr; + int hlcompr; // Highlight Recovery's compression + int hlcomprthresh; // Highlight Recovery's threshold bool histmatching; // histogram matching bool fromHistMatching; bool clampOOG; // clamp out of gamut colours @@ -473,7 +473,7 @@ struct ColorToningParams { }; std::vector labregions; int labregionsShowMask; - + ColorToningParams(); bool operator ==(const ColorToningParams& other) const; @@ -1076,14 +1076,89 @@ struct MetaDataParams { /** - * Typedef for representing a key/value for the exif metadata information + * Minimal wrapper allowing forward declaration for representing a key/value for the exif metadata information */ -typedef std::map ExifPairs; +class ExifPairs final +{ +public: + using const_iterator = std::map::const_iterator; + + const_iterator begin() const + { + return pairs.begin(); + } + + const_iterator end() const + { + return pairs.end(); + } + + void clear() + { + pairs.clear(); + } + + Glib::ustring& operator[](const Glib::ustring& key) + { + return pairs[key]; + } + + bool operator ==(const ExifPairs& other) const + { + return pairs == other.pairs; + } + +private: + std::map pairs; +}; /** * The IPTC key/value pairs */ -typedef std::map> IPTCPairs; +class IPTCPairs final +{ +public: + using iterator = std::map>::iterator; + using const_iterator = std::map>::const_iterator; + + iterator find(const Glib::ustring& key) + { + return pairs.find(key); + } + + const_iterator begin() const + { + return pairs.begin(); + } + + const_iterator end() const + { + return pairs.end(); + } + + bool empty() const + { + return pairs.empty(); + } + + void clear() + { + pairs.clear(); + } + + std::vector& operator[](const Glib::ustring& key) + { + return pairs[key]; + } + + bool operator ==(const IPTCPairs& other) const + { + return pairs == other.pairs; + } + +private: + std::map> pairs; +}; struct WaveletParams { std::vector ccwcurve; diff --git a/rtengine/profilestore.cc b/rtengine/profilestore.cc index ec57fc669..437ef6ec6 100644 --- a/rtengine/profilestore.cc +++ b/rtengine/profilestore.cc @@ -19,6 +19,8 @@ #include "profilestore.h" #include "dynamicprofile.h" +#include "procparams.h" + #include "../rtgui/options.h" #include "../rtgui/multilangmgr.h" diff --git a/rtengine/profilestore.h b/rtengine/profilestore.h index d79e5691f..5b4c94b20 100644 --- a/rtengine/profilestore.h +++ b/rtengine/profilestore.h @@ -27,8 +27,20 @@ #include "noncopyable.h" #include "dynamicprofile.h" - // forward decl +namespace rtengine +{ + +namespace procparams +{ + +class AutoPartialProfile; +class PartialProfile; + +} + +} + class DynamicProfileRule; class DynamicProfileRules; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 6fe7683eb..57a344e7f 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -36,6 +36,7 @@ #include "rtlensfun.h" #include "pdaflinesfilter.h" #include "camconst.h" +#include "procparams.h" #ifdef _OPENMP #include #endif @@ -452,6 +453,7 @@ RawImageSource::RawImageSource () , red(0, 0) , blue(0, 0) , rawDirty(true) + , histMatchingParams(new procparams::ColorManagementParams) { camProfile = nullptr; embProfile = nullptr; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 91b78081a..530211715 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -19,13 +19,16 @@ #ifndef _RAWIMAGESOURCE_ #define _RAWIMAGESOURCE_ -#include "imagesource.h" -#include "dcp.h" -#include "array2D.h" -#include "curves.h" -#include "color.h" -#include "iimage.h" #include +#include + +#include "array2D.h" +#include "color.h" +#include "curves.h" +#include "dcp.h" +#include "iimage.h" +#include "imagesource.h" + #define HR_SCALE 2 namespace rtengine @@ -39,7 +42,7 @@ private: static DiagonalCurve *phaseOneIccCurveInv; static LUTf invGrad; // for fast_demosaic static LUTf initInvGrad (); - static void colorSpaceConversion_ (Imagefloat* im, const ColorManagementParams& cmp, const ColorTemp &wb, double pre_mul[3], cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], const std::string &camName); + static void colorSpaceConversion_ (Imagefloat* im, const procparams::ColorManagementParams& cmp, const ColorTemp &wb, double pre_mul[3], cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], const std::string &camName); int defTransform (int tran); protected: @@ -91,7 +94,7 @@ protected: float psBlueBrightness[4]; std::vector histMatchingCache; - ColorManagementParams histMatchingParams; + const std::unique_ptr histMatchingParams; void processFalseColorCorrectionThread (Imagefloat* im, array2D &rbconv_Y, array2D &rbconv_I, array2D &rbconv_Q, array2D &rbout_I, array2D &rbout_Q, const int row_from, const int row_to); void hlRecovery (const std::string &method, float* red, float* green, float* blue, int width, float* hlmax); @@ -112,14 +115,14 @@ public: int load(const Glib::ustring &fname) override { return load(fname, false); } int load(const Glib::ustring &fname, bool firstFrameOnly); - void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse, bool prepareDenoise = true) override; - void demosaic (const RAWParams &raw, bool autoContrast, double &contrastThreshold) override; - void retinex (const ColorManagementParams& cmp, const RetinexParams &deh, const ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) override; - void retinexPrepareCurves (const RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) override; - void retinexPrepareBuffers (const ColorManagementParams& cmp, const RetinexParams &retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) override; + void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) override; + void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold) override; + void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) override; + void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) override; + void retinexPrepareBuffers (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) override; void flushRawData () override; void flushRGB () override; - void HLRecovery_Global (const ToneCurveParams &hrp) override; + void HLRecovery_Global (const procparams::ToneCurveParams &hrp) override; void refinement_lassus (int PassCount); void refinement(int PassCount); void setBorder(unsigned int rawBorder) override {border = rawBorder;} @@ -133,7 +136,7 @@ public: void cfaboxblur (RawImage *riFlatFile, float* cfablur, int boxH, int boxW); void scaleColors (int winx, int winy, int winw, int winh, const RAWParams &raw, array2D &rawData); // raw for cblack - void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const RAWParams &raw) override; + void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hrp, const procparams::RAWParams &raw) override; eSensorType getSensorType () const override { return ri != nullptr ? ri->getSensorType() : ST_NONE; @@ -180,10 +183,10 @@ public: } void getAutoExpHistogram (LUTu & histogram, int& histcompr) override; void getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw) override; - void getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector &outCurve) override; - DCPProfile *getDCP(const ColorManagementParams &cmp, DCPProfile::ApplyState &as) override; + void getAutoMatchedToneCurve(const procparams::ColorManagementParams &cp, std::vector &outCurve) override; + DCPProfile *getDCP(const procparams::ColorManagementParams &cmp, DCPProfile::ApplyState &as) override; - void convertColorSpace(Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb) override; + void convertColorSpace(Imagefloat* image, const procparams::ColorManagementParams &cmp, const ColorTemp &wb) override; static bool findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, DCPProfile **dcpProf, cmsHPROFILE& in); static void colorSpaceConversion (Imagefloat* im, const ColorManagementParams& cmp, const ColorTemp &wb, double pre_mul[3], cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], const std::string &camName) { diff --git a/rtengine/rcd_demosaic.cc b/rtengine/rcd_demosaic.cc index 5b6e1a164..f0f9c1bfd 100644 --- a/rtengine/rcd_demosaic.cc +++ b/rtengine/rcd_demosaic.cc @@ -20,6 +20,7 @@ #include "rawimagesource.h" #include "rt_math.h" +#include "procparams.h" #include "../rtgui/multilangmgr.h" #include "opthelper.h" #include "StopWatch.h" diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index bc8c12fec..6264d43ae 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -21,7 +21,6 @@ #include "imageformat.h" #include "rt_math.h" -#include "procparams.h" #include "procevents.h" #include #include @@ -45,6 +44,22 @@ class EditDataProvider; namespace rtengine { +enum RenderingIntent : int; + +namespace procparams +{ + +class ProcParams; +class IPTCPairs; + +struct RAWParams; +struct ColorManagementParams; +struct CropParams; + +enum class ToneCurveMode : int; + +} + class IImage8; class IImage16; class IImagefloat; @@ -315,7 +330,7 @@ public: * @param hlrecons set to true if HighLight Reconstruction is enabled */ virtual void autoExpChanged(double brightness, int bright, int contrast, int black, int hlcompr, int hlcomprthresh, bool hlrecons) = 0; - virtual void autoMatchedToneCurveChanged(procparams::ToneCurveParams::TcMode curveMode, const std::vector& curve) = 0; + virtual void autoMatchedToneCurveChanged(procparams::ToneCurveMode curveMode, const std::vector& curve) = 0; }; class AutoCamListener diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index 4856909f7..3cea8c484 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -19,6 +19,7 @@ */ #include "rtlensfun.h" +#include "procparams.h" #include "settings.h" #include diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index c196a4765..8b097b30e 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -29,10 +29,16 @@ #include "lcp.h" #include "noncopyable.h" -#include "procparams.h" namespace rtengine { +namespace procparams +{ + +struct LensProfParams; + +} + class LFModifier final : public LensCorrection, public NonCopyable @@ -113,7 +119,7 @@ public: LFCamera findCamera(const Glib::ustring &make, const Glib::ustring &model) const; LFLens findLens(const LFCamera &camera, const Glib::ustring &name) const; - static std::unique_ptr findModifier(const LensProfParams &lensProf, const FramesMetaData *idata, int width, int height, const CoarseTransformParams &coarse, int rawRotationDeg); + static std::unique_ptr findModifier(const procparams::LensProfParams &lensProf, const FramesMetaData *idata, int width, int height, const CoarseTransformParams &coarse, int rawRotationDeg); private: std::unique_ptr getModifier(const LFCamera &camera, const LFLens &lens, diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 1623ecfbf..1ee09dcf3 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -37,6 +37,7 @@ #include "../rtgui/ppversion.h" #include "improccoordinator.h" #include "settings.h" +#include "procparams.h" #include #include "StopWatch.h" #include "median.h" @@ -1220,7 +1221,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT ImProcFunctions ipf (¶ms, forHistogramMatching); // enable multithreading when forHistogramMatching is true ipf.setScale (sqrt (double (fw * fw + fh * fh)) / sqrt (double (thumbImg->getWidth() * thumbImg->getWidth() + thumbImg->getHeight() * thumbImg->getHeight()))*scale); - ipf.updateColorProfiles (ICCStore::getInstance()->getDefaultMonitorProfileName(), options.rtSettings.monitorIntent, false, false); + ipf.updateColorProfiles (ICCStore::getInstance()->getDefaultMonitorProfileName(), RenderingIntent(options.rtSettings.monitorIntent), false, false); LUTu hist16 (65536); diff --git a/rtengine/rtthumbnail.h b/rtengine/rtthumbnail.h index c01aa81ee..df33b892d 100644 --- a/rtengine/rtthumbnail.h +++ b/rtengine/rtthumbnail.h @@ -20,7 +20,6 @@ #define _THUMBPROCESSINGPARAMETERS_ #include "rawmetadatalocation.h" -#include "procparams.h" #include #include #include "image8.h" diff --git a/rtengine/settings.h b/rtengine/settings.h index 3f5a5d1fe..1fc3b222c 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -19,8 +19,6 @@ #ifndef _RTSETTINGS_ #define _RTSETTINGS_ -#include "procparams.h" - namespace rtengine { @@ -39,10 +37,10 @@ public: int leveldnautsimpl; // STD or EXPERT Glib::ustring printerProfile; ///< ICC profile name used for soft-proofing a printer output - RenderingIntent printerIntent; ///< Colorimetric intent used with the above profile + int printerIntent; ///< Colorimetric intent used with the above profile bool printerBPC; ///< Black Point Compensation for the Labimage->Printer->Monitor transform Glib::ustring monitorProfile; ///< ICC profile name used for the monitor - RenderingIntent monitorIntent; ///< Colorimetric intent used with the above profile + int monitorIntent; ///< Colorimetric intent used with the above profile bool monitorBPC; ///< Black Point Compensation for the Labimage->Monitor transform (directly, i.e. not soft-proofing and no WCS in between) bool autoMonitorProfile; ///< Try to auto-determine the correct monitor color profile bool autocielab; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index dddc3d6c3..ff2b234a3 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -24,6 +24,7 @@ #include "iccstore.h" #include "clutstore.h" #include "processingjob.h" +#include "procparams.h" #include #include "../rtgui/options.h" #include "rawimagesource.h" @@ -770,7 +771,7 @@ private: } params.toneCurve.autoexp = false; - params.toneCurve.curveMode = ToneCurveParams::TcMode::FILMLIKE; + params.toneCurve.curveMode = ToneCurveMode::FILMLIKE; params.toneCurve.curve2 = { 0 }; params.toneCurve.brightness = 0; params.toneCurve.contrast = 0; diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 298cf16ef..6ca3091a3 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -17,11 +17,13 @@ * along with RawTherapee. If not, see . */ #include "stdimagesource.h" -#include "mytime.h" + +#include "color.h" +#include "curves.h" #include "iccstore.h" #include "imageio.h" -#include "curves.h" -#include "color.h" +#include "mytime.h" +#include "procparams.h" #undef THREAD_PRIORITY_NORMAL diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index e4788f3f8..32755319e 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -74,6 +74,7 @@ #include "opthelper.h" #include "rt_algo.h" #include "rescale.h" +#include "procparams.h" namespace rtengine { diff --git a/rtengine/vng4_demosaic_RT.cc b/rtengine/vng4_demosaic_RT.cc index 1c7f27dea..0f35389fb 100644 --- a/rtengine/vng4_demosaic_RT.cc +++ b/rtengine/vng4_demosaic_RT.cc @@ -22,6 +22,7 @@ #include "rtengine.h" #include "rawimagesource.h" +#include "procparams.h" #include "../rtgui/multilangmgr.h" //#define BENCHMARK #include "StopWatch.h" diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 82f5e5525..571fd4e6b 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -32,6 +32,8 @@ #include "rtexif.h" +#include "../rtengine/procparams.h" + #include "../rtgui/cacheimagedata.h" #include "../rtgui/version.h" #include "../rtgui/ppversion.h" diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 67ce90552..43b296746 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -32,10 +32,19 @@ #include -#include "../rtengine/procparams.h" #include "../rtengine/noncopyable.h" #include "../rtengine/rawmetadatalocation.h" +namespace rtengine +{ + +namespace procparams +{ + class ExifPairs; +} + +} + class CacheImageData; namespace rtexif diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index f6c598df7..9792522c7 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -21,6 +21,7 @@ #include #include #include "../rtengine/rt_math.h" +#include "../rtengine/procparams.h" #include #include @@ -197,7 +198,7 @@ void BatchQueue::addEntries (const std::vector& entries, bool // recovery save const auto tempFile = getTempFilenameForParams (entry->filename); - if (!entry->params.save (tempFile)) + if (!entry->params->save (tempFile)) entry->savedParamsFile = tempFile; entry->selected = false; @@ -642,7 +643,7 @@ void BatchQueue::error(const Glib::ustring& descr) bqbs->setButtonListener (this); processing->addButtonSet (bqbs); processing->processing = false; - processing->job = rtengine::ProcessingJob::create(processing->filename, processing->thumbnail->getType() == FT_Raw, processing->params); + processing->job = rtengine::ProcessingJob::create(processing->filename, processing->thumbnail->getType() == FT_Raw, *processing->params); processing = nullptr; redraw (); } @@ -706,7 +707,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady(rtengine::IImagefloat* img) // We keep the extension to avoid overwriting the profile when we have // the same output filename with different extension //processing->params.save (removeExtension(fname) + paramFileExtension); - processing->params.save (fname + ".out" + paramFileExtension); + processing->params->save (fname + ".out" + paramFileExtension); } if (processing->thumbnail) { diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index b5383205f..0ce71b043 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -26,6 +26,8 @@ #include "multilangmgr.h" #include "thumbbrowserbase.h" +#include "../rtengine/procparams.h" + bool BatchQueueEntry::iconsLoaded(false); Glib::RefPtr BatchQueueEntry::savedAsIcon; @@ -36,7 +38,7 @@ BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine: origph(prevh), opreviewDone(false), job(pjob), - params(pparams), + params(new rtengine::procparams::ProcParams(pparams)), progress(0), outFileName(""), sequence(0), @@ -93,7 +95,7 @@ void BatchQueueEntry::refreshThumbnailImage () // creating the image buffer first //if (!opreview) opreview = new guint8[(origpw+1) * origph * 3]; // this will asynchronously compute the original preview and land at this.updateImage - batchQueueEntryUpdater.process (nullptr, origpw, origph, preh, this, ¶ms, thumbnail); + batchQueueEntryUpdater.process (nullptr, origpw, origph, preh, this, params.get(), thumbnail); } else { // this will asynchronously land at this.updateImage batchQueueEntryUpdater.process (opreview, origpw, origph, preh, this); diff --git a/rtgui/batchqueueentry.h b/rtgui/batchqueueentry.h index 2b75922b7..6aecff945 100644 --- a/rtgui/batchqueueentry.h +++ b/rtgui/batchqueueentry.h @@ -19,6 +19,8 @@ #ifndef _BATCHQUEUEENTRY_ #define _BATCHQUEUEENTRY_ +#include + #include #include "../rtengine/rtengine.h" #include "thumbbrowserentrybase.h" @@ -46,7 +48,7 @@ public: static Glib::RefPtr savedAsIcon; rtengine::ProcessingJob* job; - rtengine::procparams::ProcParams params; + const std::unique_ptr params; Glib::ustring savedParamsFile; double progress; Glib::ustring outFileName; diff --git a/rtgui/bayerpreprocess.cc b/rtgui/bayerpreprocess.cc index 0720612fe..89fd6fcb6 100644 --- a/rtgui/bayerpreprocess.cc +++ b/rtgui/bayerpreprocess.cc @@ -16,11 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "bayerpreprocess.h" -#include "guiutils.h" -#include "eventmapper.h" #include +#include "bayerpreprocess.h" +#include "eventmapper.h" +#include "guiutils.h" + +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index 279e68bd6..a681023a6 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -17,9 +17,13 @@ * along with RawTherapee. If not, see . */ #include "bayerprocess.h" + #include "eventmapper.h" -#include "options.h" #include "guiutils.h" +#include "options.h" + +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/bayerrawexposure.cc b/rtgui/bayerrawexposure.cc index f284d7975..d49486511 100644 --- a/rtgui/bayerrawexposure.cc +++ b/rtgui/bayerrawexposure.cc @@ -17,8 +17,11 @@ * along with RawTherapee. If not, see . */ #include "bayerrawexposure.h" + #include "guiutils.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index dcc5c7e01..48d37ebab 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -16,13 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "blackwhite.h" -#include "rtimage.h" -#include "../rtengine/color.h" #include #include -#include "guiutils.h" + +#include "blackwhite.h" + #include "edit.h" +#include "guiutils.h" +#include "rtimage.h" + +#include "../rtengine/color.h" +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index dbb3b2946..35aeb6c91 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -22,6 +22,8 @@ #include "version.h" #include +#include "../rtengine/procparams.h" + CacheImageData::CacheImageData () : md5(""), supported(false), format(FT_Invalid), rankOld(-1), inTrashOld(false), recentlySaved(false), timeValid(false), year(0), month(0), day(0), hour(0), min(0), sec(0), exifValid(false), frameCount(1), @@ -301,3 +303,7 @@ int CacheImageData::save (const Glib::ustring& fname) } } +rtengine::procparams::IPTCPairs CacheImageData::getIPTCData(unsigned int frame) const +{ + return {}; +} diff --git a/rtgui/cacheimagedata.h b/rtgui/cacheimagedata.h index f146f2ce0..d3aea803b 100644 --- a/rtgui/cacheimagedata.h +++ b/rtgui/cacheimagedata.h @@ -94,7 +94,7 @@ public: rtexif::TagDirectory* getFrameExifData (unsigned int frame = 0) const override { return nullptr; } rtexif::TagDirectory* getBestExifData (rtengine::ImageSource *imgSource, rtengine::procparams::RAWParams *rawParams) const override { return nullptr; } bool hasIPTC (unsigned int frame = 0) const override { return false; } - rtengine::procparams::IPTCPairs getIPTCData (unsigned int frame = 0) const override { return rtengine::procparams::IPTCPairs(); } + rtengine::procparams::IPTCPairs getIPTCData (unsigned int frame = 0) const override; tm getDateTime (unsigned int frame = 0) const override { return tm{}; } time_t getDateTimeAsTS(unsigned int frame = 0) const override { return time_t(-1); } int getISOSpeed (unsigned int frame = 0) const override { return iso; } diff --git a/rtgui/cacorrection.cc b/rtgui/cacorrection.cc index 4405e4ad1..c91eec145 100644 --- a/rtgui/cacorrection.cc +++ b/rtgui/cacorrection.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "cacorrection.h" #include + +#include "cacorrection.h" + #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/chmixer.cc b/rtgui/chmixer.cc index e15ed89f5..4a3411e8b 100644 --- a/rtgui/chmixer.cc +++ b/rtgui/chmixer.cc @@ -17,8 +17,11 @@ * along with RawTherapee. If not, see . */ #include "chmixer.h" + #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/clipboard.cc b/rtgui/clipboard.cc index dfd78cdd1..c8eb94d7b 100644 --- a/rtgui/clipboard.cc +++ b/rtgui/clipboard.cc @@ -18,62 +18,146 @@ */ #include "clipboard.h" +#include "../rtengine/procparams.h" + Clipboard clipboard; -Clipboard::Clipboard () : _hasIPTC(false), partProfile (false), hasDiagonalCurveDataType(DCT_Empty), hasFlatCurveDataType(FCT_Empty) {} +Clipboard::Clipboard () : + _hasIPTC(false), + iptc(new rtengine::procparams::IPTCPairs), + partProfile(new rtengine::procparams::PartialProfile(false)), + hasDiagonalCurveDataType(DCT_Empty), + hasFlatCurveDataType(FCT_Empty) +{ +} Clipboard::~Clipboard () { - partProfile.deleteInstance(); + partProfile->deleteInstance(); +} + +bool Clipboard::hasIPTC() const +{ + return _hasIPTC; +} + +const rtengine::procparams::IPTCPairs& Clipboard::getIPTC() const +{ + return *iptc; +} + +void Clipboard::setIPTC(const rtengine::procparams::IPTCPairs& iptcc) +{ + *iptc = iptcc; + _hasIPTC = true; +} + +const rtengine::procparams::PartialProfile& Clipboard::getPartialProfile() const +{ + return *partProfile; } /* * set both the "pparams" and "pedited" field of the PartialProfile; each one can be NULL */ -void Clipboard::setPartialProfile (const rtengine::procparams::PartialProfile& pprofile) +void Clipboard::setPartialProfile(const rtengine::procparams::PartialProfile& pprofile) { if (pprofile.pparams) { - if (!partProfile.pparams) { - partProfile.pparams = new rtengine::procparams::ProcParams(); + if (!partProfile->pparams) { + partProfile->pparams = new rtengine::procparams::ProcParams(); } - *partProfile.pparams = *pprofile.pparams; + *partProfile->pparams = *pprofile.pparams; } else { - if (partProfile.pparams) { - delete partProfile.pparams; - partProfile.pparams = nullptr; + if (partProfile->pparams) { + delete partProfile->pparams; + partProfile->pparams = nullptr; } } if (pprofile.pedited) { - if (!partProfile.pedited) { - partProfile.pedited = new ParamsEdited(); + if (!partProfile->pedited) { + partProfile->pedited = new ParamsEdited(); } - *partProfile.pedited = *pprofile.pedited; + *partProfile->pedited = *pprofile.pedited; } else { - if (partProfile.pedited) { - delete partProfile.pedited; - partProfile.pedited = nullptr; + if (partProfile->pedited) { + delete partProfile->pedited; + partProfile->pedited = nullptr; } } } +const rtengine::procparams::ProcParams& Clipboard::getProcParams() const +{ + return *partProfile->pparams; +} + /* * this method copy the procparams to "pparams" and delete "pedited" */ -void Clipboard::setProcParams (const rtengine::procparams::ProcParams& pparams) +void Clipboard::setProcParams(const rtengine::procparams::ProcParams& pparams) { // copy procparams - if (!partProfile.pparams) { - partProfile.pparams = new rtengine::procparams::ProcParams(); + if (!partProfile->pparams) { + partProfile->pparams = new rtengine::procparams::ProcParams(); } - *partProfile.pparams = pparams; + *partProfile->pparams = pparams; // delete pedited - if (partProfile.pedited) { - delete partProfile.pedited; - partProfile.pedited = nullptr; + if (partProfile->pedited) { + delete partProfile->pedited; + partProfile->pedited = nullptr; } } + +const ParamsEdited& Clipboard::getParamsEdited() const +{ + return *partProfile->pedited; +} + +bool Clipboard::hasProcParams() const +{ + return partProfile->pparams; +} + +bool Clipboard::hasPEdited() const +{ + return partProfile->pedited; +} + +DiagonalCurveType Clipboard::hasDiagonalCurveData() const +{ + return hasDiagonalCurveDataType; +} + +const std::vector& Clipboard::getDiagonalCurveData() const +{ + return diagonalCurve; +} + +void Clipboard::setDiagonalCurveData(const std::vector& p, DiagonalCurveType type) +{ + diagonalCurve = p; + hasDiagonalCurveDataType = type; + return; +} + +FlatCurveType Clipboard::hasFlatCurveData() const +{ + return hasFlatCurveDataType; +} + +const std::vector& Clipboard:: getFlatCurveData() const +{ + return flatCurve; +} + +void Clipboard::setFlatCurveData(const std::vector& p, FlatCurveType type) +{ + flatCurve = p; + hasFlatCurveDataType = type; + return; +} diff --git a/rtgui/clipboard.h b/rtgui/clipboard.h index eff5c08c8..74c9f6770 100644 --- a/rtgui/clipboard.h +++ b/rtgui/clipboard.h @@ -19,96 +19,64 @@ #ifndef _CLIPBOARD_ #define _CLIPBOARD_ +#include #include -#include "../rtengine/rtengine.h" -#include "../rtengine/procparams.h" -#include "paramsedited.h" -#include "myflatcurve.h" + #include "mydiagonalcurve.h" +#include "myflatcurve.h" +#include "paramsedited.h" + +#include "../rtengine/rtengine.h" + +namespace rtengine +{ + +namespace procparams +{ + +class PartialProfile; + +} + +} class Clipboard { +public: + Clipboard (); + ~Clipboard (); + bool hasIPTC() const; + const rtengine::procparams::IPTCPairs& getIPTC() const; + void setIPTC(const rtengine::procparams::IPTCPairs& iptcc); + + const rtengine::procparams::PartialProfile& getPartialProfile() const; + void setPartialProfile(const rtengine::procparams::PartialProfile& pprofile); + + const rtengine::procparams::ProcParams& getProcParams() const; + void setProcParams(const rtengine::procparams::ProcParams& pparams); + + const ParamsEdited& getParamsEdited() const; + + bool hasProcParams() const; + bool hasPEdited() const; + + DiagonalCurveType hasDiagonalCurveData() const; + const std::vector& getDiagonalCurveData() const; + void setDiagonalCurveData(const std::vector& p, DiagonalCurveType type); + + void setFlatCurveData(const std::vector& p, FlatCurveType type); + const std::vector& getFlatCurveData() const; + FlatCurveType hasFlatCurveData() const; + +private: bool _hasIPTC; - rtengine::procparams::IPTCPairs iptc; - rtengine::procparams::PartialProfile partProfile; + const std::unique_ptr iptc; + const std::unique_ptr partProfile; DiagonalCurveType hasDiagonalCurveDataType; FlatCurveType hasFlatCurveDataType; std::vector diagonalCurve; std::vector flatCurve; - - -public: - void setIPTC (const rtengine::procparams::IPTCPairs& iptcc) - { - iptc = iptcc; - _hasIPTC = true; - } - const rtengine::procparams::IPTCPairs& getIPTC () - { - return iptc; - } - bool hasIPTC () - { - return _hasIPTC; - } - - void setPartialProfile (const rtengine::procparams::PartialProfile& pprofile); - const rtengine::procparams::PartialProfile& getPartialProfile () - { - return partProfile; - }; - void setProcParams (const rtengine::procparams::ProcParams& pparams); - const rtengine::procparams::ProcParams& getProcParams () - { - return *partProfile.pparams; - } - const ParamsEdited& getParamsEdited () - { - return *partProfile.pedited; - } - bool hasProcParams () - { - return partProfile.pparams; - } - bool hasPEdited () - { - return partProfile.pedited; - } - - void setDiagonalCurveData (std::vector& p, DiagonalCurveType type ) - { - diagonalCurve = p; - hasDiagonalCurveDataType = type; - return; - } - const std::vector & getDiagonalCurveData () - { - return diagonalCurve; - } - DiagonalCurveType hasDiagonalCurveData () - { - return hasDiagonalCurveDataType; - } - - void setFlatCurveData (std::vector& p, FlatCurveType type ) - { - flatCurve = p; - hasFlatCurveDataType = type; - return; - } - const std::vector & getFlatCurveData () - { - return flatCurve; - } - FlatCurveType hasFlatCurveData () - { - return hasFlatCurveDataType; - } - - Clipboard (); - ~Clipboard (); - }; extern Clipboard clipboard; diff --git a/rtgui/coarsepanel.cc b/rtgui/coarsepanel.cc index 8f927239e..92c312554 100644 --- a/rtgui/coarsepanel.cc +++ b/rtgui/coarsepanel.cc @@ -17,8 +17,11 @@ * along with RawTherapee. If not, see . */ #include "coarsepanel.h" + #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index dea55ced4..f78a1f32b 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "colorappearance.h" #include + +#include "colorappearance.h" + #include "guiutils.h" + #include "../rtengine/color.h" +#include "../rtengine/procparams.h" #define MINTEMP0 2000 //1200 #define MAXTEMP0 12000 //12000 diff --git a/rtgui/crop.cc b/rtgui/crop.cc index 1cd87b80a..de693d399 100644 --- a/rtgui/crop.cc +++ b/rtgui/crop.cc @@ -17,9 +17,12 @@ * along with RawTherapee. If not, see . */ #include "crop.h" + #include "options.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index fdb920269..ab2f3626c 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -23,13 +23,17 @@ #include "guiutils.h" #include "cropwindow.h" #include "imagearea.h" + #include "../rtengine/dcrop.h" +#include "../rtengine/procparams.h" #include "../rtengine/refreshmap.h" #include "../rtengine/rt_math.h" using namespace rtengine; CropHandler::CropHandler() : + cropParams(new procparams::CropParams), + colorParams(new procparams::ColorManagementParams), zoom(100), ww(0), wh(0), @@ -123,8 +127,8 @@ bool CropHandler::isFullDisplay () double CropHandler::getFitCropZoom () { - double z1 = (double) wh / cropParams.h; - double z2 = (double) ww / cropParams.w; + double z1 = (double) wh / cropParams->h; + double z2 = (double) ww / cropParams->w; return z1 < z2 ? z1 : z2; } @@ -312,8 +316,8 @@ void CropHandler::setDetailedCrop( cimg.lock (); - cropParams = cp; - colorParams = cmp; + *cropParams = cp; + *colorParams = cmp; if (!cropimg.empty()) { cropimg.clear(); diff --git a/rtgui/crophandler.h b/rtgui/crophandler.h index 2690ca002..e0b48d348 100644 --- a/rtgui/crophandler.h +++ b/rtgui/crophandler.h @@ -21,6 +21,7 @@ #include #include +#include #include @@ -105,8 +106,8 @@ public: void update (); - rtengine::procparams::CropParams cropParams; - rtengine::procparams::ColorManagementParams colorParams; + const std::unique_ptr cropParams; + const std::unique_ptr colorParams; Glib::RefPtr cropPixbuf; // image displayed on monitor, using the monitor profile (i.e. lab to monitor profile) Glib::RefPtr cropPixbuftrue; // internal image in output color space for analysis (i.e. lab to either Working profile or Output profile, depending on options.rtSettings.HistogramWorking) diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 0e6530882..46227709d 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -16,21 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "cropwindow.h" - #include -#include "../rtengine/mytime.h" -#include "../rtengine/rt_math.h" -#include "../rtengine/dcrop.h" +#include "cropwindow.h" -#include "guiutils.h" -#include "threadutils.h" -#include "rtimage.h" #include "cursormanager.h" -#include "options.h" +#include "guiutils.h" #include "imagearea.h" #include "lockablecolorpicker.h" +#include "options.h" +#include "rtimage.h" +#include "threadutils.h" + +#include "../rtengine/dcrop.h" +#include "../rtengine/mytime.h" +#include "../rtengine/procparams.h" +#include "../rtengine/rt_math.h" using namespace rtengine; @@ -352,8 +353,8 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) } else { if (onArea (CropImage, x, y)) { // events inside of the image domain crop_custom_ratio = 0.f; - if ((bstate & GDK_SHIFT_MASK) && cropHandler.cropParams.w > 0 && cropHandler.cropParams.h > 0) { - crop_custom_ratio = float(cropHandler.cropParams.w) / float(cropHandler.cropParams.h); + if ((bstate & GDK_SHIFT_MASK) && cropHandler.cropParams->w > 0 && cropHandler.cropParams->h > 0) { + crop_custom_ratio = float(cropHandler.cropParams->w) / float(cropHandler.cropParams->h); } if (iarea->getToolMode () == TMColorPicker) { @@ -373,7 +374,7 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) // Add a new Color Picker rtengine::Coord imgPos; screenCoordToImage(x, y, imgPos.x, imgPos.y); - LockableColorPicker *newPicker = new LockableColorPicker(this, &cropHandler.colorParams.outputProfile, &cropHandler.colorParams.workingProfile); + LockableColorPicker *newPicker = new LockableColorPicker(this, &cropHandler.colorParams->outputProfile, &cropHandler.colorParams->workingProfile); colorPickers.push_back(newPicker); hoveredPicker = newPicker; updateHoveredPicker(&imgPos); @@ -387,49 +388,49 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) } else if (onArea (CropTopLeft, x, y)) { state = SResizeTL; press_x = x; - action_x = cropHandler.cropParams.x; + action_x = cropHandler.cropParams->x; press_y = y; - action_y = cropHandler.cropParams.y; + action_y = cropHandler.cropParams->y; } else if (onArea (CropTopRight, x, y)) { state = SResizeTR; press_x = x; - action_x = cropHandler.cropParams.w; + action_x = cropHandler.cropParams->w; press_y = y; - action_y = cropHandler.cropParams.y; + action_y = cropHandler.cropParams->y; } else if (onArea (CropBottomLeft, x, y)) { state = SResizeBL; press_x = x; - action_x = cropHandler.cropParams.x; + action_x = cropHandler.cropParams->x; press_y = y; - action_y = cropHandler.cropParams.h; + action_y = cropHandler.cropParams->h; } else if (onArea (CropBottomRight, x, y)) { state = SResizeBR; press_x = x; - action_x = cropHandler.cropParams.w; + action_x = cropHandler.cropParams->w; press_y = y; - action_y = cropHandler.cropParams.h; + action_y = cropHandler.cropParams->h; } else if (onArea (CropTop, x, y)) { state = SResizeH1; press_y = y; - action_y = cropHandler.cropParams.y; + action_y = cropHandler.cropParams->y; } else if (onArea (CropBottom, x, y)) { state = SResizeH2; press_y = y; - action_y = cropHandler.cropParams.h; + action_y = cropHandler.cropParams->h; } else if (onArea (CropLeft, x, y)) { state = SResizeW1; press_x = x; - action_x = cropHandler.cropParams.x; + action_x = cropHandler.cropParams->x; } else if (onArea (CropRight, x, y)) { state = SResizeW2; press_x = x; - action_x = cropHandler.cropParams.w; + action_x = cropHandler.cropParams->w; } else if ((bstate & GDK_SHIFT_MASK) && onArea (CropInside, x, y)) { state = SCropMove; press_x = x; press_y = y; - action_x = cropHandler.cropParams.x; - action_y = cropHandler.cropParams.y; + action_x = cropHandler.cropParams->x; + action_y = cropHandler.cropParams->y; } else if (onArea (CropObserved, x, y)) { state = SObservedMove; press_x = x; @@ -450,11 +451,11 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) } else if (iarea->getToolMode () == TMCropSelect && cropgl) { state = SCropSelecting; screenCoordToImage (x, y, press_x, press_y); - cropHandler.cropParams.enabled = true; - cropHandler.cropParams.x = press_x; - cropHandler.cropParams.y = press_y; - cropHandler.cropParams.w = cropHandler.cropParams.h = 1; - cropgl->cropInit (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h); + cropHandler.cropParams->enabled = true; + cropHandler.cropParams->x = press_x; + cropHandler.cropParams->y = press_y; + cropHandler.cropParams->w = cropHandler.cropParams->h = 1; + cropgl->cropInit (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h); } else if (iarea->getToolMode () == TMHand) { if (editSubscriber) { if ((cropgl && cropgl->inImageArea(iarea->posImage.x, iarea->posImage.y) && (editSubscriber->getEditingType() == ET_PIPETTE && (bstate & GDK_CONTROL_MASK))) || editSubscriber->getEditingType() == ET_OBJECTS) { @@ -827,57 +828,57 @@ void CropWindow::pointerMoved (int bstate, int x, int y) action_y = y; iarea->redraw (); } else if (state == SResizeH1 && cropgl) { - int oy = cropHandler.cropParams.y; - cropHandler.cropParams.y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.h += oy - cropHandler.cropParams.y; - cropgl->cropHeight1Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + int oy = cropHandler.cropParams->y; + cropHandler.cropParams->y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->h += oy - cropHandler.cropParams->y; + cropgl->cropHeight1Resized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SResizeH2 && cropgl) { - cropHandler.cropParams.h = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; - cropgl->cropHeight2Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + cropHandler.cropParams->h = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; + cropgl->cropHeight2Resized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SResizeW1 && cropgl) { - int ox = cropHandler.cropParams.x; - cropHandler.cropParams.x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.w += ox - cropHandler.cropParams.x; - cropgl->cropWidth1Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + int ox = cropHandler.cropParams->x; + cropHandler.cropParams->x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->w += ox - cropHandler.cropParams->x; + cropgl->cropWidth1Resized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SResizeW2 && cropgl) { - cropHandler.cropParams.w = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; - cropgl->cropWidth2Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + cropHandler.cropParams->w = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; + cropgl->cropWidth2Resized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SResizeTL && cropgl) { - int ox = cropHandler.cropParams.x; - cropHandler.cropParams.x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.w += ox - cropHandler.cropParams.x; - int oy = cropHandler.cropParams.y; - cropHandler.cropParams.y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.h += oy - cropHandler.cropParams.y; - cropgl->cropTopLeftResized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + int ox = cropHandler.cropParams->x; + cropHandler.cropParams->x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->w += ox - cropHandler.cropParams->x; + int oy = cropHandler.cropParams->y; + cropHandler.cropParams->y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->h += oy - cropHandler.cropParams->y; + cropgl->cropTopLeftResized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SResizeTR && cropgl) { - cropHandler.cropParams.w = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; - int oy = cropHandler.cropParams.y; - cropHandler.cropParams.y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.h += oy - cropHandler.cropParams.y; - cropgl->cropTopRightResized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + cropHandler.cropParams->w = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; + int oy = cropHandler.cropParams->y; + cropHandler.cropParams->y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->h += oy - cropHandler.cropParams->y; + cropgl->cropTopRightResized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SResizeBL && cropgl) { - int ox = cropHandler.cropParams.x; - cropHandler.cropParams.x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.w += ox - cropHandler.cropParams.x; - cropHandler.cropParams.h = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; - cropgl->cropBottomLeftResized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + int ox = cropHandler.cropParams->x; + cropHandler.cropParams->x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->w += ox - cropHandler.cropParams->x; + cropHandler.cropParams->h = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; + cropgl->cropBottomLeftResized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SResizeBR && cropgl) { - cropHandler.cropParams.w = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.h = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; - cropgl->cropBottomRightResized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h, crop_custom_ratio); + cropHandler.cropParams->w = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->h = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; + cropgl->cropBottomRightResized (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h, crop_custom_ratio); iarea->redraw (); } else if (state == SCropMove && cropgl) { - cropHandler.cropParams.x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; - cropHandler.cropParams.y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; - cropgl->cropMoved (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h); + cropHandler.cropParams->x = action_x + (x - press_x) / zoomSteps[cropZoom].zoom; + cropHandler.cropParams->y = action_y + (y - press_y) / zoomSteps[cropZoom].zoom; + cropgl->cropMoved (cropHandler.cropParams->x, cropHandler.cropParams->y, cropHandler.cropParams->w, cropHandler.cropParams->h); iarea->redraw (); } else if (state == SCropSelecting && cropgl) { screenCoordToImage (x, y, action_x, action_y); @@ -886,19 +887,19 @@ void CropWindow::pointerMoved (int bstate, int x, int y) cropgl->cropResized (cx1, cy1, cx2, cy2); if (cx2 > cx1) { - cropHandler.cropParams.x = cx1; - cropHandler.cropParams.w = cx2 - cx1 + 1; + cropHandler.cropParams->x = cx1; + cropHandler.cropParams->w = cx2 - cx1 + 1; } else { - cropHandler.cropParams.x = cx2; - cropHandler.cropParams.w = cx1 - cx2 + 1; + cropHandler.cropParams->x = cx2; + cropHandler.cropParams->w = cx1 - cx2 + 1; } if (cy2 > cy1) { - cropHandler.cropParams.y = cy1; - cropHandler.cropParams.h = cy2 - cy1 + 1; + cropHandler.cropParams->y = cy1; + cropHandler.cropParams->h = cy2 - cy1 + 1; } else { - cropHandler.cropParams.y = cy2; - cropHandler.cropParams.h = cy1 - cy2 + 1; + cropHandler.cropParams->y = cy2; + cropHandler.cropParams->h = cy1 - cy2 + 1; } iarea->redraw (); @@ -1018,17 +1019,17 @@ void CropWindow::pointerMoved (int bstate, int x, int y) if (!onArea (CropImage, x, y) || !cropHandler.cropPixbuftrue) { cropHandler.getFullImageSize(mx, my); - // pmlistener->pointerMoved (false, cropHandler.colorParams.working, mx, my, -1, -1, -1); - // if (pmhlistener) pmhlistener->pointerMoved (false, cropHandler.colorParams.working, mx, my, -1, -1, -1); + // pmlistener->pointerMoved (false, cropHandler.colorParams->working, mx, my, -1, -1, -1); + // if (pmhlistener) pmhlistener->pointerMoved (false, cropHandler.colorParams->working, mx, my, -1, -1, -1); /* Glib::ustring outputProfile; - outputProfile =cropHandler.colorParams.output ; + outputProfile =cropHandler.colorParams->output ; printf("Using \"%s\" output\n", outputProfile.c_str()); if(outputProfile==options.rtSettings.srgb) printf("OK SRGB2"); */ - pmlistener->pointerMoved (false, cropHandler.colorParams.outputProfile, cropHandler.colorParams.workingProfile, mx, my, -1, -1, -1); + pmlistener->pointerMoved (false, cropHandler.colorParams->outputProfile, cropHandler.colorParams->workingProfile, mx, my, -1, -1, -1); if (pmhlistener) { - pmhlistener->pointerMoved (false, cropHandler.colorParams.outputProfile, cropHandler.colorParams.workingProfile, mx, my, -1, -1, -1); + pmhlistener->pointerMoved (false, cropHandler.colorParams->outputProfile, cropHandler.colorParams->workingProfile, mx, my, -1, -1, -1); } } else { @@ -1075,11 +1076,11 @@ 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, isRaw); + pmlistener->pointerMoved (true, cropHandler.colorParams->outputProfile, cropHandler.colorParams->workingProfile, mx, my, rval, gval, bval, isRaw); if (pmhlistener) { // Updates the HistogramRGBArea - pmhlistener->pointerMoved (true, cropHandler.colorParams.outputProfile, cropHandler.colorParams.workingProfile, mx, my, rval, gval, bval); + pmhlistener->pointerMoved (true, cropHandler.colorParams->outputProfile, cropHandler.colorParams->workingProfile, mx, my, rval, gval, bval); } } } @@ -1119,87 +1120,87 @@ bool CropWindow::onArea (CursorArea a, int x, int y) case CropTopLeft: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - y1 >= cropHandler.cropParams.y - CROPRESIZEBORDER && - y1 <= cropHandler.cropParams.y + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + y1 >= cropHandler.cropParams->y - CROPRESIZEBORDER && + y1 <= cropHandler.cropParams->y + CROPRESIZEBORDER && y >= ypos + imgY && - x1 >= cropHandler.cropParams.x - CROPRESIZEBORDER && - x1 <= cropHandler.cropParams.x + CROPRESIZEBORDER && + x1 >= cropHandler.cropParams->x - CROPRESIZEBORDER && + x1 <= cropHandler.cropParams->x + CROPRESIZEBORDER && x >= xpos + imgX; case CropTopRight: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - y1 >= cropHandler.cropParams.y - CROPRESIZEBORDER && - y1 <= cropHandler.cropParams.y + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + y1 >= cropHandler.cropParams->y - CROPRESIZEBORDER && + y1 <= cropHandler.cropParams->y + CROPRESIZEBORDER && y >= ypos + imgY && - x1 >= cropHandler.cropParams.x + cropHandler.cropParams.w - 1 - CROPRESIZEBORDER && - x1 <= cropHandler.cropParams.x + cropHandler.cropParams.w - 1 + CROPRESIZEBORDER && + x1 >= cropHandler.cropParams->x + cropHandler.cropParams->w - 1 - CROPRESIZEBORDER && + x1 <= cropHandler.cropParams->x + cropHandler.cropParams->w - 1 + CROPRESIZEBORDER && x < xpos + imgX + imgW; case CropBottomLeft: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - y1 >= cropHandler.cropParams.y + cropHandler.cropParams.h - 1 - CROPRESIZEBORDER && - y1 <= cropHandler.cropParams.y + cropHandler.cropParams.h - 1 + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + y1 >= cropHandler.cropParams->y + cropHandler.cropParams->h - 1 - CROPRESIZEBORDER && + y1 <= cropHandler.cropParams->y + cropHandler.cropParams->h - 1 + CROPRESIZEBORDER && y < ypos + imgY + imgH && - x1 >= cropHandler.cropParams.x - CROPRESIZEBORDER && - x1 <= cropHandler.cropParams.x + CROPRESIZEBORDER && + x1 >= cropHandler.cropParams->x - CROPRESIZEBORDER && + x1 <= cropHandler.cropParams->x + CROPRESIZEBORDER && x >= xpos + imgX; case CropBottomRight: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - y1 >= cropHandler.cropParams.y + cropHandler.cropParams.h - 1 - CROPRESIZEBORDER && - y1 <= cropHandler.cropParams.y + cropHandler.cropParams.h - 1 + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + y1 >= cropHandler.cropParams->y + cropHandler.cropParams->h - 1 - CROPRESIZEBORDER && + y1 <= cropHandler.cropParams->y + cropHandler.cropParams->h - 1 + CROPRESIZEBORDER && y < ypos + imgY + imgH && - x1 >= cropHandler.cropParams.x + cropHandler.cropParams.w - 1 - CROPRESIZEBORDER && - x1 <= cropHandler.cropParams.x + cropHandler.cropParams.w - 1 + CROPRESIZEBORDER && + x1 >= cropHandler.cropParams->x + cropHandler.cropParams->w - 1 - CROPRESIZEBORDER && + x1 <= cropHandler.cropParams->x + cropHandler.cropParams->w - 1 + CROPRESIZEBORDER && x < xpos + imgX + imgW; case CropTop: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - x1 > cropHandler.cropParams.x + CROPRESIZEBORDER && - x1 < cropHandler.cropParams.x + cropHandler.cropParams.w - 1 - CROPRESIZEBORDER && - y1 > cropHandler.cropParams.y - CROPRESIZEBORDER && - y1 < cropHandler.cropParams.y + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + x1 > cropHandler.cropParams->x + CROPRESIZEBORDER && + x1 < cropHandler.cropParams->x + cropHandler.cropParams->w - 1 - CROPRESIZEBORDER && + y1 > cropHandler.cropParams->y - CROPRESIZEBORDER && + y1 < cropHandler.cropParams->y + CROPRESIZEBORDER && y >= ypos + imgY; case CropBottom: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - x1 > cropHandler.cropParams.x + CROPRESIZEBORDER && - x1 < cropHandler.cropParams.x + cropHandler.cropParams.w - 1 - CROPRESIZEBORDER && - y1 > cropHandler.cropParams.y + cropHandler.cropParams.h - 1 - CROPRESIZEBORDER && - y1 < cropHandler.cropParams.y + cropHandler.cropParams.h - 1 + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + x1 > cropHandler.cropParams->x + CROPRESIZEBORDER && + x1 < cropHandler.cropParams->x + cropHandler.cropParams->w - 1 - CROPRESIZEBORDER && + y1 > cropHandler.cropParams->y + cropHandler.cropParams->h - 1 - CROPRESIZEBORDER && + y1 < cropHandler.cropParams->y + cropHandler.cropParams->h - 1 + CROPRESIZEBORDER && y < ypos + imgY + imgH; case CropLeft: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - y1 > cropHandler.cropParams.y + CROPRESIZEBORDER && - y1 < cropHandler.cropParams.y + cropHandler.cropParams.h - 1 - CROPRESIZEBORDER && - x1 > cropHandler.cropParams.x - CROPRESIZEBORDER && - x1 < cropHandler.cropParams.x + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + y1 > cropHandler.cropParams->y + CROPRESIZEBORDER && + y1 < cropHandler.cropParams->y + cropHandler.cropParams->h - 1 - CROPRESIZEBORDER && + x1 > cropHandler.cropParams->x - CROPRESIZEBORDER && + x1 < cropHandler.cropParams->x + CROPRESIZEBORDER && x >= xpos + imgX; case CropRight: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - y1 > cropHandler.cropParams.y + CROPRESIZEBORDER && - y1 < cropHandler.cropParams.y + cropHandler.cropParams.h - 1 - CROPRESIZEBORDER && - x1 > cropHandler.cropParams.x + cropHandler.cropParams.w - 1 - CROPRESIZEBORDER && - x1 < cropHandler.cropParams.x + cropHandler.cropParams.w - 1 + CROPRESIZEBORDER && + return cropHandler.cropParams->enabled && + y1 > cropHandler.cropParams->y + CROPRESIZEBORDER && + y1 < cropHandler.cropParams->y + cropHandler.cropParams->h - 1 - CROPRESIZEBORDER && + x1 > cropHandler.cropParams->x + cropHandler.cropParams->w - 1 - CROPRESIZEBORDER && + x1 < cropHandler.cropParams->x + cropHandler.cropParams->w - 1 + CROPRESIZEBORDER && x < xpos + imgX + imgW; case CropInside: screenCoordToImage (x, y, x1, y1); - return cropHandler.cropParams.enabled && - y1 > cropHandler.cropParams.y && - y1 < cropHandler.cropParams.y + cropHandler.cropParams.h - 1 && - x1 > cropHandler.cropParams.x && - x1 < cropHandler.cropParams.x + cropHandler.cropParams.w - 1; + return cropHandler.cropParams->enabled && + y1 > cropHandler.cropParams->y && + y1 < cropHandler.cropParams->y + cropHandler.cropParams->h - 1 && + x1 > cropHandler.cropParams->x && + x1 < cropHandler.cropParams->x + cropHandler.cropParams->w - 1; case CropResize: return decorated && x >= xpos + width - 16 && y >= ypos + height - 16 && x < xpos + width && y < ypos + height; @@ -1367,7 +1368,7 @@ void CropWindow::expose (Cairo::RefPtr cr) Gdk::Cairo::set_source_pixbuf(cr, rough, posX, posY); cr->rectangle(posX, posY, rtengine::min (rough->get_width (), imgAreaW-imgX), rtengine::min (rough->get_height (), imgAreaH-imgY)); cr->fill(); -// if (cropHandler.cropParams.enabled) +// if (cropHandler.cropParams->enabled) // drawCrop (cr, x+imgX, y+imgY, imgW, imgH, cropX, cropY, zoomSteps[cropZoom].zoom, cropHandler.cropParams); } @@ -1375,7 +1376,7 @@ void CropWindow::expose (Cairo::RefPtr cr) drawObservedFrame (cr); } } else { - CropParams cropParams = cropHandler.cropParams; + CropParams cropParams = *cropHandler.cropParams; if (state == SNormal) { switch (options.cropGuides) { case Options::CROP_GUIDE_NONE: @@ -1805,7 +1806,7 @@ void CropWindow::expose (Cairo::RefPtr cr) cr->fill(); } - if (cropHandler.cropParams.enabled) { + if (cropHandler.cropParams->enabled) { int cropX, cropY; cropHandler.getPosition (cropX, cropY); drawCrop (cr, x + imgAreaX + imgX, y + imgAreaY + imgY, imgW, imgH, cropX, cropY, zoomSteps[cropZoom].zoom, cropParams, (this == iarea->mainCropWindow), useBgColor, cropHandler.isFullDisplay ()); @@ -1888,7 +1889,7 @@ void CropWindow::expose (Cairo::RefPtr cr) cr->rectangle(posX, posY, rtengine::min (rough->get_width (), imgAreaW-imgX), rtengine::min (rough->get_height (), imgAreaH-imgY)); cr->fill(); - if (cropHandler.cropParams.enabled) { + if (cropHandler.cropParams->enabled) { drawCrop (cr, x + imgAreaX + imgX, y + imgAreaY + imgY, rough->get_width(), rough->get_height(), cropX, cropY, zoomSteps[cropZoom].zoom, cropParams, (this == iarea->mainCropWindow), useBgColor, cropHandler.isFullDisplay ()); } @@ -1947,9 +1948,9 @@ void CropWindow::zoomIn (bool toCursor, int cursorX, int cursorY) y = cursorY; } else { if (zoomSteps[cropZoom].zoom <= cropHandler.getFitZoom()) { - if (cropHandler.cropParams.enabled) { - x = cropHandler.cropParams.x + cropHandler.cropParams.w / 2; - y = cropHandler.cropParams.y + cropHandler.cropParams.h / 2; + if (cropHandler.cropParams->enabled) { + x = cropHandler.cropParams->x + cropHandler.cropParams->w / 2; + y = cropHandler.cropParams->y + cropHandler.cropParams->h / 2; } else { int fw, fh; cropHandler.getFullImageSize(fw, fh); @@ -1961,11 +1962,11 @@ void CropWindow::zoomIn (bool toCursor, int cursorX, int cursorY) } else if (zoomVersion != exposeVersion) { screenCoordToImage(xpos + imgX + imgW / 2, ypos + imgY + imgH / 2, x, y); - if (cropHandler.cropParams.enabled) { + if (cropHandler.cropParams->enabled) { // add some gravity towards crop center - int x1 = cropHandler.cropParams.x + cropHandler.cropParams.w / 2; - int y1 = cropHandler.cropParams.y + cropHandler.cropParams.h / 2; - double cropd = sqrt(cropHandler.cropParams.h * cropHandler.cropParams.h + cropHandler.cropParams.w * cropHandler.cropParams.w) * zoomSteps[cropZoom].zoom; + int x1 = cropHandler.cropParams->x + cropHandler.cropParams->w / 2; + int y1 = cropHandler.cropParams->y + cropHandler.cropParams->h / 2; + double cropd = sqrt(cropHandler.cropParams->h * cropHandler.cropParams->h + cropHandler.cropParams->w * cropHandler.cropParams->w) * zoomSteps[cropZoom].zoom; double imd = sqrt(imgW * imgW + imgH * imgH); double d; @@ -2023,9 +2024,9 @@ void CropWindow::zoom11 (bool notify) int y = -1; if (zoomSteps[cropZoom].zoom <= cropHandler.getFitZoom()) { - if (cropHandler.cropParams.enabled) { - x = cropHandler.cropParams.x + cropHandler.cropParams.w / 2; - y = cropHandler.cropParams.y + cropHandler.cropParams.h / 2; + if (cropHandler.cropParams->enabled) { + x = cropHandler.cropParams->x + cropHandler.cropParams->w / 2; + y = cropHandler.cropParams->y + cropHandler.cropParams->h / 2; } else { int fw, fh; cropHandler.getFullImageSize(fw, fh); @@ -2114,7 +2115,7 @@ void CropWindow::zoomFit () void CropWindow::zoomFitCrop () { - if(cropHandler.cropParams.enabled) { + if(cropHandler.cropParams->enabled) { double z = cropHandler.getFitCropZoom (); int cz = int(zoomSteps.size())-1; @@ -2129,8 +2130,8 @@ void CropWindow::zoomFitCrop () zoomVersion = exposeVersion; int centerX, centerY; - centerX = cropHandler.cropParams.x + cropHandler.cropParams.w / 2; - centerY = cropHandler.cropParams.y + cropHandler.cropParams.h / 2; + centerX = cropHandler.cropParams->x + cropHandler.cropParams->w / 2; + centerY = cropHandler.cropParams->y + cropHandler.cropParams->h / 2; setCropAnchorPosition(centerX, centerY); changeZoom (cz, true, centerX, centerY); fitZoom = options.cropAutoFit; diff --git a/rtgui/darkframe.cc b/rtgui/darkframe.cc index d0f2e9ed0..77e9c53a6 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -16,12 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "darkframe.h" -#include "options.h" -#include "guiutils.h" #include + +#include "darkframe.h" + +#include "guiutils.h" +#include "options.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/defringe.cc b/rtgui/defringe.cc index 6a3d11d76..7d29b8c8f 100644 --- a/rtgui/defringe.cc +++ b/rtgui/defringe.cc @@ -16,9 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "defringe.h" -#include #include +#include + +#include "defringe.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/dehaze.cc b/rtgui/dehaze.cc index 0f0892ac6..8204210db 100644 --- a/rtgui/dehaze.cc +++ b/rtgui/dehaze.cc @@ -17,10 +17,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "dehaze.h" -#include "eventmapper.h" -#include #include +#include + +#include "dehaze.h" + +#include "eventmapper.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index 613dc8d44..7be07420e 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -16,12 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "dirpyrdenoise.h" -#include #include +#include + +#include "dirpyrdenoise.h" + #include "edit.h" #include "guiutils.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; extern Options options; diff --git a/rtgui/distortion.cc b/rtgui/distortion.cc index d1d097269..0ac067ba8 100644 --- a/rtgui/distortion.cc +++ b/rtgui/distortion.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "distortion.h" #include + +#include "distortion.h" + #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/epd.cc b/rtgui/epd.cc index 675a5b9b9..4b7cca10a 100644 --- a/rtgui/epd.cc +++ b/rtgui/epd.cc @@ -16,9 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "epd.h" -#include #include +#include + +#include "epd.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index 20416c549..1882f4377 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -21,13 +21,17 @@ #include "guiutils.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; using namespace rtexif; -ExifPanel::ExifPanel () : idata (nullptr) +ExifPanel::ExifPanel() : + idata(nullptr), + changeList(new rtengine::procparams::ExifPairs), + defChangeList(new rtengine::procparams::ExifPairs) { - recursiveOp = true; exifTree = Gtk::manage (new Gtk::TreeView()); @@ -166,7 +170,7 @@ void ExifPanel::read (const ProcParams* pp, const ParamsEdited* pedited) disableListener (); - changeList = pp->exif; + *changeList = pp->exif; setImageData (idata); applyChangeList (); exifSelectionChanged (); @@ -178,13 +182,13 @@ void ExifPanel::write (ProcParams* pp, ParamsEdited* pedited) { // updateChangeList (); - pp->exif = changeList; + pp->exif = *changeList; } void ExifPanel::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { - defChangeList = defParams->exif; + *defChangeList = defParams->exif; } void ExifPanel::setImageData (const FramesMetaData* id) @@ -457,7 +461,7 @@ void ExifPanel::resetAllPressed () { setImageData (idata); - changeList = defChangeList; + *changeList = *defChangeList; applyChangeList (); exifSelectionChanged (); notifyListener (); @@ -661,11 +665,11 @@ void ExifPanel::updateChangeList (Gtk::TreeModel::Children root, std::string pre for (iter = root.begin(); iter != root.end(); ++iter) { if (iter->get_value (exifColumns.edited)) { - changeList[ prefix + iter->get_value (exifColumns.field_nopango) ] = iter->get_value (exifColumns.value_nopango); + (*changeList)[ prefix + iter->get_value (exifColumns.field_nopango) ] = iter->get_value (exifColumns.value_nopango); } else if (iter->get_value (exifColumns.action) == AC_WRITE && iter->get_value (exifColumns.icon) == delicon) { - changeList[ prefix + iter->get_value (exifColumns.field_nopango) ] = "#delete"; + (*changeList)[ prefix + iter->get_value (exifColumns.field_nopango) ] = "#delete"; } else if (iter->get_value (exifColumns.action) == AC_DONTWRITE && iter->get_value (exifColumns.icon) == keepicon) { - changeList[ prefix + iter->get_value (exifColumns.field_nopango) ] = "#keep"; + (*changeList)[ prefix + iter->get_value (exifColumns.field_nopango) ] = "#keep"; } if (iter->get_value (exifColumns.icon) == keepicon) { @@ -677,14 +681,14 @@ void ExifPanel::updateChangeList (Gtk::TreeModel::Children root, std::string pre void ExifPanel::updateChangeList () { - changeList.clear (); + changeList->clear (); updateChangeList (exifTreeModel->children(), ""); } void ExifPanel::applyChangeList () { - for (rtengine::procparams::ExifPairs::iterator i = changeList.begin(); i != changeList.end(); ++i) { + for (rtengine::procparams::ExifPairs::const_iterator i = changeList->begin(); i != changeList->end(); ++i) { editTag (exifTreeModel->children(), i->first, i->second); } } diff --git a/rtgui/exifpanel.h b/rtgui/exifpanel.h index cd27cb780..c8597a287 100644 --- a/rtgui/exifpanel.h +++ b/rtgui/exifpanel.h @@ -19,7 +19,10 @@ #ifndef _EXIFPANEL_ #define _EXIFPANEL_ +#include + #include + #include "toolpanel.h" class ExifPanel : public Gtk::VBox, public ToolPanel @@ -27,8 +30,8 @@ class ExifPanel : public Gtk::VBox, public ToolPanel private: const rtengine::FramesMetaData* idata; - rtengine::procparams::ExifPairs changeList; - rtengine::procparams::ExifPairs defChangeList; + const std::unique_ptr changeList; + const std::unique_ptr defChangeList; bool recursiveOp; class ExifColumns : public Gtk::TreeModelColumnRecord diff --git a/rtgui/exportpanel.cc b/rtgui/exportpanel.cc index 3a74d3ca3..9a4c930d5 100644 --- a/rtgui/exportpanel.cc +++ b/rtgui/exportpanel.cc @@ -22,6 +22,8 @@ #include "options.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/fattaltonemap.cc b/rtgui/fattaltonemap.cc index 3a6a15a4d..85d835cc7 100644 --- a/rtgui/fattaltonemap.cc +++ b/rtgui/fattaltonemap.cc @@ -17,10 +17,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "fattaltonemap.h" -#include "eventmapper.h" -#include #include +#include + +#include "fattaltonemap.h" + +#include "eventmapper.h" + +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index d489bb1d3..2a576013a 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -18,19 +18,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "filebrowser.h" #include + #include -#include "options.h" -#include "multilangmgr.h" -#include "clipboard.h" -#include "procparamchangers.h" + +#include "filebrowser.h" + #include "batchqueue.h" -#include "../rtengine/dfmanager.h" -#include "../rtengine/ffmanager.h" +#include "clipboard.h" +#include "multilangmgr.h" +#include "options.h" +#include "procparamchangers.h" #include "rtimage.h" #include "threadutils.h" +#include "../rtengine/dfmanager.h" +#include "../rtengine/ffmanager.h" +#include "../rtengine/procparams.h" + extern Options options; namespace diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 70d2fc128..a55e2ffca 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -18,15 +18,17 @@ */ #include "filebrowserentry.h" -#include #include +#include -#include "guiutils.h" -#include "threadutils.h" -#include "rtimage.h" #include "cursormanager.h" -#include "thumbbrowserbase.h" +#include "guiutils.h" #include "inspector.h" +#include "rtimage.h" +#include "threadutils.h" +#include "thumbbrowserbase.h" + +#include "../rtengine/procparams.h" #define CROPRESIZEBORDER 4 @@ -40,7 +42,7 @@ Glib::RefPtr FileBrowserEntry::hdr; Glib::RefPtr FileBrowserEntry::ps; FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname) - : ThumbBrowserEntryBase (fname), wasInside(false), iatlistener(nullptr), press_x(0), press_y(0), action_x(0), action_y(0), rot_deg(0.0), landscape(true), cropgl(nullptr), state(SNormal), crop_custom_ratio(0.f) + : ThumbBrowserEntryBase (fname), wasInside(false), iatlistener(nullptr), press_x(0), press_y(0), action_x(0), action_y(0), rot_deg(0.0), landscape(true), cropParams(new rtengine::procparams::CropParams), cropgl(nullptr), state(SNormal), crop_custom_ratio(0.f) { thumbnail = thm; @@ -163,9 +165,9 @@ std::vector > FileBrowserEntry::getSpecificityIconsOnI void FileBrowserEntry::customBackBufferUpdate (Cairo::RefPtr c) { - if(scale != 1.0 && cropParams.enabled) { // somewhere in pipeline customBackBufferUpdate is called when scale == 1.0, which is nonsense for a thumb + if(scale != 1.0 && cropParams->enabled) { // somewhere in pipeline customBackBufferUpdate is called when scale == 1.0, which is nonsense for a thumb if (state == SCropSelecting || state == SResizeH1 || state == SResizeH2 || state == SResizeW1 || state == SResizeW2 || state == SResizeTL || state == SResizeTR || state == SResizeBL || state == SResizeBR || state == SCropMove) { - drawCrop (c, prex, prey, prew, preh, 0, 0, scale, cropParams, true, false); + drawCrop (c, prex, prey, prew, preh, 0, 0, scale, *cropParams, true, false); } else { rtengine::procparams::CropParams cparams = thumbnail->getProcParams().crop; switch (options.cropGuides) { @@ -246,7 +248,7 @@ void FileBrowserEntry::_updateImage(rtengine::IImage8* img, double s, const rten redrawRequests--; scale = s; - this->cropParams = cropParams; + *this->cropParams = cropParams; bool newLandscape = img->getWidth() > img->getHeight(); bool rotated = false; @@ -319,65 +321,65 @@ bool FileBrowserEntry::motionNotify (int x, int y) action_y = y; parent->redrawNeeded (this); } else if (state == SResizeH1 && cropgl) { - int oy = cropParams.y; - cropParams.y = action_y + (y - press_y) / scale; - cropParams.h += oy - cropParams.y; - cropgl->cropHeight1Resized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + int oy = cropParams->y; + cropParams->y = action_y + (y - press_y) / scale; + cropParams->h += oy - cropParams->y; + cropgl->cropHeight1Resized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SResizeH2 && cropgl) { - cropParams.h = action_y + (y - press_y) / scale; - cropgl->cropHeight2Resized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + cropParams->h = action_y + (y - press_y) / scale; + cropgl->cropHeight2Resized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SResizeW1 && cropgl) { - int ox = cropParams.x; - cropParams.x = action_x + (x - press_x) / scale; - cropParams.w += ox - cropParams.x; - cropgl->cropWidth1Resized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + int ox = cropParams->x; + cropParams->x = action_x + (x - press_x) / scale; + cropParams->w += ox - cropParams->x; + cropgl->cropWidth1Resized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SResizeW2 && cropgl) { - cropParams.w = action_x + (x - press_x) / scale; - cropgl->cropWidth2Resized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + cropParams->w = action_x + (x - press_x) / scale; + cropgl->cropWidth2Resized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SResizeTL && cropgl) { - int ox = cropParams.x; - cropParams.x = action_x + (x - press_x) / scale; - cropParams.w += ox - cropParams.x; - int oy = cropParams.y; - cropParams.y = action_y + (y - press_y) / scale; - cropParams.h += oy - cropParams.y; - cropgl->cropTopLeftResized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + int ox = cropParams->x; + cropParams->x = action_x + (x - press_x) / scale; + cropParams->w += ox - cropParams->x; + int oy = cropParams->y; + cropParams->y = action_y + (y - press_y) / scale; + cropParams->h += oy - cropParams->y; + cropgl->cropTopLeftResized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SResizeTR && cropgl) { - cropParams.w = action_x + (x - press_x) / scale; - int oy = cropParams.y; - cropParams.y = action_y + (y - press_y) / scale; - cropParams.h += oy - cropParams.y; - cropgl->cropTopRightResized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + cropParams->w = action_x + (x - press_x) / scale; + int oy = cropParams->y; + cropParams->y = action_y + (y - press_y) / scale; + cropParams->h += oy - cropParams->y; + cropgl->cropTopRightResized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SResizeBL && cropgl) { - int ox = cropParams.x; - cropParams.x = action_x + (x - press_x) / scale; - cropParams.w += ox - cropParams.x; - cropParams.h = action_y + (y - press_y) / scale; - cropgl->cropBottomLeftResized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + int ox = cropParams->x; + cropParams->x = action_x + (x - press_x) / scale; + cropParams->w += ox - cropParams->x; + cropParams->h = action_y + (y - press_y) / scale; + cropgl->cropBottomLeftResized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SResizeBR && cropgl) { - cropParams.w = action_x + (x - press_x) / scale; - cropParams.h = action_y + (y - press_y) / scale; - cropgl->cropBottomRightResized (cropParams.x, cropParams.y, cropParams.w, cropParams.h, crop_custom_ratio); + cropParams->w = action_x + (x - press_x) / scale; + cropParams->h = action_y + (y - press_y) / scale; + cropgl->cropBottomRightResized (cropParams->x, cropParams->y, cropParams->w, cropParams->h, crop_custom_ratio); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SCropMove && cropgl) { - cropParams.x = action_x + (x - press_x) / scale; - cropParams.y = action_y + (y - press_y) / scale; - cropgl->cropMoved (cropParams.x, cropParams.y, cropParams.w, cropParams.h); + cropParams->x = action_x + (x - press_x) / scale; + cropParams->y = action_y + (y - press_y) / scale; + cropgl->cropMoved (cropParams->x, cropParams->y, cropParams->w, cropParams->h); updateBackBuffer (); parent->redrawNeeded (this); } else if (state == SCropSelecting && cropgl) { @@ -386,19 +388,19 @@ bool FileBrowserEntry::motionNotify (int x, int y) cropgl->cropResized (cx1, cy1, cx2, cy2); if (cx2 > cx1) { - cropParams.x = cx1; - cropParams.w = cx2 - cx1 + 1; + cropParams->x = cx1; + cropParams->w = cx2 - cx1 + 1; } else { - cropParams.x = cx2; - cropParams.w = cx1 - cx2 + 1; + cropParams->x = cx2; + cropParams->w = cx1 - cx2 + 1; } if (cy2 > cy1) { - cropParams.y = cy1; - cropParams.h = cy2 - cy1 + 1; + cropParams->y = cy1; + cropParams->h = cy2 - cy1 + 1; } else { - cropParams.y = cy2; - cropParams.h = cy1 - cy2 + 1; + cropParams->y = cy2; + cropParams->h = cy1 - cy2 + 1; } updateBackBuffer (); @@ -429,71 +431,71 @@ bool FileBrowserEntry::pressNotify (int button, int type, int bstate, int x, i if (!b && selected && inside (x, y)) { if (button == 1 && type == GDK_BUTTON_PRESS && state == SNormal) { - if ((bstate & GDK_SHIFT_MASK) && cropParams.w > 0 && cropParams.h > 0) { - crop_custom_ratio = float(cropParams.w) / float(cropParams.h); + if ((bstate & GDK_SHIFT_MASK) && cropParams->w > 0 && cropParams->h > 0) { + crop_custom_ratio = float(cropParams->w) / float(cropParams->h); } if (onArea (CropTopLeft, ix, iy)) { state = SResizeTL; press_x = x; - action_x = cropParams.x; + action_x = cropParams->x; press_y = y; - action_y = cropParams.y; + action_y = cropParams->y; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropTopRight, ix, iy)) { state = SResizeTR; press_x = x; - action_x = cropParams.w; + action_x = cropParams->w; press_y = y; - action_y = cropParams.y; + action_y = cropParams->y; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropBottomLeft, ix, iy)) { state = SResizeBL; press_x = x; - action_x = cropParams.x; + action_x = cropParams->x; press_y = y; - action_y = cropParams.h; + action_y = cropParams->h; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropBottomRight, ix, iy)) { state = SResizeBR; press_x = x; - action_x = cropParams.w; + action_x = cropParams->w; press_y = y; - action_y = cropParams.h; + action_y = cropParams->h; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropTop, ix, iy)) { state = SResizeH1; press_y = y; - action_y = cropParams.y; + action_y = cropParams->y; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropBottom, ix, iy)) { state = SResizeH2; press_y = y; - action_y = cropParams.h; + action_y = cropParams->h; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropLeft, ix, iy)) { state = SResizeW1; press_x = x; - action_x = cropParams.x; + action_x = cropParams->x; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropRight, ix, iy)) { state = SResizeW2; press_x = x; - action_x = cropParams.w; + action_x = cropParams->w; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if ((bstate & GDK_SHIFT_MASK) && onArea (CropInside, ix, iy)) { state = SCropMove; press_x = x; press_y = y; - action_x = cropParams.x; - action_y = cropParams.y; + action_x = cropParams->x; + action_y = cropParams->y; cropgl = iatlistener->startCropEditing (thumbnail); b = true; } else if (onArea (CropImage, ix, iy)) { @@ -513,10 +515,10 @@ bool FileBrowserEntry::pressNotify (int button, int type, int bstate, int x, i if (cropgl) { state = SCropSelecting; - press_x = cropParams.x = (ix - prex) / scale; - press_y = cropParams.y = (iy - prey) / scale; - cropParams.w = cropParams.h = 1; - cropgl->cropInit (cropParams.x, cropParams.y, cropParams.w, cropParams.h); + press_x = cropParams->x = (ix - prex) / scale; + press_y = cropParams->y = (iy - prey) / scale; + cropParams->w = cropParams->h = 1; + cropgl->cropInit (cropParams->x, cropParams->y, cropParams->w, cropParams->h); b = true; } } @@ -582,67 +584,67 @@ bool FileBrowserEntry::onArea (CursorArea a, int x, int y) return x >= prex && x < prex + prew && y >= prey && y < prey + preh; case CropTopLeft: - return cropParams.enabled && - y1 >= cropParams.y - cropResizeBorder && - y1 <= cropParams.y + cropResizeBorder && - x1 >= cropParams.x - cropResizeBorder && - x1 <= cropParams.x + cropResizeBorder; + return cropParams->enabled && + y1 >= cropParams->y - cropResizeBorder && + y1 <= cropParams->y + cropResizeBorder && + x1 >= cropParams->x - cropResizeBorder && + x1 <= cropParams->x + cropResizeBorder; case CropTopRight: - return cropParams.enabled && - y1 >= cropParams.y - cropResizeBorder && - y1 <= cropParams.y + cropResizeBorder && - x1 >= cropParams.x + cropParams.w - 1 - cropResizeBorder && - x1 <= cropParams.x + cropParams.w - 1 + cropResizeBorder; + return cropParams->enabled && + y1 >= cropParams->y - cropResizeBorder && + y1 <= cropParams->y + cropResizeBorder && + x1 >= cropParams->x + cropParams->w - 1 - cropResizeBorder && + x1 <= cropParams->x + cropParams->w - 1 + cropResizeBorder; case CropBottomLeft: - return cropParams.enabled && - y1 >= cropParams.y + cropParams.h - 1 - cropResizeBorder && - y1 <= cropParams.y + cropParams.h - 1 + cropResizeBorder && - x1 >= cropParams.x - cropResizeBorder && - x1 <= cropParams.x + cropResizeBorder; + return cropParams->enabled && + y1 >= cropParams->y + cropParams->h - 1 - cropResizeBorder && + y1 <= cropParams->y + cropParams->h - 1 + cropResizeBorder && + x1 >= cropParams->x - cropResizeBorder && + x1 <= cropParams->x + cropResizeBorder; case CropBottomRight: - return cropParams.enabled && - y1 >= cropParams.y + cropParams.h - 1 - cropResizeBorder && - y1 <= cropParams.y + cropParams.h - 1 + cropResizeBorder && - x1 >= cropParams.x + cropParams.w - 1 - cropResizeBorder && - x1 <= cropParams.x + cropParams.w - 1 + cropResizeBorder; + return cropParams->enabled && + y1 >= cropParams->y + cropParams->h - 1 - cropResizeBorder && + y1 <= cropParams->y + cropParams->h - 1 + cropResizeBorder && + x1 >= cropParams->x + cropParams->w - 1 - cropResizeBorder && + x1 <= cropParams->x + cropParams->w - 1 + cropResizeBorder; case CropTop: - return cropParams.enabled && - x1 > cropParams.x + cropResizeBorder && - x1 < cropParams.x + cropParams.w - 1 - cropResizeBorder && - y1 > cropParams.y - cropResizeBorder && - y1 < cropParams.y + cropResizeBorder; + return cropParams->enabled && + x1 > cropParams->x + cropResizeBorder && + x1 < cropParams->x + cropParams->w - 1 - cropResizeBorder && + y1 > cropParams->y - cropResizeBorder && + y1 < cropParams->y + cropResizeBorder; case CropBottom: - return cropParams.enabled && - x1 > cropParams.x + cropResizeBorder && - x1 < cropParams.x + cropParams.w - 1 - cropResizeBorder && - y1 > cropParams.y + cropParams.h - 1 - cropResizeBorder && - y1 < cropParams.y + cropParams.h - 1 + cropResizeBorder; + return cropParams->enabled && + x1 > cropParams->x + cropResizeBorder && + x1 < cropParams->x + cropParams->w - 1 - cropResizeBorder && + y1 > cropParams->y + cropParams->h - 1 - cropResizeBorder && + y1 < cropParams->y + cropParams->h - 1 + cropResizeBorder; case CropLeft: - return cropParams.enabled && - y1 > cropParams.y + cropResizeBorder && - y1 < cropParams.y + cropParams.h - 1 - cropResizeBorder && - x1 > cropParams.x - cropResizeBorder && - x1 < cropParams.x + cropResizeBorder; + return cropParams->enabled && + y1 > cropParams->y + cropResizeBorder && + y1 < cropParams->y + cropParams->h - 1 - cropResizeBorder && + x1 > cropParams->x - cropResizeBorder && + x1 < cropParams->x + cropResizeBorder; case CropRight: - return cropParams.enabled && - y1 > cropParams.y + cropResizeBorder && - y1 < cropParams.y + cropParams.h - 1 - cropResizeBorder && - x1 > cropParams.x + cropParams.w - 1 - cropResizeBorder && - x1 < cropParams.x + cropParams.w - 1 + cropResizeBorder; + return cropParams->enabled && + y1 > cropParams->y + cropResizeBorder && + y1 < cropParams->y + cropParams->h - 1 - cropResizeBorder && + x1 > cropParams->x + cropParams->w - 1 - cropResizeBorder && + x1 < cropParams->x + cropParams->w - 1 + cropResizeBorder; case CropInside: - return cropParams.enabled && - y1 > cropParams.y && - y1 < cropParams.y + cropParams.h - 1 && - x1 > cropParams.x && - x1 < cropParams.x + cropParams.w - 1; + return cropParams->enabled && + y1 > cropParams->y && + y1 < cropParams->y + cropParams->h - 1 && + x1 > cropParams->x && + x1 < cropParams->x + cropParams->w - 1; default: /* do nothing */ ; } diff --git a/rtgui/filebrowserentry.h b/rtgui/filebrowserentry.h index b1fa8c54b..3a3d32977 100644 --- a/rtgui/filebrowserentry.h +++ b/rtgui/filebrowserentry.h @@ -20,6 +20,7 @@ #define _FILEBROWSERENTRY_ #include +#include #include @@ -55,7 +56,7 @@ class FileBrowserEntry : public ThumbBrowserEntryBase, int press_x, press_y, action_x, action_y; double rot_deg; bool landscape; - rtengine::procparams::CropParams cropParams; + const std::unique_ptr cropParams; CropGUIListener* cropgl; FileBrowserEntryIdleHelper* feih; diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 5ebac5e12..c400a18e3 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -1187,7 +1187,7 @@ void FileCatalog::developRequested(const std::vector& tbe, bo params.icm.inputProfile = options.fastexport_icm_input_profile; params.icm.workingProfile = options.fastexport_icm_working_profile; params.icm.outputProfile = options.fastexport_icm_output_profile; - params.icm.outputIntent = options.fastexport_icm_outputIntent; + params.icm.outputIntent = rtengine::RenderingIntent(options.fastexport_icm_outputIntent); params.icm.outputBPC = options.fastexport_icm_outputBPC; } diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index f929048b8..e354724ba 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -1,12 +1,13 @@ +#include #include #include #include "filmsimulation.h" -#include - #include "options.h" + #include "../rtengine/clutstore.h" +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 86d27aacf..3cbd7acf1 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -16,12 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "flatfield.h" -#include "options.h" -#include "guiutils.h" #include + +#include "flatfield.h" + +#include "guiutils.h" +#include "options.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/gradient.cc b/rtgui/gradient.cc index 5091d3637..fd99e9939 100644 --- a/rtgui/gradient.cc +++ b/rtgui/gradient.cc @@ -2,7 +2,10 @@ * This file is part of RawTherapee. */ #include "gradient.h" + #include "rtimage.h" + +#include "../rtengine/procparams.h" #include "../rtengine/rt_math.h" using namespace rtengine; diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index a645846d1..e2a40bcf8 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -23,6 +23,7 @@ #include "../rtengine/rt_math.h" #include "../rtengine/utils.h" #include "../rtengine/icons.h" +#include "../rtengine/procparams.h" #include "rtimage.h" #include "multilangmgr.h" diff --git a/rtgui/history.cc b/rtgui/history.cc index 35f99db5b..4d435c460 100644 --- a/rtgui/history.cc +++ b/rtgui/history.cc @@ -17,10 +17,13 @@ * along with RawTherapee. If not, see . */ #include "history.h" + +#include "eventmapper.h" +#include "guiutils.h" #include "multilangmgr.h" #include "rtimage.h" -#include "guiutils.h" -#include "eventmapper.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/hsvequalizer.cc b/rtgui/hsvequalizer.cc index 1dfb017a7..7db76aa9f 100644 --- a/rtgui/hsvequalizer.cc +++ b/rtgui/hsvequalizer.cc @@ -16,9 +16,10 @@ * * 2010 Ilya Popov */ - #include "hsvequalizer.h" + #include "../rtengine/color.h" +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index bb7fdd89b..ba8bf9cef 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -17,15 +17,18 @@ * along with RawTherapee. If not, see . */ #include -#include "icmpanel.h" -#include "options.h" -#include "eventmapper.h" +#include "icmpanel.h" + +#include "eventmapper.h" #include "guiutils.h" -#include "../rtengine/iccstore.h" -#include "../rtengine/dcp.h" +#include "options.h" #include "rtimage.h" +#include "../rtengine/dcp.h" +#include "../rtengine/iccstore.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index 0bdb7f11c..40a8c2ca8 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -23,6 +23,7 @@ #include "multilangmgr.h" #include "cropwindow.h" #include "../rtengine/refreshmap.h" +#include "../rtengine/procparams.h" #include "options.h" ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), fullImageWidth(0), fullImageHeight(0) @@ -659,7 +660,7 @@ void ImageArea::initialImageArrived () } else { mainCropWindow->zoomFit(); } - } else if ((options.cropAutoFit || options.bgcolor != 0) && mainCropWindow->cropHandler.cropParams.enabled) { + } else if ((options.cropAutoFit || options.bgcolor != 0) && mainCropWindow->cropHandler.cropParams->enabled) { mainCropWindow->zoomFitCrop(); } fullImageWidth = w; diff --git a/rtgui/impulsedenoise.cc b/rtgui/impulsedenoise.cc index 3e5a9a980..9203ce8a7 100644 --- a/rtgui/impulsedenoise.cc +++ b/rtgui/impulsedenoise.cc @@ -16,11 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "impulsedenoise.h" #include #include + +#include "impulsedenoise.h" + #include "guiutils.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/iptcpanel.cc b/rtgui/iptcpanel.cc index 0dafe940f..7347927a0 100644 --- a/rtgui/iptcpanel.cc +++ b/rtgui/iptcpanel.cc @@ -20,10 +20,15 @@ #include "clipboard.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; -IPTCPanel::IPTCPanel () +IPTCPanel::IPTCPanel () : + changeList(new rtengine::procparams::IPTCPairs), + defChangeList(new rtengine::procparams::IPTCPairs), + embeddedData(new rtengine::procparams::IPTCPairs) { set_spacing (4); @@ -410,12 +415,12 @@ void IPTCPanel::read (const ProcParams* pp, const ParamsEdited* pedited) { disableListener (); - changeList.clear(); + changeList->clear(); if (!pp->iptc.empty()) { - changeList = pp->iptc; + *changeList = pp->iptc; } else { - changeList = embeddedData; + *changeList = *embeddedData; } applyChangeList (); @@ -425,25 +430,25 @@ void IPTCPanel::read (const ProcParams* pp, const ParamsEdited* pedited) void IPTCPanel::write (ProcParams* pp, ParamsEdited* pedited) { - pp->iptc = changeList; + pp->iptc = *changeList; } void IPTCPanel::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { - defChangeList = defParams->iptc; + *defChangeList = defParams->iptc; } void IPTCPanel::setImageData (const FramesMetaData* id) { if (id) { - embeddedData = id->getIPTCData (); + *embeddedData = id->getIPTCData (); } else { - embeddedData.clear (); + embeddedData->clear (); } - file->set_sensitive (!embeddedData.empty()); + file->set_sensitive (!embeddedData->empty()); } void IPTCPanel::notifyListener () @@ -564,33 +569,33 @@ void IPTCPanel::delSuppCategory () void IPTCPanel::updateChangeList () { - changeList.clear (); - changeList["Caption" ].push_back (captionText->get_text ()); - changeList["CaptionWriter" ].push_back (captionWriter->get_text ()); - changeList["Headline" ].push_back (headline->get_text ()); - changeList["Instructions" ].push_back (instructions->get_text ()); + changeList->clear (); + (*changeList)["Caption" ].push_back (captionText->get_text ()); + (*changeList)["CaptionWriter" ].push_back (captionWriter->get_text ()); + (*changeList)["Headline" ].push_back (headline->get_text ()); + (*changeList)["Instructions" ].push_back (instructions->get_text ()); for (unsigned int i = 0; i < keywords->size(); i++) { - changeList["Keywords" ].push_back (keywords->get_text (i)); + (*changeList)["Keywords" ].push_back (keywords->get_text (i)); } - changeList["Category" ].push_back (category->get_entry()->get_text ()); + (*changeList)["Category" ].push_back (category->get_entry()->get_text ()); for (unsigned int i = 0; i < suppCategories->size(); i++) { - changeList["SupplementalCategories"].push_back (suppCategories->get_text (i)); + (*changeList)["SupplementalCategories"].push_back (suppCategories->get_text (i)); } - changeList["Creator" ].push_back (creator->get_text ()); - changeList["CreatorJobTitle"].push_back (creatorJobTitle->get_text ()); - changeList["Credit" ].push_back (credit->get_text ()); - changeList["Source" ].push_back (source->get_text ()); - changeList["Copyright" ].push_back (copyright->get_text ()); - changeList["City" ].push_back (city->get_text ()); - changeList["Province" ].push_back (province->get_text ()); - changeList["Country" ].push_back (country->get_text ()); - changeList["Title" ].push_back (title->get_text ()); - changeList["DateCreated" ].push_back (dateCreated->get_text ()); - changeList["TransReference" ].push_back (transReference->get_text ()); + (*changeList)["Creator" ].push_back (creator->get_text ()); + (*changeList)["CreatorJobTitle"].push_back (creatorJobTitle->get_text ()); + (*changeList)["Credit" ].push_back (credit->get_text ()); + (*changeList)["Source" ].push_back (source->get_text ()); + (*changeList)["Copyright" ].push_back (copyright->get_text ()); + (*changeList)["City" ].push_back (city->get_text ()); + (*changeList)["Province" ].push_back (province->get_text ()); + (*changeList)["Country" ].push_back (country->get_text ()); + (*changeList)["Title" ].push_back (title->get_text ()); + (*changeList)["DateCreated" ].push_back (dateCreated->get_text ()); + (*changeList)["TransReference" ].push_back (transReference->get_text ()); notifyListener (); } @@ -623,7 +628,7 @@ void IPTCPanel::applyChangeList () keyword->get_entry()->set_text (""); suppCategory->get_entry()->set_text (""); - for (rtengine::procparams::IPTCPairs::iterator i = changeList.begin(); i != changeList.end(); ++i) { + for (rtengine::procparams::IPTCPairs::const_iterator i = changeList->begin(); i != changeList->end(); ++i) { if (i->first == "Caption" && !i->second.empty()) { captionText->set_text (i->second.at(0)); } else if (i->first == "CaptionWriter" && !i->second.empty()) { @@ -676,7 +681,7 @@ void IPTCPanel::resetClicked () { disableListener (); - changeList = defChangeList; + *changeList = *defChangeList; applyChangeList (); enableListener (); notifyListener (); @@ -686,7 +691,7 @@ void IPTCPanel::fileClicked () { disableListener (); - changeList = embeddedData; + *changeList = *embeddedData; applyChangeList (); enableListener (); notifyListener (); @@ -695,14 +700,14 @@ void IPTCPanel::fileClicked () void IPTCPanel::copyClicked () { - clipboard.setIPTC (changeList); + clipboard.setIPTC (*changeList); } void IPTCPanel::pasteClicked () { disableListener (); - changeList = clipboard.getIPTC (); + *changeList = clipboard.getIPTC (); applyChangeList (); enableListener (); notifyListener (); diff --git a/rtgui/iptcpanel.h b/rtgui/iptcpanel.h index 5574fe884..25683ccec 100644 --- a/rtgui/iptcpanel.h +++ b/rtgui/iptcpanel.h @@ -19,17 +19,20 @@ #ifndef _IPTCPANEL_ #define _IPTCPANEL_ +#include + #include -#include "toolpanel.h" + #include "guiutils.h" +#include "toolpanel.h" class IPTCPanel : public Gtk::VBox, public ToolPanel { private: - rtengine::procparams::IPTCPairs changeList; - rtengine::procparams::IPTCPairs defChangeList; - rtengine::procparams::IPTCPairs embeddedData; + const std::unique_ptr changeList; + const std::unique_ptr defChangeList; + const std::unique_ptr embeddedData; Gtk::TextView* captionView; Glib::RefPtr captionText; diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 2e851c321..e73fa31e0 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -16,11 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "labcurve.h" #include -#include "../rtengine/improcfun.h" + +#include "labcurve.h" + #include "edit.h" +#include "../rtengine/improcfun.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index 898fa1105..baf816c8b 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -20,6 +20,8 @@ #include "guiutils.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index d421632a9..85dcb992a 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -16,15 +16,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include -#include "lensprofile.h" -#include "guiutils.h" -#include "../rtengine/lcp.h" -#include -#include "rtimage.h" -#include "../rtengine/rtlensfun.h" #include #include +#include + +#include + +#include "lensprofile.h" + +#include "guiutils.h" +#include "rtimage.h" + +#include "../rtengine/lcp.h" +#include "../rtengine/procparams.h" +#include "../rtengine/rtlensfun.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/localcontrast.cc b/rtgui/localcontrast.cc index 2be811a99..93b67657d 100644 --- a/rtgui/localcontrast.cc +++ b/rtgui/localcontrast.cc @@ -17,10 +17,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "localcontrast.h" -#include "eventmapper.h" -#include #include +#include + +#include "localcontrast.h" + +#include "eventmapper.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/options.cc b/rtgui/options.cc index 2755c8888..0df70a4fd 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -25,6 +25,8 @@ #include "guiutils.h" #include "version.h" +#include "../rtengine/procparams.h" + #ifdef _OPENMP #include #endif diff --git a/rtgui/options.h b/rtgui/options.h index 06c49ed07..c06d9df30 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -368,7 +368,7 @@ public: Glib::ustring fastexport_icm_input_profile; Glib::ustring fastexport_icm_working_profile; Glib::ustring fastexport_icm_output_profile; - rtengine::RenderingIntent fastexport_icm_outputIntent; + int fastexport_icm_outputIntent; bool fastexport_icm_outputBPC; Glib::ustring fastexport_icm_custom_output_profile; bool fastexport_resize_enabled; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 992cb5c58..2c29b4f5b 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "paramsedited.h" #include -#include "options.h" + +#include "paramsedited.h" + #include "addsetids.h" +#include "options.h" + +#include "../rtengine/procparams.h" ParamsEdited::ParamsEdited(bool value) { diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index d7b4e8af4..95701e01a 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -16,27 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PARAMEDITED_H_ -#define _PARAMEDITED_H_ +#pragma once -#include #include -#include "../rtengine/procparams.h" + #include "../rtengine/rtengine.h" -class GeneralParamsEdited -{ - -public: +struct GeneralParamsEdited { bool rank; bool colorlabel; bool intrash; }; -class ToneCurveParamsEdited -{ - -public: +struct ToneCurveParamsEdited { bool curve; bool curve2; bool curveMode; @@ -58,9 +50,7 @@ public: bool clampOOG; }; -class RetinexParamsEdited -{ -public: +struct RetinexParamsEdited { bool enabled; bool str; bool scal; @@ -90,19 +80,17 @@ public: bool lhcurve; bool retinex; bool medianmap; - bool isUnchanged() const; bool highlights; bool htonalwidth; bool shadows; bool stonalwidth; bool radius; + bool isUnchanged() const; }; -class LCurveParamsEdited -{ -public: +struct LCurveParamsEdited { bool enabled; bool brightness; bool contrast; @@ -122,9 +110,7 @@ public: }; -class LocalContrastParamsEdited -{ -public: +struct LocalContrastParamsEdited { bool enabled; bool radius; bool amount; @@ -132,11 +118,7 @@ public: bool lightness; }; - -class RGBCurvesParamsEdited -{ - -public: +struct RGBCurvesParamsEdited { bool enabled; bool lumamode; bool rcurve; @@ -144,10 +126,7 @@ public: bool bcurve; }; -class ColorToningEdited -{ - -public: +struct ColorToningEdited { bool enabled; bool opacityCurve; bool colorCurve; @@ -182,31 +161,22 @@ public: bool labregionsShowMask; }; -class SharpenEdgeParamsEdited -{ - -public : +struct SharpenEdgeParamsEdited { bool enabled; bool passes; bool amount; bool threechannels; }; -class SharpenMicroParamsEdited -{ -public : +struct SharpenMicroParamsEdited { bool enabled; bool matrix; bool amount; bool contrast; bool uniformity; - }; -class SharpeningParamsEdited -{ - -public: +struct SharpeningParamsEdited { bool enabled; bool contrast; bool blurradius; @@ -226,10 +196,7 @@ public: bool deconvdamping; }; -class VibranceParamsEdited -{ - -public: +struct VibranceParamsEdited { bool enabled; bool pastels; bool saturated; @@ -240,19 +207,7 @@ public: bool skintonescurve; }; -/*class ColorBoostParamsEdited { - - public: - bool amount; - bool avoidclip; - bool enable_saturationlimiter; - bool rstprotection; -};*/ - -class WBParamsEdited -{ - -public: +struct WBParamsEdited { bool enabled; bool method; bool temperature; @@ -261,50 +216,19 @@ public: bool tempBias; }; -/*class ColorShiftParamsEdited { - - public: - bool a; - bool b; -};*/ - -/*class LumaDenoiseParamsEdited { - - public: - bool enabled; - bool radius; - bool edgetolerance; -};*/ - -/*class ColorDenoiseParamsEdited { - - public: - bool enabled; - bool amount; -};*/ - -class DefringeParamsEdited -{ - -public: +struct DefringeParamsEdited { bool enabled; bool radius; bool threshold; bool huecurve; }; -class ImpulseDenoiseParamsEdited -{ - -public: +struct ImpulseDenoiseParamsEdited { bool enabled; bool thresh; }; -class ColorAppearanceParamsEdited -{ - -public: +struct ColorAppearanceParamsEdited { bool curve; bool curve2; bool curve3; @@ -337,22 +261,16 @@ public: bool rstprotection; bool surrsource; bool gamut; -// bool badpix; bool datacie; bool tonecie; -// bool sharpcie; bool tempout; bool greenout; bool ybout; bool tempsc; bool greensc; - }; -class DirPyrDenoiseParamsEdited -{ - -public: +struct DirPyrDenoiseParamsEdited { bool enabled; bool enhance; bool median; @@ -365,7 +283,6 @@ public: bool lcurve; bool cccurve; -// bool perform; bool dmethod; bool Lmethod; bool Cmethod; @@ -375,12 +292,9 @@ public: bool methodmed; bool rgbmethod; bool passes; - }; -class EPDParamsEdited -{ -public: +struct EPDParamsEdited { bool enabled; bool strength; bool gamma; @@ -389,21 +303,14 @@ public: bool reweightingIterates; }; - -class FattalToneMappingParamsEdited -{ -public: +struct FattalToneMappingParamsEdited { bool enabled; bool threshold; bool amount; bool anchor; }; - -class SHParamsEdited -{ - -public: +struct SHParamsEdited { bool enabled; bool highlights; bool htonalwidth; @@ -413,10 +320,7 @@ public: bool lab; }; -class CropParamsEdited -{ - -public: +struct CropParamsEdited { bool enabled; bool x; bool y; @@ -428,58 +332,47 @@ public: bool guide; }; -class CoarseTransformParamsEdited -{ - -public: +struct CoarseTransformParamsEdited { bool rotate; bool hflip; bool vflip; }; -class CommonTransformParamsEdited -{ - -public: +struct CommonTransformParamsEdited { bool autofill; }; -class RotateParamsEdited -{ - -public: +struct RotateParamsEdited { bool degree; }; -class DistortionParamsEdited -{ - -public: +struct DistortionParamsEdited { bool amount; }; -class LensProfParamsEdited -{ -public: - bool lcpFile, useDist, useVign, useCA; - bool useLensfun, lfAutoMatch, lfCameraMake, lfCameraModel, lfLens; +struct LensProfParamsEdited { + bool lcpFile; + bool useDist; + bool useVign; + bool useCA; + + bool useLensfun; + bool lfAutoMatch; + bool lfCameraMake; + bool lfCameraModel; + bool lfLens; + bool lcMode; bool isUnchanged() const; }; -class PerspectiveParamsEdited -{ - -public: +struct PerspectiveParamsEdited { bool horizontal; bool vertical; }; -class GradientParamsEdited -{ - -public: +struct GradientParamsEdited { bool enabled; bool degree; bool feather; @@ -488,20 +381,14 @@ public: bool centerY; }; -class PCVignetteParamsEdited -{ - -public: +struct PCVignetteParamsEdited { bool enabled; bool strength; bool feather; bool roundness; }; -class VignettingParamsEdited -{ - -public: +struct VignettingParamsEdited { bool amount; bool radius; bool strength; @@ -509,20 +396,15 @@ public: bool centerY; }; -class ChannelMixerParamsEdited -{ - -public: +struct ChannelMixerParamsEdited { bool enabled; bool red[3]; bool green[3]; bool blue[3]; }; -class BlackWhiteParamsEdited -{ -public: +struct BlackWhiteParamsEdited { bool enabledcc; bool enabled; bool method; @@ -546,28 +428,14 @@ public: bool afterCurveMode; bool autoc; bool algo; - }; -class CACorrParamsEdited -{ - -public: +struct CACorrParamsEdited { bool red; bool blue; }; -/* -class HRecParamsEdited { - public: - bool enabled; - bool method; -}; -*/ -class ResizeParamsEdited -{ - -public: +struct ResizeParamsEdited { bool scale; bool appliesTo; bool method; @@ -578,10 +446,7 @@ public: bool allowUpscaling; }; -class ColorManagementParamsEdited -{ - -public: +struct ColorManagementParamsEdited { bool inputProfile; bool toneCurve; bool applyLookTable; @@ -598,10 +463,8 @@ public: bool outputIntent; bool outputBPC; }; -class WaveletParamsEdited -{ -public: +struct WaveletParamsEdited { bool enabled; bool strength; bool balance; @@ -685,13 +548,9 @@ public: bool expfinal; bool exptoning; bool expnoise; - }; -class DirPyrEqualizerParamsEdited -{ - -public: +struct DirPyrEqualizerParamsEdited { bool enabled; bool gamutlab; bool mult[6]; @@ -699,52 +558,35 @@ public: bool threshold; bool skinprotect; bool hueskin; - // bool algo; }; -class HSVEqualizerParamsEdited -{ - -public: +struct HSVEqualizerParamsEdited { bool enabled; bool hcurve; bool scurve; bool vcurve; }; -class FilmSimulationParamsEdited -{ -public: +struct FilmSimulationParamsEdited { bool enabled; bool clutFilename; bool strength; }; -class SoftLightParamsEdited -{ -public: +struct SoftLightParamsEdited { bool enabled; bool strength; }; -class DehazeParamsEdited -{ -public: +struct DehazeParamsEdited { bool enabled; bool strength; bool showDepthMap; bool depth; }; - -class RAWParamsEdited -{ - -public: - class BayerSensor - { - - public: +struct RAWParamsEdited { + struct BayerSensor { bool method; bool border; bool imageNum; @@ -774,7 +616,6 @@ public: bool pixelShiftNonGreenCross; bool pixelShiftDemosaicMethod; - //bool allEnhance; bool greenEq; bool linenoise; bool linenoiseDirection; @@ -783,10 +624,7 @@ public: bool isUnchanged() const; }; - class XTransSensor - { - - public: + struct XTransSensor { bool method; bool dualDemosaicAutoContrast; bool dualDemosaicContrast; @@ -824,66 +662,56 @@ public: }; -class MetaDataParamsEdited -{ -public: +struct MetaDataParamsEdited { bool mode; }; - -class ParamsEdited -{ - -public: - GeneralParamsEdited general; - ToneCurveParamsEdited toneCurve; - LCurveParamsEdited labCurve; - LocalContrastParamsEdited localContrast; - RGBCurvesParamsEdited rgbCurves; - ColorToningEdited colorToning; - RetinexParamsEdited retinex; - SharpeningParamsEdited sharpening; - SharpeningParamsEdited prsharpening; - SharpenEdgeParamsEdited sharpenEdge; - SharpenMicroParamsEdited sharpenMicro; - VibranceParamsEdited vibrance; - ColorAppearanceParamsEdited colorappearance; - //ColorBoostParamsEdited colorBoost; - WBParamsEdited wb; - //ColorShiftParamsEdited colorShift; - //LumaDenoiseParamsEdited lumaDenoise; - //ColorDenoiseParamsEdited colorDenoise; - DefringeParamsEdited defringe; - DirPyrDenoiseParamsEdited dirpyrDenoise; - EPDParamsEdited epd; +struct ParamsEdited { + GeneralParamsEdited general; + ToneCurveParamsEdited toneCurve; + LCurveParamsEdited labCurve; + LocalContrastParamsEdited localContrast; + RGBCurvesParamsEdited rgbCurves; + ColorToningEdited colorToning; + RetinexParamsEdited retinex; + SharpeningParamsEdited sharpening; + SharpeningParamsEdited prsharpening; + SharpenEdgeParamsEdited sharpenEdge; + SharpenMicroParamsEdited sharpenMicro; + VibranceParamsEdited vibrance; + ColorAppearanceParamsEdited colorappearance; + WBParamsEdited wb; + DefringeParamsEdited defringe; + DirPyrDenoiseParamsEdited dirpyrDenoise; + EPDParamsEdited epd; FattalToneMappingParamsEdited fattal; - ImpulseDenoiseParamsEdited impulseDenoise; - SHParamsEdited sh; - CropParamsEdited crop; - CoarseTransformParamsEdited coarse; - CommonTransformParamsEdited commonTrans; - RotateParamsEdited rotate; - DistortionParamsEdited distortion; - LensProfParamsEdited lensProf; - PerspectiveParamsEdited perspective; - GradientParamsEdited gradient; - PCVignetteParamsEdited pcvignette; - CACorrParamsEdited cacorrection; - VignettingParamsEdited vignetting; - ChannelMixerParamsEdited chmixer; - BlackWhiteParamsEdited blackwhite; - ResizeParamsEdited resize; - ColorManagementParamsEdited icm; - RAWParamsEdited raw; - DirPyrEqualizerParamsEdited dirpyrequalizer; - WaveletParamsEdited wavelet; - HSVEqualizerParamsEdited hsvequalizer; - FilmSimulationParamsEdited filmSimulation; - SoftLightParamsEdited softlight; - DehazeParamsEdited dehaze; - MetaDataParamsEdited metadata; - bool exif; - bool iptc; + ImpulseDenoiseParamsEdited impulseDenoise; + SHParamsEdited sh; + CropParamsEdited crop; + CoarseTransformParamsEdited coarse; + CommonTransformParamsEdited commonTrans; + RotateParamsEdited rotate; + DistortionParamsEdited distortion; + LensProfParamsEdited lensProf; + PerspectiveParamsEdited perspective; + GradientParamsEdited gradient; + PCVignetteParamsEdited pcvignette; + CACorrParamsEdited cacorrection; + VignettingParamsEdited vignetting; + ChannelMixerParamsEdited chmixer; + BlackWhiteParamsEdited blackwhite; + ResizeParamsEdited resize; + ColorManagementParamsEdited icm; + RAWParamsEdited raw; + DirPyrEqualizerParamsEdited dirpyrequalizer; + WaveletParamsEdited wavelet; + HSVEqualizerParamsEdited hsvequalizer; + FilmSimulationParamsEdited filmSimulation; + SoftLightParamsEdited softlight; + DehazeParamsEdited dehaze; + MetaDataParamsEdited metadata; + bool exif; + bool iptc; explicit ParamsEdited(bool value = false); @@ -891,4 +719,3 @@ public: void initFrom(const std::vector& src); void combine(rtengine::procparams::ProcParams& toEdit, const rtengine::procparams::ProcParams& mods, bool forceSet); }; -#endif diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index dbcb912e3..0325fa063 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -22,6 +22,8 @@ #include #include "../rtengine/rtengine.h" +struct ParamsEdited; + class PartialPasteDlg : public Gtk::Dialog { diff --git a/rtgui/pcvignette.cc b/rtgui/pcvignette.cc index 3d668fed9..303ae5cfb 100644 --- a/rtgui/pcvignette.cc +++ b/rtgui/pcvignette.cc @@ -3,6 +3,8 @@ */ #include "pcvignette.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/perspective.cc b/rtgui/perspective.cc index db5e0c50b..db2f32248 100644 --- a/rtgui/perspective.cc +++ b/rtgui/perspective.cc @@ -17,8 +17,11 @@ * along with RawTherapee. If not, see . */ #include "perspective.h" + #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index e23775bf9..c41e38ac9 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -2404,7 +2404,7 @@ void Preferences::workflowUpdate () || moptions.rtSettings.printerBPC != options.rtSettings.printerBPC || moptions.rtSettings.printerIntent != options.rtSettings.printerIntent) { // Update the position of the Histogram - parent->updateProfiles (moptions.rtSettings.printerProfile, moptions.rtSettings.printerIntent, moptions.rtSettings.printerBPC); + parent->updateProfiles (moptions.rtSettings.printerProfile, rtengine::RenderingIntent(moptions.rtSettings.printerIntent), moptions.rtSettings.printerBPC); } } diff --git a/rtgui/preprocess.cc b/rtgui/preprocess.cc index 9ad0953af..0d8933a98 100644 --- a/rtgui/preprocess.cc +++ b/rtgui/preprocess.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "preprocess.h" -#include "guiutils.h" #include +#include "preprocess.h" + +#include "guiutils.h" + +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/previewhandler.cc b/rtgui/previewhandler.cc index 2315b8c91..a1640b39c 100644 --- a/rtgui/previewhandler.cc +++ b/rtgui/previewhandler.cc @@ -19,11 +19,15 @@ #include "previewhandler.h" #include #include "../rtengine/rtengine.h" +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; -PreviewHandler::PreviewHandler () : image(nullptr), previewScale(1.) +PreviewHandler::PreviewHandler () : + image(nullptr), + cropParams(new procparams::CropParams), + previewScale(1.) { pih = new PreviewHandlerIdleHelper; @@ -72,7 +76,7 @@ void PreviewHandler::setImage(rtengine::IImage8* i, double scale, const rtengine pih->phandler->image = i; } - pih->phandler->cropParams = cp; + *pih->phandler->cropParams = cp; pih->phandler->previewScale = scale; --pih->pending; @@ -139,7 +143,7 @@ void PreviewHandler::imageReady(const rtengine::procparams::CropParams& cp) pih->phandler->previewImg = Gdk::Pixbuf::create_from_data(pih->phandler->image->getData(), Gdk::COLORSPACE_RGB, false, 8, pih->phandler->image->getWidth(), pih->phandler->image->getHeight(), 3 * pih->phandler->image->getWidth()); pih->phandler->previewImgMutex.unlock (); - pih->phandler->cropParams = cp; + *pih->phandler->cropParams = cp; pih->phandler->previewImageChanged (); --pih->pending; @@ -204,3 +208,8 @@ void PreviewHandler::previewImageChanged () (*i)->previewImageChanged (); } } + +rtengine::procparams::CropParams PreviewHandler::getCropParams() +{ + return *cropParams; +} diff --git a/rtgui/previewhandler.h b/rtgui/previewhandler.h index 81a68e05c..fcd0a0c5f 100644 --- a/rtgui/previewhandler.h +++ b/rtgui/previewhandler.h @@ -20,6 +20,7 @@ #define _PREVIEWHANDLER_ #include +#include #include @@ -54,7 +55,7 @@ private: protected: rtengine::IImage8* image; - rtengine::procparams::CropParams cropParams; + const std::unique_ptr cropParams; double previewScale; PreviewHandlerIdleHelper* pih; std::list listeners; @@ -82,10 +83,7 @@ public: // with this function it is possible to ask for a rough approximation of a (possibly zoomed) crop of the image Glib::RefPtr getRoughImage (int x, int y, int w, int h, double zoom); Glib::RefPtr getRoughImage (int desiredW, int desiredH, double& zoom); - rtengine::procparams::CropParams getCropParams () - { - return cropParams; - } + rtengine::procparams::CropParams getCropParams (); }; #endif diff --git a/rtgui/previewwindow.cc b/rtgui/previewwindow.cc index cd4977bb1..c999ff663 100644 --- a/rtgui/previewwindow.cc +++ b/rtgui/previewwindow.cc @@ -21,6 +21,8 @@ #include "imagearea.h" #include "cursormanager.h" +#include "../rtengine/procparams.h" + PreviewWindow::PreviewWindow () : previewHandler(nullptr), mainCropWin(nullptr), imageArea(nullptr), imgX(0), imgY(0), imgW(0), imgH(0), zoom(0.0), press_x(0), press_y(0), isMoving(false), needsUpdate(false), cursor_type(CSUndefined) diff --git a/rtgui/profilechangelistener.h b/rtgui/profilechangelistener.h index 8e8dc99b5..e333933ea 100644 --- a/rtgui/profilechangelistener.h +++ b/rtgui/profilechangelistener.h @@ -23,6 +23,18 @@ #include "../rtengine/rtengine.h" +namespace rtengine +{ + +namespace procparams +{ + +class PartialProfile; + +} + +} + class ProfileChangeListener { public: diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index a3a0f72b7..af39695fa 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -17,12 +17,15 @@ * along with RawTherapee. If not, see . */ #include "profilepanel.h" -#include "options.h" + #include "clipboard.h" #include "multilangmgr.h" +#include "options.h" #include "profilestorecombobox.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/profilestorecombobox.cc b/rtgui/profilestorecombobox.cc index e7d64f28b..96bbc32fa 100644 --- a/rtgui/profilestorecombobox.cc +++ b/rtgui/profilestorecombobox.cc @@ -24,9 +24,6 @@ #include "toolpanel.h" #include "guiutils.h" -using namespace rtengine; -using namespace rtengine::procparams; - ProfileStoreLabel::ProfileStoreLabel (const ProfileStoreEntry *entry) : Gtk::Label (entry->label), entry (entry) { set_alignment (0, 0.5); diff --git a/rtgui/rawcacorrection.cc b/rtgui/rawcacorrection.cc index 2daeb102f..57b8ff4ac 100644 --- a/rtgui/rawcacorrection.cc +++ b/rtgui/rawcacorrection.cc @@ -17,10 +17,13 @@ * along with RawTherapee. If not, see . */ #include "rawcacorrection.h" + #include "eventmapper.h" #include "guiutils.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/rawexposure.cc b/rtgui/rawexposure.cc index 0c5191476..6f08e64c7 100644 --- a/rtgui/rawexposure.cc +++ b/rtgui/rawexposure.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "rawexposure.h" -#include "guiutils.h" #include +#include "rawexposure.h" + +#include "guiutils.h" + +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/resize.cc b/rtgui/resize.cc index fc0f51191..4635dca50 100644 --- a/rtgui/resize.cc +++ b/rtgui/resize.cc @@ -17,8 +17,11 @@ * along with RawTherapee. If not, see . */ #include "resize.h" -#include "guiutils.h" + #include "eventmapper.h" +#include "guiutils.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/rgbcurves.cc b/rtgui/rgbcurves.cc index 1ffb8cc46..75af43508 100644 --- a/rtgui/rgbcurves.cc +++ b/rtgui/rgbcurves.cc @@ -18,6 +18,8 @@ */ #include "rgbcurves.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/rotate.cc b/rtgui/rotate.cc index 9f70010df..9f5d665d5 100644 --- a/rtgui/rotate.cc +++ b/rtgui/rotate.cc @@ -16,11 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "rotate.h" #include + +#include "rotate.h" + #include "guiutils.h" #include "rtimage.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/sensorbayer.cc b/rtgui/sensorbayer.cc index 8bd36fe32..44afdd2e8 100644 --- a/rtgui/sensorbayer.cc +++ b/rtgui/sensorbayer.cc @@ -20,9 +20,6 @@ #include "guiutils.h" #include "rtimage.h" -using namespace rtengine; -using namespace rtengine::procparams; - SensorBayer::SensorBayer () : FoldableToolPanel(this, "sensorbayer", M("TP_RAW_SENSOR_BAYER_LABEL")) { diff --git a/rtgui/sensorxtrans.cc b/rtgui/sensorxtrans.cc index 3f93e050a..c0a704ebf 100644 --- a/rtgui/sensorxtrans.cc +++ b/rtgui/sensorxtrans.cc @@ -20,9 +20,6 @@ #include "guiutils.h" #include "rtimage.h" -using namespace rtengine; -using namespace rtengine::procparams; - SensorXTrans::SensorXTrans () : FoldableToolPanel(this, "sensorxtrans", M("TP_RAW_SENSOR_XTRANS_LABEL")) { diff --git a/rtgui/shadowshighlights.cc b/rtgui/shadowshighlights.cc index f4ed90138..6fdf6f2f3 100644 --- a/rtgui/shadowshighlights.cc +++ b/rtgui/shadowshighlights.cc @@ -17,8 +17,11 @@ * along with RawTherapee. If not, see . */ #include "shadowshighlights.h" + #include "eventmapper.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/sharpenedge.cc b/rtgui/sharpenedge.cc index 03675a3bf..b6528e4c9 100644 --- a/rtgui/sharpenedge.cc +++ b/rtgui/sharpenedge.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "sharpenedge.h" -#include "guiutils.h" -#include #include +#include + +#include "sharpenedge.h" + +#include "guiutils.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/sharpenmicro.cc b/rtgui/sharpenmicro.cc index 971f9247a..0b4142677 100644 --- a/rtgui/sharpenmicro.cc +++ b/rtgui/sharpenmicro.cc @@ -18,9 +18,13 @@ */ #include #include + #include "sharpenmicro.h" -#include "guiutils.h" + #include "eventmapper.h" +#include "guiutils.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/softlight.cc b/rtgui/softlight.cc index 072c45e98..0054f8f6d 100644 --- a/rtgui/softlight.cc +++ b/rtgui/softlight.cc @@ -17,10 +17,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "softlight.h" -#include "eventmapper.h" -#include #include +#include + +#include "softlight.h" + +#include "eventmapper.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/thresholdselector.cc b/rtgui/thresholdselector.cc index 891095e6f..2d94d43de 100644 --- a/rtgui/thresholdselector.cc +++ b/rtgui/thresholdselector.cc @@ -21,9 +21,12 @@ #include #include "thresholdselector.h" + #include "multilangmgr.h" #include "mycurve.h" +#include "../rtengine/procparams.h" + ThresholdSelector::ThresholdSelector(double minValueBottom, double maxValueBottom, double defBottom, Glib::ustring labelBottom, unsigned int precisionBottom, double minValueTop, double maxValueTop, double defTop, Glib::ustring labelTop, unsigned int precisionTop, ThresholdCurveProvider* curveProvider) diff --git a/rtgui/thumbimageupdater.cc b/rtgui/thumbimageupdater.cc index f7caf5f5e..c0df751a5 100644 --- a/rtgui/thumbimageupdater.cc +++ b/rtgui/thumbimageupdater.cc @@ -27,6 +27,8 @@ #include "guiutils.h" #include "threadutils.h" +#include "../rtengine/procparams.h" + #ifdef _OPENMP #include #endif diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 7fb547aa6..757708002 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -25,6 +25,7 @@ #include #include #include "../rtengine/imagedata.h" +#include "../rtengine/procparams.h" #include #include "../rtengine/dynamicprofile.h" @@ -36,10 +37,21 @@ using namespace rtengine::procparams; -Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf) - : fname(fname), cfs(*cf), cachemgr(cm), ref(1), enqueueNumber(0), tpp(nullptr), - pparamsValid(false), imageLoading(false), lastImg(nullptr), - lastW(0), lastH(0), lastScale(0), initial_(false) +Thumbnail::Thumbnail(CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf) : + fname(fname), + cfs(*cf), + cachemgr(cm), + ref(1), + enqueueNumber(0), + tpp(nullptr), + pparams(new ProcParams), + pparamsValid(false), + imageLoading(false), + lastImg(nullptr), + lastW(0), + lastH(0), + lastScale(0), + initial_(false) { loadProcParams (); @@ -64,10 +76,20 @@ Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageDa tpp = nullptr; } -Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, const std::string& md5) - : fname(fname), cachemgr(cm), ref(1), enqueueNumber(0), tpp(nullptr), pparamsValid(false), - imageLoading(false), lastImg(nullptr), - lastW(0), lastH(0), lastScale(0.0), initial_(true) +Thumbnail::Thumbnail(CacheManager* cm, const Glib::ustring& fname, const std::string& md5) : + fname(fname), + cachemgr(cm), + ref(1), + enqueueNumber(0), + tpp(nullptr), + pparams(new ProcParams), + pparamsValid(false), + imageLoading(false), + lastImg(nullptr), + lastW(0), + lastH(0), + lastScale(0.0), + initial_(true) { @@ -107,20 +129,20 @@ void Thumbnail::_generateThumbnailImage () if (ext.lowercase() == "jpg" || ext.lowercase() == "jpeg") { infoFromImage (fname); - tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams.wb.equal); + tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal); if (tpp) { cfs.format = FT_Jpeg; } } else if (ext.lowercase() == "png") { - tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams.wb.equal); + tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal); if (tpp) { cfs.format = FT_Png; } } else if (ext.lowercase() == "tif" || ext.lowercase() == "tiff") { infoFromImage (fname); - tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams.wb.equal); + tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal); if (tpp) { cfs.format = FT_Tiff; @@ -141,7 +163,7 @@ void Thumbnail::_generateThumbnailImage () if ( tpp == nullptr ) { quick = false; - tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, sensorType, tw, th, 1, pparams.wb.equal, TRUE); + tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, sensorType, tw, th, 1, pparams->wb.equal, TRUE); } cfs.sensortype = sensorType; @@ -178,22 +200,22 @@ const ProcParams& Thumbnail::getProcParams () const ProcParams& Thumbnail::getProcParamsU () { if (pparamsValid) { - return pparams; + return *pparams; } else { - pparams = *(ProfileStore::getInstance()->getDefaultProcParams (getType() == FT_Raw)); + *pparams = *(ProfileStore::getInstance()->getDefaultProcParams (getType() == FT_Raw)); - if (pparams.wb.method == "Camera") { + if (pparams->wb.method == "Camera") { double ct; - getCamWB (ct, pparams.wb.green); - pparams.wb.temperature = ct; - } else if (pparams.wb.method == "Auto") { + getCamWB (ct, pparams->wb.green); + pparams->wb.temperature = ct; + } else if (pparams->wb.method == "Auto") { double ct; - getAutoWB (ct, pparams.wb.green, pparams.wb.equal, pparams.wb.tempBias); - pparams.wb.temperature = ct; + getAutoWB (ct, pparams->wb.green, pparams->wb.equal, pparams->wb.tempBias); + pparams->wb.temperature = ct; } } - return pparams; // there is no valid pp to return, but we have to return something + return *pparams; // there is no valid pp to return, but we have to return something } /** @brief Create default params on demand and returns a new updatable object @@ -320,27 +342,27 @@ void Thumbnail::loadProcParams () MyMutex::MyLock lock(mutex); pparamsValid = false; - pparams.setDefaults(); + pparams->setDefaults(); const PartialProfile *defaultPP = ProfileStore::getInstance()->getDefaultPartialProfile(getType() == FT_Raw); - defaultPP->applyTo(&pparams); + defaultPP->applyTo(pparams.get()); if (options.paramsLoadLocation == PLL_Input) { // try to load it from params file next to the image file - int ppres = pparams.load (fname + paramFileExtension); - pparamsValid = !ppres && pparams.ppVersion >= 220; + int ppres = pparams->load (fname + paramFileExtension); + pparamsValid = !ppres && pparams->ppVersion >= 220; // if no success, try to load the cached version of the procparams if (!pparamsValid) { - pparamsValid = !pparams.load (getCacheFileName ("profiles", paramFileExtension)); + pparamsValid = !pparams->load (getCacheFileName ("profiles", paramFileExtension)); } } else { // try to load it from cache - pparamsValid = !pparams.load (getCacheFileName ("profiles", paramFileExtension)); + pparamsValid = !pparams->load (getCacheFileName ("profiles", paramFileExtension)); // if no success, try to load it from params file next to the image file if (!pparamsValid) { - int ppres = pparams.load (fname + paramFileExtension); - pparamsValid = !ppres && pparams.ppVersion >= 220; + int ppres = pparams->load (fname + paramFileExtension); + pparamsValid = !ppres && pparams->ppVersion >= 220; } } } @@ -373,7 +395,7 @@ void Thumbnail::clearProcParams (int whoClearedIt) // probably not as this is the only option to set param values to default // reset the params to defaults - pparams.setDefaults(); + pparams->setDefaults(); // and restore rank and inTrash setRank(rank); @@ -422,42 +444,42 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh { const bool needsReprocessing = resetToDefault - || pparams.toneCurve != pp.toneCurve - || pparams.labCurve != pp.labCurve - || pparams.localContrast != pp.localContrast - || pparams.rgbCurves != pp.rgbCurves - || pparams.colorToning != pp.colorToning - || pparams.vibrance != pp.vibrance - || pparams.wb != pp.wb - || pparams.colorappearance != pp.colorappearance - || pparams.epd != pp.epd - || pparams.fattal != pp.fattal - || pparams.sh != pp.sh - || pparams.crop != pp.crop - || pparams.coarse != pp.coarse - || pparams.commonTrans != pp.commonTrans - || pparams.rotate != pp.rotate - || pparams.distortion != pp.distortion - || pparams.lensProf != pp.lensProf - || pparams.perspective != pp.perspective - || pparams.gradient != pp.gradient - || pparams.pcvignette != pp.pcvignette - || pparams.cacorrection != pp.cacorrection - || pparams.vignetting != pp.vignetting - || pparams.chmixer != pp.chmixer - || pparams.blackwhite != pp.blackwhite - || pparams.icm != pp.icm - || pparams.hsvequalizer != pp.hsvequalizer - || pparams.filmSimulation != pp.filmSimulation - || pparams.softlight != pp.softlight - || pparams.dehaze != pp.dehaze + || pparams->toneCurve != pp.toneCurve + || pparams->labCurve != pp.labCurve + || pparams->localContrast != pp.localContrast + || pparams->rgbCurves != pp.rgbCurves + || pparams->colorToning != pp.colorToning + || pparams->vibrance != pp.vibrance + || pparams->wb != pp.wb + || pparams->colorappearance != pp.colorappearance + || pparams->epd != pp.epd + || pparams->fattal != pp.fattal + || pparams->sh != pp.sh + || pparams->crop != pp.crop + || pparams->coarse != pp.coarse + || pparams->commonTrans != pp.commonTrans + || pparams->rotate != pp.rotate + || pparams->distortion != pp.distortion + || pparams->lensProf != pp.lensProf + || pparams->perspective != pp.perspective + || pparams->gradient != pp.gradient + || pparams->pcvignette != pp.pcvignette + || pparams->cacorrection != pp.cacorrection + || pparams->vignetting != pp.vignetting + || pparams->chmixer != pp.chmixer + || pparams->blackwhite != pp.blackwhite + || pparams->icm != pp.icm + || pparams->hsvequalizer != pp.hsvequalizer + || pparams->filmSimulation != pp.filmSimulation + || pparams->softlight != pp.softlight + || pparams->dehaze != pp.dehaze || whoChangedIt == FILEBROWSER || whoChangedIt == BATCHEDITOR; { MyMutex::MyLock lock(mutex); - if (pparams != pp) { + if (*pparams != pp) { cfs.recentlySaved = false; } else if (pparamsValid && !updateCacheNow) { // nothing to do @@ -470,9 +492,9 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh const int inTrash = getStage(); if (pe) { - pe->combine(pparams, pp, true); + pe->combine(*pparams, pp, true); } else { - pparams = pp; + *pparams = pp; } pparamsValid = true; @@ -506,7 +528,7 @@ void Thumbnail::imageDeveloped () cfs.save (getCacheFileName ("data", ".txt")); if (options.saveParamsCache) { - pparams.save (getCacheFileName ("profiles", paramFileExtension)); + pparams->save (getCacheFileName ("profiles", paramFileExtension)); } } @@ -574,7 +596,7 @@ void Thumbnail::getThumbnailSize (int &w, int &h, const rtengine::procparams::Pr ppCoarse -= 180; } - int thisCoarse = this->pparams.coarse.rotate; + int thisCoarse = this->pparams->coarse.rotate; if (thisCoarse >= 180) { thisCoarse -= 180; @@ -948,7 +970,7 @@ void Thumbnail::updateCache (bool updatePParams, bool updateCacheImageData) { if (updatePParams && pparamsValid) { - pparams.save ( + pparams->save ( options.saveParamsFile ? fname + paramFileExtension : "", options.saveParamsCache ? getCacheFileName ("profiles", paramFileExtension) : "", true @@ -981,6 +1003,45 @@ void Thumbnail::setFileName (const Glib::ustring &fn) cfs.md5 = cachemgr->getMD5 (fname); } +int Thumbnail::getRank () const +{ + return pparams->rank; +} + +void Thumbnail::setRank (int rank) +{ + if (pparams->rank != rank) { + pparams->rank = rank; + pparamsValid = true; + } +} + +int Thumbnail::getColorLabel () const +{ + return pparams->colorlabel; +} + +void Thumbnail::setColorLabel (int colorlabel) +{ + if (pparams->colorlabel != colorlabel) { + pparams->colorlabel = colorlabel; + pparamsValid = true; + } +} + +int Thumbnail::getStage () const +{ + return pparams->inTrash; +} + +void Thumbnail::setStage (bool stage) +{ + if (pparams->inTrash != stage) { + pparams->inTrash = stage; + pparamsValid = true; + } +} + void Thumbnail::addThumbnailListener (ThumbnailListener* tnl) { diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 28762e505..0bcdd470a 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -19,7 +19,9 @@ #ifndef _THUMBNAIL_ #define _THUMBNAIL_ +#include #include + #include #include "cachemanager.h" #include "options.h" @@ -30,6 +32,8 @@ #include "threadutils.h" class CacheManager; +struct ParamsEdited; + class Thumbnail { @@ -47,7 +51,7 @@ class Thumbnail float imgRatio; // hack to avoid rounding error // double scale; // portion of the sizes of the processed thumbnail image and the full scale image - rtengine::procparams::ProcParams pparams; + const std::unique_ptr pparams; bool pparamsValid; bool imageLoading; @@ -160,41 +164,14 @@ public: return cfs.md5; } - int getRank () const - { - return pparams.rank; - } - void setRank (int rank) - { - if (pparams.rank != rank) { - pparams.rank = rank; - pparamsValid = true; - } - } + int getRank () const; + void setRank (int rank); - int getColorLabel () const - { - return pparams.colorlabel; - } - void setColorLabel (int colorlabel) - { - if (pparams.colorlabel != colorlabel) { - pparams.colorlabel = colorlabel; - pparamsValid = true; - } - } + int getColorLabel () const; + void setColorLabel (int colorlabel); - int getStage () const - { - return pparams.inTrash; - } - void setStage (bool stage) - { - if (pparams.inTrash != stage) { - pparams.inTrash = stage; - pparamsValid = true; - } - } + int getStage () const; + void setStage (bool stage); void addThumbnailListener (ThumbnailListener* tnl); void removeThumbnailListener (ThumbnailListener* tnl); diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index b4157e58a..1bd8b2cbd 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -16,13 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "tonecurve.h" -#include "adjuster.h" -#include #include -#include "ppversion.h" + +#include + +#include "tonecurve.h" + +#include "adjuster.h" #include "edit.h" #include "eventmapper.h" +#include "ppversion.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; @@ -347,33 +352,33 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = toneCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode = ToneCurveParams::TcMode::STD; + pp->toneCurve.curveMode = ToneCurveMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode = ToneCurveParams::TcMode::WEIGHTEDSTD; + pp->toneCurve.curveMode = ToneCurveMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode = ToneCurveParams::TcMode::FILMLIKE; + pp->toneCurve.curveMode = ToneCurveMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode = ToneCurveParams::TcMode::SATANDVALBLENDING; + pp->toneCurve.curveMode = ToneCurveMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode = ToneCurveParams::TcMode::LUMINANCE; + pp->toneCurve.curveMode = ToneCurveMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode = ToneCurveParams::TcMode::PERCEPTUAL; + pp->toneCurve.curveMode = ToneCurveMode::PERCEPTUAL; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::STD; + pp->toneCurve.curveMode2 = ToneCurveMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::WEIGHTEDSTD; + pp->toneCurve.curveMode2 = ToneCurveMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::FILMLIKE; + pp->toneCurve.curveMode2 = ToneCurveMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::SATANDVALBLENDING; + pp->toneCurve.curveMode2 = ToneCurveMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::LUMINANCE; + pp->toneCurve.curveMode2 = ToneCurveMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::PERCEPTUAL; + pp->toneCurve.curveMode2 = ToneCurveMode::PERCEPTUAL; } pp->toneCurve.histmatching = histmatching->get_active(); @@ -979,7 +984,7 @@ void ToneCurve::autoExpChanged(double expcomp, int bright, int contr, int black, ); } -void ToneCurve::autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveParams::TcMode curveMode, const std::vector& curve) +void ToneCurve::autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveMode curveMode, const std::vector& curve) { nextToneCurveMode = curveMode; nextToneCurve = curve; diff --git a/rtgui/tonecurve.h b/rtgui/tonecurve.h index 2cf7b9d12..47789ec01 100644 --- a/rtgui/tonecurve.h +++ b/rtgui/tonecurve.h @@ -81,7 +81,7 @@ protected: int nextHlcompr; int nextHlcomprthresh; bool nextHLRecons; - rtengine::procparams::ToneCurveParams::TcMode nextToneCurveMode; + rtengine::procparams::ToneCurveMode nextToneCurveMode; std::vector nextToneCurve; void setHistmatching(bool enabled); @@ -132,7 +132,7 @@ public: void histmatchingToggled(); void autoExpChanged(double expcomp, int bright, int contr, int black, int hlcompr, int hlcomprthresh, bool hlrecons) override; - void autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveParams::TcMode curveMode, const std::vector& curve) override; + void autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveMode curveMode, const std::vector& curve) override; void setRaw (bool raw); diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index c9c4f823c..1fe9808cd 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -20,6 +20,8 @@ #include "toolpanelcoord.h" #include "guiutils.h" +#include "../rtengine/procparams.h" + using namespace rtengine::procparams; diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index fbe87f5f0..521d52949 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -22,7 +22,6 @@ #include #include #include "../rtengine/rtengine.h" -#include "../rtengine/procparams.h" #include "guiutils.h" #include "multilangmgr.h" #include "paramsedited.h" diff --git a/rtgui/vignetting.cc b/rtgui/vignetting.cc index 34559ef21..799a4cff7 100644 --- a/rtgui/vignetting.cc +++ b/rtgui/vignetting.cc @@ -18,6 +18,8 @@ */ #include "vignetting.h" +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index 49d64bd8f..e98394735 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -16,10 +16,13 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "eventmapper.h" #include "xtransprocess.h" -#include "options.h" + +#include "eventmapper.h" #include "guiutils.h" +#include "options.h" + +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/xtransrawexposure.cc b/rtgui/xtransrawexposure.cc index 19fcb0c46..b58a6e72a 100644 --- a/rtgui/xtransrawexposure.cc +++ b/rtgui/xtransrawexposure.cc @@ -16,10 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "xtransrawexposure.h" -#include "guiutils.h" #include +#include "xtransrawexposure.h" + +#include "guiutils.h" + +#include "../rtengine/procparams.h" + using namespace rtengine; using namespace rtengine::procparams;