Adding a new spot adjust editing mode in rtengine / preview window

This commit is contained in:
Hombre
2019-08-04 16:07:35 +02:00
parent 4d43dd7e09
commit 7d310e688c
13 changed files with 198 additions and 99 deletions

View File

@@ -474,7 +474,7 @@ HISTORY_MSG_232;N&B - Type de courbe 'Avant'
HISTORY_MSG_233;N&B - Courbe 'Après' HISTORY_MSG_233;N&B - Courbe 'Après'
HISTORY_MSG_234;N&B - Type de courbe 'Après' HISTORY_MSG_234;N&B - Type de courbe 'Après'
HISTORY_MSG_235;N&B - Mixeur de Canaux - Auto HISTORY_MSG_235;N&B - Mixeur de Canaux - Auto
HISTORY_MSG_236;Retrait de taches - Modif. de points HISTORY_MSG_236;--inutilisé--
HISTORY_MSG_237;N&B - Mixeur de Canaux HISTORY_MSG_237;N&B - Mixeur de Canaux
HISTORY_MSG_238;FD - Étendu HISTORY_MSG_238;FD - Étendu
HISTORY_MSG_239;FD - Force HISTORY_MSG_239;FD - Force
@@ -764,6 +764,8 @@ HISTORY_MSG_SHARPENING_CONTRAST;Netteté - Seuil de contraste
HISTORY_MSG_SH_COLORSPACE;O/HL - Espace couleur HISTORY_MSG_SH_COLORSPACE;O/HL - Espace couleur
HISTORY_MSG_SOFTLIGHT_ENABLED;Lumière douce HISTORY_MSG_SOFTLIGHT_ENABLED;Lumière douce
HISTORY_MSG_SOFTLIGHT_STRENGTH;Lumière douce - Force HISTORY_MSG_SOFTLIGHT_STRENGTH;Lumière douce - Force
HISTORY_MSG_SPOT;Retrait de taches
HISTORY_MSG_SPOT_ENTRY;Retrait de taches - Modif. de points
HISTORY_MSG_TM_FATTAL_ANCHOR;CPD - Ancre HISTORY_MSG_TM_FATTAL_ANCHOR;CPD - Ancre
HISTORY_NEWSNAPSHOT;Ajouter HISTORY_NEWSNAPSHOT;Ajouter
HISTORY_NEWSNAPSHOT_TOOLTIP;Raccourci: <b>Alt-s</b> HISTORY_NEWSNAPSHOT_TOOLTIP;Raccourci: <b>Alt-s</b>

View File

@@ -75,6 +75,7 @@ EXIFPANEL_RESET;Reset
EXIFPANEL_RESETALL;Reset All EXIFPANEL_RESETALL;Reset All
EXIFPANEL_RESETALLHINT;Reset all tags to their original values. EXIFPANEL_RESETALLHINT;Reset all tags to their original values.
EXIFPANEL_RESETHINT;Reset the selected tags to their original values. EXIFPANEL_RESETHINT;Reset the selected tags to their original values.
EXIFPANEL_SHOWALL;Show all
EXIFPANEL_SUBDIRECTORY;Subdirectory EXIFPANEL_SUBDIRECTORY;Subdirectory
EXPORT_BYPASS;Processing steps to bypass EXPORT_BYPASS;Processing steps to bypass
EXPORT_BYPASS_ALL;Select / Unselect All EXPORT_BYPASS_ALL;Select / Unselect All
@@ -283,9 +284,9 @@ HISTORY_MSG_30;RLD - Radius
HISTORY_MSG_31;RLD - Amount HISTORY_MSG_31;RLD - Amount
HISTORY_MSG_32;RLD - Damping HISTORY_MSG_32;RLD - Damping
HISTORY_MSG_33;RLD - Iterations HISTORY_MSG_33;RLD - Iterations
HISTORY_MSG_34;LCP distortion correction HISTORY_MSG_34;Lens Correction - Distortion
HISTORY_MSG_35;LCP vignetting correction HISTORY_MSG_35;Lens Correction - Vignetting
HISTORY_MSG_36;LCP CA correction HISTORY_MSG_36;Lens Correction - CA
HISTORY_MSG_37;Exposure - Auto levels HISTORY_MSG_37;Exposure - Auto levels
HISTORY_MSG_38;White Balance - Method HISTORY_MSG_38;White Balance - Method
HISTORY_MSG_39;WB - Temperature HISTORY_MSG_39;WB - Temperature
@@ -334,7 +335,7 @@ HISTORY_MSG_81;Resize
HISTORY_MSG_82;Profile changed HISTORY_MSG_82;Profile changed
HISTORY_MSG_83;S/H - Sharp mask HISTORY_MSG_83;S/H - Sharp mask
HISTORY_MSG_84;Perspective correction HISTORY_MSG_84;Perspective correction
HISTORY_MSG_85;LCP HISTORY_MSG_85;Lens Correction - LCP file
HISTORY_MSG_86;RGB Curves - Luminosity mode HISTORY_MSG_86;RGB Curves - Luminosity mode
HISTORY_MSG_87;Impulse Noise Reduction HISTORY_MSG_87;Impulse Noise Reduction
HISTORY_MSG_88;Impulse NR threshold HISTORY_MSG_88;Impulse NR threshold
@@ -483,7 +484,7 @@ HISTORY_MSG_232;B&amp;W - 'Before' curve type
HISTORY_MSG_233;B&amp;W - 'After' curve HISTORY_MSG_233;B&amp;W - 'After' curve
HISTORY_MSG_234;B&amp;W - 'After' curve type HISTORY_MSG_234;B&amp;W - 'After' curve type
HISTORY_MSG_235;B&amp;W - CM - Auto HISTORY_MSG_235;B&amp;W - CM - Auto
HISTORY_MSG_236;Spot removal - Point modif. HISTORY_MSG_236;--unused--
HISTORY_MSG_237;B&amp;W - CM HISTORY_MSG_237;B&amp;W - CM
HISTORY_MSG_238;GF - Feather HISTORY_MSG_238;GF - Feather
HISTORY_MSG_239;GF - Strength HISTORY_MSG_239;GF - Strength
@@ -672,7 +673,7 @@ HISTORY_MSG_421;Retinex - Gamma
HISTORY_MSG_422;Retinex - Gamma HISTORY_MSG_422;Retinex - Gamma
HISTORY_MSG_423;Retinex - Gamma slope HISTORY_MSG_423;Retinex - Gamma slope
HISTORY_MSG_424;Retinex - HL threshold HISTORY_MSG_424;Retinex - HL threshold
HISTORY_MSG_425;Spot removal HISTORY_MSG_425;Retinex - Log base
HISTORY_MSG_426;Retinex - Hue equalizer HISTORY_MSG_426;Retinex - Hue equalizer
HISTORY_MSG_427;Output rendering intent HISTORY_MSG_427;Output rendering intent
HISTORY_MSG_428;Monitor rendering intent HISTORY_MSG_428;Monitor rendering intent
@@ -775,6 +776,8 @@ HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold
HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace
HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light
HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength
HISTORY_MSG_SPOT;Spot removal
HISTORY_MSG_SPOT_ENTRY;Spot removal - Point modif.
HISTORY_MSG_TM_FATTAL_ANCHOR;DRC - Anchor HISTORY_MSG_TM_FATTAL_ANCHOR;DRC - Anchor
HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b> HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b>

View File

@@ -618,6 +618,12 @@ void Crop::update(int todo)
parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw); parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw);
} }
if ((todo & M_SPOT) && params.spot.enabled && !params.spot.entries.empty()) {
PreviewProps pp(trafx, trafy, trafw * skip, trafh * skip, skip);
//parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw);
parent->ipf.removeSpots(origCrop, params.spot.entries, pp);
}
DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise; DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise;
if (params.dirpyrDenoise.Lmethod == "CUR") { if (params.dirpyrDenoise.Lmethod == "CUR") {
@@ -692,6 +698,33 @@ void Crop::update(int todo)
// has to be called after setCropSizes! Tools prior to this point can't handle the Edit mechanism, but that shouldn't be a problem. // has to be called after setCropSizes! Tools prior to this point can't handle the Edit mechanism, but that shouldn't be a problem.
createBuffer(cropw, croph); createBuffer(cropw, croph);
if ((todo & M_SPOT_ADJUST) && params.spot.enabled && !params.spot.entries.empty()) {
PreviewProps pp(trafx, trafy, trafw * skip, trafh * skip, skip);
parent->ipf.removeSpots(origCrop, params.spot.entries, pp);
}
// Apply Spot removal
if (todo & (M_SPOT|M_SPOT_ADJUST)) {
if (params.spot.enabled && !params.spot.entries.empty()) {
if(!spotCrop) {
spotCrop = new Imagefloat (cropw, croph);
}
baseCrop->copyData (spotCrop);
PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip);
//parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw);
parent->ipf.removeSpots (spotCrop, params.spot.entries, pp);
} else {
if (spotCrop) {
delete spotCrop;
spotCrop = nullptr;
}
}
}
if (spotCrop) {
baseCrop = spotCrop;
}
std::unique_ptr<Imagefloat> fattalCrop; std::unique_ptr<Imagefloat> fattalCrop;
if ((todo & M_HDR) && (params.fattal.enabled || params.dehaze.enabled)) { if ((todo & M_HDR) && (params.fattal.enabled || params.dehaze.enabled)) {
@@ -747,29 +780,6 @@ void Crop::update(int todo)
parent->ipf.ToneMapFattal02(f); parent->ipf.ToneMapFattal02(f);
} }
// Apply Spot removal
if (params.spot.enabled) {
if (todo & M_SPOT) {
if(!spotCrop) {
spotCrop = new Imagefloat (cropw, croph);
}
baseCrop->copyData (spotCrop);
PreviewProps pp (cropx, cropy, cropw, croph, skip);
parent->ipf.removeSpots (spotCrop, params.spot.entries, pp);
}
} else {
if (spotCrop) {
delete spotCrop;
}
spotCrop = NULL;
}
if (spotCrop) {
baseCrop = spotCrop;
}
// crop back to the size expected by the rest of the pipeline // crop back to the size expected by the rest of the pipeline
if (need_cropping) { if (need_cropping) {
Imagefloat *c = origCrop; Imagefloat *c = origCrop;

View File

@@ -40,7 +40,7 @@ extern const Settings* settings;
ImProcCoordinator::ImProcCoordinator() : ImProcCoordinator::ImProcCoordinator() :
orig_prev(nullptr), orig_prev(nullptr),
oprevi(nullptr), oprevi(nullptr),
spot_prev (nullptr), spotprev(nullptr),
oprevl(nullptr), oprevl(nullptr),
nprevl(nullptr), nprevl(nullptr),
fattal_11_dcrop_cache(nullptr), fattal_11_dcrop_cache(nullptr),
@@ -50,7 +50,6 @@ ImProcCoordinator::ImProcCoordinator() :
imgsrc (nullptr), imgsrc (nullptr),
lastAwbEqual (0.), lastAwbEqual (0.),
lastAwbTempBias (0.0), lastAwbTempBias (0.0),
previewProps(-1, -1, -1, -1, 1),
monitorIntent (RI_RELATIVE), monitorIntent (RI_RELATIVE),
softProof(false), softProof(false),
gamutCheck(false), gamutCheck(false),
@@ -217,7 +216,7 @@ DetailedCrop* ImProcCoordinator::createCrop(::EditDataProvider *editDataProvider
void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
{ {
MyMutex::MyLock processingLock (mProcessing); MyMutex::MyLock processingLock(mProcessing);
constexpr int numofphases = 15; constexpr int numofphases = 15;
int readyphase = 0; int readyphase = 0;
@@ -234,6 +233,41 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
} }
} }
if (todo & M_SPOT_ADJUST) {
// TWEAKING THE PROCPARAMS FOR THE SPOT ADJUSTMENT MODE
// -> using fast demozaicing method
highDetailNeeded = false;
//params->raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST);
//params->raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST);
// -> disabling all transform
//params->coarse = CoarseTransformParams();
params->lensProf = LensProfParams();
params->cacorrection = CACorrParams();
params->distortion = DistortionParams();
params->rotate = RotateParams();
params->perspective = PerspectiveParams();
params->vignetting = VignettingParams();
// -> disabling standard crop
params->crop.enabled = false;
// -> disabling time consuming and unnecessary tool
params->sh.enabled = false;
params->blackwhite.enabled = false;
params->dehaze.enabled = false;
params->wavelet.enabled = false;
params->filmSimulation.enabled = false;
params->sharpenEdge.enabled = false;
params->sharpenMicro.enabled = false;
params->sharpening.enabled = false;
params->softlight.enabled = false;
params->gradient.enabled = false;
params->pcvignette.enabled = false;
params->colorappearance.enabled = false;
}
if (((todo & ALL) == ALL) || (todo & M_MONITOR) || panningRelatedChange || (highDetailNeeded && options.prevdemo != PD_Sidecar)) { if (((todo & ALL) == ALL) || (todo & M_MONITOR) || panningRelatedChange || (highDetailNeeded && options.prevdemo != PD_Sidecar)) {
bwAutoR = bwAutoG = bwAutoB = -9000.f; bwAutoR = bwAutoG = bwAutoB = -9000.f;
@@ -451,11 +485,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
// Will (re)allocate the preview's buffers // Will (re)allocate the preview's buffers
setScale(scale); setScale(scale);
previewProps.set(0, 0, fw, fh, scale); PreviewProps pp(0, 0, fw, fh, scale);
// Tells to the ImProcFunctions' tools what is the preview scale, which may lead to some simplifications // Tells to the ImProcFunctions' tools what is the preview scale, which may lead to some simplifications
ipf.setScale(scale); ipf.setScale(scale);
imgsrc->getImage(currWB, tr, orig_prev, previewProps, params->toneCurve, params->raw); imgsrc->getImage(currWB, tr, orig_prev, pp, params->toneCurve, params->raw);
denoiseInfoStore.valid = false; denoiseInfoStore.valid = false;
//ColorTemp::CAT02 (orig_prev, &params) ; //ColorTemp::CAT02 (orig_prev, &params) ;
// printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale); // printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale);
@@ -507,47 +541,48 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
readyphase++; readyphase++;
oprevi = orig_prev;
progress ("Spot Removal...", 100 * readyphase / numofphases);
if (todo & (M_SPOT|M_SPOT_ADJUST)) {
if (params->spot.enabled && !params->spot.entries.empty()) {
allocCache(spotprev);
orig_prev->copyData (spotprev);
PreviewProps pp(0, 0, fw, fh, scale);
ipf.removeSpots (spotprev, params->spot.entries, pp);
} else {
if (spotprev) {
delete spotprev;
spotprev = nullptr;
}
}
}
if (spotprev) {
if (oprevi == orig_prev) {
allocCache(oprevi);
}
spotprev->copyData(oprevi);
}
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) { if (fattal_11_dcrop_cache) {
delete fattal_11_dcrop_cache; delete fattal_11_dcrop_cache;
fattal_11_dcrop_cache = nullptr; fattal_11_dcrop_cache = nullptr;
} }
ipf.dehaze(orig_prev); if (oprevi == orig_prev) {
ipf.ToneMapFattal02(orig_prev); oprevi = new Imagefloat (pW, pH);
orig_prev->copyData (oprevi);
if (oprevi != orig_prev) {
delete oprevi;
} }
ipf.dehaze(oprevi);
ipf.ToneMapFattal02(oprevi);
} }
oprevi = orig_prev;
progress ("Spot Removal...", 100 * readyphase / numofphases);
if (params->spot.enabled && !params->spot.entries.empty ()) {
if ((todo & M_SPOT)) {
// First update the image with spot healing
ipf.removeSpots (oprevi, params->spot.entries, previewProps);
// Then fork the image to cache the data
if (spot_prev == nullptr) {
spot_prev = new Imagefloat (pW, pH);
}
oprevi->copyData (spot_prev);
}
if (spot_prev) {
oprevi = spot_prev;
}
} else {
if (spot_prev) {
delete spot_prev;
spot_prev = nullptr;
}
}
readyphase++;
progress ("Rotate / Distortion...", 100 * readyphase / numofphases); progress ("Rotate / Distortion...", 100 * readyphase / numofphases);
// Remove transformation if unneeded // Remove transformation if unneeded
bool needstransform = ipf.needsTransform(); bool needstransform = ipf.needsTransform();
@@ -1063,16 +1098,16 @@ void ImProcCoordinator::freeAll()
{ {
if (allocated) { if (allocated) {
if (spot_prev && spot_prev != oprevi) { if (spotprev && spotprev != oprevi) {
delete spot_prev; delete spotprev;
} }
spot_prev = nullptr; spotprev = nullptr;
if (oprevi && oprevi != orig_prev) { if (orig_prev != oprevi) {
delete oprevi; delete oprevi;
} }
oprevi = nullptr; oprevi = nullptr;
delete orig_prev; delete orig_prev;
orig_prev = nullptr; orig_prev = nullptr;
delete oprevl; delete oprevl;
@@ -1099,6 +1134,15 @@ void ImProcCoordinator::freeAll()
allocated = false; allocated = false;
} }
void ImProcCoordinator::allocCache (Imagefloat* &imgfloat)
{
if (imgfloat == nullptr) {
imgfloat = new Imagefloat(pW, pH);
} else {
imgfloat->allocate(pW, pH);
}
}
/** @brief Handles image buffer (re)allocation and trigger sizeChanged of SizeListener[s] /** @brief Handles image buffer (re)allocation and trigger sizeChanged of SizeListener[s]
* If the scale change, this method will free all buffers and reallocate ones of the new size. * If the scale change, this method will free all buffers and reallocate ones of the new size.
* It will then tell to the SizeListener that size has changed (sizeChanged) * It will then tell to the SizeListener that size has changed (sizeChanged)

View File

@@ -57,7 +57,7 @@ class ImProcCoordinator : public StagedImageProcessor
protected: protected:
Imagefloat *orig_prev; Imagefloat *orig_prev;
Imagefloat *oprevi; Imagefloat *oprevi;
Imagefloat *spot_prev; Imagefloat *spotprev;
LabImage *oprevl; LabImage *oprevl;
LabImage *nprevl; LabImage *nprevl;
Imagefloat *fattal_11_dcrop_cache; // global cache for ToneMapFattal02 used in 1:1 detail windows (except when denoise is active) Imagefloat *fattal_11_dcrop_cache; // global cache for ToneMapFattal02 used in 1:1 detail windows (except when denoise is active)
@@ -73,8 +73,6 @@ protected:
double lastAwbEqual; double lastAwbEqual;
double lastAwbTempBias; double lastAwbTempBias;
PreviewProps previewProps;
Glib::ustring monitorProfile; Glib::ustring monitorProfile;
RenderingIntent monitorIntent; RenderingIntent monitorIntent;
bool softProof; bool softProof;
@@ -183,6 +181,7 @@ protected:
void progress (Glib::ustring str, int pr); void progress (Glib::ustring str, int pr);
void reallocAll (); void reallocAll ();
void allocCache (Imagefloat* &imgfloat);
void updateLRGBHistograms (); void updateLRGBHistograms ();
void setScale (int prevscale); void setScale (int prevscale);
void updatePreviewImage (int todo, bool panningRelatedChange); void updatePreviewImage (int todo, bool panningRelatedChange);

View File

@@ -262,7 +262,7 @@ enum ProcEventCode {
EvBWAfterCurve = 232, EvBWAfterCurve = 232,
EvBWAfterCurveMode = 233, EvBWAfterCurveMode = 233,
EvAutoch = 234, EvAutoch = 234,
EvSpotEntry = 235, // EvFixedch=235, -- can be reused --
EvNeutralBW = 236, EvNeutralBW = 236,
EvGradientFeather = 237, EvGradientFeather = 237,
EvGradientStrength = 238, EvGradientStrength = 238,
@@ -451,7 +451,7 @@ enum ProcEventCode {
EvLgam = 421, EvLgam = 421,
EvLslope = 422, EvLslope = 422,
EvLhighl = 423, EvLhighl = 423,
EvSpotEnabled = 424, // EvLbaselog = 424, -- can be reused --
EvRetinexlhcurve = 425, EvRetinexlhcurve = 425,
EvOIntent = 426, EvOIntent = 426,
EvMonitorTransform = 427, EvMonitorTransform = 427,

View File

@@ -262,7 +262,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
RGBCURVE, // EvBWAfterCurve RGBCURVE, // EvBWAfterCurve
RGBCURVE, // EvBWAfterCurveMode RGBCURVE, // EvBWAfterCurveMode
RGBCURVE, // EvAutoch RGBCURVE, // EvAutoch
SPOT, // EvSpotEntry 0, // --unused--
RGBCURVE, // EvNeutralBW RGBCURVE, // EvNeutralBW
TRANSFORM, // EvGradientFeather TRANSFORM, // EvGradientFeather
TRANSFORM, // EvGradientStrength TRANSFORM, // EvGradientStrength
@@ -451,7 +451,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
DEMOSAIC, // EvLgam DEMOSAIC, // EvLgam
DEMOSAIC, // EvLslope DEMOSAIC, // EvLslope
RETINEX, // EvLhighl RETINEX, // EvLhighl
SPOT, // EvSpotEnabled 0, // --unused--
DEMOSAIC, // EvRetinexlhcurve DEMOSAIC, // EvRetinexlhcurve
OUTPUTPROFILE, // EvOIntent OUTPUTPROFILE, // EvOIntent
MONITORTRANSFORM, // EvMonitorTransform: no history message MONITORTRANSFORM, // EvMonitorTransform: no history message
@@ -470,7 +470,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
RETINEX, // EvRetinexgaintransmission RETINEX, // EvRetinexgaintransmission
RETINEX, // EvLskal RETINEX, // EvLskal
OUTPUTPROFILE, // EvOBPCompens OUTPUTPROFILE, // EvOBPCompens
ALLNORAW, // EvWBtempBias ALLNORAW, // EvWBtempBias
DARKFRAME, // EvRawImageNum DARKFRAME, // EvRawImageNum
0, // unused 0, // unused
0, // unused 0, // unused

View File

@@ -22,6 +22,9 @@
#include <unordered_map> #include <unordered_map>
#include "procevents.h" #include "procevents.h"
// Use M_SPOT_ADJUST to update the rendering for On Preview Adjustment of the Spot tool
#define M_SPOT_ADJUST (1<<19)
// Use M_VOID if you wish to update the proc params without updating the preview at all ! // Use M_VOID if you wish to update the proc params without updating the preview at all !
#define M_VOID (1<<18) #define M_VOID (1<<18)
// Use M_MINUPDATE if you wish to update the preview without modifying the image (think about it like a "refreshPreview") // Use M_MINUPDATE if you wish to update the preview without modifying the image (think about it like a "refreshPreview")
@@ -51,16 +54,16 @@
// Bitfield of functions to do to the preview image when an event occurs // Bitfield of functions to do to the preview image when an event occurs
// Use those or create new ones for your new events // Use those or create new ones for your new events
#define FIRST (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR|M_MONITOR) // without HIGHQUAL #define FIRST (M_PREPROC|M_RAW|M_INIT|M_SPOT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR|M_MONITOR) // without HIGHQUAL
#define ALL (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) // without HIGHQUAL #define ALL (M_PREPROC|M_RAW|M_INIT|M_SPOT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) // without HIGHQUAL
#define DARKFRAME (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define DARKFRAME (M_PREPROC|M_RAW|M_INIT|M_SPOT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define FLATFIELD (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define FLATFIELD (M_PREPROC|M_RAW|M_INIT|M_SPOT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define DEMOSAIC (M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define DEMOSAIC (M_RAW|M_INIT|M_SPOT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define ALLNORAW (M_INIT|M_LINDENOISE|M_HDR|M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define ALLNORAW (M_INIT|M_SPOT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define HDR (M_LINDENOISE|M_HDR|M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define HDR (M_SPOT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define SPOT (M_SPOT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define SPOTADJUST (M_SPOT_ADJUST|M_HDR|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define TRANSFORM (M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define TRANSFORM (M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define AUTOEXP (M_HDR|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define AUTOEXP (M_SPOT|M_HDR|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define RGBCURVE (M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) #define RGBCURVE (M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define LUMINANCECURVE (M_LUMACURVE|M_LUMINANCE|M_COLOR) #define LUMINANCECURVE (M_LUMACURVE|M_LUMINANCE|M_COLOR)
#define SHARPENING (M_LUMINANCE|M_COLOR) #define SHARPENING (M_LUMINANCE|M_COLOR)

View File

@@ -7,6 +7,8 @@
#include <iomanip> #include <iomanip>
#include "../rtengine/rt_math.h" #include "../rtengine/rt_math.h"
#include "guiutils.h" #include "guiutils.h"
#include "eventmapper.h"
#include "../rtengine/refreshmap.h"
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;
@@ -64,6 +66,12 @@ Spot::Spot() : FoldableToolPanel (this, "spot", M ("TP_SPOT_LABEL"), true, true)
link.datum = Geometry::IMAGE; link.datum = Geometry::IMAGE;
link.setActive (false); link.setActive (false);
auto m = ProcEventMapper::getInstance();
EvSpotEnabled = m->newEvent(ALLNORAW, "TP_SPOT_LABEL");
EvSpotEnabledOPA = m->newEvent(SPOTADJUST, "");
EvSpotEntry = m->newEvent(SPOTADJUST, "HISTORY_MSG_SPOT_ENTRY");
EvSpotEntryOPA = m->newEvent(SPOTADJUST, "HISTORY_MSG_SPOT_ENTRY");
show_all(); show_all();
} }
@@ -135,7 +143,7 @@ void Spot::resetPressed()
updateGeometry(); updateGeometry();
if (listener) { if (listener) {
listener->panelChanged (EvSpotEntry, Glib::ustring::compose (M ("TP_SPOT_COUNTLABEL"), 0)); listener->panelChanged (edit->get_active() ? EvSpotEntryOPA : EvSpotEntry, Glib::ustring::compose (M ("TP_SPOT_COUNTLABEL"), 0));
} }
} }
} }
@@ -167,16 +175,15 @@ void Spot::editedToggled ()
} }
} }
void Spot::enabledChanged () void Spot::enabledChanged ()
{ {
if (listener) { if (listener) {
if (get_inconsistent()) { if (get_inconsistent()) {
listener->panelChanged (EvSpotEnabled, M ("GENERAL_UNCHANGED")); listener->panelChanged (edit->get_active() ? EvSpotEnabledOPA : EvSpotEnabled, M ("GENERAL_UNCHANGED"));
} else if (getEnabled()) { } else if (getEnabled()) {
listener->panelChanged (EvSpotEnabled, M ("GENERAL_ENABLED")); listener->panelChanged (edit->get_active() ? EvSpotEnabledOPA : EvSpotEnabled, M ("GENERAL_ENABLED"));
} else { } else {
listener->panelChanged (EvSpotEnabled, M ("GENERAL_DISABLED")); listener->panelChanged (edit->get_active() ? EvSpotEnabledOPA : EvSpotEnabled, M ("GENERAL_DISABLED"));
} }
} }
} }
@@ -188,10 +195,14 @@ void Spot::setEditProvider (EditDataProvider* provider)
void Spot::editToggled () void Spot::editToggled ()
{ {
if (edit->get_active()) { if (listener) {
subscribe(); if (edit->get_active()) {
} else { listener->refreshPreview(EvSpotEnabledOPA); // reprocess the preview w/o creating History entry
unsubscribe(); subscribe();
} else {
unsubscribe();
listener->refreshPreview(EvSpotEnabled); // reprocess the preview w/o creating History entry
}
} }
} }
@@ -372,7 +383,7 @@ void Spot::addNewEntry()
// TODO: find a way to disable the active spot's Mouse Over geometry but still displaying its location... // TODO: find a way to disable the active spot's Mouse Over geometry but still displaying its location...
if (listener) { if (listener) {
listener->panelChanged (EvSpotEntry, M ("TP_SPOT_ENTRYCHANGED")); listener->panelChanged (EvSpotEntryOPA, M ("TP_SPOT_ENTRYCHANGED"));
} }
} }
@@ -690,5 +701,6 @@ void Spot::switchOffEditMode ()
} }
EditSubscriber::switchOffEditMode(); // disconnect EditSubscriber::switchOffEditMode(); // disconnect
listener->refreshPreview(EvSpotEnabled); // reprocess the preview w/o creating History entry
} }

View File

@@ -98,6 +98,14 @@ public:
bool pick2 (const bool picked); bool pick2 (const bool picked);
bool pick3 (const bool picked); bool pick3 (const bool picked);
void switchOffEditMode (); void switchOffEditMode ();
rtengine::ProcEvent EvSpotEnabled;
rtengine::ProcEvent EvSpotEnabledOPA; // used to toggle-on the Spot 'On Preview Adjustment' mode
rtengine::ProcEvent EvSpotEntry;
rtengine::ProcEvent EvSpotEntryOPA;
rtengine::ProcEvent evt;
}; };
#endif #endif

View File

@@ -35,6 +35,10 @@ class ToolPanelListener
{ {
public: public:
virtual ~ToolPanelListener() = default; virtual ~ToolPanelListener() = default;
/// @brief Ask to refresh the preview not triggered by a parameter change (e.g. 'On Preview' editing).
virtual void refreshPreview(const rtengine::ProcEvent& event) = 0;
/// @brief Used to notify all listeners that a parameters has been effectively changed
virtual void panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) = 0; virtual void panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) = 0;
}; };

View File

@@ -379,6 +379,19 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
} }
void ToolPanelCoordinator::refreshPreview (const rtengine::ProcEvent& event)
{
if (!ipc) {
return;
}
ProcParams* params = ipc->beginUpdateParams ();
for (auto toolPanel : toolPanels) {
toolPanel->write (params);
}
ipc->endUpdateParams (event); // starts the IPC processing
}
void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr)
{ {

View File

@@ -237,6 +237,7 @@ public:
} }
// toolpanellistener interface // toolpanellistener interface
void refreshPreview(const rtengine::ProcEvent& event) override;
void panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) override; void panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) override;
void imageTypeChanged (bool isRaw, bool isBayer, bool isXtrans, bool isMono = false) override; void imageTypeChanged (bool isRaw, bool isBayer, bool isXtrans, bool isMono = false) override;