rawTherapee/rtgui/labgrid.h
Desmis 35abd92209
Custom TRC Tone response curve and Illuminant - change Histogram - RGB and Lab values - for output (screen, TIF, JPG..) (#5949)
* Change TRC in the process

* Improve GUI slope

* Add tooltip output profile

* Various change to enable and tooltip

* Chnage rtthumbnail

* Small change tooltip trc

* Another small change tooltip

* Improve GUI - change default TRC BT709 - change tooltip

* Other GUI improvment

* Small changes to BT709 values

* Various change to TRC - add illuminant working profile

* Change labels tooltip TRC illuminant

* Display wp in console if wp provided

* Change tooltip

* Change max wlope

* Init trc + illum + primaries

* Add black point compensation

* Change location abstract

* Fixed bug with rtthumbnail...

* Added tooltip

* Logscale for wslope

* Change tooltip abstract

* Change labels tooltips abstract profile

* Added 6 sliders custom primaries X and Y

* Change GUI custom primaries

* Use custom primaries abstract profiles

* Tooltip with primaries red green blue

* Fixed warning gtk

* Change one tooltip

* Change range custom primaries

* Change GUI default Primaries

* Change one tooltip

* Speedup for trc

* Rendering intent for abstract profile

* Hide intent abstract

* Preserve neutral tones

* Chnage settings preserves neutral tones

* Improve GUI

* Improvment to preserv

* Clean code - speedup TRC when illuminant and primaries default

* Change label

* Change bad default value Blux

* Add forgoten illuminant when selecting primaries

* clean code

* Change labels

* improve workingtrc for LA

* Change default primaries when select default

* Added others working profile to primaries

* Change labels and GUI

* Change tooltip

* CIExy diagram displaying the primaries (interactive) and the white point (#6207)

* Ciexy diagram

* Change to Ciexy graph

* Change graph and defaut coordonates

* Various changes to graph - params

* Disable setListener(ToolPanelListener)

* Add some graduation to graph

* Clean comment code graph

* Change radius 0

* Enable sensitive graph Ciexy

* update Ciexy graph with primaries

* Remove reset button graph

* Change labels and behavior

* First step third spot green

* Second step 3rd spot green

* First try 3 primaries graph Ciexy

* Fixed bad behavior in lab grid

* Fixed another bad behavior graph

* Clean and comment code

* Change default gamma

* More accurate graph Cie xy

* Added white point to Ciexy graph

* Added tooltip Cie xy diagram

* Improvment when illuminant change

* Refine diagram CIE xy - added WP 2000K

* White point D120 + tooltip

* Change label

* Change labels

* Change tooltips

* Improve diagram CIE xy with parabolic

* Other parabolic to improve Cie xy diagram

* Small change GUI

* Added Label CIE xy - change labels

* Change behavior when none - change labels

* Improve gUI and trys to fix LGTM alerts

* CIE xy change set sensitive

* Improve tooltip primaries sliders

* Adapt tooltip to new labels

* Fixed crash and some bad behavior

* First fix bad behavior with some primaries

* Second fixed bad behavior primaries

* Third fixed bad behavior primaries

* Change white point BestRGB

* Change order rgb in history msg Ciexy

* Change tooltip

* Change tooltip

* Improve GUI primaries

* Illuminant 1500K - display in console matrix XYZ-RGB

* Improve GUI illuminant

* Change a tooltip

* Somme changes to GUI and verbose

* Test code for wprim in read

* clean code for wprims

* further cleanups, not tested

* Some cleanups and bugfixes, #5949

* Simplify `std::unique_ptr<>` dereferencing

Also some minor cleanups.

* Some changes suggested by Floessie

* Others change suggested

* Others changes suggested by Floessie

* Forgotten change in procparams.cc

* Added black and white for use with the primaries channel mixer

* Small change behavior GUI - illuminant

* Change pragma omp in iplab2rgb

* Add enums and clean up

* Remove unused code icmpanel.cc

* Fix LGTM alert, #5949

Co-authored-by: Ingo Weyrich <heckflosse67@gmx.de>
Co-authored-by: Flössie <floessie.mail@gmail.com>
2021-05-16 06:18:25 +02:00

132 lines
4.9 KiB
C++

/** -*- C++ -*-
*
* This file is part of RawTherapee.
*
* Copyright (c) 2017 Alberto Griggio <alberto.griggio@gmail.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 <https://www.gnu.org/licenses/>.
*/
// adapted from the "color correction" module of Darktable. Original copyright follows
/*
copyright (c) 2009--2010 johannes hanika.
darktable 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.
darktable 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 darktable. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gtkmm.h>
#include "eventmapper.h"
#include "toolpanel.h"
class LabGridArea final : public Gtk::DrawingArea, public BackBuffer {
private:
rtengine::ProcEvent evt;
Glib::ustring evtMsg;
enum State { NONE, HIGH, LOW, GRE};
State litPoint;
double low_a;
double high_a;
double low_b;
double high_b;
double gre_x;
double gre_y;
double whi_x;
double whi_y;
double defaultLow_a;
double defaultHigh_a;
double defaultLow_b;
double defaultHigh_b;
double defaultgre_x;
double defaultgre_y;
double defaultwhi_x;
double defaultwhi_y;
ToolPanelListener *listener;
bool edited;
bool isDragged;
sigc::connection delayconn;
static const int inset = 5;
bool low_enabled;
bool ciexy_enabled;
bool notifyListener();
void getLitPoint();
public:
LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true, bool ciexy=false);
void getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy) const;
void setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, bool notify);
void setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy);
void setEdited(bool yes);
bool getEdited() const;
void reset(bool toInitial);
void setListener(ToolPanelListener *l);
bool lowEnabled() const;
void setLowEnabled(bool yes);
bool ciexyEnabled() const;
void setciexyEnabled(bool yes);
bool on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf) override;
void on_style_updated () override;
bool on_button_press_event(GdkEventButton *event) override;
bool on_button_release_event(GdkEventButton *event) override;
bool on_motion_notify_event(GdkEventMotion *event) override;
Gtk::SizeRequestMode get_request_mode_vfunc() const override;
void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const override;
void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const override;
};
class LabGrid: public Gtk::Box {
private:
LabGridArea grid;
bool resetPressed(GdkEventButton *event);
public:
LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true, bool ciexy=false);
void getParams(double &la, double &lb, double &ha, double &hb, double &gx, double &gy, double &wx, double &wy) const { return grid.getParams(la, lb, ha, hb, gx, gy, wx, wy); }
void setParams(double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy, bool notify) { grid.setParams(la, lb, ha, hb, gx, gy, wx, wy, notify); }
void setDefault (double la, double lb, double ha, double hb, double gx, double gy, double wx, double wy) { grid.setDefault(la, lb, ha, hb, gx, gy, wx, wy); }
void setEdited(bool yes) { grid.setEdited(yes); }
bool getEdited() const { return grid.getEdited(); }
void reset(bool toInitial) { grid.reset(toInitial); }
void setListener(ToolPanelListener *l) { grid.setListener(l); }
bool lowEnabled() const { return grid.lowEnabled(); }
void setLowEnabled(bool yes) { grid.setLowEnabled(yes); }
bool ciexyEnabled() const { return grid.ciexyEnabled(); }
void setciexyEnabled(bool yes) { grid.setciexyEnabled(yes); }
};