rawTherapee/rtgui/locallab.h
Desmis 16db6186dd
Generalized Hyperbolic Stretch in Selective Editing (#7210)
* GHS GUI first step

* GHS GUI first step

* GUI step 3

* Hide show ghsmethod

* Siril functions for ghs

* Init ghs in iplocallab

* ghs step 2

* ghs step 4

* Comment copyright Pixlnsight 2021

* Smooth highlights and tooltips

* Enabled saturation and luminance ghs mode

* First tooltip

* Ghs tooltips

* Remove wrong packstart inverssh

* Change labels and tooltips

* Disabled mask in global and other improvments

* Comment code

* appimage and windows yml ghs

* Change tooltip

* Ghsmethod hue and change tolltips

* Change tooltip

* Inverse Stretch step 1

* Inverse GHS

* GHS tooltips

* Change tooltips

* Change tooltip

* Linear black point

* Small change to blackpoint

* Change tooltip

* Clean and comment code

* forgotten GHS highlight attenuation msg in history

* Comment code with Transformation equations

* Change tooltip

* Wrong default value balck point

* Comment code iplocallab

* Ghs curve step 1

* GHS curve step 2

* Show GHS setting in a Curve Box

* Tooltip for ghs S curve

* Disabled warning in compilation simpleprocess

* Simplified code part 1

* Simplified code GHS graph part 2

* Improve black point with negatives values

* Improve BP and tooltip

* Listener enable only with GHS

* White point for GHS

* Change label and tooltip

* Improve behavior white point and black point

* Link sliders ghs_SP ghs_LP ghs_HP and change code to avoid balck screen

* hide unused button in diagonal curve GHS

* prevents the GHS representation in S from displaying artifacts if ghs-d=0

* Change tooltips

* Improvment and tooltips

* Forgotten tooltip

* Improve GUI GHS S curve - change tooltips

* Set transition gray areas in S curve GHS with values of the RT-spot

* Change label GHS

* setlogscale blackpoint and symmetry

* Set recursive reference enable by default in controlspotpanel

* Change lastlocalCurvesDir Dirghs in locallabtools and options - change labels

* Added in converttonormal ghsMode.. not sure if this is useful

* DIY to make GHS curve work without the choices

* Change RGB calculation with luminance function working profile

* 5 modes GHS method

* Label to show datas clipped Black point and White point

* Various change white point tooltips

* Bad behavior wp bp labels

* Small change to improccordinator call to ghschanged ghsbwchanged

* Set log scale ghs_D

* Hide Graduated filter if GHS enable

* Luminance Lab in ghsmethod

* Lab slope factor step 1

* Slope and Chromaticity GHS improvments

* Fixed bad sqrt line 17477 iplocallab

* Workaround linear GHS - re-enable Graduated filer GHS

* Change limits slope lab factor

* Ghs chromaticity Lab (Lch)

* Improve ghs chromaticity

* Change labels and tooltips Lab chroma

* Slope Lab to 100

* Noise and saturation RGB

* Saturation RGB standard and labels

* Change histogram and navigator panel without gamma when using working profile

* Remove gray in GHS curve

* Local contrast a minima

* Regularization stretch

* Improve Graduated Filter in all cases GHS Color and Light etc.

* Improves nlmeans to reduce noise after GHS

* Change to GF - tooltip Nlmeans

* Added oW oH tW tH etc.

* Added call GF

* tX tY for previewProps

* Comment code GF

* Improve local contrast ghs

* Change norm to norm2

* Improve GUI mode complexity and Lab GHS

* Show values BP WP in GUI

* Labgrid ghs step 1

* Labgrid for simulation GHS - step 2

* More points for Labgrid ghs

* Clean and comment code

* Fixed crash in inverse GHS white point - set to 10 points for GSH simulation

* Change to black point in inverse GHS

* Intilialize simulation with nothing if new spot

* Remove curve GHS - optimize code simulation - improve GUI

* set ghs default - fixed crash is case HP SP LP

* Fixed crash - I hope in inverse GHS

* Simplify WP and BP limits to avoid crash in inverse GHS

* Clean code with ghscurve - ghsshape

* Change tooltips

* Change to D - GUI - comment code

* Simulation with 4 more points

* Best simulation with point 0.05 and 0.95

* Clean code - change for crsah in Inverse GHS

* Show values WP and BP
2024-11-13 08:23:41 +01:00

265 lines
7.9 KiB
C++

/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
* 2017 Jacques Desmis <jdesmis@gmail.com>
* 2019 Pierre Cabrera <pierre.cab@gmail.com>
*/
#ifndef _LOCALLAB_H_
#define _LOCALLAB_H_
#pragma once
#include "controlspotpanel.h"
#include "guiutils.h"
#include "locallabtools.h"
/* ==== LocallabToolListListener ==== */
class LocallabToolList;
class LocallabToolListListener
{
public:
LocallabToolListListener() {};
virtual ~LocallabToolListListener() {};
virtual void locallabToolToAdd(const Glib::ustring &toolname) = 0;
};
/* ==== LocallabToolList ==== */
class LocallabToolList:
public Gtk::Box
{
private:
// Tree model to manage ComboBox rows
class ToolRow:
public Gtk::TreeModel::ColumnRecord
{
public:
Gtk::TreeModelColumn<int> id;
Gtk::TreeModelColumn<Glib::ustring> name;
ToolRow()
{
add(id);
add(name);
}
};
// Tool list GUI widgets
MyComboBox* const list;
sigc::connection listConn;
ToolRow toolRow;
Glib::RefPtr<Gtk::ListStore> listTreeModel;
// Tool list listener
LocallabToolListListener* listListener;
public:
LocallabToolList();
// Setter for tool list listener
void setLocallabToolListListener(LocallabToolListListener* ltll)
{
listListener = ltll;
}
// Tool list management function
void addToolRow(const Glib::ustring &toolname, const int id);
void removeToolRow(const Glib::ustring &toolname);
void removeAllTool();
private:
// Tool list event management function
void toolRowSelected();
};
/* ==== Locallab ==== */
class Locallab :
public ToolParamBlock,
public FoldableToolPanel,
public rtengine::LocallabListener,
public ControlPanelListener,
public LocallabToolListener,
public LocallabToolListListener
{
private:
// Spot control panel widget
ControlSpotPanel* const expsettings;
// Tool list widget
LocallabToolList* const toollist;
// Locallab tool widgets
LocallabColor expcolor;
LocallabExposure expexpose;
LocallabShadow expshadhigh;
LocallabVibrance expvibrance;
LocallabSoft expsoft;
LocallabBlur expblur;
LocallabTone exptonemap;
LocallabRetinex expreti;
LocallabSharp expsharp;
LocallabContrast expcontrast;
LocallabCBDL expcbdl;
LocallabLog explog;
LocallabMask expmask;
Locallabcie expcie;
OptionalRadioButtonGroup delta_e_preview_button_group;
std::vector<LocallabTool*> locallabTools;
// Locallab tools mask background management data
std::vector<locallabRetiMinMax> retiMinMax;
// Locallab tools mask background management data
std::vector<locallabDenoiseLC> denoiselc;
std::vector<locallabcieBEF> cie_bef;
std::vector<locallabcieLC> cie_lc;
std::vector<locallabshGHS> sh_ghs;
std::vector<locallabshGHSbw> sh_ghsbw;
std::vector<locallabsetLC> set_lc;
std::vector<locallabcieSIG> cie_sig;
// Locallab tools mask background management data
std::vector<locallabRef> maskBackRef;
// Other widgets
//Gtk::Button* const resetshowButton;
Glib::ustring spotName;
public:
static const Glib::ustring TOOL_NAME;
Locallab();
// FoldableToolPanel management functions
void read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override;
void write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override;
void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override;
void setListener(ToolPanelListener* tpl) override;
// Locallab Retinex tool min/man management function
void minmaxChanged(const std::vector<locallabRetiMinMax> &minmax, int selspot) override;
// new functions for global - normal use
// void mainChanged(int spottype, int selspot, bool iscolor, bool issh, bool isvib, bool isexpos, bool issoft, bool isblur, bool istom, bool isret, bool issharp, bool iscont, bool iscbdl, bool islog, bool ismas, bool iscie)override;
void scopeChangedcol(int scope, int selspot, bool enab)override;
void scopeChangedsh(int scope, int selspot, bool enab)override;
void scopeChangedvib(int scope, int selspot, bool enab)override;
void scopeChangedset(int scope, int selspot, bool enab)override;
void maiChanged(const std::vector<locallabsetLC> &setlc, int selspot) override;
//Locallab denoise
// Locallab Retinex tool min/man management function
void denChanged(const std::vector<locallabDenoiseLC> &denlc, int selspot) override;
// Locallab CIE tool primaries function
void cieChanged(const std::vector<locallabcieLC> &cielc, int selspot) override;
// Locallab SH GHS tool Curve S GHS function
void ghsChanged(const std::vector<locallabshGHS> &shghs, int selspot) override;
// Locallab SH GHS tool Black point & White point GHS function
void ghsbwChanged(const std::vector<locallabshGHSbw> &shghsbw, int selspot) override;
// Locallab Log Encoding and Cam16 autocompute function
void ciebefChanged(const std::vector<locallabcieBEF> &ciebef, int selspot) override;
void sigChanged(const std::vector<locallabcieSIG> &ciesig, int selspot) override;
// Locallab tools mask background management function
// void refChanged(const std::vector<locallabRef> &ref, int selspot) override;
void refChanged2(float *huerefp, float *chromarefp, float *lumarefp, float *fabrefp, int selspot)override;
// Mask visibility management functions
struct llMaskVisibility {
bool previewDeltaE;
int colorMask;
int colorMaskinv;
int expMask;
int expMaskinv;
int SHMask;
int SHMaskinv;
int vibMask;
int softMask;
int blMask;
int tmMask;
int retiMask;
int sharMask;
int lcMask;
int cbMask;
int logMask;
int maskMask;
int cieMask;
};
void resetMaskVisibility();
llMaskVisibility getMaskVisibility() const;
// Other widgets event functions
//void resetshowPressed();
// EditProvider management function
void setEditProvider(EditDataProvider* provider) override;
void subscribe();
void unsubscribe();
// FoldableToolPanel event function
void enabledChanged() override;
// Curve management function
void autoOpenCurve() override;
// Locallab tools expanders management functions
void foldAllButOne(LocallabTool* except);
void openAllTools();
// Locallab tools advice tooltips management function
void updateShowtooltipVisibility(bool showtooltip);
private:
// Locallab tools management functions
void addTool(Gtk::Box* where, LocallabTool* tool);
// Locallab GUI management function
void setParamEditable(bool cond);
// ControlSpotListener function
void resetToolMaskView() override;
void spotNameChanged(const Glib::ustring &newName) override;
// LocallabToolListener function
void resetOtherMaskView(LocallabTool* current) override;
void toolRemoved(LocallabTool* current) override;
// LocallabToolListListener function
void locallabToolToAdd(const Glib::ustring &toolname) override;
};
#endif