diff --git a/rtdata/iccprofiles/output/RTv4_ACES-SP0.icc b/rtdata/iccprofiles/output/RTv4_ACES-AP0.icc
similarity index 100%
rename from rtdata/iccprofiles/output/RTv4_ACES-SP0.icc
rename to rtdata/iccprofiles/output/RTv4_ACES-AP0.icc
diff --git a/rtdata/iccprofiles/output/RTv4_ACES-SP1.icc b/rtdata/iccprofiles/output/RTv4_ACES-AP1.icc
similarity index 100%
rename from rtdata/iccprofiles/output/RTv4_ACES-SP1.icc
rename to rtdata/iccprofiles/output/RTv4_ACES-AP1.icc
diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais
index 458ad3a33..d947efb1a 100644
--- a/rtdata/languages/Francais
+++ b/rtdata/languages/Francais
@@ -201,7 +201,7 @@ FILEBROWSER_UNRANK_TOOLTIP;Effacer le rang\nRaccourci: Shift-0
FILEBROWSER_ZOOMINHINT;Augmenter la taille des vignettes.\nRaccourci: +\n\nRaccourcis dans le mode Éditeur Unique: Alt-+
FILEBROWSER_ZOOMOUTHINT;Diminuer la taille des vignettes.\nRaccourci: -\n\nRaccourcis dans le mode Éditeur Unique: Alt--
FILECHOOSER_FILTER_ANY;Tous les fichiers
-FILECHOOSER_FILTER_COLPROF;Profils couleur
+FILECHOOSER_FILTER_COLPROF;Profils couleur (*.icc)
FILECHOOSER_FILTER_CURVE;Fichiers de courbe
FILECHOOSER_FILTER_LCP;Profils de correction d'objectif
FILECHOOSER_FILTER_PP;Fichiers de traitement
@@ -228,6 +228,7 @@ GENERAL_OK;OK
GENERAL_OPEN;Ouvrir
GENERAL_PORTRAIT;Portrait
GENERAL_SAVE;Enregistrer
+GENERAL_SAVE_AS;Enregistrer sous...
GENERAL_SLIDER;Curseur
GENERAL_UNCHANGED;(Inchangé)
GENERAL_WARNING;Attention
@@ -725,6 +726,7 @@ HISTORY_NEWSNAPSHOT;Ajouter
HISTORY_NEWSNAPSHOT_TOOLTIP;Raccourci: Alt-s
HISTORY_SNAPSHOT;Capture
HISTORY_SNAPSHOTS;Captures
+ICCPROFCREATOR_SAVEDIALOG_TITLE;Enregistrer le profil ICC sous...
IPTCPANEL_CATEGORY;Catégorie
IPTCPANEL_CATEGORYHINT;Identifie le sujet de l'image selon l'opinion du fournisseur.
IPTCPANEL_CITY;Ville
@@ -772,6 +774,7 @@ LENSPROFILE_CORRECTION_LCPFILE;Fichier LCP
LENSPROFILE_CORRECTION_MANUAL;Paramètres de correction manuel
LENSPROFILE_LENS_WARNING;Attention: la taille du capteur utilisé pour le profilage de l'objectif est plus grand que celui de l'appareil sélectionné, le résultat peut être faux.
MAIN_BUTTON_FULLSCREEN;Plein écran
+MAIN_BUTTON_ICCPROFCREATOR;Créateur de Profil ICC
MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigue à l'image Suivante relativement à l'image ouverte dans l'Éditeur\nRaccourci: Shift-F4\n\nPour naviguer à l'image Suivante relativement à la vignette sélectionnée dans le Navigateur de fichiers\nRaccourci: F4
MAIN_BUTTON_NAVPREV_TOOLTIP;Navigue à l'image Précédente relativement à l'image ouverte dans l'Éditeur\nRaccourci: Shift-F3\n\nPour naviguer à l'image Précédente relativement à la vignette sélectionnée dans le Navigateur de fichiers\nRaccourci: F3
MAIN_BUTTON_NAVSYNC_TOOLTIP;Synchronise le Navigateur de fichiers avec l'Éditeur pour révéler la vignette de l'image actuellement ouverte, et efface les filtres dans le Navigateur de fichiers\nRaccourci: x\n\nComme ci-dessus, mais sans effacer les filtres dans le Navigateur de fichiers\nRaccourci: y\n(Notez que la vignette ne sera pas visible si elle a été filtrée).
@@ -860,7 +863,7 @@ NAVIGATOR_S;S:
NAVIGATOR_V;V:
NAVIGATOR_XY_FULL;Largeur = %1, Hauteur = %2
NAVIGATOR_XY_NA;x = n/d, y = n/d
-OPTIONS_BUNDLED_MISSING;Le profile fourni "%1" n'a pas été trouvé!\n\nVotre installation peut être endomagé.\n\nLes valeurs internes par défaut seront utilisées à la place.
+OPTIONS_BUNDLED_MISSING;Le profil fourni "%1" n'a pas été trouvé!\n\nVotre installation peut être endomagé.\n\nLes valeurs internes par défaut seront utilisées à la place.
OPTIONS_DEFIMG_MISSING;Le profil par défaut pour les images standards n'a pas été trouvé ou n'a pas été réglé.\n\nVérifiez le dossier de vos profils, il peut être manquant ou endommagé\n\n"%1" sera utilisé à la place.
OPTIONS_DEFRAW_MISSING;Le profil par défaut pour les images Raw n'a pas été trouvé ou n'a pas été réglé.\n\nVérifiez le dossier de vos profils, il peut être manquant ou endommagé\n\n"%1" sera utilisé à la place.
PARTIALPASTE_ADVANCEDGROUP;Réglages Avancés
diff --git a/rtdata/languages/default b/rtdata/languages/default
index dcc4ac9fe..641502cdd 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -205,7 +205,7 @@ FILEBROWSER_UNRANK_TOOLTIP;Unrank.\nShortcut: Shift-0
FILEBROWSER_ZOOMINHINT;Increase thumbnail size.\n\nShortcuts:\n+ - Multiple Editor Tabs Mode,\nAlt-+ - Single Editor Tab Mode.
FILEBROWSER_ZOOMOUTHINT;Decrease thumbnail size.\n\nShortcuts:\n- - Multiple Editor Tabs Mode,\nAlt-- - Single Editor Tab Mode.
FILECHOOSER_FILTER_ANY;All files
-FILECHOOSER_FILTER_COLPROF;Color profiles
+FILECHOOSER_FILTER_COLPROF;Color profiles (*.icc)
FILECHOOSER_FILTER_CURVE;Curve files
FILECHOOSER_FILTER_LCP;Lens correction profiles
FILECHOOSER_FILTER_PP;Processing profiles
@@ -233,6 +233,7 @@ GENERAL_OPEN;Open
GENERAL_PORTRAIT;Portrait
GENERAL_RESET;Reset
GENERAL_SAVE;Save
+GENERAL_SAVE_AS;Save as...
GENERAL_SLIDER;Slider
GENERAL_UNCHANGED;(Unchanged)
GENERAL_WARNING;Warning
@@ -752,6 +753,7 @@ HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s
HISTORY_SNAPSHOT;Snapshot
HISTORY_SNAPSHOTS;Snapshots
+ICCPROFCREATOR_SAVEDIALOG_TITLE;Save ICC profile as...
IPTCPANEL_CATEGORY;Category
IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider.
IPTCPANEL_CITY;City
@@ -799,6 +801,7 @@ LENSPROFILE_CORRECTION_LCPFILE;LCP File
LENSPROFILE_CORRECTION_MANUAL;Manual correction parameters
LENSPROFILE_LENS_WARNING;Warning: the crop factor used for lens profiling is larger than the crop factor of the camera, the results might be wrong.
MAIN_BUTTON_FULLSCREEN;Fullscreen
+MAIN_BUTTON_ICCPROFCREATOR;ICC Profile Creator
MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4
MAIN_BUTTON_NAVPREV_TOOLTIP;Navigate to the previous image relative to image opened in the Editor.\nShortcut: Shift-F3\n\nTo navigate to the previous image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F3
MAIN_BUTTON_NAVSYNC_TOOLTIP;Synchronize the File Browser or Filmstrip with the Editor to reveal the thumbnail of the currently opened image, and clear any active filters.\nShortcut: x\n\nAs above, but without clearing active filters:\nShortcut: y\n(Note that the thumbnail of the opened image will not be shown if filtered out).
@@ -1602,49 +1605,47 @@ TP_FLATFIELD_BT_VERTICAL;Vertical
TP_FLATFIELD_CLIPCONTROL;Clip control
TP_FLATFIELD_CLIPCONTROL_TOOLTIP;Clip control avoids clipped highlights caused by applying the flat field. If there are already clipped highlights before applying the flat field, clip control can lead to color cast.
TP_FLATFIELD_LABEL;Flat-Field
-TP_GAMMA_CURV;Gamma
-TP_GAMMA_CUSTOM;Custom output profile
-TP_GAMMA_PRIM;Primaries:
-TP_GAMMA_OUTPUT_TRC_PRESET;Tone response curve
-TP_GAMMA_PROF;Generate ICC profile:
-TP_GAMMA_PROF_NONE;none
-TP_GAMMA_PROF_V2;ICC v2
-TP_GAMMA_PROF_V4;ICC v4
-TP_GAMMA_SLOP;Slope
-TP_GAMMA_PRIM_ACESP0;AcesP0
-TP_GAMMA_PRIM_ACESP1;AcesP1
-TP_GAMMA_PRIM_ADOBE;Adobe
-TP_GAMMA_PRIM_PROPH;Prophoto
-TP_GAMMA_PRIM_REC2020;Rec2020
-TP_GAMMA_PRIM_SRGB;sRGB
-TP_GAMMA_PRIM_WIDEG;Widegamut
-TP_GAMMA_PRIM_BEST;BestRGB
-TP_GAMMA_PRIM_BETA;BetaRGB
-TP_GAMMA_PRIM_BRUCE;BruceRGB
-TP_GAMMA_PRIM_FREE;Custom primaries - ICC v4
-
-TP_GAMMA_PRIM_REDX;Red X
-TP_GAMMA_PRIM_REDY;Red Y
-TP_GAMMA_PRIM_GREX;Green X
-TP_GAMMA_PRIM_GREY;Green Y
-TP_GAMMA_PRIM_BLUX;Blue X
-TP_GAMMA_PRIM_BLUY;Blue Y
-TP_GAMMA_TEMP;Illuminant (ICC v4)
-TP_GAMMA_TEMP_DEF;Default
-TP_GAMMA_TEMP_41;D41
-TP_GAMMA_TEMP_50;D50
-TP_GAMMA_TEMP_55;D55
-TP_GAMMA_TEMP_60;D60
-TP_GAMMA_TEMP_65;D65
-TP_GAMMA_TEMP_80;D80
-TP_GAMMA_TEMP_INC;StdA 2856K
-TP_GAMMA_TEMP_TOOLTIP;You can only change the Illuminant and Custom Primaries if you generate an ICC v4 profile
-TP_GAMMA_WORKTRC;Tone response curve:
-TP_GAMMA_WORKTRC_NONE;None
-TP_GAMMA_WORKTRC_CUSTOM;Custom
-TP_GAMMA_WORKTRC_TOOLTIP;Only for build in profiles
-TP_GAMMA_WORKTRC_GAMMA;Gamma
-TP_GAMMA_WORKTRC_SLOPE;Slope
+ICCPROFCREATOR_CUSTOM;Custom
+ICCPROFCREATOR_GAMMA;Gamma
+ICCPROFCREATOR_PRIMARIES;Primaries:
+ICCPROFCREATOR_TRC_PRESET;Tone response curve:
+ICCPROFCREATOR_ICCVERSION;Generated profile's version:
+ICCPROFCREATOR_PROF_V2;ICC v2
+ICCPROFCREATOR_PROF_V4;ICC v4
+ICCPROFCREATOR_SLOPE;Slope
+ICCPROFCREATOR_PRIM_ACESP0;AcesP0
+ICCPROFCREATOR_PRIM_ACESP1;AcesP1
+ICCPROFCREATOR_PRIM_ADOBE;Adobe
+ICCPROFCREATOR_PRIM_PROPH;Prophoto
+ICCPROFCREATOR_PRIM_REC2020;Rec2020
+ICCPROFCREATOR_PRIM_SRGB;sRGB
+ICCPROFCREATOR_PRIM_WIDEG;Widegamut
+ICCPROFCREATOR_PRIM_BEST;BestRGB
+ICCPROFCREATOR_PRIM_BETA;BetaRGB
+ICCPROFCREATOR_PRIM_BRUCE;BruceRGB
+ICCPROFCREATOR_PRIM_TOOLTIP;You can only set Custom Primaries with ICC v4 profiles
+ICCPROFCREATOR_PRIM_REDX;Red X
+ICCPROFCREATOR_PRIM_REDY;Red Y
+ICCPROFCREATOR_PRIM_GREX;Green X
+ICCPROFCREATOR_PRIM_GREY;Green Y
+ICCPROFCREATOR_PRIM_BLUX;Blue X
+ICCPROFCREATOR_PRIM_BLUY;Blue Y
+ICCPROFCREATOR_ILL;Illuminant:
+ICCPROFCREATOR_ILL_DEF;Default
+ICCPROFCREATOR_ILL_41;D41
+ICCPROFCREATOR_ILL_50;D50
+ICCPROFCREATOR_ILL_55;D55
+ICCPROFCREATOR_ILL_60;D60
+ICCPROFCREATOR_ILL_65;D65
+ICCPROFCREATOR_ILL_80;D80
+ICCPROFCREATOR_ILL_INC;StdA 2856K
+ICCPROFCREATOR_ILL_TOOLTIP;You can only set Illuminant with ICC v4 profiles
+TP_ICM_WORKTRC;Tone response curve:
+TP_ICM_WORKTRC_NONE;None
+TP_ICM_WORKTRC_CUSTOM;Custom
+TP_ICM_WORKTRC_TOOLTIP;Only for build in profiles
+TP_ICM_WORKTRC_GAMMA;Gamma
+TP_ICM_WORKTRC_SLOPE;Slope
TP_GENERAL_11SCALE_TOOLTIP;The effects of this tool are only visible or only accurate at a preview scale of 1:1.
TP_GRADIENT_CENTER;Center
TP_GRADIENT_CENTER_X;Center X
diff --git a/rtengine/color.h b/rtengine/color.h
index 3101a616b..33c170a69 100644
--- a/rtengine/color.h
+++ b/rtengine/color.h
@@ -1074,34 +1074,34 @@ public:
/**
* @brief sRGB gamma
- * See also calcGamma above with the following values: pwr=2.399 ts=12.92 mode=0.003041 imax=0.055
+ * See also calcGamma above with the following values: pwr=2.399 ts=12.92310 mode=0.003041 imax=0.055
* @param x red, green or blue channel's value [0 ; 1]
* @return the gamma modified's value [0 ; 1]
*/
static inline double gamma2 (double x) // g3 1+g4
{
- // return x <= 0.003041 ? x * 12.92 : 1.055 * exp(log(x) / 2.39990) - 0.055;//calculate with calcgamma
- //return x <= 0.0031308 ? x * 12.92 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//standard discontinuous
+ // return x <= 0.003041 ? x * 12.92310 : 1.055 * exp(log(x) / 2.39990) - 0.055;//calculate with calcgamma
+ //return x <= 0.0031308 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//standard discontinuous
//very small differences between the 2
return x <= 0.003040 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//continuous
- // return x <= 0.003041 ? x * 12.92 : 1.055011 * exp(log(x) / sRGBGammaCurve) - 0.055011;//continuous
+ // return x <= 0.003041 ? x * 12.92310 : 1.055011 * exp(log(x) / sRGBGammaCurve) - 0.055011;//continuous
}
/**
* @brief Inverse sRGB gamma
- * See also calcGamma above with the following values: pwr=2.3999 ts=12.92 mode=0.003041 imax=0.055
+ * See also calcGamma above with the following values: pwr=2.3999 ts=12.92310 mode=0.003041 imax=0.055
* @param x red, green or blue channel's value [0 ; 1]
* @return the inverse gamma modified's value [0 ; 1]
*/
static inline double igamma2 (double x) //g2
{
- // return x <= 0.039289 ? x / 12.92 : exp(log((x + 0.055) / 1.055) * 2.39990);//calculate with calcgamma
- // return x <= 0.04045 ? x / 12.92 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//standard discontinuous
+ // return x <= 0.039289 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * 2.39990);//calculate with calcgamma
+ // return x <= 0.04045 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//standard discontinuous
//very small differences between the 4
return x <= 0.039286 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//continuous
- // return x <= 0.039293 ? x / 12.92 : exp(log((x + 0.055011) / 1.055011) * sRGBGammaCurve);//continuous
+ // return x <= 0.039293 ? x / 12.92310 : exp(log((x + 0.055011) / 1.055011) * sRGBGammaCurve);//continuous
}
diff --git a/rtengine/curves.h b/rtengine/curves.h
index 635c21da9..98934f13a 100644
--- a/rtengine/curves.h
+++ b/rtengine/curves.h
@@ -267,19 +267,19 @@ public:
// standard srgb gamma and its inverse
static inline double gamma2 (double x)
{
- return x <= 0.00304 ? x * 12.92 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;
+ return x <= 0.00304 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;
}
static inline double igamma2 (double x)
{
- return x <= 0.03928 ? x / 12.92 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);
+ return x <= 0.03928 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);
}
static inline float gamma2 (float x)
{
- return x <= 0.00304 ? x * 12.92 : 1.055 * expf(logf(x) / sRGBGammaCurve) - 0.055;
+ return x <= 0.00304 ? x * 12.92310 : 1.055 * expf(logf(x) / sRGBGammaCurve) - 0.055;
}
static inline float igamma2 (float x)
{
- return x <= 0.03928 ? x / 12.92 : expf(logf((x + 0.055) / 1.055) * sRGBGammaCurve);
+ return x <= 0.03928 ? x / 12.92310 : expf(logf((x + 0.055) / 1.055) * sRGBGammaCurve);
}
// gamma function with adjustable parameters
static inline double gamma (double x, double gamma, double start, double slope, double mul, double add)
diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc
index 05f1a32a2..4a8aa3b6f 100644
--- a/rtengine/dcraw.cc
+++ b/rtengine/dcraw.cc
@@ -2896,7 +2896,7 @@ void CLASS lossy_dng_load_raw()
}
order = sorder;
} else {
- gamma_curve (1/2.4, 12.92, 1, 255);
+ gamma_curve (1/2.4, 12.92310, 1, 255);
FORC3 memcpy (cur[c], curve, sizeof cur[0]);
}
cinfo.err = jpeg_std_error (&jerr);
@@ -6608,7 +6608,7 @@ void CLASS apply_tiff()
if (model[0] == 'N') load_flags = 80;
} else if (raw_width*raw_height*3 == tiff_ifd[raw].bytes) {
load_raw = &CLASS nikon_yuv_load_raw;
- gamma_curve (1/2.4, 12.92, 1, 4095);
+ gamma_curve (1/2.4, 12.92310, 1, 4095);
memset (cblack, 0, sizeof cblack);
filters = 0;
} else if (raw_width*raw_height*2 == tiff_ifd[raw].bytes) {
@@ -8920,7 +8920,7 @@ void CLASS identify()
strcpy (model,"One");
parse_redcine();
load_raw = &CLASS redcine_load_raw;
- gamma_curve (1/2.4, 12.92, 1, 4095);
+ gamma_curve (1/2.4, 12.92310, 1, 4095);
filters = 0x49494949;
} else if (!memcmp (head,"DSC-Image",9))
parse_rollei();
diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc
index 73da0abdc..ebcef3ab6 100644
--- a/rtengine/dcrop.cc
+++ b/rtengine/dcrop.cc
@@ -819,12 +819,7 @@ void Crop::update(int todo)
int ch = baseCrop->getHeight();
Imagefloat* readyImg0 = NULL;
- double ga0, ga1, ga2, ga3, ga4, ga5, ga6;
- int mul = -5;
- double gga = 2.4, ssl = 12.92;
-
- readyImg0 = parent->ipf.workingtrc(baseCrop, cw, ch, mul, params.icm.workingProfile, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);
-
+ readyImg0 = parent->ipf.workingtrc(baseCrop, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
@@ -836,11 +831,10 @@ void Crop::update(int todo)
}
delete readyImg0;
+
//adjust gamma TRC
Imagefloat* readyImg = NULL;
- gga = params.icm.outputGamma, ssl = params.icm.outputSlope;
- mul = 5;
- readyImg = parent->ipf.workingtrc(baseCrop, cw, ch, mul, params.icm.workingProfile, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);
+ readyImg = parent->ipf.workingtrc(baseCrop, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
@@ -852,7 +846,6 @@ void Crop::update(int todo)
}
delete readyImg;
-
}
}
}
diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc
index 947b7f34e..2816b1c75 100644
--- a/rtengine/histmatching.cc
+++ b/rtengine/histmatching.cc
@@ -211,8 +211,6 @@ void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, st
neutral.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST);
neutral.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST);
neutral.icm.outputProfile = "sRGB";
- neutral.icm.outputGammaPreset = "Custom";
- neutral.icm.customOutputProfile = false;
std::unique_ptr source;
{
diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc
index 4e5ca7078..4d490c0a0 100644
--- a/rtengine/iccstore.cc
+++ b/rtengine/iccstore.cc
@@ -201,9 +201,8 @@ cmsHPROFILE createXYZProfile()
const double(*wprofiles[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_bruce, xyz_beta, xyz_best, xyz_rec2020, xyz_ACESp0, xyz_ACESp1};//
const double(*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, bruce_xyz, beta_xyz, best_xyz, rec2020_xyz, ACESp0_xyz, ACESp1_xyz};//
const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB", "Rec2020", "ACESp0", "ACESp1"};//
-const char* wpgamma[] = {"Custom", "BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linear_g1.0", "standard_g2.2", "standard_g1.8", "High_g1.3_s3.35", "Low_g2.6_s6.9", "Lab_g3.0s9.03296"}; //gamma free
//default = gamma inside profile
-//BT709 g=2.22 s=4.5 sRGB g=2.4 s=12.92
+//BT709 g=2.22 s=4.5 sRGB g=2.4 s=12.92310
//linear g=1.0
//std22 g=2.2 std18 g=1.8
// high g=1.3 s=3.35 for high dynamic images
@@ -1030,97 +1029,6 @@ std::vector rtengine::ICCStore::getWorkingProfiles()
return implementation->getWorkingProfiles();
}
-std::vector rtengine::ICCStore::getGamma()
-{
-
- std::vector res;
-
- for (unsigned int i = 0; i < sizeof(wpgamma) / sizeof(wpgamma[0]); i++) {
- res.push_back(wpgamma[i]);
- }
-
- return res;
-}
-
-void rtengine::ICCStore::getGammaArray(const procparams::ColorManagementParams &icm, GammaValues &ga)
-{
- const double eps = 0.000000001; // not divide by zero
-
- if (icm.customOutputProfile && icm.outputGammaPreset != "Custom") { //if Free gamma selected with other than Free
- // gamma : ga[0],ga[1],ga[2],ga[3],ga[4],ga[5] by calcul
- if (icm.outputGammaPreset == "BT709_g2.2_s4.5") {
- ga[0] = 2.22; //BT709 2.2 4.5 - my preferred as D.Coffin
- ga[1] = 0.909995;
- ga[2] = 0.090005;
- ga[3] = 0.222222;
- ga[4] = 0.081071;
- } else if (icm.outputGammaPreset == "sRGB_g2.4_s12.92") {
- ga[0] = 2.40; //sRGB 2.4 12.92 - RT default as Lightroom
- ga[1] = 0.947858;
- ga[2] = 0.052142;
- ga[3] = 0.077399;
- ga[4] = 0.039293;
- } else if (icm.outputGammaPreset == "High_g1.3_s3.35") {
- ga[0] = 1.3 ; //for high dynamic images
- ga[1] = 0.998279;
- ga[2] = 0.001721;
- ga[3] = 0.298507;
- ga[4] = 0.005746;
- } else if (icm.outputGammaPreset == "Low_g2.6_s6.9") {
- ga[0] = 2.6 ; //gamma 2.6 variable : for low contrast images
- ga[1] = 0.891161;
- ga[2] = 0.108839;
- ga[3] = 0.144928;
- ga[4] = 0.076332;
- } else if (icm.outputGammaPreset == "standard_g2.2") {
- ga[0] = 2.2; //gamma=2.2(as gamma of Adobe, Widegamut...)
- ga[1] = 1.;
- ga[2] = 0.;
- ga[3] = 1. / eps;
- ga[4] = 0.;
- } else if (icm.outputGammaPreset == "standard_g1.8") {
- ga[0] = 1.8; //gamma=1.8(as gamma of Prophoto)
- ga[1] = 1.;
- ga[2] = 0.;
- ga[3] = 1. / eps;
- ga[4] = 0.;
- } else if (icm.outputGammaPreset == "Lab_g3.0s9.03296") {
- ga[0] = 3.0; //Lab gamma =3 slope=9.03296
- ga[1] = 0.8621;
- ga[2] = 0.1379;
- ga[3] = 0.1107;
- ga[4] = 0.08;
-
- } else { /* if (icm.gamma == "linear_g1.0") */
- ga[0] = 1.0; //gamma=1 linear : for high dynamic images(cf : D.Coffin...)
- ga[1] = 1.;
- ga[2] = 0.;
- ga[3] = 1. / eps;
- ga[4] = 0.;
- }
-
- ga[5] = 0.0;
- ga[6] = 0.0;
- } else { //free gamma selected
- GammaValues g_a; //gamma parameters
- double pwr = 1.0 / icm.workingTRCGamma;
- double ts = icm.workingTRCSlope;
- double slope = icm.workingTRCSlope == 0 ? eps : icm.workingTRCSlope;
-
- int mode = 0;
- Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
- ga[4] = g_a[3] * ts;
- //printf("g_a.gamma0=%f g_a.gamma1=%f g_a.gamma2=%f g_a.gamma3=%f g_a.gamma4=%f\n", g_a.gamma0,g_a.gamma1,g_a.gamma2,g_a.gamma3,g_a.gamma4);
- ga[0] = icm.workingTRCGamma;
- ga[1] = 1. / (1.0 + g_a[4]);
- ga[2] = g_a[4] / (1.0 + g_a[4]);
- ga[3] = 1. / slope;
- ga[5] = 0.0;
- ga[6] = 0.0;
- // printf("ga[0]=%f ga[1]=%f ga[2]=%f ga[3]=%f ga[4]=%f\n", ga[0],ga[1],ga[2],ga[3],ga[4]);
- }
-}
-
// WARNING: the caller must lock lcmsMutex
cmsHPROFILE rtengine::ICCStore::makeStdGammaProfile(cmsHPROFILE iprof)
{
@@ -1247,7 +1155,7 @@ cmsHPROFILE rtengine::ICCStore::createFromMatrix(const double matrix[3][3], bool
pcurve[2] = 1;
// pcurve[3] = 0x1f00000;// pcurve for gamma BT709 : g=2.22 s=4.5
// normalize gamma in RT, default(Emil's choice = sRGB)
- pcurve[3] = 0x2390000;//pcurve for gamma sRGB : g:2.4 s=12.92
+ pcurve[3] = 0x2390000;//pcurve for gamma sRGB : g:2.4 s=12.92310
} else {
// lcms2 up to 2.4 has a bug with linear gamma causing precision loss(banding)
@@ -1311,584 +1219,3 @@ cmsHPROFILE rtengine::ICCStore::createFromMatrix(const double matrix[3][3], bool
delete [] oprof;
return p;
}
-
-cmsHPROFILE rtengine::ICCStore::createGammaProfile(const procparams::ColorManagementParams &icm, GammaValues &ga)
-{
- float p[6]; //primaries
- ga[5] = 0.0;
- ga[6] = 0.0;
-
- enum class ColorTemp {
- D50 = 5003, // for Widegamut, Prophoto Best, Beta -> D50
- D65 = 6504, // for sRGB, AdobeRGB, Bruce Rec2020 -> D65
- D60 = 6005 // for ACES AP0 and ACES AP1
- };
- ColorTemp temp = ColorTemp::D50;
-
- //primaries for 10 working profiles ==> output profiles
- if (icm.outputPimariesPreset == "Widegamut") {
- p[0] = 0.7350; //Widegamut primaries
- p[1] = 0.2650;
- p[2] = 0.1150;
- p[3] = 0.8260;
- p[4] = 0.1570;
- p[5] = 0.0180;
- } else if (icm.outputPimariesPreset == "Adobe") {
- p[0] = 0.6400; //Adobe primaries
- p[1] = 0.3300;
- p[2] = 0.2100;
- p[3] = 0.7100;
- p[4] = 0.1500;
- p[5] = 0.0600;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "sRGB") {
- p[0] = 0.6400; // sRGB primaries
- p[1] = 0.3300;
- p[2] = 0.3000;
- p[3] = 0.6000;
- p[4] = 0.1500;
- p[5] = 0.0600;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "BruceRGB") {
- p[0] = 0.6400; // Bruce primaries
- p[1] = 0.3300;
- p[2] = 0.2800;
- p[3] = 0.6500;
- p[4] = 0.1500;
- p[5] = 0.0600;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "BetaRGB") {
- p[0] = 0.6888; // Beta primaries
- p[1] = 0.3112;
- p[2] = 0.1986;
- p[3] = 0.7551;
- p[4] = 0.1265;
- p[5] = 0.0352;
- } else if (icm.outputPimariesPreset == "BestRGB") {
- p[0] = 0.7347; // Best primaries
- p[1] = 0.2653;
- p[2] = 0.2150;
- p[3] = 0.7750;
- p[4] = 0.1300;
- p[5] = 0.0350;
- } else if (icm.outputPimariesPreset == "Rec2020") {
- p[0] = 0.7080; // Rec2020 primaries
- p[1] = 0.2920;
- p[2] = 0.1700;
- p[3] = 0.7970;
- p[4] = 0.1310;
- p[5] = 0.0460;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "ACES-AP0") {
- p[0] = 0.7347; // ACES AP0 primaries
- p[1] = 0.2653;
- p[2] = 0.0000;
- p[3] = 1.0;
- p[4] = 0.0001;
- p[5] = -0.0770;
- temp = ColorTemp::D60;
- } else if (icm.outputPimariesPreset == "ACES-AP1") {
- p[0] = 0.713; // ACES AP1 primaries
- p[1] = 0.293;
- p[2] = 0.165;
- p[3] = 0.830;
- p[4] = 0.128;
- p[5] = 0.044;
- temp = ColorTemp::D60;
- } else if (icm.outputPimariesPreset == "ProPhoto") {
- p[0] = 0.7347; //ProPhoto and default primaries
- p[1] = 0.2653;
- p[2] = 0.1596;
- p[3] = 0.8404;
- p[4] = 0.0366;
- p[5] = 0.0001;
- } else if (icm.outputPimariesPreset == "pfree") {
- p[0] = icm.redPrimaryX;
- p[1] = icm.redPrimaryY;
- p[2] = icm.greenPrimaryX;
- p[3] = icm.greenPrimaryY;
- p[4] = icm.bluePrimaryX;
- p[5] = icm.bluePrimaryY;
- } else {
- p[0] = 0.7347; //default primaries
- p[1] = 0.2653;
- p[2] = 0.1596;
- p[3] = 0.8404;
- p[4] = 0.0366;
- p[5] = 0.0001;
- }
-
-
- cmsCIExyY xyD;
- cmsCIExyYTRIPLE Primaries = {
- {p[0], p[1], 1.0}, // red
- {p[2], p[3], 1.0}, // green
- {p[4], p[5], 1.0} // blue
- };
- cmsToneCurve* GammaTRC[3];
-
- // 7 parameters for smoother curves
- cmsFloat64Number Parameters[7] = { ga[0], ga[1], ga[2], ga[3], ga[4], ga[5], ga[6] } ;
- /*
- if(icm.wprofile == "v4" && icm.wtemp != "DEF") {
- if(icm.wtemp == "D41") outPr = outPr + "D41";
- else if(icm.wtemp == "D50") outPr = outPr + "D50";
- else if(icm.wtemp == "D55") outPr = outPr + "D55";
- else if(icm.wtemp == "D60") outPr = outPr + "D60";
- else if(icm.wtemp == "D65") outPr = outPr + "D65";
- else if(icm.wtemp == "D80") outPr = outPr + "D80";
-
- }
- */
- //lcmsMutex->lock(); Mutex acquired by the caller
- double tempv4 = 5000.;
-
- if (icm.outputProfileVersion == "v4" && icm.outputIlluminant != "DEF") {
- if (icm.outputIlluminant == "D41") {
- tempv4 = 4100.;
- } else if (icm.outputIlluminant == "D50") {
- tempv4 = 5003.;
- } else if (icm.outputIlluminant == "D55") {
- tempv4 = 5500.;
- } else if (icm.outputIlluminant == "D60") {
- tempv4 = 6004.;
- } else if (icm.outputIlluminant == "D65") {
- tempv4 = 6504.;
- } else if (icm.outputIlluminant == "D80") {
- tempv4 = 8000.;
- } else if (icm.outputIlluminant == "stdA") {
- tempv4 = 5003.;
- }
-
- }
-
- if (icm.outputProfileVersion == "v4" && icm.outputIlluminant != "DEF") {
- cmsWhitePointFromTemp(&xyD, tempv4);
- } else {
- cmsWhitePointFromTemp(&xyD, (double)temp);
- }
-
- if (icm.outputIlluminant == "stdA") xyD = {0.447573, 0.407440, 1.0};
-
- // cmsWhitePointFromTemp(&xyD, (double)temp);
-
- GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, Parameters); //5 = smoother than 4
-
- cmsHPROFILE oprofdef = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC); //oprofdef become Outputprofile
-
- cmsFreeToneCurve(GammaTRC[0]);
-
- //lcmsMutex->unlock();
-
- return oprofdef;
-}
-
-// WARNING: the caller must lock lcmsMutex
-cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams::ColorManagementParams &icm, GammaValues &ga)
-{
- bool pro = false;
- Glib::ustring outProfile;
- cmsHPROFILE outputProfile = nullptr;
- Glib::ustring outPr;
- Glib::ustring gammaStr;
-
-
- if (icm.customOutputProfile && icm.workingTRCGamma < 1.35) {
- pro = true; //select profil with gammaTRC modified :
- } else if (icm.outputGammaPreset == "linear_g1.0" || (icm.outputGammaPreset == "High_g1.3_s3.35")) {
- pro = true; //pro=0 RT_sRGB || Prophoto
- }
-
- //necessary for V2 profile
- if (icm.outputPimariesPreset == "Prophoto" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.prophoto) && !pro) {
- outProfile = options.rtSettings.prophoto;
- outPr = "Large_";
-
- } else if (icm.outputPimariesPreset == "Adobe" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.adobe)) {
- outProfile = options.rtSettings.adobe;
- outPr = "Medium_";
- } else if (icm.outputPimariesPreset == "Widegamut" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.widegamut)) {
- outProfile = options.rtSettings.widegamut;
- outPr = "Wide_";
- } else if (icm.outputPimariesPreset == "BetaRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.beta)) {
- outProfile = options.rtSettings.beta;
- outPr = "Beta_";
- } else if (icm.outputPimariesPreset == "BestRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.best)) {
- outProfile = options.rtSettings.best;
- outPr = "Best_";
- } else if (icm.outputPimariesPreset == "BruceRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.bruce)) {
- outProfile = options.rtSettings.bruce;
- outPr = "Bruce_";
- } else if (icm.outputPimariesPreset == "sRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.srgb) && !pro) {
- outProfile = options.rtSettings.srgb;
- outPr = "sRGB_";
- } else if (icm.outputPimariesPreset == "sRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.srgb10) && pro) {
- outProfile = options.rtSettings.srgb10;
- outPr = "sRGB_";
- } else if (icm.outputPimariesPreset == "ProPhoto" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.prophoto10) && pro) {
- outProfile = options.rtSettings.prophoto10;
- outPr = "Large_";
- } else if (icm.outputPimariesPreset == "Rec2020" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.rec2020)) {
- outProfile = options.rtSettings.rec2020;
- outPr = "Rec2020_";
- } else if (icm.outputPimariesPreset == "ACES-AP0" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESp0)) {
- outProfile = options.rtSettings.ACESp0;
- outPr = "ACES-AP0_";
- } else if (icm.outputPimariesPreset == "ACES-AP1" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESp1)) {
- outProfile = options.rtSettings.ACESp1;
- outPr = "ACES-AP1_";
- } else if (icm.outputPimariesPreset == "pfree") {
- outProfile = options.rtSettings.srgb;
- printf("PFREE\n");
- outPr = "pfree_";
-
- } else {
- // Should not occurs
- if (settings->verbose) {
- printf("\"%s\": unknown working profile! - use LCMS2 substitution\n", icm.workingProfile.c_str());
- }
-
- return nullptr;
- }
-
-
- //begin adaptation rTRC gTRC bTRC
- //"outputProfile" profile has the same characteristics than RGB values, but TRC are adapted... for applying profile
- if (settings->verbose) {
- printf("Output Gamma - profile Primaries as RT profile: \"%s\"\n", outProfile.c_str()); //c_str()
- }
-
- outputProfile = ICCStore::getInstance()->getProfile(outProfile); //get output profile
-
- if (outputProfile == nullptr) {
-
- if (settings->verbose) {
- printf("\"%s\" ICC output profile not found!\n", outProfile.c_str());
- }
-
- return nullptr;
- }
-
- // 7 parameters for smoother curves
- cmsFloat64Number Parameters[7] = { ga[0], ga[1], ga[2], ga[3], ga[4], ga[5], ga[6] };
-
- //change desc Tag , to "free gamma", or "BT709", etc.
- cmsMLU *mlu;
- cmsContext ContextID = cmsGetProfileContextID(outputProfile); // create context to modify some TAGs
- mlu = cmsMLUalloc(ContextID, 1);
- Glib::ustring outPro;
- Glib::ustring outTemp;
- double gammsave = 2.4;
- double slopesave = 12.92;
- if (icm.outputGammaPreset == "High_g1.3_s3.35") {
- gammaStr = "_High_g=1.3_s=3.35";
- gammsave = 1.3;
- slopesave = 3.35;
- } else if (icm.outputGammaPreset == "Low_g2.6_s6.9") {
- gammaStr = "_Low_g=2.6_s=6.9";
- gammsave = 2.6;
- slopesave = 6.9;
- } else if (icm.outputGammaPreset == "sRGB_g2.4_s12.92") {
- gammaStr = "_sRGB_g=2.4_s=12.92";
- gammsave = 2.4;
- slopesave = 12.92;
- } else if (icm.outputGammaPreset == "BT709_g2.2_s4.5") {
- gammaStr = "_BT709_g=2.2_s=4.5";
- gammsave = 2.22;
- slopesave = 4.5;
- } else if (icm.outputGammaPreset == "linear_g1.0") {
- gammaStr = "_Linear_g=1.0";
- gammsave = 1.;
- slopesave = 0.;
- } else if (icm.outputGammaPreset == "standard_g2.2") {
- gammaStr = "_g=2.2";
- gammsave = 2.2;
- slopesave = 0.;
- } else if (icm.outputGammaPreset == "standard_g1.8") {
- gammaStr = "_g=1.8";
- gammsave = 1.8;
- slopesave = 0.;
- } else if (icm.outputGammaPreset == "Lab_g3.0s9.03296") {
- gammaStr = "_LAB_g3.0_s9.03296";
- gammsave = 3.0;
- slopesave = 9.03296;
- }
-
- outTemp = outPr;
-
- if (icm.outputProfileVersion == "v4" && icm.outputIlluminant != "DEF") {
- if (icm.outputIlluminant == "D41") {
- outPr = outPr + "D41";
- } else if (icm.outputIlluminant == "D50") {
- outPr = outPr + "D50";
- } else if (icm.outputIlluminant == "D55") {
- outPr = outPr + "D55";
- } else if (icm.outputIlluminant == "D60") {
- outPr = outPr + "D60";
- } else if (icm.outputIlluminant == "D65") {
- outPr = outPr + "D65";
- } else if (icm.outputIlluminant == "D80") {
- outPr = outPr + "D80";
- } else if (icm.outputIlluminant == "stdA") {
- outPr = outPr + "stdA";
- }
-
- // printf("outpr=%s \n",outPr.c_str());
-
- }
-
- // create description with gamma + slope + primaries
- std::wostringstream gammaWs;
- std::wstring gammaStrICC;
-
- gammaWs.precision(3);
-
- Glib::ustring gammaGS;//to save gamma and slope in a tag
-
- if (icm.outputGammaPreset == "Custom") {
- if (icm.outputProfileVersion == "v4") {
- outPro = "RTv4_" + outPr + std::to_string((float)icm.workingTRCGamma) + " " + std::to_string((float)icm.workingTRCSlope) + ".icc";
- } else if (icm.outputProfileVersion == "v2" || icm.outputProfileVersion == "none") {
- outPro = "RTv2_" + outPr + std::to_string((float)icm.workingTRCGamma) + " " + std::to_string((float)icm.workingTRCSlope) + ".icc";
- }
-
- gammaWs.precision(2);
- gammaWs << outTemp << " g=" << (float)icm.workingTRCGamma << " s=" << (float)icm.workingTRCSlope;
- gammaGS ="g" +std::to_string((double)icm.workingTRCGamma) + "s" + std::to_string((double)icm.workingTRCSlope) + "!";
-
-
- } else {
-
- if (icm.outputProfileVersion == "v4") {
- outPro = "RTv4_" + outPr + gammaStr + ".icc";
-
- } else if (icm.outputProfileVersion == "v2" || icm.outputProfileVersion == "none") {
- outPro = "RTv2_" + outPr + gammaStr + ".icc";
- }
-
- gammaWs << outTemp << gammaStr;
- gammaGS = "g" + std::to_string(gammsave) + "s" + std::to_string(slopesave) + "!";
- }
-
- //write in tag 'dmdd' values of current gamma and slope to retrive after in Output profile
- wchar_t *wGammaGS = (wchar_t*)g_utf8_to_utf16 (gammaGS.c_str(), -1, NULL, NULL, NULL);
- if (!wGammaGS) {
- printf("Error: lab2rgbOut / g_utf8_to_utf16 failed!\n");
- }
-
- cmsMLU *description = cmsMLUalloc(NULL, 1);
- // Language code (3 letters code) : https://www.iso.org/obp/ui/
- // Country code (3 letters code) : http://www.loc.gov/standards/iso639-2/php/code_list.php
- if (cmsMLUsetWide(description, "eng", "USA", wGammaGS)) {
- cmsWriteTag(outputProfile, cmsSigDeviceModelDescTag, description); //save 'dmdd' in description
- } else {
- printf("Error: lab2rgbOut / cmsMLUsetWide failed for \"%s\" !\n", gammaGS.c_str());
- }
- cmsMLUsetWide(mlu, "en", "US", gammaWs.str().c_str());
-
- cmsMLUfree(description);
-
- // instruction with //ICC are used to generate ICC profile
- if (mlu == nullptr) {
- printf("Description error\n");
- } else {
-
- if (icm.outputProfileVersion == "v4") {
- cmsSetProfileVersion(outputProfile, 4.3);
- } else {
- cmsSetProfileVersion(outputProfile, 2.0);
- }
-
-//change
- float p[6]; //primaries
- ga[6] = 0.0;
-
- enum class ColorTemp {
- D50 = 5003, // for Widegamut, Prophoto Best, Beta -> D50
- D65 = 6504, // for sRGB, AdobeRGB, Bruce Rec2020 -> D65
- D60 = 6005 //for ACESc->D60
- };
- ColorTemp temp = ColorTemp::D50;
-
- if (icm.outputPimariesPreset == "Widegamut") {
- p[0] = 0.7350; //Widegamut primaries
- p[1] = 0.2650;
- p[2] = 0.1150;
- p[3] = 0.8260;
- p[4] = 0.1570;
- p[5] = 0.0180;
-
- } else if (icm.outputPimariesPreset == "Adobe") {
- p[0] = 0.6400; //Adobe primaries
- p[1] = 0.3300;
- p[2] = 0.2100;
- p[3] = 0.7100;
- p[4] = 0.1500;
- p[5] = 0.0600;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "sRGB") {
- p[0] = 0.6400; // sRGB primaries
- p[1] = 0.3300;
- p[2] = 0.3000;
- p[3] = 0.6000;
- p[4] = 0.1500;
- p[5] = 0.0600;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "BruceRGB") {
- p[0] = 0.6400; // Bruce primaries
- p[1] = 0.3300;
- p[2] = 0.2800;
- p[3] = 0.6500;
- p[4] = 0.1500;
- p[5] = 0.0600;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "BetaRGB") {
- p[0] = 0.6888; // Beta primaries
- p[1] = 0.3112;
- p[2] = 0.1986;
- p[3] = 0.7551;
- p[4] = 0.1265;
- p[5] = 0.0352;
- } else if (icm.outputPimariesPreset == "BestRGB") {
- p[0] = 0.7347; // Best primaries
- p[1] = 0.2653;
- p[2] = 0.2150;
- p[3] = 0.7750;
- p[4] = 0.1300;
- p[5] = 0.0350;
- } else if (icm.outputPimariesPreset == "Rec2020") {
- p[0] = 0.7080; // Rec2020 primaries
- p[1] = 0.2920;
- p[2] = 0.1700;
- p[3] = 0.7970;
- p[4] = 0.1310;
- p[5] = 0.0460;
- temp = ColorTemp::D65;
- } else if (icm.outputPimariesPreset == "ACES-AP0") {
- p[0] = 0.7347; // ACES P0 primaries
- p[1] = 0.2653;
- p[2] = 0.0000;
- p[3] = 1.0;
- p[4] = 0.0001;
- p[5] = -0.0770;
- temp = ColorTemp::D60;
- } else if (icm.outputPimariesPreset == "ACES-AP1") {
- p[0] = 0.713; // ACES P1 primaries
- p[1] = 0.293;
- p[2] = 0.165;
- p[3] = 0.830;
- p[4] = 0.128;
- p[5] = 0.044;
- temp = ColorTemp::D60;
- } else if (icm.outputPimariesPreset == "ProPhoto") {
- p[0] = 0.7347; // ProPhoto and default primaries
- p[1] = 0.2653;
- p[2] = 0.1596;
- p[3] = 0.8404;
- p[4] = 0.0366;
- p[5] = 0.0001;
- } else if (icm.outputPimariesPreset == "pfree") {
- p[0] = icm.redPrimaryX;
- p[1] = icm.redPrimaryY;
- p[2] = icm.greenPrimaryX;
- p[3] = icm.greenPrimaryY;
- p[4] = icm.bluePrimaryX;
- p[5] = icm.bluePrimaryY;
-
- } else {
- p[0] = 0.7347; //default primaries
- p[1] = 0.2653;
- p[2] = 0.1596;
- p[3] = 0.8404;
- p[4] = 0.0366;
- p[5] = 0.0001;
- }
-
- cmsCIExyY xyD;
- cmsCIExyYTRIPLE Primaries = {
- {p[0], p[1], 1.0}, // red
- {p[2], p[3], 1.0}, // green
- {p[4], p[5], 1.0} // blue
- };
- double tempv4 = 5000.;
-
- if (icm.outputProfileVersion == "v4" && icm.outputIlluminant != "DEF") {
- if (icm.outputIlluminant == "D41") {
- tempv4 = 4100.;
- } else if (icm.outputIlluminant == "D50") {
- tempv4 = 5003.;
- } else if (icm.outputIlluminant == "D55") {
- tempv4 = 5500.;
- } else if (icm.outputIlluminant == "D60") {
- tempv4 = 6004.;
- } else if (icm.outputIlluminant == "D65") {
- tempv4 = 6504.;
- } else if (icm.outputIlluminant == "D80") {
- tempv4 = 8000.;
- } else if (icm.outputIlluminant == "stdA") {
- tempv4 = 5003.;
- }
-
- //printf("tempv4=%f \n", tempv4);
-
- }
-
- if (icm.outputProfileVersion == "v4" && icm.outputIlluminant != "DEF") {
- cmsWhitePointFromTemp(&xyD, tempv4);
- } else {
- cmsWhitePointFromTemp(&xyD, (double)temp);
- }
-
- if (icm.outputIlluminant == "stdA") xyD = {0.447573, 0.407440, 1.0};
-
- cmsToneCurve* GammaTRC[3];
-
-
- // Calculate output profile's rTRC gTRC bTRC
- GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, Parameters);
-
- if (icm.outputProfileVersion == "v4") {
- outputProfile = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC);
- }
-
- cmsWriteTag(outputProfile, cmsSigRedTRCTag, GammaTRC[0]);
- cmsWriteTag(outputProfile, cmsSigGreenTRCTag, GammaTRC[1]);
- cmsWriteTag(outputProfile, cmsSigBlueTRCTag, GammaTRC[2]);
- cmsWriteTag(outputProfile, cmsSigProfileDescriptionTag, mlu);//desc changed
-
- /* //to read XYZ values
- cmsCIEXYZ *redT = static_cast(cmsReadTag(outputProfile, cmsSigRedMatrixColumnTag));
- cmsCIEXYZ *greenT = static_cast(cmsReadTag(outputProfile, cmsSigGreenMatrixColumnTag));
- cmsCIEXYZ *blueT = static_cast(cmsReadTag(outputProfile, cmsSigBlueMatrixColumnTag));
- printf("rx=%f gx=%f bx=%f ry=%f gy=%f by=%f rz=%f gz=%f bz=%f\n", redT->X, greenT->X, blueT->X, redT->Y, greenT->Y, blueT->Y, redT->Z, greenT->Z, blueT->Z);
- */
-
- cmsMLUfree(mlu);
- cmsMLU *copyright = cmsMLUalloc(NULL, 1);
- cmsMLUsetASCII(copyright, "en", "US", "Copyright RawTherapee 2018, CC0");
- cmsWriteTag(outputProfile, cmsSigCopyrightTag, copyright);
- cmsMLUfree(copyright);
- // cmsWriteTag(outputProfile, cmsSigProfileDescriptionTag, mlu);//desc changed
- cmsMLU *MfgDesc;
- MfgDesc = cmsMLUalloc(NULL, 1);
- cmsMLUsetASCII(MfgDesc, "en", "US", "RawTherapee");
- cmsWriteTag(outputProfile, cmsSigDeviceMfgDescTag, MfgDesc);
- cmsMLUfree(MfgDesc);
-
- Glib::ustring realoutPro;
- realoutPro = options.cacheBaseDir + "/" + outPro;//ICC profile in cache
-
-
- if (icm.outputProfileVersion == "v2" || icm.outputProfileVersion == "v4") {
- cmsSaveProfileToFile(outputProfile, realoutPro.c_str());
-
- }
-
- // if (GammaTRC) {
- cmsFreeToneCurve(GammaTRC[0]);
- // }
- }
-
- return outputProfile;
-
-}
diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h
index c23ecd112..6b57fd072 100644
--- a/rtengine/iccstore.h
+++ b/rtengine/iccstore.h
@@ -96,13 +96,9 @@ public:
std::uint8_t getProofIntents(const Glib::ustring& name) const;
/*static*/ std::vector getWorkingProfiles();
- static std::vector getGamma();
- static void getGammaArray(const procparams::ColorManagementParams& icm, GammaValues& ga);
static cmsHPROFILE makeStdGammaProfile(cmsHPROFILE iprof);
static cmsHPROFILE createFromMatrix(const double matrix[3][3], bool gamma = false, const Glib::ustring& name = Glib::ustring());
- static cmsHPROFILE createGammaProfile(const procparams::ColorManagementParams& icm, GammaValues& ga);
- static cmsHPROFILE createCustomGammaOutputProfile(const procparams::ColorManagementParams& icm, GammaValues& ga);
private:
class Implementation;
diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index 3fc450328..8f22f664b 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -93,7 +93,7 @@ ImProcCoordinator::ImProcCoordinator()
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), icmListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr),
+ plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(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)
{}
@@ -495,11 +495,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
int ch = oprevi->getHeight();
// put gamma TRC to 1
Imagefloat* readyImg0 = NULL;
- double ga0, ga1, ga2, ga3, ga4, ga5, ga6;
- int mul = -5;
- double gga = 2.4, ssl = 12.92;
-
- readyImg0 = ipf.workingtrc(oprevi, cw, ch, mul, params.icm.workingProfile, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);
+ readyImg0 = ipf.workingtrc(oprevi, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
@@ -513,9 +509,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
delete readyImg0;
//adjust TRC
Imagefloat* readyImg = NULL;
- gga = params.icm.outputGamma, ssl = params.icm.outputSlope;
- mul = 5;
- readyImg = ipf.workingtrc(oprevi, cw, ch, mul, params.icm.workingProfile, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);
+ readyImg = ipf.workingtrc(oprevi, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h
index 843459f90..aabc9000b 100644
--- a/rtengine/improccoordinator.h
+++ b/rtengine/improccoordinator.h
@@ -158,7 +158,6 @@ protected:
AutoCamListener* acListener;
AutoBWListener* abwListener;
AutoWBListener* awbListener;
- ICMListener* icmListener;
FrameCountListener *frameCountListener;
ImageTypeListener *imageTypeListener;
@@ -323,11 +322,6 @@ public:
{
awbListener = awb;
}
- void setICMListener (ICMListener* icml)
- {
- icmListener = icml;
- }
-
void setAutoColorTonListener (AutoColorTonListener* bwct)
{
actListener = bwct;
diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h
index db3958379..756e8d158 100644
--- a/rtengine/improcfun.h
+++ b/rtengine/improcfun.h
@@ -346,9 +346,9 @@ public:
void shadowsHighlights(LabImage *lab);
Image8* lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool consider_histogram_settings = true);
- Imagefloat* lab2rgbOut(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, GammaValues *ga = nullptr);
+ Imagefloat* lab2rgbOut(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm);
// CieImage *ciec;
- Imagefloat* workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profile, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6);
+ Imagefloat* workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profile, double gampos, double slpos);
bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr);
bool transCoord(int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr);
diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc
index c4d322112..cc36d7451 100644
--- a/rtengine/iplab2rgb.cc
+++ b/rtengine/iplab2rgb.cc
@@ -283,7 +283,7 @@ Image8* ImProcFunctions::lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch,
* If a custom gamma profile can be created, divide by 327.68, convert to xyz and apply the custom gamma transform
* otherwise divide by 327.68, convert to xyz and apply the sRGB transform, before converting with gamma2curve
*/
-Imagefloat* ImProcFunctions::lab2rgbOut(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, GammaValues *ga)
+Imagefloat* ImProcFunctions::lab2rgbOut(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm)
{
if (cx < 0) {
@@ -306,85 +306,75 @@ Imagefloat* ImProcFunctions::lab2rgbOut(LabImage* lab, int cx, int cy, int cw, i
cmsHPROFILE oprof = nullptr;
- if (ga) {
- lcmsMutex->lock();
- ICCStore::getInstance()->getGammaArray(icm, *ga);
- oprof = ICCStore::getInstance()->createGammaProfile(icm, *ga);
- lcmsMutex->unlock();
- } else {
- oprof = ICCStore::getInstance()->getProfile(icm.outputProfile);
- Glib::ustring outtest = icm.outputProfile;
- std::string fileis_RTv2 = outtest.substr(0, 4);
- //printf("IsRTv2=%s\n", fileis_RTv2.c_str());
- if(fileis_RTv2 == "RTv2") {//Only fot ICC v2 : read tag from desc to retrieve gamma and slope save before in generate ICC v2
- //due to bug in LCMS in CmsToneCurve
- //printf("icmout=%s \n",icm.output.c_str());
- GammaValues g_b; //gamma parameters
- GammaValues gb; //gamma parameters
- const double eps = 0.000000001; // not divide by zero
- double gammatag = 2.4;
- double slopetag = 12.92;
- cmsMLU *modelDescMLU = (cmsMLU*) (cmsReadTag(oprof, cmsSigDeviceModelDescTag));
- if (modelDescMLU) {
- cmsUInt32Number count = cmsMLUgetWide(modelDescMLU, "eng", "USA", nullptr, 0); // get buffer length first
- if (count) {
- wchar_t *buffer = new wchar_t[count];
- count = cmsMLUgetWide(modelDescMLU, "eng", "USA", buffer, count); // now put the string in the buffer
- Glib::ustring modelDesc;
+ oprof = ICCStore::getInstance()->getProfile(icm.outputProfile);
+ Glib::ustring outtest = icm.outputProfile;
+ std::string fileis_RTv2 = outtest.substr(0, 4);
+ //printf("IsRTv2=%s\n", fileis_RTv2.c_str());
+ if(fileis_RTv2 == "RTv2") {//Only fot ICC v2 : read tag from desc to retrieve gamma and slope save before in generate ICC v2
+ //due to bug in LCMS in CmsToneCurve
+ //printf("icmout=%s \n",icm.output.c_str());
+ GammaValues g_b; //gamma parameters
+ const double eps = 0.000000001; // not divide by zero
+ double gammatag = 2.4;
+ double slopetag = 12.92310;
+ cmsMLU *modelDescMLU = (cmsMLU*) (cmsReadTag(oprof, cmsSigDeviceModelDescTag));
+ if (modelDescMLU) {
+ cmsUInt32Number count = cmsMLUgetWide(modelDescMLU, "eng", "USA", nullptr, 0); // get buffer length first
+ if (count) {
+ wchar_t *buffer = new wchar_t[count];
+ count = cmsMLUgetWide(modelDescMLU, "eng", "USA", buffer, count); // now put the string in the buffer
+ Glib::ustring modelDesc;
#if __SIZEOF_WCHAR_T__ == 2
- char* cModelDesc = g_utf16_to_utf8((unsigned short int*)buffer, -1, nullptr, nullptr, nullptr); // convert to utf-8 in a buffer allocated by glib
- if (cModelDesc) {
- modelDesc.assign(cModelDesc);
- g_free(cModelDesc);
- }
+ char* cModelDesc = g_utf16_to_utf8((unsigned short int*)buffer, -1, nullptr, nullptr, nullptr); // convert to utf-8 in a buffer allocated by glib
+ if (cModelDesc) {
+ modelDesc.assign(cModelDesc);
+ g_free(cModelDesc);
+ }
#else
- modelDesc = utf32_to_utf8(buffer, count);
+ modelDesc = utf32_to_utf8(buffer, count);
#endif
- delete [] buffer;
- if (!modelDesc.empty()) {
- printf("dmdd=%s\n", modelDesc.c_str());
+ delete [] buffer;
+ if (!modelDesc.empty()) {
+ printf("dmdd=%s\n", modelDesc.c_str());
- std::size_t pos = modelDesc.find("g");
- std::size_t posmid = modelDesc.find("s");
- std::size_t posend = modelDesc.find("!");
- std::string strgamma = modelDesc.substr(pos + 1, (posmid - pos));
- gammatag = std::stod(strgamma.c_str());
- std::string strslope = modelDesc.substr(posmid + 1, (posend - posmid));
- slopetag = std::stod(strslope.c_str());
- // printf("gam=%f slo=%f\n", gammatag, slopetag);
- }
- } else {
- printf("Error: lab2rgbOut / String length is null!\n");
+ std::size_t pos = modelDesc.find("g");
+ std::size_t posmid = modelDesc.find("s");
+ std::size_t posend = modelDesc.find("!");
+ std::string strgamma = modelDesc.substr(pos + 1, (posmid - pos));
+ gammatag = std::stod(strgamma.c_str());
+ std::string strslope = modelDesc.substr(posmid + 1, (posend - posmid));
+ slopetag = std::stod(strslope.c_str());
+ // printf("gam=%f slo=%f\n", gammatag, slopetag);
}
} else {
- printf("Error: lab2rgbOut / cmsReadTag/cmsSigDeviceModelDescTag failed!\n");
+ printf("Error: lab2rgbOut / String length is null!\n");
}
-
- double pwr = 1.0 / gammatag;
- double ts = slopetag;
- double slope = slopetag == 0 ? eps : slopetag;
-
- int mode = 0;
- Color::calcGamma(pwr, ts, mode, g_b); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
- gb[4] = g_b[3] * ts;
- gb[0] = gammatag;
- gb[1] = 1. / (1.0 + g_b[4]);
- gb[2] = g_b[4] / (1.0 + g_b[4]);
- gb[3] = 1. / slope;
- gb[5] = 0.0;
- gb[6] = 0.0;
-
- cmsToneCurve* GammaTRC[3];
- cmsFloat64Number Parameters[7] = { gb[0], gb[1], gb[2], gb[3], gb[4], gb[5], gb[6] } ;
-
- GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, Parameters); //5 = smoother than 4
- cmsWriteTag(oprof, cmsSigRedTRCTag, GammaTRC[0]);
- cmsWriteTag(oprof, cmsSigGreenTRCTag, GammaTRC[1]);
- cmsWriteTag(oprof, cmsSigBlueTRCTag, GammaTRC[2]);
- cmsFreeToneCurve(GammaTRC[0]);
+ } else {
+ printf("Error: lab2rgbOut / cmsReadTag/cmsSigDeviceModelDescTag failed!\n");
}
+ double pwr = 1.0 / gammatag;
+ double ts = slopetag;
+ double slope = slopetag == 0 ? eps : slopetag;
+ int mode = 0;
+ Color::calcGamma(pwr, ts, mode, g_b); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
+ cmsFloat64Number gammaParams[7]; //gamma parameters
+ gammaParams[4] = g_b[3] * ts;
+ gammaParams[0] = gammatag;
+ gammaParams[1] = 1. / (1.0 + g_b[4]);
+ gammaParams[2] = g_b[4] / (1.0 + g_b[4]);
+ gammaParams[3] = 1. / slope;
+ gammaParams[5] = 0.0;
+ gammaParams[6] = 0.0;
+
+ cmsToneCurve* GammaTRC[3];
+
+ GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, gammaParams); //5 = smoother than 4
+ cmsWriteTag(oprof, cmsSigRedTRCTag, GammaTRC[0]);
+ cmsWriteTag(oprof, cmsSigGreenTRCTag, GammaTRC[1]);
+ cmsWriteTag(oprof, cmsSigBlueTRCTag, GammaTRC[2]);
+ cmsFreeToneCurve(GammaTRC[0]);
}
if (oprof) {
@@ -439,7 +429,7 @@ Imagefloat* ImProcFunctions::lab2rgbOut(LabImage* lab, int cx, int cy, int cw, i
}
-Imagefloat* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profile, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6)
+Imagefloat* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profile, double gampos, double slpos)
{
TMatrix wprof;
@@ -474,7 +464,6 @@ Imagefloat* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int
int five = mul;
- ga6 = 0.0;
pwr = 1.0 / gampos;
if (gampos < 1.0) {
@@ -592,15 +581,6 @@ Imagefloat* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int
int mode = 0;
Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
- ga4 = g_a[3] * ts;
- ga0 = gampos;
- ga1 = 1. / (1.0 + g_a[4]);
- ga2 = g_a[4] / (1.0 + g_a[4]);
- ga3 = 1. / slpos;
- ga5 = 0.0;
- ga6 = 0.0;
- // printf("ga0=%f ga1=%f ga2=%f ga3=%f ga4=%f\n", ga0, ga1, ga2, ga3, ga4);
-
cmsCIExyY xyD;
cmsCIExyYTRIPLE Primaries = {
@@ -610,17 +590,19 @@ Imagefloat* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int
};
cmsToneCurve* GammaTRC[3];
- cmsFloat64Number Parameters[7];
- Parameters[0] = ga0;
- Parameters[1] = ga1;
- Parameters[2] = ga2;
- Parameters[3] = ga3;
- Parameters[4] = ga4;
- Parameters[5] = ga5;
- Parameters[6] = ga6;
-// 7 parameters for smoother curves
+ cmsFloat64Number gammaParams[7];
+ gammaParams[4] = g_a[3] * ts;
+ gammaParams[0] = gampos;
+ gammaParams[1] = 1. / (1.0 + g_a[4]);
+ gammaParams[2] = g_a[4] / (1.0 + g_a[4]);
+ gammaParams[3] = 1. / slpos;
+ gammaParams[5] = 0.0;
+ gammaParams[6] = 0.0;
+ // printf("ga0=%f ga1=%f ga2=%f ga3=%f ga4=%f\n", ga0, ga1, ga2, ga3, ga4);
+
+ // 7 parameters for smoother curves
cmsWhitePointFromTemp(&xyD, (double)temp);
- GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, five, Parameters);//5 = more smoother than 4
+ GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, five, gammaParams);//5 = more smoother than 4
oprofdef = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC);
cmsFreeToneCurve(GammaTRC[0]);
}
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index a1c87375a..ac5ce9d3e 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -1960,20 +1960,7 @@ ColorManagementParams::ColorManagementParams() :
workingTRCSlope(12.92310),
outputProfile("RT_sRGB"),
outputIntent(RI_RELATIVE),
- outputBPC(true),
- customOutputProfile(false),
- outputPimariesPreset("sRGB"),
- redPrimaryX(0.6400),
- redPrimaryY(0.3300),
- greenPrimaryX(0.3000),
- greenPrimaryY(0.6000),
- bluePrimaryX(0.1500),
- bluePrimaryY(0.0600),
- outputGammaPreset("Custom"),
- outputGamma(2.4),
- outputSlope(12.92),
- outputProfileVersion("none"),
- outputIlluminant("DEF")
+ outputBPC(true)
{
}
@@ -1992,20 +1979,7 @@ bool ColorManagementParams::operator ==(const ColorManagementParams& other) cons
&& workingTRCSlope == other.workingTRCSlope
&& outputProfile == other.outputProfile
&& outputIntent == other.outputIntent
- && outputBPC == other.outputBPC
- && customOutputProfile == other.customOutputProfile
- && outputPimariesPreset == other.outputPimariesPreset
- && redPrimaryX == other.redPrimaryX
- && redPrimaryY == other.redPrimaryY
- && greenPrimaryX == other.greenPrimaryX
- && greenPrimaryY == other.greenPrimaryY
- && bluePrimaryX == other.bluePrimaryX
- && bluePrimaryY == other.bluePrimaryY
- && outputGammaPreset == other.outputGammaPreset
- && outputGamma == other.outputGamma
- && outputSlope == other.outputSlope
- && outputProfileVersion == other.outputProfileVersion
- && outputIlluminant == other.outputIlluminant;
+ && outputBPC == other.outputBPC;
}
bool ColorManagementParams::operator !=(const ColorManagementParams& other) const
@@ -3197,19 +3171,6 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
keyFile
);
saveToKeyfile(!pedited || pedited->icm.outputBPC, "Color Management", "OutputBPC", icm.outputBPC, keyFile);
- saveToKeyfile(!pedited || pedited->icm.customOutputProfile, "Color Management", "CustomOutputProfile", icm.customOutputProfile, keyFile);
- saveToKeyfile(!pedited || pedited->icm.outputPrimariesPreset, "Color Management", "OutputPimariesPreset", icm.outputPimariesPreset, keyFile);
- saveToKeyfile(!pedited || pedited->icm.redPrimaryX, "Color Management", "RedPrimaryX", icm.redPrimaryX, keyFile);
- saveToKeyfile(!pedited || pedited->icm.redPrimaryY, "Color Management", "RedPrimaryY", icm.redPrimaryY, keyFile);
- saveToKeyfile(!pedited || pedited->icm.greenPrimaryX, "Color Management", "GreenPrimaryX", icm.greenPrimaryX, keyFile);
- saveToKeyfile(!pedited || pedited->icm.greenPrimaryY, "Color Management", "GreenPrimaryY", icm.greenPrimaryY, keyFile);
- saveToKeyfile(!pedited || pedited->icm.bluePrimaryX, "Color Management", "BluePrimaryX", icm.bluePrimaryX, keyFile);
- saveToKeyfile(!pedited || pedited->icm.bluePrimaryY, "Color Management", "BluePrimaryY", icm.bluePrimaryY, keyFile);
- saveToKeyfile(!pedited || pedited->icm.outputGammaPreset, "Color Management", "OutputGammaPreset", icm.outputGammaPreset, keyFile);
- saveToKeyfile(!pedited || pedited->icm.outputGamma, "Color Management", "OutputGamma", icm.outputGamma, keyFile);
- saveToKeyfile(!pedited || pedited->icm.outputSlope, "Color Management", "OutputSlope", icm.outputSlope, keyFile);
- saveToKeyfile(!pedited || pedited->icm.outputProfileVersion, "Color Management", "OutputProfileVersion", icm.outputProfileVersion, keyFile);
- saveToKeyfile(!pedited || pedited->icm.outputIlluminant, "Color Management", "OutputIlluminant", icm.outputIlluminant, keyFile);
// Wavelet
saveToKeyfile(!pedited || pedited->wavelet.enabled, "Wavelet", "Enabled", wavelet.enabled, keyFile);
@@ -4251,20 +4212,6 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
}
}
assignFromKeyfile(keyFile, "Color Management", "OutputBPC", pedited, icm.outputBPC, pedited->icm.outputBPC);
-
- assignFromKeyfile(keyFile, "Color Management", ppVersion < 338 ? "Freegamma" : "CustomOutputProfile", pedited, icm.customOutputProfile, pedited->icm.customOutputProfile);
- assignFromKeyfile(keyFile, "Color Management", "OutputPimariesPreset", pedited, icm.outputPimariesPreset, pedited->icm.outputPrimariesPreset);
- assignFromKeyfile(keyFile, "Color Management", "RedPrimaryX", pedited, icm.redPrimaryX, pedited->icm.redPrimaryX);
- assignFromKeyfile(keyFile, "Color Management", "RedPrimaryY", pedited, icm.redPrimaryY, pedited->icm.redPrimaryY);
- assignFromKeyfile(keyFile, "Color Management", "GreenPrimaryX", pedited, icm.greenPrimaryX, pedited->icm.greenPrimaryX);
- assignFromKeyfile(keyFile, "Color Management", "GreenPrimaryY", pedited, icm.greenPrimaryY, pedited->icm.greenPrimaryY);
- assignFromKeyfile(keyFile, "Color Management", "BluePrimaryX", pedited, icm.bluePrimaryX, pedited->icm.bluePrimaryX);
- assignFromKeyfile(keyFile, "Color Management", "BluePrimaryY", pedited, icm.bluePrimaryY, pedited->icm.bluePrimaryY);
- assignFromKeyfile(keyFile, "Color Management", ppVersion < 338 ? "Gammafree" : "OutputGammaPreset", pedited, icm.outputGammaPreset, pedited->icm.outputGammaPreset);
- assignFromKeyfile(keyFile, "Color Management", ppVersion < 338 ? "GammaValue" : "OutputGamma", pedited, icm.outputGamma, pedited->icm.outputGamma);
- assignFromKeyfile(keyFile, "Color Management", ppVersion < 338 ? "GammaSlope" : "OutputSlope", pedited, icm.outputSlope, pedited->icm.outputSlope);
- assignFromKeyfile(keyFile, "Color Management", "OutputProfileVersion", pedited, icm.outputProfileVersion, pedited->icm.outputProfileVersion);
- assignFromKeyfile(keyFile, "Color Management", "OutputIlluminant", pedited, icm.outputIlluminant, pedited->icm.outputIlluminant);
}
if (keyFile.has_group("Wavelet")) {
diff --git a/rtengine/procparams.h b/rtengine/procparams.h
index 69b80d082..144639b54 100644
--- a/rtengine/procparams.h
+++ b/rtengine/procparams.h
@@ -1025,20 +1025,6 @@ struct ColorManagementParams {
RenderingIntent outputIntent;
bool outputBPC;
- bool customOutputProfile;
- Glib::ustring outputPimariesPreset;
- double redPrimaryX;
- double redPrimaryY;
- double greenPrimaryX;
- double greenPrimaryY;
- double bluePrimaryX;
- double bluePrimaryY;
- Glib::ustring outputGammaPreset;
- double outputGamma;
- double outputSlope;
- Glib::ustring outputProfileVersion;
- Glib::ustring outputIlluminant;
-
static const Glib::ustring NoICMString;
ColorManagementParams();
diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h
index 70244b864..c76c542e3 100644
--- a/rtengine/rtengine.h
+++ b/rtengine/rtengine.h
@@ -351,13 +351,6 @@ public :
virtual void WBChanged (double temp, double green) = 0;
};
-class ICMListener
-{
-public :
- virtual ~ICMListener() = default;
- virtual void TRCChanged (double gamm, double slo) = 0;
-};
-
class FrameCountListener
{
public :
@@ -479,7 +472,6 @@ public:
virtual void setFrameCountListener (FrameCountListener* l) = 0;
virtual void setAutoBWListener (AutoBWListener* l) = 0;
virtual void setAutoWBListener (AutoWBListener* l) = 0;
- virtual void setICMListener (ICMListener* l) = 0;
virtual void setAutoColorTonListener (AutoColorTonListener* l) = 0;
virtual void setAutoChromaListener (AutoChromaListener* l) = 0;
virtual void setRetinexListener (RetinexListener* l) = 0;
diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc
index 5efff5fee..a0875a667 100644
--- a/rtengine/simpleprocess.cc
+++ b/rtengine/simpleprocess.cc
@@ -881,9 +881,7 @@ private:
ipf.lab2rgb (labcbdl, *baseImg, params.icm.workingProfile);
}
-
- //gamma TRC working
- {
+ //gamma TRC working
if (params.icm.workingTRC == "Custom") { //exec TRC IN free
Glib::ustring profile;
profile = params.icm.workingProfile;
@@ -893,11 +891,7 @@ private:
int ch = baseImg->getHeight();
// put gamma TRC to 1
Imagefloat* readyImg0 = NULL;
- double ga0, ga1, ga2, ga3, ga4, ga5, ga6;
- int mul = -5;
- double gga = 2.4, ssl = 12.92;
-
- readyImg0 = ipf.workingtrc(baseImg, cw, ch, mul, params.icm.workingProfile, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);
+ readyImg0 = ipf.workingtrc(baseImg, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
@@ -909,11 +903,10 @@ private:
}
delete readyImg0;
+
//adjust TRC
Imagefloat* readyImg = NULL;
- gga = params.icm.outputGamma, ssl = params.icm.outputSlope;
- mul = 5;
- readyImg = ipf.workingtrc(baseImg, cw, ch, mul, params.icm.workingProfile, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);
+ readyImg = ipf.workingtrc(baseImg, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
@@ -925,12 +918,9 @@ private:
}
delete readyImg;
-
}
}
- }
-
-
+
// RGB processing
curve1 (65536);
@@ -1260,30 +1250,16 @@ private:
bool useLCMS = false;
bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled && !autili && !butili ;
- if (params.icm.customOutputProfile /*!= "Custom" || params.icm.customOutputProfile*/) {
+ ///////////// Custom output gamma has been removed, the user now has to create
+ ///////////// a new output profile with the ICCProfileCreator
- GammaValues ga;
- // if(params.blackwhite.enabled) params.toneCurve.hrenabled=false;
- readyImg = ipf.lab2rgbOut (labView, cx, cy, cw, ch, params.icm, &ga);
- customGamma = true;
+ // if Default gamma mode: we use the profile selected in the "Output profile" combobox;
+ // gamma come from the selected profile, otherwise it comes from "Free gamma" tool
- //or selected Free gamma
- useLCMS = false;
+ readyImg = ipf.lab2rgbOut (labView, cx, cy, cw, ch, params.icm);
- if ((jprof = ICCStore::getInstance()->createCustomGammaOutputProfile (params.icm, ga)) == nullptr) {
-
- useLCMS = true;
- }
-
- } else {
- // if Default gamma mode: we use the profile selected in the "Output profile" combobox;
- // gamma come from the selected profile, otherwise it comes from "Free gamma" tool
-
- readyImg = ipf.lab2rgbOut (labView, cx, cy, cw, ch, params.icm);
-
- if (settings->verbose) {
- printf ("Output profile_: \"%s\"\n", params.icm.outputProfile.c_str());
- }
+ if (settings->verbose) {
+ printf ("Output profile_: \"%s\"\n", params.icm.outputProfile.c_str());
}
delete labView;
diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt
index c39ed004c..70867b1b2 100644
--- a/rtgui/CMakeLists.txt
+++ b/rtgui/CMakeLists.txt
@@ -71,6 +71,7 @@ set(NONCLISOURCEFILES
histogrampanel.cc
history.cc
hsvequalizer.cc
+ iccprofilecreator.cc
icmpanel.cc
ilabel.cc
imagearea.cc
diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h
index 15c6ba078..54f7a6bdd 100644
--- a/rtgui/addsetids.h
+++ b/rtgui/addsetids.h
@@ -50,8 +50,6 @@ enum {
ADDSET_SHARPENMICRO_UNIFORMITY,
ADDSET_VIBRANCE_PASTELS,
ADDSET_VIBRANCE_SATURATED,
- ADDSET_FREE_OUPUT_GAMMA,
- ADDSET_FREE_OUTPUT_SLOPE,
ADDSET_CAT_DEGREE,
ADDSET_CAT_ADAPTSCENE,
ADDSET_CAT_ADAPTVIEWING,
diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc
index 0f9f9f06b..12435ea6b 100644
--- a/rtgui/batchtoolpanelcoord.cc
+++ b/rtgui/batchtoolpanelcoord.cc
@@ -150,7 +150,6 @@ void BatchToolPanelCoordinator::initSession ()
prsharpening->setAdjusterBehavior (false, false, false, false, false, false, false);
sharpenEdge->setAdjusterBehavior (false, false);
sharpenMicro->setAdjusterBehavior (false, false, false);
- icm->setAdjusterBehavior (false, false);
epd->setAdjusterBehavior (false, false, false, false, false);
fattal->setAdjusterBehavior (false, false, false);
@@ -199,7 +198,6 @@ void BatchToolPanelCoordinator::initSession ()
sharpenEdge->setAdjusterBehavior (options.baBehav[ADDSET_SHARPENEDGE_AMOUNT], options.baBehav[ADDSET_SHARPENEDGE_PASS]);
sharpenMicro->setAdjusterBehavior (options.baBehav[ADDSET_SHARPENMICRO_AMOUNT], options.baBehav[ADDSET_SHARPENMICRO_CONTRAST], options.baBehav[ADDSET_SHARPENMICRO_UNIFORMITY]);
- icm->setAdjusterBehavior (options.baBehav[ADDSET_FREE_OUPUT_GAMMA], options.baBehav[ADDSET_FREE_OUTPUT_SLOPE]);
// colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRPROTECT], options.baBehav[ADDSET_COLORTONING_BALANCE]);
colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRENGTH], options.baBehav[ADDSET_COLORTONING_BALANCE]);
filmSimulation->setAdjusterBehavior(options.baBehav[ADDSET_FILMSIMULATION_STRENGTH]);
@@ -278,8 +276,6 @@ void BatchToolPanelCoordinator::initSession ()
if (options.baBehav[ADDSET_CAT_CONTRAST]) { pparams.colorappearance.contrast = 0; }
if (options.baBehav[ADDSET_CAT_CONTRAST_Q]) { pparams.colorappearance.qcontrast = 0; }
if (options.baBehav[ADDSET_CAT_HUE]) { pparams.colorappearance.colorh = 0; }
- if (options.baBehav[ADDSET_FREE_OUPUT_GAMMA]) { pparams.icm.workingTRCGamma = 0; }
- if (options.baBehav[ADDSET_FREE_OUTPUT_SLOPE]) { pparams.icm.workingTRCSlope = 0; }
//if (options.baBehav[ADDSET_CBOOST_AMOUNT]) pparams.colorBoost.amount = 0;
//if (options.baBehav[ADDSET_CS_BLUEYELLOW]) pparams.colorShift.a = 0;
//if (options.baBehav[ADDSET_CS_GREENMAGENTA]) pparams.colorShift.b = 0;
diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc
index 53aa06003..f07abf6fb 100644
--- a/rtgui/filecatalog.cc
+++ b/rtgui/filecatalog.cc
@@ -1185,7 +1185,6 @@ void FileCatalog::developRequested (std::vector tbe, bool fas
params.icm.outputProfile = options.fastexport_icm_output_profile;
params.icm.outputIntent = options.fastexport_icm_outputIntent;
params.icm.outputBPC = options.fastexport_icm_outputBPC;
- params.icm.outputGammaPreset = options.fastexport_icm_custom_output_profile;
}
if (params.resize.enabled) {
diff --git a/rtgui/iccprofilecreator.cc b/rtgui/iccprofilecreator.cc
new file mode 100644
index 000000000..ad864482b
--- /dev/null
+++ b/rtgui/iccprofilecreator.cc
@@ -0,0 +1,904 @@
+/*
+ * This file is part of RawTherapee.
+ *
+ * Copyright (c) 2018 Jacques DESMIS
+ * Copyright (c) 2018 Jean-Christophe FRISCH
+ *
+ * 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 .
+ */
+#include
+#include "iccprofilecreator.h"
+#include "multilangmgr.h"
+#include "cachemanager.h"
+#include "addsetids.h"
+#include "../rtengine/icons.h"
+#include "../rtengine/color.h"
+#include "rtimage.h"
+#ifdef _OPENMP
+#include
+#endif
+
+extern Options options;
+
+namespace rtengine
+{
+
+extern const Settings* settings;
+
+}
+
+const char* sTRCPreset[] = {"BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linear_g1.0", "standard_g2.2", "standard_g1.8", "High_g1.3_s3.35", "Low_g2.6_s6.9", "Lab_g3.0s9.03296"}; //gamma free
+
+ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow)
+ : Gtk::Dialog (M ("MAIN_BUTTON_ICCPROFCREATOR"), *rtwindow, true)
+ , primariesPreset(options.ICCPC_primariesPreset)
+ , redPrimaryX(options.ICCPC_redPrimaryX)
+ , redPrimaryY(options.ICCPC_redPrimaryY)
+ , greenPrimaryX(options.ICCPC_greenPrimaryX)
+ , greenPrimaryY(options.ICCPC_greenPrimaryY)
+ , bluePrimaryX(options.ICCPC_bluePrimaryX)
+ , bluePrimaryY(options.ICCPC_bluePrimaryY)
+ , gammaPreset(options.ICCPC_gammaPreset)
+ , gamma(options.ICCPC_gamma)
+ , slope(options.ICCPC_slope)
+ , profileVersion(options.ICCPC_profileVersion)
+ , illuminant(options.ICCPC_illuminant)
+ , parent(rtwindow)
+{
+
+ set_default_size(600, -1);
+
+ Gtk::Grid* mainGrid = Gtk::manage(new Gtk::Grid());
+
+ //--------------------------------- primaries
+
+ Gtk::Label* prilab = Gtk::manage(new Gtk::Label(M("ICCPROFCREATOR_PRIMARIES")));
+ setExpandAlignProperties(prilab, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);
+ mainGrid->attach(*prilab, 0, 0, 1, 1);
+
+ primaries = Gtk::manage(new MyComboBoxText());
+ setExpandAlignProperties(primaries, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
+ primaries->append(M("ICCPROFCREATOR_PRIM_ACESP0"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_ACESP1"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_ADOBE"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_PROPH"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_REC2020"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_SRGB"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_WIDEG"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_BEST"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_BETA"));
+ primaries->append(M("ICCPROFCREATOR_PRIM_BRUCE"));
+ primaries->append(M("ICCPROFCREATOR_CUSTOM"));
+ primaries->set_tooltip_text(M("ICCPROFCREATOR_PRIM_TOOLTIP"));
+ mainGrid->attach(*primaries, 1, 0, 1, 1);
+
+ primariesGrid = Gtk::manage(new Gtk::Grid());
+ setExpandAlignProperties(primariesGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
+ primariesGrid->set_column_spacing(5);
+
+ /*
+ Gtk::Image* gamuts0 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
+ Gtk::Image* gamutl0 = Gtk::manage(new RTImage("rt-logo-small.png"));
+ Gtk::Image* gamuts1 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
+ Gtk::Image* gamutl1 = Gtk::manage(new RTImage("rt-logo-small.png"));
+ Gtk::Image* gamuts2 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
+ Gtk::Image* gamutl2 = Gtk::manage(new RTImage("rt-logo-small.png"));
+ Gtk::Image* gamuts3 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
+ Gtk::Image* gamutl3 = Gtk::manage(new RTImage("rt-logo-small.png"));
+ Gtk::Image* gamuts4 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
+ Gtk::Image* gamutl4 = Gtk::manage(new RTImage("rt-logo-small.png"));
+ Gtk::Image* gamuts5 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
+ Gtk::Image* gamutl5 = Gtk::manage(new RTImage("rt-logo-small.png"));
+ */
+
+ aPrimariesRedX = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_REDX"), 0.6300, 0.7350, 0.0001, 0.6400/*, gamuts0, gamutl0*/));
+ setExpandAlignProperties(aPrimariesRedX, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
+ aPrimariesRedY = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_REDY"), 0.2650, 0.3350, 0.0001, 0.3300/*, gamutl1, gamuts1*/));
+ setExpandAlignProperties(aPrimariesRedY, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
+ aPrimariesGreenX = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_GREX"), 0.0000, 0.3100, 0.0001, 0.3000/*, gamutl2, gamuts2*/));
+ setExpandAlignProperties(aPrimariesGreenX, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
+ aPrimariesGreenY = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_GREY"), 0.5900, 1.0000, 0.0001, 0.6000/*, gamuts3, gamutl3*/));
+ setExpandAlignProperties(aPrimariesGreenY, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
+ aPrimariesBlueX = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_BLUX"), 0.0001, 0.1600, 0.0001, 0.1500/*, gamutl4, gamuts4*/));
+ setExpandAlignProperties(aPrimariesBlueX, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
+ aPrimariesBlueY = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_BLUY"), -0.0700, 0.0700, 0.0001, 0.060/*, gamutl5, gamuts5*/));
+ setExpandAlignProperties(aPrimariesBlueY, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
+
+ primariesGrid->attach(*aPrimariesRedX, 0, 0, 1, 1);
+ primariesGrid->attach(*aPrimariesRedY, 1, 0, 1, 1);
+
+ primariesGrid->attach(*aPrimariesGreenX, 0, 1, 1, 1);
+ primariesGrid->attach(*aPrimariesGreenY, 1, 1, 1, 1);
+
+ primariesGrid->attach(*aPrimariesBlueX, 0, 2, 1, 1);
+ primariesGrid->attach(*aPrimariesBlueY, 1, 2, 1, 1);
+
+ mainGrid->attach(*primariesGrid, 1, 1, 1, 1);
+
+ //--------------------------------- output gamma
+
+ Gtk::Label* galab = Gtk::manage(new Gtk::Label(M("ICCPROFCREATOR_TRC_PRESET")));
+ setExpandAlignProperties(galab, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);
+ mainGrid->attach(*galab, 0, 2, 1, 1);
+
+ trcPresets = Gtk::manage(new MyComboBoxText());
+ setExpandAlignProperties(trcPresets, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
+ std::vector outputTRCPresets;
+ outputTRCPresets.push_back(M("ICCPROFCREATOR_CUSTOM"));
+ for (unsigned int i = 0; i < sizeof(sTRCPreset) / sizeof(sTRCPreset[0]); i++) {
+ outputTRCPresets.push_back(sTRCPreset[i]);
+ }
+ for (size_t i = 0; i < outputTRCPresets.size(); i++) {
+ trcPresets->append(outputTRCPresets[i]);
+ }
+ mainGrid->attach(*trcPresets, 1, 2, 1, 1);
+
+ //--------------------------------- sliders gampos and slpos
+
+ aGamma = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_GAMMA"), 1, 3.5, 0.01, 2.4));
+ setExpandAlignProperties(aGamma, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
+
+ if (aGamma->delay < options.adjusterMaxDelay) {
+ aGamma->delay = options.adjusterMaxDelay;
+ }
+ aGamma->show();
+ mainGrid->attach(*aGamma, 1, 3, 1, 1); //gamma
+
+ aSlope = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_SLOPE"), 0, 15, 0.00001, 12.92310));
+ setExpandAlignProperties(aSlope, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
+
+ if (aSlope->delay < options.adjusterMaxDelay) {
+ aSlope->delay = options.adjusterMaxDelay;
+ }
+ aSlope->show();
+ mainGrid->attach(*aSlope, 1, 4, 1, 1); //slope
+
+ //--------------------------------- temperature
+
+ Gtk::Label* illlab = Gtk::manage(new Gtk::Label(M("ICCPROFCREATOR_ILL")));
+ setExpandAlignProperties(illlab, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);
+ mainGrid->attach(*illlab, 0, 5, 1, 1); //slope
+ cIlluminant = Gtk::manage(new MyComboBoxText());
+ setExpandAlignProperties(cIlluminant, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_DEF"));
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_41"));
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_50"));
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_55"));
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_60"));
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_65"));
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_80"));
+ cIlluminant->append(M("ICCPROFCREATOR_ILL_INC"));
+ cIlluminant->set_tooltip_text(M("ICCPROFCREATOR_ILL_TOOLTIP"));
+ mainGrid->attach(*cIlluminant, 1, 5, 1, 1);
+
+ //--------------------------------- V2 or V4 profiles
+
+ Gtk::Label* proflab = Gtk::manage(new Gtk::Label(M("ICCPROFCREATOR_ICCVERSION")));
+ setExpandAlignProperties(proflab, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);
+ mainGrid->attach(*proflab, 0, 6, 1, 1);
+ iccVersion = Gtk::manage(new MyComboBoxText());
+ setExpandAlignProperties(iccVersion, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
+ iccVersion->append(M("ICCPROFCREATOR_PROF_V4"));
+ iccVersion->append(M("ICCPROFCREATOR_PROF_V2"));
+ mainGrid->attach(*iccVersion, 1, 6, 1, 1);
+
+ //--------------------------------- Adding the mainGrid
+
+ get_content_area()->add(*mainGrid);
+
+ //--------------------------------- Setting default values for Adjusters
+
+ aGamma->setDefault(options.ICCPC_gamma);
+ aSlope->setDefault(options.ICCPC_slope);
+ aPrimariesRedX->setDefault(options.ICCPC_redPrimaryX);
+ aPrimariesRedY->setDefault(options.ICCPC_redPrimaryY);
+ aPrimariesGreenX->setDefault(options.ICCPC_greenPrimaryX);
+ aPrimariesGreenY->setDefault(options.ICCPC_greenPrimaryY);
+ aPrimariesBlueX->setDefault(options.ICCPC_bluePrimaryX);
+ aPrimariesBlueY->setDefault(options.ICCPC_bluePrimaryY);
+
+ //--------------- Updating widgets with actual values (from options)
+
+ if (primariesPreset == "ACES-AP0") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_ACESP0"));
+ } else if (primariesPreset == "ACES-AP1") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_ACESP1"));
+ } else if (primariesPreset == "Adobe") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_ADOBE"));
+ } else if (primariesPreset == "ProPhoto") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_PROPH"));
+ } else if (primariesPreset == "Rec2020") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_REC2020"));
+ } else if (primariesPreset == "sRGB") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_SRGB"));
+ } else if (primariesPreset == "Widegamut") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_WIDEG"));
+ } else if (primariesPreset == "BestRGB") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_BEST"));
+ } else if (primariesPreset == "BetaRGB") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_BETA"));
+ } else if (primariesPreset == "BruceRGB") {
+ primaries->set_active_text(M("ICCPROFCREATOR_PRIM_BRUCE"));
+ } else if (primariesPreset == "custom") {
+ primaries->set_active_text(M("ICCPROFCREATOR_CUSTOM"));
+ }
+
+ trcPresets->set_active(0);
+ if (gammaPreset != "Custom") {
+ trcPresets->set_active_text(gammaPreset);
+ }
+
+ aGamma->setValue(options.ICCPC_gamma);
+ aSlope->setValue(options.ICCPC_slope);
+ aPrimariesRedX->setValue(redPrimaryX);
+ aPrimariesRedY->setValue(redPrimaryY);
+ aPrimariesGreenX->setValue(greenPrimaryX);
+ aPrimariesGreenY->setValue(greenPrimaryY);
+ aPrimariesBlueX->setValue(bluePrimaryX);
+ aPrimariesBlueY->setValue(bluePrimaryY);
+
+ if (illuminant == "DEF") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_DEF"));
+ } else if (illuminant == "D41") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_41"));
+ } else if (illuminant == "D50") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_50"));
+ } else if (illuminant == "D55") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_55"));
+ } else if (illuminant == "D60") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_60"));
+ } else if (illuminant == "D65") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_65"));
+ } else if (illuminant == "D80") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_80"));
+ } else if (illuminant == "stdA") {
+ cIlluminant->set_active_text(M("ICCPROFCREATOR_ILL_INC"));
+ }
+
+ iccVersion->set_active(0);
+ if (profileVersion == "v2") {
+ iccVersion->set_active(1);
+ }
+
+ trcPresetsChanged();
+ illuminantChanged();
+ primariesChanged();
+
+ //--------------- Action area button
+
+ Gtk::Button* save = Gtk::manage (new Gtk::Button (M ("GENERAL_SAVE_AS")));
+ save->signal_clicked().connect ( sigc::mem_fun (*this, &ICCProfileCreator::savePressed) );
+ get_action_area()->pack_start (*save);
+
+ Gtk::Button* close = Gtk::manage (new Gtk::Button (M ("GENERAL_CLOSE")));
+ close->signal_clicked().connect ( sigc::mem_fun (*this, &ICCProfileCreator::closePressed) );
+ get_action_area()->pack_start (*close);
+
+ //--------------- Show childrens
+
+ show_all_children ();
+
+ //--------------- Connecting the signals
+
+ aPrimariesRedX->setAdjusterListener(this);
+ aPrimariesRedY->setAdjusterListener(this);
+ aPrimariesGreenX->setAdjusterListener(this);
+ aPrimariesGreenY->setAdjusterListener(this);
+ aPrimariesBlueX->setAdjusterListener(this);
+ aPrimariesBlueY->setAdjusterListener(this);
+ aGamma->setAdjusterListener(this);
+ aSlope->setAdjusterListener(this);
+ primariesconn = primaries->signal_changed().connect(sigc::mem_fun(*this, &ICCProfileCreator::primariesChanged));
+ trcpresetsconn = trcPresets->signal_changed().connect(sigc::mem_fun(*this, &ICCProfileCreator::trcPresetsChanged));
+ illconn = cIlluminant->signal_changed().connect(sigc::mem_fun(*this, &ICCProfileCreator::illuminantChanged));
+}
+
+void ICCProfileCreator::closePressed()
+{
+ storeValues();
+ hide();
+}
+
+void ICCProfileCreator::updateICCVersion()
+{
+ if (cIlluminant->get_active_text() != M("ICCPROFCREATOR_ILL_DEF") || primaries->get_active_text() == M("ICCPROFCREATOR_CUSTOM")) {
+ iccVersion->set_active_text(M("ICCPROFCREATOR_PROF_V4"));
+ iccVersion->set_sensitive(false);
+ } else {
+ iccVersion->set_sensitive(true);
+ }
+}
+
+void ICCProfileCreator::primariesChanged()
+{
+ if (primaries->get_active_text() == M("ICCPROFCREATOR_CUSTOM")) {
+ primariesGrid->set_sensitive(true);
+ } else {
+ primariesGrid->set_sensitive(false);
+ }
+ updateICCVersion();
+}
+
+void ICCProfileCreator::illuminantChanged()
+{
+ updateICCVersion();
+}
+
+void ICCProfileCreator::trcPresetsChanged()
+{
+ aGamma->block(true);
+ aSlope->block(true);
+
+ bool sensitive = trcPresets->get_active_row_number() == 0;
+ aGamma->set_sensitive(sensitive);
+ aSlope->set_sensitive(sensitive);
+
+ aGamma->block(false);
+ aSlope->block(false);
+}
+
+void ICCProfileCreator::storeValues()
+{
+ if (iccVersion->get_active_text() == M("ICCPROFCREATOR_PROF_V4")) {
+ options.ICCPC_profileVersion = profileVersion = "v4";
+ } else if (iccVersion->get_active_text() == M("ICCPROFCREATOR_PROF_V2")) {
+ options.ICCPC_profileVersion = profileVersion = "v2";
+ }
+
+ options.ICCPC_gammaPreset = gammaPreset = trcPresets->get_active_text();
+ if (gammaPreset == M("ICCPROFCREATOR_CUSTOM")) {
+ options.ICCPC_gammaPreset = gammaPreset = "Custom";
+ }
+
+ if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_DEF")) {
+ options.ICCPC_illuminant = illuminant = "DEF";
+ } else if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_41")) {
+ options.ICCPC_illuminant = illuminant = "D41";
+ } else if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_50")) {
+ options.ICCPC_illuminant = illuminant = "D50";
+ } else if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_55")) {
+ options.ICCPC_illuminant = illuminant = "D55";
+ } else if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_60")) {
+ options.ICCPC_illuminant = illuminant = "D60";
+ } else if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_65")) {
+ options.ICCPC_illuminant = illuminant = "D65";
+ } else if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_80")) {
+ options.ICCPC_illuminant = illuminant = "D80";
+ } else if (cIlluminant->get_active_text() == M("ICCPROFCREATOR_ILL_INC")) {
+ options.ICCPC_illuminant = illuminant = "stdA";
+ }
+
+ if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_ACESP0")) {
+ options.ICCPC_primariesPreset = primariesPreset = "ACES-AP0";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_ACESP1")) {
+ options.ICCPC_primariesPreset = primariesPreset = "ACES-AP1";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_ADOBE")) {
+ options.ICCPC_primariesPreset = primariesPreset = "Adobe";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_PROPH")) {
+ options.ICCPC_primariesPreset = primariesPreset = "ProPhoto";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_REC2020")) {
+ options.ICCPC_primariesPreset = primariesPreset = "Rec2020";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_SRGB")) {
+ options.ICCPC_primariesPreset = primariesPreset = "sRGB";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_WIDEG")) {
+ options.ICCPC_primariesPreset = primariesPreset = "Widegamut";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_BEST")) {
+ options.ICCPC_primariesPreset = primariesPreset = "BestRGB";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_BETA")) {
+ options.ICCPC_primariesPreset = primariesPreset = "BetaRGB";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_PRIM_BRUCE")) {
+ options.ICCPC_primariesPreset = primariesPreset = "BruceRGB";
+ } else if (primaries->get_active_text() == M("ICCPROFCREATOR_CUSTOM")) {
+ options.ICCPC_primariesPreset = primariesPreset = "custom";
+ }
+
+ options.ICCPC_gamma = gamma = aGamma->getValue();
+ options.ICCPC_slope = slope = aSlope->getValue();
+ options.ICCPC_redPrimaryX = redPrimaryX = aPrimariesRedX->getValue();
+ options.ICCPC_redPrimaryY = redPrimaryY = aPrimariesRedY->getValue();
+ options.ICCPC_greenPrimaryX = greenPrimaryX = aPrimariesGreenX->getValue();
+ options.ICCPC_greenPrimaryY = greenPrimaryY = aPrimariesGreenY->getValue();
+ options.ICCPC_bluePrimaryX = bluePrimaryX = aPrimariesBlueX->getValue();
+ options.ICCPC_bluePrimaryY = bluePrimaryY = aPrimariesBlueY->getValue();
+
+}
+
+// Copyright (c) 2018 Jacques DESMIS
+// WARNING: the caller must lock lcmsMutex
+void ICCProfileCreator::savePressed()
+{
+ bool pro = false;
+ cmsHPROFILE newProfile = nullptr;
+ Glib::ustring sNewProfile;
+ Glib::ustring sPrimariesPreset;
+ Glib::ustring sGammaPreset;
+
+ storeValues();
+
+ // -------------------------------------------- Compute de default file name
+
+ if (gammaPreset == "linear_g1.0" || (gammaPreset == "High_g1.3_s3.35")) {
+ pro = true; //pro=0 RT_sRGB || Prophoto
+ }
+
+ //necessary for V2 profile
+ if (primariesPreset == "ACES-AP0" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESp0)) {
+ sNewProfile = options.rtSettings.ACESp0;
+ sPrimariesPreset = "ACES-AP0_";
+ } else if (primariesPreset == "ACES-AP1" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESp1)) {
+ sNewProfile = options.rtSettings.ACESp1;
+ sPrimariesPreset = "ACES-AP1_";
+ } else if (primariesPreset == "Adobe" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.adobe)) {
+ sNewProfile = options.rtSettings.adobe;
+ sPrimariesPreset = "Medium_";
+ } else if (primariesPreset == "ProPhoto" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.prophoto) && !pro) {
+ sNewProfile = options.rtSettings.prophoto;
+ sPrimariesPreset = "Large_";
+ } else if (primariesPreset == "ProPhoto" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.prophoto10) && pro) {
+ sNewProfile = options.rtSettings.prophoto10;
+ sPrimariesPreset = "Large_";
+ } else if (primariesPreset == "Rec2020" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.rec2020)) {
+ sNewProfile = options.rtSettings.rec2020;
+ sPrimariesPreset = "Rec2020_";
+ } else if (primariesPreset == "sRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.srgb) && !pro) {
+ sNewProfile = options.rtSettings.srgb;
+ sPrimariesPreset = "sRGB_";
+ } else if (primariesPreset == "sRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.srgb10) && pro) {
+ sNewProfile = options.rtSettings.srgb10;
+ sPrimariesPreset = "sRGB_";
+ } else if (primariesPreset == "Widegamut" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.widegamut)) {
+ sNewProfile = options.rtSettings.widegamut;
+ sPrimariesPreset = "Wide_";
+ } else if (primariesPreset == "BestRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.best)) {
+ sNewProfile = options.rtSettings.best;
+ sPrimariesPreset = "Best_";
+ } else if (primariesPreset == "BetaRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.beta)) {
+ sNewProfile = options.rtSettings.beta;
+ sPrimariesPreset = "Beta_";
+ } else if (primariesPreset == "BruceRGB" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.bruce)) {
+ sNewProfile = options.rtSettings.bruce;
+ sPrimariesPreset = "Bruce_";
+ } else if (primariesPreset == "custom") {
+ sNewProfile = options.rtSettings.srgb;
+ sPrimariesPreset = "Custom_";
+ } else {
+ // Should not occurs
+ if (rtengine::settings->verbose) {
+ printf("\"%s\": unknown working profile! - use LCMS2 substitution\n", primariesPreset.c_str());
+ }
+ return;
+ }
+
+ //begin adaptation rTRC gTRC bTRC
+ //"newProfile" profile has the same characteristics than RGB values, but TRC are adapted... for applying profile
+ if (rtengine::settings->verbose) {
+ printf("Output Gamma - profile Primaries as RT profile: \"%s\"\n", sNewProfile.c_str());
+ }
+
+ newProfile = rtengine::ICCStore::getInstance()->getProfile(sNewProfile); //get output profile
+
+ if (newProfile == nullptr) {
+
+ if (rtengine::settings->verbose) {
+ printf("\"%s\" ICC output profile not found!\n", sNewProfile.c_str());
+ }
+ return;
+ }
+
+ // 7 parameters for smoother curves
+ cmsFloat64Number Parameters[7] = { ga[0], ga[1], ga[2], ga[3], ga[4], ga[5], ga[6] };
+
+ //change desc Tag , to "free gamma", or "BT709", etc.
+ Glib::ustring fName;
+ Glib::ustring sPrimariesAndIlluminant;
+ double presetGamma = 2.4;
+ double presetSlope = 12.92310;
+ const double eps = 0.000000001; // not divide by zero
+ if (gammaPreset == "High_g1.3_s3.35") {
+ sGammaPreset = "_High_g=1.3_s=3.35";
+ presetGamma = 1.3;
+ presetSlope = 3.35;
+ ga[0] = 1.3 ; //for high dynamic images
+ ga[1] = 0.998279;
+ ga[2] = 0.001721;
+ ga[3] = 0.298507;
+ ga[4] = 0.005746;
+ } else if (gammaPreset == "Low_g2.6_s6.9") {
+ sGammaPreset = "_Low_g=2.6_s=6.9";
+ presetGamma = 2.6;
+ presetSlope = 6.9;
+ ga[0] = 2.6 ; //gamma 2.6 variable : for low contrast images
+ ga[1] = 0.891161;
+ ga[2] = 0.108839;
+ ga[3] = 0.144928;
+ ga[4] = 0.076332;
+ } else if (gammaPreset == "sRGB_g2.4_s12.92") {
+ sGammaPreset = "_sRGB_g=2.4_s=12.92310";
+ presetGamma = 2.4;
+ presetSlope = 12.92310;
+ ga[0] = 2.40; //sRGB 2.4 12.92 - RT default as Lightroom
+ ga[1] = 0.947858;
+ ga[2] = 0.052142;
+ ga[3] = 0.077399;
+ ga[4] = 0.039293;
+ } else if (gammaPreset == "BT709_g2.2_s4.5") {
+ sGammaPreset = "_BT709_g=2.2_s=4.5";
+ presetGamma = 2.22;
+ presetSlope = 4.5;
+ ga[0] = 2.22; //BT709 2.2 4.5 - my preferred as D.Coffin
+ ga[1] = 0.909995;
+ ga[2] = 0.090005;
+ ga[3] = 0.222222;
+ ga[4] = 0.081071;
+ } else if (gammaPreset == "linear_g1.0") {
+ sGammaPreset = "_Linear_g=1.0";
+ presetGamma = 1.;
+ presetSlope = 0.;
+ ga[0] = 1.0; //gamma=1 linear : for high dynamic images (cf D.Coffin...)
+ ga[1] = 1.;
+ ga[2] = 0.;
+ ga[3] = 1. / eps;
+ ga[4] = 0.;
+ } else if (gammaPreset == "standard_g2.2") {
+ sGammaPreset = "_g=2.2";
+ presetGamma = 2.2;
+ presetSlope = 0.;
+ ga[0] = 2.2; //gamma=2.2(as gamma of Adobe, Widegamut...)
+ ga[1] = 1.;
+ ga[2] = 0.;
+ ga[3] = 1. / eps;
+ ga[4] = 0.;
+ } else if (gammaPreset == "standard_g1.8") {
+ sGammaPreset = "_g=1.8";
+ presetGamma = 1.8;
+ presetSlope = 0.;
+ ga[0] = 1.8; //gamma=1.8(as gamma of Prophoto)
+ ga[1] = 1.;
+ ga[2] = 0.;
+ ga[3] = 1. / eps;
+ ga[4] = 0.;
+ } else if (gammaPreset == "Lab_g3.0s9.03296") {
+ sGammaPreset = "_LAB_g3.0_s9.03296";
+ presetGamma = 3.0;
+ presetSlope = 9.03296;
+ ga[0] = 3.0; //Lab gamma =3 slope=9.03296
+ ga[1] = 0.8621;
+ ga[2] = 0.1379;
+ ga[3] = 0.1107;
+ ga[4] = 0.08;
+ } else if (gammaPreset == "Custom") {
+ rtengine::GammaValues g_a; //gamma parameters
+ double pwr = 1.0 / gamma;
+ double ts = slope;
+ double slope2 = slope == 0 ? eps : slope;
+
+ int mode = 0;
+ rtengine::Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2
+ ga[4] = g_a[3] * ts;
+ //printf("g_a.gamma0=%f g_a.gamma1=%f g_a.gamma2=%f g_a.gamma3=%f g_a.gamma4=%f\n", g_a.gamma0,g_a.gamma1,g_a.gamma2,g_a.gamma3,g_a.gamma4);
+ ga[0] = gamma;
+ ga[1] = 1. /(1.0 + g_a[4]);
+ ga[2] = g_a[4] /(1.0 + g_a[4]);
+ ga[3] = 1. / slope2;
+ //printf("ga[0]=%f ga[1]=%f ga[2]=%f ga[3]=%f ga[4]=%f\n", ga[0],ga[1],ga[2],ga[3],ga[4]);
+
+ sGammaPreset = Glib::ustring::compose("_g%1_s%2",
+ Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(2), gamma),
+ Glib::ustring::format (std::setw(6), std::fixed, std::setprecision(5), slope));
+ presetGamma = gamma;
+ presetSlope = slope;
+ }
+ ga[5] = 0.0;
+ ga[6] = 0.0;
+
+
+ sPrimariesAndIlluminant = sPrimariesPreset;
+
+ if (profileVersion == "v4" && illuminant != "DEF") {
+ sPrimariesPreset += illuminant;
+ // printf("outpr=%s \n",outPr.c_str());
+ }
+
+ // create description with gamma + slope + primaries
+ std::wostringstream gammaWs;
+ std::wstring gammaStrICC;
+
+ Glib::ustring gammaGS;//to save gamma and slope in a tag
+
+ if (gammaPreset == "Custom") {
+ Glib::ustring sGamma(Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(2), gamma));
+ Glib::ustring sSlope(Glib::ustring::format (std::setw(6), std::fixed, std::setprecision(5), slope));
+ fName = (profileVersion == "v4" ? "RTv4_" : "RTv2_") + sPrimariesAndIlluminant + sGamma + " " + sSlope + ".icc";
+ gammaWs << sPrimariesPreset << " g=" << Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(2), gamma) << " s=" << Glib::ustring::format (std::setw(6), std::fixed, std::setprecision(5), slope);
+ gammaGS = "g" + sGamma + "s" + sSlope + "!";
+
+
+ } else {
+ Glib::ustring sGamma(Glib::ustring::format (std::setw(3), std::fixed, std::setprecision(2), presetGamma));
+ Glib::ustring sSlope(Glib::ustring::format (std::setw(6), std::fixed, std::setprecision(5), presetSlope));
+ fName = (profileVersion == "v4" ? "RTv4_" : "RTv2_") + sPrimariesAndIlluminant + sGammaPreset + ".icc";
+ gammaWs << sPrimariesPreset << sGammaPreset;
+ gammaGS = "g" + sGamma + "s" + sSlope + "!";
+ }
+
+ // -------------------------------------------- Asking the file name
+
+ Gtk::FileChooserDialog dialog(getToplevelWindow(this), M("ICCPROFCREATOR_SAVEDIALOG_TITLE"), Gtk::FILE_CHOOSER_ACTION_SAVE);
+ bindCurrentFolder(dialog, options.lastICCProfCreatorDir);
+ dialog.set_current_name(fName);
+ //dialog.set_current_folder(lastPath);
+
+ dialog.add_button(M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL);
+ dialog.add_button(M("GENERAL_SAVE"), Gtk::RESPONSE_OK);
+
+ Glib::RefPtr filter_icc = Gtk::FileFilter::create();
+ filter_icc->set_name(M("FILECHOOSER_FILTER_COLPROF"));
+ filter_icc->add_pattern("*.icc");
+ dialog.add_filter(filter_icc);
+
+ /*
+ Glib::RefPtr filter_any = Gtk::FileFilter::create();
+ filter_any->set_name(M("FILECHOOSER_FILTER_ANY"));
+ filter_any->add_pattern("*");
+ dialog.add_filter(filter_any);
+ */
+
+ dialog.show_all_children();
+ //dialog.set_do_overwrite_confirmation (true);
+
+ Glib::ustring absoluteFName;
+
+ do {
+ int result = dialog.run();
+
+ if (result != Gtk::RESPONSE_OK) {
+ return;
+ } else {
+ absoluteFName = dialog.get_filename();
+ Glib::ustring ext = getExtension(absoluteFName);
+
+ if (ext != "icc") {
+ absoluteFName += ".icc";
+ }
+
+ if (confirmOverwrite(dialog, absoluteFName)) {
+ //lastPath = Glib::path_get_dirname(absoluteFName);
+ break;
+ }
+ }
+ } while (1);
+
+ // -----------------------------------------------------------------
+
+ //write in tag 'dmdd' values of current gamma and slope to retrive after in Output profile
+ wchar_t *wGammaGS = (wchar_t*)g_utf8_to_utf16 (gammaGS.c_str(), -1, NULL, NULL, NULL);
+ if (!wGammaGS) {
+ printf("Error: lab2rgbOut / g_utf8_to_utf16 failed!\n");
+ }
+
+ cmsMLU *description = cmsMLUalloc(NULL, 1);
+ // Language code (3 letters code) : https://www.iso.org/obp/ui/
+ // Country code (3 letters code) : http://www.loc.gov/standards/iso639-2/php/code_list.php
+ if (cmsMLUsetWide(description, "eng", "USA", wGammaGS)) {
+ cmsWriteTag(newProfile, cmsSigDeviceModelDescTag, description); //save 'dmdd' in description
+ } else {
+ printf("Error: lab2rgbOut / cmsMLUsetWide failed for \"%s\" !\n", gammaGS.c_str());
+ }
+ cmsMLU *mlu;
+ cmsContext ContextID = cmsGetProfileContextID(newProfile); // create context to modify some TAGs
+ mlu = cmsMLUalloc(ContextID, 1);
+ cmsMLUsetWide(mlu, "en", "US", gammaWs.str().c_str());
+
+ cmsMLUfree(description);
+
+ // instruction with //ICC are used to generate ICC profile
+ if (mlu == nullptr) {
+ printf("Description error\n");
+ } else {
+
+ if (profileVersion == "v4") {
+ cmsSetProfileVersion(newProfile, 4.3);
+ } else {
+ cmsSetProfileVersion(newProfile, 2.0);
+ }
+
+//change
+ float p[6]; //primaries
+ ga[6] = 0.0;
+
+ enum class ColorTemp {
+ D50 = 5003, // for Widegamut, Prophoto Best, Beta -> D50
+ D65 = 6504, // for sRGB, AdobeRGB, Bruce Rec2020 -> D65
+ D60 = 6005 //for ACESc->D60
+ };
+ ColorTemp temp = ColorTemp::D50;
+
+ if (primariesPreset == "Widegamut") {
+ p[0] = 0.7350; //Widegamut primaries
+ p[1] = 0.2650;
+ p[2] = 0.1150;
+ p[3] = 0.8260;
+ p[4] = 0.1570;
+ p[5] = 0.0180;
+
+ } else if (primariesPreset == "Adobe") {
+ p[0] = 0.6400; //Adobe primaries
+ p[1] = 0.3300;
+ p[2] = 0.2100;
+ p[3] = 0.7100;
+ p[4] = 0.1500;
+ p[5] = 0.0600;
+ temp = ColorTemp::D65;
+ } else if (primariesPreset == "sRGB") {
+ p[0] = 0.6400; // sRGB primaries
+ p[1] = 0.3300;
+ p[2] = 0.3000;
+ p[3] = 0.6000;
+ p[4] = 0.1500;
+ p[5] = 0.0600;
+ temp = ColorTemp::D65;
+ } else if (primariesPreset == "BruceRGB") {
+ p[0] = 0.6400; // Bruce primaries
+ p[1] = 0.3300;
+ p[2] = 0.2800;
+ p[3] = 0.6500;
+ p[4] = 0.1500;
+ p[5] = 0.0600;
+ temp = ColorTemp::D65;
+ } else if (primariesPreset == "BetaRGB") {
+ p[0] = 0.6888; // Beta primaries
+ p[1] = 0.3112;
+ p[2] = 0.1986;
+ p[3] = 0.7551;
+ p[4] = 0.1265;
+ p[5] = 0.0352;
+ } else if (primariesPreset == "BestRGB") {
+ p[0] = 0.7347; // Best primaries
+ p[1] = 0.2653;
+ p[2] = 0.2150;
+ p[3] = 0.7750;
+ p[4] = 0.1300;
+ p[5] = 0.0350;
+ } else if (primariesPreset == "Rec2020") {
+ p[0] = 0.7080; // Rec2020 primaries
+ p[1] = 0.2920;
+ p[2] = 0.1700;
+ p[3] = 0.7970;
+ p[4] = 0.1310;
+ p[5] = 0.0460;
+ temp = ColorTemp::D65;
+ } else if (primariesPreset == "ACES-AP0") {
+ p[0] = 0.7347; // ACES P0 primaries
+ p[1] = 0.2653;
+ p[2] = 0.0000;
+ p[3] = 1.0;
+ p[4] = 0.0001;
+ p[5] = -0.0770;
+ temp = ColorTemp::D60;
+ } else if (primariesPreset == "ACES-AP1") {
+ p[0] = 0.713; // ACES P1 primaries
+ p[1] = 0.293;
+ p[2] = 0.165;
+ p[3] = 0.830;
+ p[4] = 0.128;
+ p[5] = 0.044;
+ temp = ColorTemp::D60;
+ } else if (primariesPreset == "ProPhoto") {
+ p[0] = 0.7347; // ProPhoto and default primaries
+ p[1] = 0.2653;
+ p[2] = 0.1596;
+ p[3] = 0.8404;
+ p[4] = 0.0366;
+ p[5] = 0.0001;
+ } else if (primariesPreset == "custom") {
+ p[0] = redPrimaryX;
+ p[1] = redPrimaryY;
+ p[2] = greenPrimaryX;
+ p[3] = greenPrimaryY;
+ p[4] = bluePrimaryX;
+ p[5] = bluePrimaryY;
+
+ } else {
+ p[0] = 0.7347; //default primaries
+ p[1] = 0.2653;
+ p[2] = 0.1596;
+ p[3] = 0.8404;
+ p[4] = 0.0366;
+ p[5] = 0.0001;
+ }
+
+ cmsCIExyY xyD;
+ cmsCIExyYTRIPLE Primaries = {
+ {p[0], p[1], 1.0}, // red
+ {p[2], p[3], 1.0}, // green
+ {p[4], p[5], 1.0} // blue
+ };
+ double tempv4 = 5000.;
+
+ if (profileVersion == "v4" && illuminant != "DEF") {
+ if (illuminant == "D41") {
+ tempv4 = 4100.;
+ } else if (illuminant == "D50") {
+ tempv4 = 5003.;
+ } else if (illuminant == "D55") {
+ tempv4 = 5500.;
+ } else if (illuminant == "D60") {
+ tempv4 = 6004.;
+ } else if (illuminant == "D65") {
+ tempv4 = 6504.;
+ } else if (illuminant == "D80") {
+ tempv4 = 8000.;
+ } else if (illuminant == "stdA") {
+ tempv4 = 5003.;
+ }
+
+ //printf("tempv4=%f \n", tempv4);
+
+ }
+
+ if (profileVersion == "v4" && illuminant != "DEF") {
+ cmsWhitePointFromTemp(&xyD, tempv4);
+ } else {
+ cmsWhitePointFromTemp(&xyD, (double)temp);
+ }
+
+ if (illuminant == "stdA") xyD = {0.447573, 0.407440, 1.0};
+
+ // Calculate output profile's rTRC gTRC bTRC
+ cmsToneCurve* GammaTRC[3];
+ GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, Parameters);
+
+ if (profileVersion == "v4") {
+ newProfile = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC);
+ }
+
+ cmsWriteTag(newProfile, cmsSigRedTRCTag, GammaTRC[0]);
+ cmsWriteTag(newProfile, cmsSigGreenTRCTag, GammaTRC[1]);
+ cmsWriteTag(newProfile, cmsSigBlueTRCTag, GammaTRC[2]);
+ cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, mlu);//desc changed
+
+ /* //to read XYZ values
+ cmsCIEXYZ *redT = static_cast(cmsReadTag(newProfile, cmsSigRedMatrixColumnTag));
+ cmsCIEXYZ *greenT = static_cast(cmsReadTag(newProfile, cmsSigGreenMatrixColumnTag));
+ cmsCIEXYZ *blueT = static_cast(cmsReadTag(newProfile, cmsSigBlueMatrixColumnTag));
+ printf("rx=%f gx=%f bx=%f ry=%f gy=%f by=%f rz=%f gz=%f bz=%f\n", redT->X, greenT->X, blueT->X, redT->Y, greenT->Y, blueT->Y, redT->Z, greenT->Z, blueT->Z);
+ */
+
+ cmsMLUfree(mlu);
+ cmsMLU *copyright = cmsMLUalloc(NULL, 1);
+ cmsMLUsetASCII(copyright, "eng", "USA", "Copyright RawTherapee 2018, CC0");
+ cmsWriteTag(newProfile, cmsSigCopyrightTag, copyright);
+ cmsMLUfree(copyright);
+ //cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, mlu);//desc changed
+ cmsMLU *MfgDesc;
+ MfgDesc = cmsMLUalloc(NULL, 1);
+ cmsMLUsetASCII(MfgDesc, "eng", "USA", "RawTherapee");
+ cmsWriteTag(newProfile, cmsSigDeviceMfgDescTag, MfgDesc);
+ cmsMLUfree(MfgDesc);
+
+ /*
+ Glib::ustring realoutPro;
+ realoutPro = options.cacheBaseDir + "/" + fName;//ICC profile in cache
+ */
+
+ if (profileVersion == "v2" || profileVersion == "v4") {
+ cmsSaveProfileToFile(newProfile, absoluteFName.c_str());
+
+ }
+
+ //if (GammaTRC) {
+ cmsFreeToneCurve(GammaTRC[0]);
+ //}
+ }
+}
diff --git a/rtgui/iccprofilecreator.h b/rtgui/iccprofilecreator.h
new file mode 100644
index 000000000..cf2590a71
--- /dev/null
+++ b/rtgui/iccprofilecreator.h
@@ -0,0 +1,88 @@
+/*
+ * This file is part of RawTherapee.
+ *
+ * Copyright (c) 2018 Jacques DESMIS
+ * Copyright (c) 2018 Jean-Christophe FRISCH
+ *
+ * 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 .
+ */
+#pragma once
+
+#include
+#include "adjuster.h"
+#include "options.h"
+#include
+#include "rtwindow.h"
+
+class ICCProfileCreator : public Gtk::Dialog, public AdjusterListener
+{
+
+private:
+
+ double ga[7];
+
+ //------------------------ Params -----------------------
+ Glib::ustring primariesPreset;
+ double redPrimaryX;
+ double redPrimaryY;
+ double greenPrimaryX;
+ double greenPrimaryY;
+ double bluePrimaryX;
+ double bluePrimaryY;
+ Glib::ustring gammaPreset;
+ double gamma;
+ double slope;
+
+ Glib::ustring profileVersion;
+ Glib::ustring illuminant;
+ //-------------------------------------------------------
+
+ RTWindow *parent;
+
+ Adjuster* aGamma;
+ Adjuster* aSlope;
+ Adjuster* aPrimariesRedX;
+ Adjuster* aPrimariesRedY;
+ Adjuster* aPrimariesGreenX;
+ Adjuster* aPrimariesGreenY;
+ Adjuster* aPrimariesBlueX;
+ Adjuster* aPrimariesBlueY;
+
+ Gtk::Grid* primariesGrid;
+ MyComboBoxText* iccVersion;
+ MyComboBoxText* trcPresets;
+ sigc::connection trcpresetsconn;
+ MyComboBoxText* primaries;
+ sigc::connection primariesconn;
+ MyComboBoxText* cIlluminant;
+ sigc::connection illconn;
+
+ //Glib::ustring lastPath;
+
+ void initWithDefaults ();
+ void storeDefaults ();
+ void storeValues();
+
+ void updateICCVersion();
+ void primariesChanged();
+ void illuminantChanged();
+ void trcPresetsChanged();
+ static std::vector getGamma();
+ void getGammaArray();
+ void savePressed();
+ void closePressed();
+
+public:
+ explicit ICCProfileCreator (RTWindow *rtwindow);
+};
diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc
index f46385c84..9ff799f4c 100644
--- a/rtgui/icmpanel.cc
+++ b/rtgui/icmpanel.cc
@@ -47,7 +47,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
EvICMslop = m->newEvent(ALLNORAW, "HISTORY_MSG_ICMSLOP");
EvICMtrcinMethod = m->newEvent(ALLNORAW, "HISTORY_MSG_ICMTRCIN");
- isBatchMode = lastToneCurve = lastApplyLookTable = lastApplyBaselineExposureOffset = lastApplyHueSatMap = lastCustomOutputProfile = false;
+ isBatchMode = lastToneCurve = lastApplyLookTable = lastApplyBaselineExposureOffset = lastApplyHueSatMap = false;
ipDialog = Gtk::manage(new MyFileChooserButton(M("TP_ICM_INPUTDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
ipDialog->set_tooltip_text(M("TP_ICM_INPUTCUSTOM_TOOLTIP"));
@@ -61,7 +61,6 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
iFrame->set_label_align(0.025, 0.5);
iVBox = Gtk::manage(new Gtk::VBox());
- iVBox->set_spacing(2);
inone = Gtk::manage(new Gtk::RadioButton(M("TP_ICM_INPUTNONE")));
inone->set_tooltip_text(M("TP_ICM_INPUTNONE_TOOLTIP"));
@@ -170,7 +169,6 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
wFrame->set_label_align(0.025, 0.5);
Gtk::VBox *wProfVBox = Gtk::manage(new Gtk::VBox());
- wProfVBox->set_spacing(2);
wProfNames = Gtk::manage(new MyComboBoxText());
wProfVBox->pack_start(*wProfNames, Gtk::PACK_SHRINK);
@@ -189,21 +187,21 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
wTRCHBox = Gtk::manage(new Gtk::HBox());
- Gtk::Label* wtrclab = Gtk::manage(new Gtk::Label(M("TP_GAMMA_WORKTRC")));
+ Gtk::Label* wtrclab = Gtk::manage(new Gtk::Label(M("TP_ICM_WORKTRC")));
wTRCHBox->pack_start(*wtrclab, Gtk::PACK_SHRINK);
wTRC = Gtk::manage(new MyComboBoxText());
wTRCHBox->pack_start(*wTRC, Gtk::PACK_EXPAND_WIDGET);
wProfVBox->pack_start(*wTRCHBox, Gtk::PACK_EXPAND_WIDGET);
- wTRC->append(M("TP_GAMMA_WORKTRC_NONE"));
- wTRC->append(M("TP_GAMMA_WORKTRC_CUSTOM"));
+ wTRC->append(M("TP_ICM_WORKTRC_NONE"));
+ wTRC->append(M("TP_ICM_WORKTRC_CUSTOM"));
wTRC->set_active(0);
- wTRC->set_tooltip_text(M("TP_GAMMA_WORKTRC_TOOLTIP"));
+ wTRC->set_tooltip_text(M("TP_ICM_WORKTRC_TOOLTIP"));
- wGamma = Gtk::manage(new Adjuster(M("TP_GAMMA_WORKTRC_GAMMA"), 0.40, 15.0, 0.001, 2.4));
- wSlope = Gtk::manage(new Adjuster(M("TP_GAMMA_WORKTRC_SLOPE"), 0., 150., 0.01, 12.92));
+ wGamma = Gtk::manage(new Adjuster(M("TP_ICM_WORKTRC_GAMMA"), 0.40, 15.0, 0.001, 2.4));
+ wSlope = Gtk::manage(new Adjuster(M("TP_ICM_WORKTRC_SLOPE"), 0., 150., 0.01, 12.92310));
wProfVBox->pack_start(*wGamma, Gtk::PACK_SHRINK);
wGamma->show();
@@ -234,7 +232,6 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
oFrame->set_label_align(0.025, 0.5);
Gtk::VBox *oProfVBox = Gtk::manage(new Gtk::VBox());
- oProfVBox->set_spacing(2);
oProfNames = Gtk::manage(new MyComboBoxText());
oProfVBox->pack_start(*oProfNames, Gtk::PACK_SHRINK);
@@ -269,171 +266,8 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
obpc->set_active(true);
oProfVBox->pack_start(*obpc, Gtk::PACK_SHRINK);
- // Output gamma
- oTRCPresetsHBox = Gtk::manage(new Gtk::HBox());
-
- //Gtk::HBox* gaHBox = Gtk::manage(new Gtk::HBox());
- Gtk::Label* galab = Gtk::manage(new Gtk::Label(M("TP_GAMMA_OUTPUT_TRC_PRESET")));
-
- oTRCPresetsHBox->pack_start(*galab, Gtk::PACK_SHRINK);
- oTRCPresets = Gtk::manage(new MyComboBoxText());
- oTRCPresetsHBox->pack_start(*oTRCPresets, Gtk::PACK_EXPAND_WIDGET);
-
-
- std::vector outputTRCPresets = rtengine::ICCStore::getGamma();
-
- for (size_t i = 0; i < outputTRCPresets.size(); i++) {
- oTRCPresets->append(outputTRCPresets[i]);
- }
-
- oTRCPresets->set_active(0);
-
- Gtk::Frame* cgFrame = Gtk::manage(new Gtk::Frame());
-
- Gtk::VBox *cgVBox = Gtk::manage(new Gtk::VBox());
- cgVBox->set_spacing(2);
-
-
- customOutProfile = Gtk::manage(new Gtk::CheckButton((M("TP_GAMMA_CUSTOM"))));
- customOutProfile->set_active(false);
- cgFrame->set_label_widget(*customOutProfile);
-
-
- //primaries
- primariesHBox = Gtk::manage(new Gtk::HBox());
-
- Gtk::Label* prilab = Gtk::manage(new Gtk::Label(M("TP_GAMMA_PRIM")));
-
- primariesHBox->pack_start(*prilab, Gtk::PACK_SHRINK);
- primaries = Gtk::manage(new MyComboBoxText());
- primariesHBox->pack_start(*primaries, Gtk::PACK_EXPAND_WIDGET);
- cgVBox->pack_start(*primariesHBox, Gtk::PACK_EXPAND_WIDGET);
- primaries->append(M("TP_GAMMA_PRIM_ACESP0"));
- primaries->append(M("TP_GAMMA_PRIM_ACESP1"));
- primaries->append(M("TP_GAMMA_PRIM_ADOBE"));
- primaries->append(M("TP_GAMMA_PRIM_PROPH"));
- primaries->append(M("TP_GAMMA_PRIM_REC2020"));
- primaries->append(M("TP_GAMMA_PRIM_SRGB"));
- primaries->append(M("TP_GAMMA_PRIM_WIDEG"));
- primaries->append(M("TP_GAMMA_PRIM_BEST"));
- primaries->append(M("TP_GAMMA_PRIM_BETA"));
- primaries->append(M("TP_GAMMA_PRIM_BRUCE"));
- primaries->append(M("TP_GAMMA_PRIM_FREE"));
- primaries->set_active(5);
-
- primariesVBox = Gtk::manage(new Gtk::VBox());
- priGreenHBox = Gtk::manage(new Gtk::HBox());
- priBlueHBox = Gtk::manage(new Gtk::HBox());
- priRedHBox = Gtk::manage(new Gtk::HBox());
-
- Gtk::Image* gamuts0 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
- Gtk::Image* gamutl0 = Gtk::manage(new RTImage("rt-logo-small.png"));
- Gtk::Image* gamuts1 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
- Gtk::Image* gamutl1 = Gtk::manage(new RTImage("rt-logo-small.png"));
- Gtk::Image* gamuts2 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
- Gtk::Image* gamutl2 = Gtk::manage(new RTImage("rt-logo-small.png"));
- Gtk::Image* gamuts3 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
- Gtk::Image* gamutl3 = Gtk::manage(new RTImage("rt-logo-small.png"));
- Gtk::Image* gamuts4 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
- Gtk::Image* gamutl4 = Gtk::manage(new RTImage("rt-logo-small.png"));
- Gtk::Image* gamuts5 = Gtk::manage(new RTImage("rt-logo-tiny.png"));
- Gtk::Image* gamutl5 = Gtk::manage(new RTImage("rt-logo-small.png"));
-
- primariesRedX = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_REDX"), 0.6300, 0.7350, 0.0001, 0.6400, gamuts0, gamutl0));
- primariesRedY = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_REDY"), 0.2650, 0.3350, 0.0001, 0.3300, gamutl1, gamuts1));
- primariesGreenX = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_GREX"), 0.0000, 0.3100, 0.0001, 0.3000, gamutl2, gamuts2));
- primariesGreenY = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_GREY"), 0.5900, 1.0000, 0.0001, 0.6000, gamuts3, gamutl3));
- primariesBlueX = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_BLUX"), 0.0001, 0.1600, 0.0001, 0.1500, gamutl4, gamuts4));
- primariesBlueY = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_BLUY"), -0.0700, 0.0700, 0.0001, 0.060, gamutl5, gamuts5));
-
- priRedHBox->pack_start(*primariesRedX,Gtk::PACK_EXPAND_WIDGET, 4);
- priRedHBox->pack_start(*primariesRedY,Gtk::PACK_EXPAND_WIDGET, 4);
- primariesVBox->pack_start(*priRedHBox,Gtk::PACK_EXPAND_WIDGET, 4);
-
- priGreenHBox->pack_start(*primariesGreenX, Gtk::PACK_EXPAND_WIDGET, 4);
- priGreenHBox->pack_start(*primariesGreenY, Gtk::PACK_EXPAND_WIDGET, 4);
- primariesVBox->pack_start(*priGreenHBox, Gtk::PACK_EXPAND_WIDGET, 4);
-
- priBlueHBox->pack_start(*primariesBlueX, Gtk::PACK_EXPAND_WIDGET, 4);
- priBlueHBox->pack_start(*primariesBlueY, Gtk::PACK_EXPAND_WIDGET, 4);
- primariesVBox->pack_start(*priBlueHBox,Gtk::PACK_EXPAND_WIDGET, 4);
-
- cgVBox->pack_start(*primariesVBox, Gtk::PACK_SHRINK);
-
- primariesRedX->setAdjusterListener(this);
- primariesRedY->setAdjusterListener(this);
- primariesGreenX->setAdjusterListener(this);
- primariesGreenY->setAdjusterListener(this);
- primariesBlueX->setAdjusterListener(this);
- primariesBlueY->setAdjusterListener(this);
-
- //sliders gampos and slpos
- cgVBox->pack_start(*oTRCPresetsHBox, Gtk::PACK_EXPAND_WIDGET);
- oTRCHBox = Gtk::manage(new Gtk::HBox());
-
- oGamma = Gtk::manage(new Adjuster(M("TP_GAMMA_CURV"), 1, 3.5, 0.00001, 2.4));
- oGamma->setAdjusterListener(this);
-
- if (oGamma->delay < options.adjusterMaxDelay) {
- oGamma->delay = options.adjusterMaxDelay;
- }
-
- oGamma->show();
-
- oSlope = Gtk::manage(new Adjuster(M("TP_GAMMA_SLOP"), 0, 15, 0.00001, 12.92310));
- oSlope->setAdjusterListener(this);
-
- if (oSlope->delay < options.adjusterMaxDelay) {
- oSlope->delay = options.adjusterMaxDelay;
- }
-
- oSlope->show();
- oTRCHBox->pack_start(*oGamma, Gtk::PACK_EXPAND_WIDGET, 4); //gamma
- oTRCHBox->pack_start(*oSlope, Gtk::PACK_EXPAND_WIDGET, 4); //slope
- cgVBox->pack_start(*oTRCHBox, Gtk::PACK_EXPAND_WIDGET, 4);
-
- //V2 or V4 profiles
- profHBox = Gtk::manage(new Gtk::HBox());
- Gtk::Label* proflab = Gtk::manage(new Gtk::Label(M("TP_GAMMA_PROF") + ":"));
-
- profHBox->pack_start(*proflab, Gtk::PACK_SHRINK);
- wprofile = Gtk::manage(new MyComboBoxText());
- profHBox->pack_start(*wprofile, Gtk::PACK_EXPAND_WIDGET);
-
-// fgVBox->pack_start(*profHBox, Gtk::PACK_EXPAND_WIDGET);
- wprofile->append(M("TP_GAMMA_PROF_NONE"));
- wprofile->append(M("TP_GAMMA_PROF_V2"));
- wprofile->append(M("TP_GAMMA_PROF_V4"));
-
- wprofile->set_active(0);
-
- //temperature
- oIllHBox = Gtk::manage(new Gtk::HBox());
-
- Gtk::Label* templab = Gtk::manage(new Gtk::Label(M("TP_GAMMA_TEMP") + ":"));
-
- oIllHBox->pack_start(*templab, Gtk::PACK_SHRINK);
- oIlluminant = Gtk::manage(new MyComboBoxText());
- oIllHBox->pack_start(*oIlluminant, Gtk::PACK_EXPAND_WIDGET);
- cgVBox->pack_start(*oIllHBox, Gtk::PACK_EXPAND_WIDGET);
- oIlluminant->append(M("TP_GAMMA_TEMP_DEF"));
- oIlluminant->append(M("TP_GAMMA_TEMP_41"));
- oIlluminant->append(M("TP_GAMMA_TEMP_50"));
- oIlluminant->append(M("TP_GAMMA_TEMP_55"));
- oIlluminant->append(M("TP_GAMMA_TEMP_60"));
- oIlluminant->append(M("TP_GAMMA_TEMP_65"));
- oIlluminant->append(M("TP_GAMMA_TEMP_80"));
- oIlluminant->append(M("TP_GAMMA_TEMP_INC"));
-
- oIlluminant->set_active(0);
- oIlluminant->set_tooltip_text(M("TP_GAMMA_TEMP_TOOLTIP"));
-
- cgVBox->pack_start(*profHBox, Gtk::PACK_EXPAND_WIDGET);
-
- cgFrame->add(*cgVBox);
- oProfVBox->pack_start(*cgFrame, Gtk::PACK_EXPAND_WIDGET);
-
oFrame->add(*oProfVBox);
+
pack_start(*oFrame, Gtk::PACK_EXPAND_WIDGET);
// ---------------------------- Output gamma list entries
@@ -472,15 +306,10 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
wprofnamesconn = wProfNames->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wpChanged));
oprofnamesconn = oProfNames->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::opChanged));
orendintentconn = oRendIntent->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::oiChanged));
- otrcconn = oTRCPresets->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::gpChanged));
dcpillconn = dcpIll->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::dcpIlluminantChanged));
- primariesconn = primaries->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wprimariesChanged));
- wprofileconn = wprofile->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wprofileChanged));
- oillconn = oIlluminant->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wtempChanged));
wtrcconn = wTRC->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wtrcinChanged));
obpcconn = obpc->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::oBPCChanged));
- coprofconn = customOutProfile->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::GamChanged));
tcurveconn = ckbToneCurve->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::toneCurveChanged));
ltableconn = ckbApplyLookTable->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::applyLookTableChanged));
beoconn = ckbApplyBaselineExposureOffset->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::applyBaselineExposureOffsetChanged));
@@ -656,7 +485,6 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
ConnectionBlocker obpcconn_(obpcconn);
ConnectionBlocker ipc_(ipc);
- ConnectionBlocker coprofconn_(coprofconn);
ConnectionBlocker tcurveconn_(tcurveconn);
ConnectionBlocker ltableconn_(ltableconn);
ConnectionBlocker beoconn_(beoconn);
@@ -664,11 +492,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
ConnectionBlocker wprofnamesconn_(wprofnamesconn);
ConnectionBlocker oprofnamesconn_(oprofnamesconn);
ConnectionBlocker orendintentconn_(orendintentconn);
- ConnectionBlocker otrcconn_(otrcconn);
ConnectionBlocker dcpillconn_(dcpillconn);
- ConnectionBlocker primariesconn_(primariesconn);
- ConnectionBlocker wprofileconn_(wprofileconn);
- ConnectionBlocker oillconn_(oillconn);
if (pp->icm.inputProfile.substr(0, 5) != "file:" && !ipDialog->get_filename().empty()) {
ipDialog->set_filename(pp->icm.inputProfile);
@@ -703,57 +527,6 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
}
wProfNames->set_active_text(pp->icm.workingProfile);
- oTRCPresets->set_active_text(pp->icm.outputGammaPreset);
-
-
- if (pp->icm.outputPimariesPreset == "ACES-AP0") {
- primaries->set_active(0);
- } else if (pp->icm.outputPimariesPreset == "ACES-AP1") {
- primaries->set_active(1);
- } else if (pp->icm.outputPimariesPreset == "Adobe") {
- primaries->set_active(2);
- } else if (pp->icm.outputPimariesPreset == "ProPhoto") {
- primaries->set_active(3);
- } else if (pp->icm.outputPimariesPreset == "Rec2020") {
- primaries->set_active(4);
- } else if (pp->icm.outputPimariesPreset == "sRGB") {
- primaries->set_active(5);
- } else if (pp->icm.outputPimariesPreset == "Widegamut") {
- primaries->set_active(6);
- } else if (pp->icm.outputPimariesPreset == "BestRGB") {
- primaries->set_active(7);
- } else if (pp->icm.outputPimariesPreset == "BetaRGB") {
- primaries->set_active(8);
- } else if (pp->icm.outputPimariesPreset == "BruceRGB") {
- primaries->set_active(9);
- } else if (pp->icm.outputPimariesPreset == "pfree") {
- primaries->set_active(10);
- }
-
- if (primaries->get_active_row_number() == 10) {
- primariesVBox->set_sensitive(true);
- } else {
- primariesVBox->set_sensitive(false);
- }
-
-
- if (pp->icm.outputIlluminant == "DEF") {
- oIlluminant->set_active(0);
- } else if (pp->icm.outputIlluminant == "D41") {
- oIlluminant->set_active(1);
- } else if (pp->icm.outputIlluminant == "D50") {
- oIlluminant->set_active(2);
- } else if (pp->icm.outputIlluminant == "D55") {
- oIlluminant->set_active(3);
- } else if (pp->icm.outputIlluminant == "D60") {
- oIlluminant->set_active(4);
- } else if (pp->icm.outputIlluminant == "D65") {
- oIlluminant->set_active(5);
- } else if (pp->icm.outputIlluminant == "D80") {
- oIlluminant->set_active(6);
- } else if (pp->icm.outputIlluminant == "stdA") {
- oIlluminant->set_active(7);
- }
if (pp->icm.workingTRC == "none") {
wTRC->set_active(0);
@@ -761,23 +534,6 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
wTRC->set_active(1);
}
- if (pp->icm.outputProfileVersion == "none") {
- wprofile->set_active(0);
- } else if (pp->icm.outputProfileVersion == "v2") {
- wprofile->set_active(1);
- } else if (pp->icm.outputProfileVersion == "v4") {
- wprofile->set_active(2);
- }
-
-
- if (primaries->get_active_row_number() == 10) {
- wprofile->set_active(2);
- }
-
- gpChanged();
- wprofileChanged();
- wtempChanged();
- wprimariesChanged();
wtrcinChanged();
if (pp->icm.outputProfile == ColorManagementParams::NoICMString) {
@@ -802,40 +558,8 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
ckbApplyHueSatMap->set_active(pp->icm.applyHueSatMap);
lastApplyHueSatMap = pp->icm.applyHueSatMap;
- customOutProfile->set_active(pp->icm.customOutputProfile);
- lastCustomOutputProfile = pp->icm.customOutputProfile;
-
- if (!batchMode) {
- oProfNames->set_sensitive(/*wgamma->get_active_row_number() == 0 &&*/ !pp->icm.customOutputProfile); //"default"
- oTRCPresets->set_sensitive(pp->icm.customOutputProfile);
- oGamma->set_sensitive(pp->icm.customOutputProfile);
- oGamma->set_sensitive(pp->icm.outputGammaPreset == "Custom");
- oSlope->set_sensitive(pp->icm.customOutputProfile);
- oSlope->set_sensitive(pp->icm.outputGammaPreset == "Custom");
- updateRenderingIntent(pp->icm.outputProfile);
- primaries->set_sensitive(pp->icm.customOutputProfile);
- wprofile->set_sensitive(pp->icm.customOutputProfile);
-
- if (wprofile->get_active_row_number() == 2) {
- oIlluminant->set_sensitive(pp->icm.customOutputProfile);
- } else {
- oIlluminant->set_sensitive(false);
- }
-
- // wtemp->set_sensitive(pp->icm.freegamma);
-
- }
-
- oGamma->setValue(pp->icm.workingTRCGamma);
- oSlope->setValue(pp->icm.workingTRCSlope);
- primariesRedX->setValue(pp->icm.redPrimaryX);
- primariesRedY->setValue(pp->icm.redPrimaryY);
- primariesGreenX->setValue(pp->icm.greenPrimaryX);
- primariesGreenY->setValue(pp->icm.greenPrimaryY);
- primariesBlueX->setValue(pp->icm.bluePrimaryX);
- primariesBlueY->setValue(pp->icm.bluePrimaryY);
- wGamma->setValue(pp->icm.outputGamma);
- wSlope->setValue(pp->icm.outputSlope);
+ wGamma->setValue(pp->icm.workingTRCGamma);
+ wSlope->setValue(pp->icm.workingTRCSlope);
if (pedited) {
iunchanged->set_active(!pedited->icm.inputProfile);
@@ -844,7 +568,6 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
ckbApplyLookTable->set_inconsistent(!pedited->icm.applyLookTable);
ckbApplyBaselineExposureOffset->set_inconsistent(!pedited->icm.applyBaselineExposureOffset);
ckbApplyHueSatMap->set_inconsistent(!pedited->icm.applyHueSatMap);
- customOutProfile->set_inconsistent(!pedited->icm.customOutputProfile);
if (!pedited->icm.workingProfile) {
wProfNames->set_active_text(M("GENERAL_UNCHANGED"));
@@ -862,36 +585,12 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
dcpIll->set_active_text(M("GENERAL_UNCHANGED"));
}
- if (!pedited->icm.outputGammaPreset) {
- oTRCPresets->set_active_text(M("GENERAL_UNCHANGED"));
- }
-
- if (!pedited->icm.outputPrimariesPreset) {
- primaries->set_active_text(M("GENERAL_UNCHANGED"));
- }
-
- if (!pedited->icm.outputProfileVersion) {
- wprofile->set_active_text(M("GENERAL_UNCHANGED"));
- }
-
- if (!pedited->icm.outputIlluminant) {
- oIlluminant->set_active_text(M("GENERAL_UNCHANGED"));
- }
-
if (!pedited->icm.workingTRC) {
wTRC->set_active_text(M("GENERAL_UNCHANGED"));
}
- oGamma->setEditedState(pedited->icm.workingTRCGamma ? Edited : UnEdited);
- oSlope->setEditedState(pedited->icm.workingTRCSlope ? Edited : UnEdited);
- primariesRedX->setEditedState(pedited->icm.redPrimaryX ? Edited : UnEdited);
- primariesRedY->setEditedState(pedited->icm.redPrimaryY ? Edited : UnEdited);
- primariesGreenX->setEditedState(pedited->icm.greenPrimaryX ? Edited : UnEdited);
- primariesGreenY->setEditedState(pedited->icm.greenPrimaryY ? Edited : UnEdited);
- primariesBlueX->setEditedState(pedited->icm.bluePrimaryX ? Edited : UnEdited);
- primariesBlueY->setEditedState(pedited->icm.bluePrimaryY ? Edited : UnEdited);
- wGamma->setEditedState(pedited->icm.outputGamma ? Edited : UnEdited);
- wSlope->setEditedState(pedited->icm.outputSlope ? Edited : UnEdited);
+ wGamma->setEditedState(pedited->icm.workingTRCGamma ? Edited : UnEdited);
+ wSlope->setEditedState(pedited->icm.workingTRCSlope ? Edited : UnEdited);
}
@@ -920,10 +619,7 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
}
pp->icm.workingProfile = wProfNames->get_active_text();
- pp->icm.outputGammaPreset = oTRCPresets->get_active_text();
pp->icm.dcpIlluminant = rtengine::max(dcpIll->get_active_row_number(), 0);
- pp->icm.outputPimariesPreset = primaries->get_active_text();
- pp->icm.outputIlluminant = oIlluminant->get_active_text();
pp->icm.workingTRC = wTRC->get_active_text();
if (oProfNames->get_active_text() == M("TP_ICM_NOICM")) {
@@ -940,78 +636,19 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pp->icm.outputIntent = rtengine::RI_RELATIVE;
}
- if (wprofile->get_active_row_number() == 0) {
- pp->icm.outputProfileVersion = "none";
- } else if (wprofile->get_active_row_number() == 1) {
- pp->icm.outputProfileVersion = "v2";
- } else if (wprofile->get_active_row_number() == 2) {
- pp->icm.outputProfileVersion = "v4";
- }
-
- if (primaries->get_active_row_number() == 0) {
- pp->icm.outputPimariesPreset = "ACES-AP0";
- } else if (primaries->get_active_row_number() == 1) {
- pp->icm.outputPimariesPreset = "ACES-AP1";
- } else if (primaries->get_active_row_number() == 2) {
- pp->icm.outputPimariesPreset = "Adobe";
- } else if (primaries->get_active_row_number() == 3) {
- pp->icm.outputPimariesPreset = "ProPhoto";
- } else if (primaries->get_active_row_number() == 4) {
- pp->icm.outputPimariesPreset = "Rec2020";
- } else if (primaries->get_active_row_number() == 5) {
- pp->icm.outputPimariesPreset = "sRGB";
- } else if (primaries->get_active_row_number() == 6) {
- pp->icm.outputPimariesPreset = "Widegamut";
- } else if (primaries->get_active_row_number() == 7) {
- pp->icm.outputPimariesPreset = "BestRGB";
- } else if (primaries->get_active_row_number() == 8) {
- pp->icm.outputPimariesPreset = "BetaRGB";
- } else if (primaries->get_active_row_number() == 9) {
- pp->icm.outputPimariesPreset = "BruceRGB";
- } else if (primaries->get_active_row_number() == 10) {
- pp->icm.outputPimariesPreset = "pfree";
- }
-
- if (oIlluminant->get_active_row_number() == 0) {
- pp->icm.outputIlluminant = "DEF";
- } else if (oIlluminant->get_active_row_number() == 1) {
- pp->icm.outputIlluminant = "D41";
- } else if (oIlluminant->get_active_row_number() == 2) {
- pp->icm.outputIlluminant = "D50";
- } else if (oIlluminant->get_active_row_number() == 3) {
- pp->icm.outputIlluminant = "D55";
- } else if (oIlluminant->get_active_row_number() == 4) {
- pp->icm.outputIlluminant = "D60";
- } else if (oIlluminant->get_active_row_number() == 5) {
- pp->icm.outputIlluminant = "D65";
- } else if (oIlluminant->get_active_row_number() == 6) {
- pp->icm.outputIlluminant = "D80";
- } else if (oIlluminant->get_active_row_number() == 7) {
- pp->icm.outputIlluminant = "stdA";
- }
-
if (wTRC->get_active_row_number() == 0) {
pp->icm.workingTRC = "none";
} else if (wTRC->get_active_row_number() == 1) {
pp->icm.workingTRC = "Custom";
}
- pp->icm.customOutputProfile = customOutProfile->get_active();
pp->icm.toneCurve = ckbToneCurve->get_active();
pp->icm.applyLookTable = ckbApplyLookTable->get_active();
pp->icm.applyBaselineExposureOffset = ckbApplyBaselineExposureOffset->get_active();
pp->icm.applyHueSatMap = ckbApplyHueSatMap->get_active();
- pp->icm.workingTRCGamma = (double) oGamma->getValue();
- pp->icm.workingTRCSlope = (double) oSlope->getValue();
pp->icm.outputBPC = obpc->get_active();
- pp->icm.redPrimaryX = (double) primariesRedX->getValue();
- pp->icm.redPrimaryY = (double) primariesRedY->getValue();
- pp->icm.greenPrimaryX = (double) primariesGreenX->getValue();
- pp->icm.greenPrimaryY = (double) primariesGreenY->getValue();
- pp->icm.bluePrimaryX = (double) primariesBlueX->getValue();
- pp->icm.bluePrimaryY = (double) primariesBlueY->getValue();
- pp->icm.outputGamma = (double) wGamma->getValue();
- pp->icm.outputSlope = (double) wSlope->getValue();
+ pp->icm.workingTRCGamma = (double) wGamma->getValue();
+ pp->icm.workingTRCSlope = (double) wSlope->getValue();
if (pedited) {
pedited->icm.inputProfile = !iunchanged->get_active();
@@ -1024,98 +661,30 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pedited->icm.applyLookTable = !ckbApplyLookTable->get_inconsistent();
pedited->icm.applyBaselineExposureOffset = !ckbApplyBaselineExposureOffset->get_inconsistent();
pedited->icm.applyHueSatMap = !ckbApplyHueSatMap->get_inconsistent();
- pedited->icm.outputGammaPreset = oTRCPresets->get_active_text() != M("GENERAL_UNCHANGED");
- pedited->icm.customOutputProfile = !customOutProfile->get_inconsistent();
- pedited->icm.workingTRCGamma = oGamma->getEditedState();
- pedited->icm.workingTRCSlope = oSlope->getEditedState();
- pedited->icm.redPrimaryX = primariesRedX->getEditedState();
- pedited->icm.redPrimaryY = primariesRedY->getEditedState();
- pedited->icm.greenPrimaryX = primariesGreenX->getEditedState();
- pedited->icm.greenPrimaryY = primariesGreenY->getEditedState();
- pedited->icm.bluePrimaryX = primariesBlueX->getEditedState();
- pedited->icm.bluePrimaryY = primariesBlueY->getEditedState();
- pedited->icm.outputGamma = wGamma->getEditedState();
- pedited->icm.outputSlope = wSlope->getEditedState();
-
- pedited->icm.outputPrimariesPreset = primaries->get_active_text() != M("GENERAL_UNCHANGED");
- pedited->icm.outputProfileVersion = wprofile->get_active_text() != M("GENERAL_UNCHANGED");
- pedited->icm.outputIlluminant = oIlluminant->get_active_text() != M("GENERAL_UNCHANGED");
+ pedited->icm.workingTRCGamma = wGamma->getEditedState();
+ pedited->icm.workingTRCSlope = wSlope->getEditedState();
pedited->icm.workingTRC = wTRC->get_active_text() != M("GENERAL_UNCHANGED");
}
}
void ICMPanel::setDefaults(const ProcParams* defParams, const ParamsEdited* pedited)
{
- oGamma->setDefault(defParams->icm.workingTRCGamma);
- oSlope->setDefault(defParams->icm.workingTRCSlope);
- primariesRedX->setDefault(defParams->icm.redPrimaryX);
- primariesRedY->setDefault(defParams->icm.redPrimaryY);
- primariesGreenX->setDefault(defParams->icm.greenPrimaryX);
- primariesGreenY->setDefault(defParams->icm.greenPrimaryY);
- primariesBlueX->setDefault(defParams->icm.bluePrimaryX);
- primariesBlueY->setDefault(defParams->icm.bluePrimaryY);
- wGamma->setDefault(defParams->icm.outputGamma);
- wSlope->setDefault(defParams->icm.outputSlope);
+ wGamma->setDefault(defParams->icm.workingTRCGamma);
+ wSlope->setDefault(defParams->icm.workingTRCSlope);
if (pedited) {
- oGamma->setDefaultEditedState(pedited->icm.workingTRCGamma ? Edited : UnEdited);
- oSlope->setDefaultEditedState(pedited->icm.workingTRCSlope ? Edited : UnEdited);
- primariesRedX->setDefaultEditedState(pedited->icm.redPrimaryX ? Edited : UnEdited);
- primariesRedY->setDefaultEditedState(pedited->icm.redPrimaryY ? Edited : UnEdited);
- primariesGreenX->setDefaultEditedState(pedited->icm.greenPrimaryX ? Edited : UnEdited);
- primariesGreenY->setDefaultEditedState(pedited->icm.greenPrimaryY ? Edited : UnEdited);
- primariesBlueX->setDefaultEditedState(pedited->icm.bluePrimaryX ? Edited : UnEdited);
- primariesBlueY->setDefaultEditedState(pedited->icm.bluePrimaryY ? Edited : UnEdited);
- wGamma->setDefaultEditedState(pedited->icm.outputGamma ? Edited : UnEdited);
- wSlope->setDefaultEditedState(pedited->icm.outputSlope ? Edited : UnEdited);
+ wGamma->setDefaultEditedState(pedited->icm.workingTRCGamma ? Edited : UnEdited);
+ wSlope->setDefaultEditedState(pedited->icm.workingTRCSlope ? Edited : UnEdited);
} else {
- oGamma->setDefaultEditedState(Irrelevant);
- oSlope->setDefaultEditedState(Irrelevant);
- primariesRedX->setDefaultEditedState(Irrelevant);
- primariesRedY->setDefaultEditedState(Irrelevant);
- primariesGreenX->setDefaultEditedState(Irrelevant);
- primariesGreenY->setDefaultEditedState(Irrelevant);
- primariesBlueX->setDefaultEditedState(Irrelevant);
- primariesBlueY->setDefaultEditedState(Irrelevant);
wGamma->setDefaultEditedState(Irrelevant);
wSlope->setDefaultEditedState(Irrelevant);
}
}
-void ICMPanel::setAdjusterBehavior(bool gammaadd, bool slopeadd)
-{
- oGamma->setAddMode(gammaadd);
- oSlope->setAddMode(slopeadd);
-}
-
void ICMPanel::adjusterChanged(Adjuster* a, double newval)
{
-
- if (listener && (customOutProfile->get_active() || batchMode)) {
-
- Glib::ustring costr = Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(2), newval);
-
- if (a == oGamma) {
- listener->panelChanged(EvGAMPOS, costr);
- } else if (a == oSlope) {
- listener->panelChanged(EvSLPOS, costr);
- } else if (a == primariesRedX) {
- listener->panelChanged(EvICMpredx, costr);
- } else if (a == primariesRedY) {
- listener->panelChanged(EvICMpredy, costr);
- } else if (a == primariesGreenX) {
- listener->panelChanged(EvICMpgrex, costr);
- } else if (a == primariesGreenY) {
- listener->panelChanged(EvICMpgrey, costr);
- } else if (a == primariesBlueX) {
- listener->panelChanged(EvICMpblux, costr);
- } else if (a == primariesBlueY) {
- listener->panelChanged(EvICMpbluy, costr);
- }
- }
-
if (listener || batchMode) {
Glib::ustring costr2 = Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(2), newval);
@@ -1130,51 +699,11 @@ void ICMPanel::adjusterChanged(Adjuster* a, double newval)
void ICMPanel::wpChanged()
{
- if (wprofile->get_active_row_number() == 2) {
- oIlluminant->set_sensitive(true);
- } else {
- oIlluminant->set_sensitive(false);
- }
-
if (listener) {
listener->panelChanged(EvWProfile, wProfNames->get_active_text());
}
}
-void ICMPanel::wprimariesChanged()
-{
- if (primaries->get_active_row_number() == 10) {
- primariesVBox->set_sensitive(true);
- } else {
- primariesVBox->set_sensitive(false);
- }
-
- if (primaries->get_active_row_number() == 10) {
- wprofile->set_active(2);
- }
-
- if (listener) {
- listener->panelChanged(EvICMprimariMethod, primaries->get_active_text());
- }
-}
-
-void ICMPanel::wtempChanged()
-{
- if (wprofile->get_active_row_number() == 2) {
- oIlluminant->set_sensitive(true);
- } else {
- oIlluminant->set_sensitive(false);
- }
-
- if (oIlluminant->get_active_row_number() != 0) {
- wprofile->set_active(2);
- }
-
- if (listener) {
- listener->panelChanged(EvICMtempMethod, oIlluminant->get_active_text());
- }
-}
-
void ICMPanel::wtrcinChanged()
{
if (wTRC->get_active_row_number() == 0) {
@@ -1191,40 +720,6 @@ void ICMPanel::wtrcinChanged()
}
}
-void ICMPanel::wprofileChanged()
-{
- if (wprofile->get_active_row_number() == 2) {
- oIlluminant->set_sensitive(true);
- } else {
- oIlluminant->set_sensitive(false);
- }
-
- if (oIlluminant->get_active_row_number() != 0) {
- wprofile->set_active(2);
- }
-
- if (listener) {
- listener->panelChanged(EvICMprofileMethod, wprofile->get_active_text());
-
- }
-}
-
-void ICMPanel::gpChanged()
-{
- if (oTRCPresets->get_active_row_number() == 0) {
- oGamma->set_sensitive(true);
- oSlope->set_sensitive(true);
- } else {
- oGamma->set_sensitive(false);
- oSlope->set_sensitive(false);
- }
-
- if (listener) {
- listener->panelChanged(EvGAMMA, oTRCPresets->get_active_text());
- oProfNames->set_sensitive(oTRCPresets->get_active_row_number() == 0);
- }
-}
-
void ICMPanel::dcpIlluminantChanged()
{
if (listener) {
@@ -1336,19 +831,6 @@ void ICMPanel::applyHueSatMapChanged()
}
}
-void ICMPanel::TRCChanged(double gamm, double slo)
-{
- GThreadLock lock;
- disableListener();
- setEnabled(true);
- oGamma->setValue(gamm);
- oSlope->setValue(slo);
- oGamma->setDefault(gamm);
- oSlope->setDefault(slo);
- enableListener();
-}
-
-
void ICMPanel::ipChanged()
{
@@ -1375,111 +857,6 @@ void ICMPanel::ipChanged()
oldip = profname;
}
-void ICMPanel::GamChanged()
-{
-
- if (wprofile->get_active_row_number() == 2) {
- oIlluminant->set_sensitive(true);
- } else {
- oIlluminant->set_sensitive(false);
- }
-
- if (multiImage) {
- if (customOutProfile->get_inconsistent()) {
- customOutProfile->set_inconsistent(false);
- coprofconn.block(true);
- customOutProfile->set_active(false);
- coprofconn.block(false);
- } else if (lastCustomOutputProfile) {
- customOutProfile->set_inconsistent(true);
- }
-
- lastCustomOutputProfile = customOutProfile->get_active();
- }
-
- if (listener) {
- if (customOutProfile->get_inconsistent()) {
- listener->panelChanged(EvGAMFREE, M("GENERAL_UNCHANGED"));
- } else if (customOutProfile->get_active()) {
- listener->panelChanged(EvGAMFREE, M("GENERAL_ENABLED"));
-
- if (!batchMode) {
- oProfNames->set_sensitive(false);//disabled choice
- oTRCPresets->show();
- oGamma->show();
- oSlope->show();
- primaries->show();
- wprofile->show();
- oIlluminant->show();
-
- oTRCPresets->set_sensitive(true);
- oGamma->set_sensitive(true);
- oSlope->set_sensitive(true);
- primaries->set_sensitive(true);
- wprofile->set_sensitive(true);
-
- //wtemp->set_sensitive(true);
- if (wprofile->get_active_row_number() == 2) {
- oIlluminant->set_sensitive(true);
- }
- primariesHBox->show();
- primariesVBox->show();
-
- primariesHBox->set_sensitive(true);
- if (primaries->get_active_row_number() == 10) {
- primariesVBox->set_sensitive(true);
- } else {
- primariesVBox->set_sensitive(false);
- }
- oTRCPresetsHBox->show();
- profHBox->show();
- oIllHBox->show();
-
- oTRCPresetsHBox->set_sensitive(true);
- profHBox->set_sensitive(true);
- oIllHBox->set_sensitive(true);
- }
- } else {
- listener->panelChanged(EvGAMFREE, M("GENERAL_DISABLED"));
-
- if (!batchMode) {
- oProfNames->set_sensitive(true);
- oTRCPresets->hide();
- oGamma->hide();
- oSlope->hide();
- primaries->hide();
- wprofile->hide();
- oIlluminant->hide();
-
- oTRCPresets->set_sensitive(false);
- oGamma->set_sensitive(false);
- oSlope->set_sensitive(false);
- primaries->set_sensitive(false);
- wprofile->set_sensitive(false);
-
- if (wprofile->get_active_row_number() != 2) {
- oIlluminant->set_sensitive(false);
- }
- primariesHBox->hide();
- primariesVBox->hide();
-
- oTRCPresetsHBox->hide();
- profHBox->hide();
- oIllHBox->hide();
-
- primariesHBox->set_sensitive(false);
- primariesVBox->set_sensitive(false);
-
- oTRCPresetsHBox->set_sensitive(false);
- profHBox->set_sensitive(false);
- oIllHBox->set_sensitive(false);
-
-
- }
- }
- }
-}
-
void ICMPanel::opChanged()
{
if (!batchMode) {
@@ -1650,14 +1027,8 @@ void ICMPanel::setBatchMode(bool batchMode)
oRendIntent->addEntry("unchanged-22.png", M("GENERAL_UNCHANGED"));
oRendIntent->show();
wProfNames->append(M("GENERAL_UNCHANGED"));
- oTRCPresets->append(M("GENERAL_UNCHANGED"));
- primaries->append(M("GENERAL_UNCHANGED"));
- wprofile->append(M("GENERAL_UNCHANGED"));
- oIlluminant->append(M("GENERAL_UNCHANGED"));
wTRC->append(M("GENERAL_UNCHANGED"));
dcpIll->append(M("GENERAL_UNCHANGED"));
- oGamma->showEditedCB();
- oSlope->showEditedCB();
wGamma->showEditedCB();
wSlope->showEditedCB();
}
diff --git a/rtgui/icmpanel.h b/rtgui/icmpanel.h
index 329e00029..e04a4397e 100644
--- a/rtgui/icmpanel.h
+++ b/rtgui/icmpanel.h
@@ -39,22 +39,13 @@ public:
class ICMPanel :
public ToolParamBlock,
public AdjusterListener,
- public FoldableToolPanel,
- public rtengine::ICMListener
+ public FoldableToolPanel
{
protected:
- Gtk::Frame* dcpFrame;
- Gtk::Frame* coipFrame;
-
- Adjuster* oGamma;
- Adjuster* oSlope;
- Adjuster* primariesRedX;
- Adjuster* primariesRedY;
- Adjuster* primariesGreenX;
- Adjuster* primariesGreenY;
- Adjuster* primariesBlueX;
- Adjuster* primariesBlueY;
+ Gtk::Frame* dcpFrame;
+ Gtk::Frame* coipFrame;
+
Adjuster* wGamma;
Adjuster* wSlope;
@@ -62,8 +53,6 @@ protected:
Gtk::HBox* gabox;
- bool lastCustomOutputProfile;
- sigc::connection coprofconn;
//bool freegamma;
bool lastToneCurve;
sigc::connection tcurveconn;
@@ -91,57 +80,39 @@ private:
rtengine::ProcEvent EvICMslop;
rtengine::ProcEvent EvICMtrcinMethod;
- Gtk::VBox * iVBox;
- Gtk::HBox* primariesHBox;
- Gtk::HBox* oTRCPresetsHBox;
- Gtk::HBox* profHBox;
- Gtk::HBox* oIllHBox;
- Gtk::VBox* primariesVBox;
+ Gtk::VBox* iVBox;
Gtk::HBox* wTRCHBox;
- Gtk::HBox* priGreenHBox;
- Gtk::HBox* priBlueHBox;
- Gtk::HBox* oTRCHBox;
- Gtk::HBox* priRedHBox;
- Gtk::CheckButton* obpc;
- Gtk::CheckButton* customOutProfile;
- Gtk::RadioButton* inone;
+ Gtk::CheckButton* obpc;
+ Gtk::RadioButton* inone;
- Gtk::RadioButton* iembedded;
- Gtk::RadioButton* icamera;
- Gtk::RadioButton* icameraICC;
- Gtk::RadioButton* ifromfile;
- Gtk::Label* dcpIllLabel;
- MyComboBoxText* dcpIll;
- sigc::connection dcpillconn;
- Gtk::CheckButton* ckbToneCurve;
- Gtk::CheckButton* ckbApplyLookTable;
- Gtk::CheckButton* ckbApplyBaselineExposureOffset;
- Gtk::CheckButton* ckbApplyHueSatMap;
- MyComboBoxText* wProfNames;
- sigc::connection wprofnamesconn;
- MyComboBoxText* oTRCPresets;
- sigc::connection otrcconn;
- MyComboBoxText* primaries;
- sigc::connection primariesconn;
- MyComboBoxText* wprofile;
- sigc::connection wprofileconn;
- MyComboBoxText* oIlluminant;
- sigc::connection oillconn;
- MyComboBoxText* wTRC;
- sigc::connection wtrcconn;
+ Gtk::RadioButton* iembedded;
+ Gtk::RadioButton* icamera;
+ Gtk::RadioButton* icameraICC;
+ Gtk::RadioButton* ifromfile;
+ Gtk::Label* dcpIllLabel;
+ MyComboBoxText* dcpIll;
+ sigc::connection dcpillconn;
+ Gtk::CheckButton* ckbToneCurve;
+ Gtk::CheckButton* ckbApplyLookTable;
+ Gtk::CheckButton* ckbApplyBaselineExposureOffset;
+ Gtk::CheckButton* ckbApplyHueSatMap;
+ MyComboBoxText* wProfNames;
+ sigc::connection wprofnamesconn;
+ MyComboBoxText* wTRC;
+ sigc::connection wtrcconn;
- MyComboBoxText* oProfNames;
- sigc::connection oprofnamesconn;
- std::unique_ptr oRendIntent;
- sigc::connection orendintentconn;
- Gtk::RadioButton* iunchanged;
+ MyComboBoxText* oProfNames;
+ sigc::connection oprofnamesconn;
+ std::unique_ptr oRendIntent;
+ sigc::connection orendintentconn;
+ Gtk::RadioButton* iunchanged;
MyFileChooserButton* ipDialog;
Gtk::RadioButton::Group opts;
- Gtk::Button* saveRef;
- sigc::connection ipc;
- Glib::ustring oldip;
- ICMPanelListener* icmplistener;
+ Gtk::Button* saveRef;
+ sigc::connection ipc;
+ Glib::ustring oldip;
+ ICMPanelListener* icmplistener;
double dcpTemperatures[2];
Glib::ustring lastRefFilename;
@@ -156,26 +127,19 @@ public:
void setBatchMode(bool batchMode);
void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr);
void adjusterChanged(Adjuster* a, double newval);
- void setAdjusterBehavior(bool gammaadd, bool slopeadd);
void wpChanged();
- void wprimariesChanged();
- void wprofileChanged();
- void wtempChanged();
void wtrcinChanged();
void opChanged();
void oiChanged(int n);
void oBPCChanged();
void ipChanged();
- void gpChanged();
- void GamChanged();
void ipSelectionChanged();
void dcpIlluminantChanged();
void toneCurveChanged();
void applyLookTableChanged();
void applyBaselineExposureOffsetChanged();
void applyHueSatMapChanged();
- void TRCChanged(double gamm, double slo);
void setRawMeta(bool raw, const rtengine::FramesData* pMeta);
void saveReferencePressed();
diff --git a/rtgui/options.cc b/rtgui/options.cc
index 7971ad3cc..0945bc5b6 100644
--- a/rtgui/options.cc
+++ b/rtgui/options.cc
@@ -198,6 +198,9 @@ void Options::updatePaths()
lastBWCurvesDir = preferredPath;
}
+ if (lastICCProfCreatorDir.empty() || !Glib::file_test(lastICCProfCreatorDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test(lastICCProfCreatorDir, Glib::FILE_TEST_IS_DIR)) {
+ lastICCProfCreatorDir = preferredPath;
+ }
}
Glib::ustring Options::getPreferredProfilePath()
@@ -440,6 +443,19 @@ void Options::setDefaults()
menuGroupProfileOperations = true;
menuGroupExtProg = true;
+ ICCPC_primariesPreset = "sRGB",
+ ICCPC_redPrimaryX = 0.6400;
+ ICCPC_redPrimaryY = 0.3300;
+ ICCPC_greenPrimaryX = 0.3000;
+ ICCPC_greenPrimaryY = 0.6000;
+ ICCPC_bluePrimaryX = 0.1500;
+ ICCPC_bluePrimaryY = 0.0600;
+ ICCPC_gammaPreset = "Custom";
+ ICCPC_gamma = 2.4;
+ ICCPC_slope = 12.92;
+ ICCPC_profileVersion = "v4";
+ ICCPC_illuminant = "DEF";
+
fastexport_bypass_sharpening = true;
fastexport_bypass_sharpenEdge = true;
fastexport_bypass_sharpenMicro = true;
@@ -466,7 +482,6 @@ void Options::setDefaults()
fastexport_icm_output_profile = "RT_sRGB";
fastexport_icm_outputIntent = rtengine::RI_RELATIVE;
fastexport_icm_outputBPC = true;
- fastexport_icm_custom_output_profile = "Custom";
fastexport_resize_enabled = true;
fastexport_resize_scale = 1;
fastexport_resize_appliesTo = "Cropped area";
@@ -588,6 +603,7 @@ void Options::setDefaults()
lastProfilingReferenceDir = "";
lastBWCurvesDir = "";
lastLensProfileDir = "";
+ lastICCProfCreatorDir = "";
gimpPluginShowInfoDialog = true;
maxRecentFolders = 15;
rtSettings.lensfunDbDirectory = ""; // set also in main.cc and main-cli.cc
@@ -1473,6 +1489,14 @@ void Options::readFromFile(Glib::ustring fname)
rtSettings.bruce = keyFile.get_string("Color Management", "Bruce");
}
+ if (keyFile.has_key("Color Management", "ACES-AP0")) {
+ rtSettings.ACESp0 = keyFile.get_string("Color Management", "ACES-AP0");
+ }
+
+ if (keyFile.has_key("Color Management", "ACES-AP1")) {
+ rtSettings.ACESp1 = keyFile.get_string("Color Management", "ACES-AP1");
+ }
+
if (keyFile.has_key("Color Management", "GamutLch")) {
rtSettings.gamutLch = keyFile.get_boolean("Color Management", "GamutLch");
}
@@ -1497,6 +1521,45 @@ void Options::readFromFile(Glib::ustring fname)
}
+ if (keyFile.has_group("ICC Profile Creator")) {
+ if (keyFile.has_key("ICC Profile Creator", "PimariesPreset")) {
+ ICCPC_primariesPreset = keyFile.get_string("ICC Profile Creator", "PimariesPreset");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "RedPrimaryX")) {
+ ICCPC_redPrimaryX = keyFile.get_double("ICC Profile Creator", "RedPrimaryX");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "RedPrimaryY")) {
+ ICCPC_redPrimaryY = keyFile.get_double("ICC Profile Creator", "RedPrimaryY");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "GreenPrimaryX")) {
+ ICCPC_greenPrimaryX = keyFile.get_double("ICC Profile Creator", "GreenPrimaryX");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "GreenPrimaryY")) {
+ ICCPC_greenPrimaryY = keyFile.get_double("ICC Profile Creator", "GreenPrimaryY");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "BluePrimaryX")) {
+ ICCPC_bluePrimaryX = keyFile.get_double("ICC Profile Creator", "BluePrimaryX");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "BluePrimaryY")) {
+ ICCPC_bluePrimaryY = keyFile.get_double("ICC Profile Creator", "BluePrimaryY");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "GammaPreset")) {
+ ICCPC_gammaPreset = keyFile.get_string("ICC Profile Creator", "GammaPreset");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "Gamma")) {
+ ICCPC_gamma = keyFile.get_double("ICC Profile Creator", "Gamma");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "Slope")) {
+ ICCPC_slope = keyFile.get_double("ICC Profile Creator", "Slope");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "ProfileVersion")) {
+ ICCPC_profileVersion = keyFile.get_string("ICC Profile Creator", "ProfileVersion");
+ }
+ if (keyFile.has_key("ICC Profile Creator", "Illuminant")) {
+ ICCPC_illuminant = keyFile.get_string("ICC Profile Creator", "Illuminant");
+ }
+ }
+
if (keyFile.has_group("Batch Processing")) {
if (keyFile.has_key("Batch Processing", "AdjusterBehavior")) {
baBehav = keyFile.get_integer_list("Batch Processing", "AdjusterBehavior");
@@ -1641,10 +1704,6 @@ void Options::readFromFile(Glib::ustring fname)
fastexport_icm_outputBPC = keyFile.get_boolean("Fast Export", "fastexport_icm_output_bpc");
}
- if (keyFile.has_key("Fast Export", "fastexport_icm_gamma")) {
- fastexport_icm_custom_output_profile = keyFile.get_string("Fast Export", "fastexport_icm_gamma");
- }
-
if (keyFile.has_key("Fast Export", "fastexport_resize_enabled")) {
fastexport_resize_enabled = keyFile.get_boolean("Fast Export", "fastexport_resize_enabled");
}
@@ -1695,6 +1754,7 @@ void Options::readFromFile(Glib::ustring fname)
safeDirGet(keyFile, "Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir);
safeDirGet(keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir);
safeDirGet(keyFile, "Dialogs", "LastLensProfileDir", lastLensProfileDir);
+ safeDirGet(keyFile, "Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir);
if (keyFile.has_key("Dialogs", "GimpPluginShowInfoDialog")) {
gimpPluginShowInfoDialog = keyFile.get_boolean("Dialogs", "GimpPluginShowInfoDialog");
@@ -1987,6 +2047,8 @@ void Options::saveToFile(Glib::ustring fname)
keyFile.set_string("Color Management", "Best", rtSettings.best);
keyFile.set_string("Color Management", "Rec2020", rtSettings.rec2020);
keyFile.set_string("Color Management", "Bruce", rtSettings.bruce);
+ keyFile.set_string("Color Management", "ACES-AP0", rtSettings.ACESp0);
+ keyFile.set_string("Color Management", "ACES-AP1", rtSettings.ACESp1);
keyFile.set_integer("Color Management", "WhiteBalanceSpotSize", whiteBalanceSpotSize);
keyFile.set_boolean("Color Management", "GamutICC", rtSettings.gamutICC);
keyFile.set_boolean("Color Management", "GamutLch", rtSettings.gamutLch);
@@ -2002,6 +2064,18 @@ void Options::saveToFile(Glib::ustring fname)
//keyFile.set_double ("Color Management", "Decaction", rtSettings.decaction);
keyFile.set_string("Color Management", "ClutsDirectory", clutsDir);
+ keyFile.set_string("ICC Profile Creator", "PimariesPreset", ICCPC_primariesPreset);
+ keyFile.set_double("ICC Profile Creator", "RedPrimaryX", ICCPC_redPrimaryX);
+ keyFile.set_double("ICC Profile Creator", "RedPrimaryY", ICCPC_redPrimaryY);
+ keyFile.set_double("ICC Profile Creator", "GreenPrimaryX", ICCPC_greenPrimaryX);
+ keyFile.set_double("ICC Profile Creator", "GreenPrimaryY", ICCPC_greenPrimaryY);
+ keyFile.set_double("ICC Profile Creator", "BluePrimaryX", ICCPC_bluePrimaryX);
+ keyFile.set_double("ICC Profile Creator", "BluePrimaryY", ICCPC_bluePrimaryY);
+ keyFile.set_string("ICC Profile Creator", "GammaPreset", ICCPC_gammaPreset);
+ keyFile.set_double("ICC Profile Creator", "Gamma", ICCPC_gamma);
+ keyFile.set_double("ICC Profile Creator", "Slope", ICCPC_slope);
+ keyFile.set_string("ICC Profile Creator", "ProfileVersion", ICCPC_profileVersion);
+ keyFile.set_string("ICC Profile Creator", "Illuminant", ICCPC_illuminant);
Glib::ArrayHandle bab = baBehav;
keyFile.set_integer_list("Batch Processing", "AdjusterBehavior", bab);
@@ -2038,7 +2112,6 @@ void Options::saveToFile(Glib::ustring fname)
keyFile.set_string("Fast Export", "fastexport_icm_output", fastexport_icm_output_profile);
keyFile.set_integer("Fast Export", "fastexport_icm_output_intent", fastexport_icm_outputIntent);
keyFile.set_boolean("Fast Export", "fastexport_icm_output_bpc", fastexport_icm_outputBPC);
- keyFile.set_string("Fast Export", "fastexport_icm_gamma", fastexport_icm_custom_output_profile);
keyFile.set_boolean("Fast Export", "fastexport_resize_enabled", fastexport_resize_enabled);
keyFile.set_double("Fast Export", "fastexport_resize_scale", fastexport_resize_scale);
keyFile.set_string("Fast Export", "fastexport_resize_appliesTo", fastexport_resize_appliesTo);
@@ -2063,6 +2136,7 @@ void Options::saveToFile(Glib::ustring fname)
keyFile.set_string("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir);
keyFile.set_string("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir);
keyFile.set_string("Dialogs", "LastLensProfileDir", lastLensProfileDir);
+ keyFile.set_string("Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir);
keyFile.set_boolean("Dialogs", "GimpPluginShowInfoDialog", gimpPluginShowInfoDialog);
keyFile.set_string("Lensfun", "DBDirectory", rtSettings.lensfunDbDirectory);
diff --git a/rtgui/options.h b/rtgui/options.h
index 8d736dc3d..fe4539333 100644
--- a/rtgui/options.h
+++ b/rtgui/options.h
@@ -287,6 +287,20 @@ public:
bool menuGroupProfileOperations;
bool menuGroupExtProg;
+ // ICC Profile Creator
+ Glib::ustring ICCPC_primariesPreset;
+ double ICCPC_redPrimaryX;
+ double ICCPC_redPrimaryY;
+ double ICCPC_greenPrimaryX;
+ double ICCPC_greenPrimaryY;
+ double ICCPC_bluePrimaryX;
+ double ICCPC_bluePrimaryY;
+ Glib::ustring ICCPC_gammaPreset;
+ double ICCPC_gamma;
+ double ICCPC_slope;
+ Glib::ustring ICCPC_profileVersion;
+ Glib::ustring ICCPC_illuminant;
+
// fast export options
bool fastexport_bypass_sharpening;
bool fastexport_bypass_sharpenEdge;
@@ -341,6 +355,7 @@ public:
Glib::ustring lastProfilingReferenceDir;
Glib::ustring lastBWCurvesDir;
Glib::ustring lastLensProfileDir;
+ Glib::ustring lastICCProfCreatorDir;
bool gimpPluginShowInfoDialog;
size_t maxRecentFolders; // max. number of recent folders stored in options file
diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc
index 6e78cd793..ce9545a83 100644
--- a/rtgui/paramsedited.cc
+++ b/rtgui/paramsedited.cc
@@ -387,21 +387,8 @@ void ParamsEdited::set(bool v)
icm.outputProfile = v;
icm.outputIntent = v;
icm.outputBPC = v;
- icm.outputGammaPreset = v;
- icm.customOutputProfile = v;
icm.workingTRCGamma = v;
icm.workingTRCSlope = v;
- icm.redPrimaryX = v;
- icm.redPrimaryY = v;
- icm.greenPrimaryX = v;
- icm.greenPrimaryY = v;
- icm.bluePrimaryX = v;
- icm.bluePrimaryY = v;
- icm.outputGamma = v;
- icm.outputSlope = v;
- icm.outputPrimariesPreset = v;
- icm.outputProfileVersion = v;
- icm.outputIlluminant = v;
icm.workingTRC = v;
raw.bayersensor.method = v;
raw.bayersensor.imageNum = v;
@@ -950,21 +937,8 @@ void ParamsEdited::initFrom(const std::vector&
icm.outputProfile = icm.outputProfile && p.icm.outputProfile == other.icm.outputProfile;
icm.outputIntent = icm.outputIntent && p.icm.outputIntent == other.icm.outputIntent;
icm.outputBPC = icm.outputBPC && p.icm.outputBPC == other.icm.outputBPC ;
- icm.outputGammaPreset = icm.outputGammaPreset && p.icm.outputGammaPreset == other.icm.outputGammaPreset;
- icm.customOutputProfile = icm.customOutputProfile && p.icm.customOutputProfile == other.icm.customOutputProfile;
icm.workingTRCGamma = icm.workingTRCGamma && p.icm.workingTRCGamma == other.icm.workingTRCGamma;
icm.workingTRCSlope = icm.workingTRCSlope && p.icm.workingTRCSlope == other.icm.workingTRCSlope;
- icm.redPrimaryX = icm.redPrimaryX && p.icm.redPrimaryX == other.icm.redPrimaryX;
- icm.redPrimaryY = icm.redPrimaryY && p.icm.redPrimaryY == other.icm.redPrimaryY;
- icm.greenPrimaryX = icm.greenPrimaryX && p.icm.greenPrimaryX == other.icm.greenPrimaryX;
- icm.greenPrimaryY = icm.greenPrimaryY && p.icm.greenPrimaryY == other.icm.greenPrimaryY;
- icm.bluePrimaryX = icm.bluePrimaryX && p.icm.bluePrimaryX == other.icm.bluePrimaryX;
- icm.bluePrimaryY = icm.bluePrimaryY && p.icm.bluePrimaryY == other.icm.bluePrimaryY;
- icm.outputGamma = icm.outputGamma && p.icm.outputGamma == other.icm.outputGamma;
- icm.outputSlope = icm.outputSlope && p.icm.outputSlope == other.icm.outputSlope;
- icm.outputPrimariesPreset = icm.outputPrimariesPreset && p.icm.outputPimariesPreset == other.icm.outputPimariesPreset;
- icm.outputProfileVersion = icm.outputProfileVersion && p.icm.outputProfileVersion == other.icm.outputProfileVersion;
- icm.outputIlluminant = icm.outputIlluminant && p.icm.outputIlluminant == other.icm.outputIlluminant;
icm.workingTRC = icm.workingTRC && p.icm.workingTRC == other.icm.workingTRC;
raw.bayersensor.method = raw.bayersensor.method && p.raw.bayersensor.method == other.raw.bayersensor.method;
raw.bayersensor.imageNum = raw.bayersensor.imageNum && p.raw.bayersensor.imageNum == other.raw.bayersensor.imageNum;
@@ -2471,69 +2445,17 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
}
if (icm.workingTRCGamma) {
- toEdit.icm.workingTRCGamma = dontforceSet && options.baBehav[ADDSET_FREE_OUPUT_GAMMA] ? toEdit.icm.workingTRCGamma + mods.icm.workingTRCGamma : mods.icm.workingTRCGamma;
+ toEdit.icm.workingTRCGamma = mods.icm.workingTRCGamma;
}
if (icm.workingTRCSlope) {
- toEdit.icm.workingTRCSlope = dontforceSet && options.baBehav[ADDSET_FREE_OUTPUT_SLOPE] ? toEdit.icm.workingTRCSlope + mods.icm.workingTRCSlope : mods.icm.workingTRCSlope;
- }
-
- if (icm.outputGamma) {
- toEdit.icm.outputGamma = mods.icm.outputGamma;
- }
-
- if (icm.outputSlope) {
- toEdit.icm.outputSlope = mods.icm.outputSlope;
- }
-
- if (icm.redPrimaryX) {
- toEdit.icm.redPrimaryX = mods.icm.redPrimaryX;
- }
-
- if (icm.redPrimaryY) {
- toEdit.icm.redPrimaryY = mods.icm.redPrimaryY;
- }
-
- if (icm.greenPrimaryX) {
- toEdit.icm.greenPrimaryX = mods.icm.greenPrimaryX;
- }
-
- if (icm.greenPrimaryY) {
- toEdit.icm.greenPrimaryY = mods.icm.greenPrimaryY;
- }
-
- if (icm.bluePrimaryX) {
- toEdit.icm.bluePrimaryX = mods.icm.bluePrimaryX;
- }
-
- if (icm.bluePrimaryY) {
- toEdit.icm.bluePrimaryY = mods.icm.bluePrimaryY;
- }
-
- if (icm.outputGammaPreset) {
- toEdit.icm.outputGammaPreset = mods.icm.outputGammaPreset;
- }
-
- if (icm.outputPrimariesPreset) {
- toEdit.icm.outputPimariesPreset = mods.icm.outputPimariesPreset;
- }
-
- if (icm.outputProfileVersion) {
- toEdit.icm.outputProfileVersion = mods.icm.outputProfileVersion;
- }
-
- if (icm.outputIlluminant) {
- toEdit.icm.outputIlluminant = mods.icm.outputIlluminant;
+ toEdit.icm.workingTRCSlope = mods.icm.workingTRCSlope;
}
if (icm.workingTRC) {
toEdit.icm.workingTRC = mods.icm.workingTRC;
}
- if (icm.customOutputProfile) {
- toEdit.icm.customOutputProfile = mods.icm.customOutputProfile;
- }
-
if (raw.bayersensor.method) {
toEdit.raw.bayersensor.method = mods.raw.bayersensor.method;
}
diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h
index c91408a31..bfb8bc702 100644
--- a/rtgui/paramsedited.h
+++ b/rtgui/paramsedited.h
@@ -592,20 +592,6 @@ public:
bool outputProfile;
bool outputIntent;
bool outputBPC;
-
- bool customOutputProfile;
- bool outputPrimariesPreset;
- bool redPrimaryX;
- bool redPrimaryY;
- bool greenPrimaryX;
- bool greenPrimaryY;
- bool bluePrimaryX;
- bool bluePrimaryY;
- bool outputGammaPreset;
- bool outputGamma;
- bool outputSlope;
- bool outputProfileVersion;
- bool outputIlluminant;
};
class WaveletParamsEdited
{
diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc
index 623cb25d5..b7532365b 100644
--- a/rtgui/preferences.cc
+++ b/rtgui/preferences.cc
@@ -292,8 +292,6 @@ Gtk::Widget* Preferences::getBatchProcPanel ()
mi = behModel->append ();
mi->set_value (behavColumns.label, M ("TP_GAMMA_OUTPUT"));
- appendBehavList (mi, M ("TP_GAMMA_CURV"), ADDSET_FREE_OUPUT_GAMMA, false);
- appendBehavList (mi, M ("TP_GAMMA_SLOP"), ADDSET_FREE_OUTPUT_SLOPE, false);
mi = behModel->append ();
mi->set_value (behavColumns.label, M ("TP_CHMIXER_LABEL"));
diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc
index 0a8140955..5a312ace7 100644
--- a/rtgui/rtwindow.cc
+++ b/rtgui/rtwindow.cc
@@ -21,6 +21,7 @@
#include "rtwindow.h"
#include "options.h"
#include "preferences.h"
+#include "iccprofilecreator.h"
#include "cursormanager.h"
#include "rtimage.h"
#include "whitebalance.h"
@@ -228,6 +229,12 @@ RTWindow::RTWindow ()
iFullscreen = new RTImage ("fullscreen.png");
iFullscreen_exit = new RTImage ("fullscreen-exit.png");
+ Gtk::Button* iccProfileCreator = Gtk::manage (new Gtk::Button ());
+ setExpandAlignProperties (iccProfileCreator, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
+ iccProfileCreator->set_image (*Gtk::manage (new RTImage ("gamut-plus.png")));
+ iccProfileCreator->set_tooltip_markup (M ("MAIN_BUTTON_ICCPROFCREATOR"));
+ iccProfileCreator->signal_clicked().connect ( sigc::mem_fun (*this, &RTWindow::showICCProfileCreator) );
+
//Gtk::LinkButton* rtWeb = Gtk::manage (new Gtk::LinkButton ("http://rawtherapee.com")); // unused... but fail to be linked anyway !?
//Gtk::Button* preferences = Gtk::manage (new Gtk::Button (M("MAIN_BUTTON_PREFERENCES")+"..."));
Gtk::Button* preferences = Gtk::manage (new Gtk::Button ());
@@ -256,6 +263,7 @@ RTWindow::RTWindow ()
prProgBar.set_inverted (true);
actionGrid->set_orientation (Gtk::ORIENTATION_VERTICAL);
actionGrid->attach_next_to (prProgBar, Gtk::POS_BOTTOM, 1, 1);
+ actionGrid->attach_next_to (*iccProfileCreator, Gtk::POS_BOTTOM, 1, 1);
actionGrid->attach_next_to (*preferences, Gtk::POS_BOTTOM, 1, 1);
actionGrid->attach_next_to (*btn_fullscreen, Gtk::POS_BOTTOM, 1, 1);
mainNB->set_action_widget (actionGrid, Gtk::PACK_END);
@@ -263,6 +271,7 @@ RTWindow::RTWindow ()
prProgBar.set_orientation (Gtk::ORIENTATION_HORIZONTAL);
actionGrid->set_orientation (Gtk::ORIENTATION_HORIZONTAL);
actionGrid->attach_next_to (prProgBar, Gtk::POS_RIGHT, 1, 1);
+ actionGrid->attach_next_to (*iccProfileCreator, Gtk::POS_RIGHT, 1, 1);
actionGrid->attach_next_to (*preferences, Gtk::POS_RIGHT, 1, 1);
actionGrid->attach_next_to (*btn_fullscreen, Gtk::POS_RIGHT, 1, 1);
mainNB->set_action_widget (actionGrid, Gtk::PACK_END);
@@ -747,6 +756,23 @@ void RTWindow::writeToolExpandedStatus (std::vector &tpOpen)
}
+void RTWindow::showICCProfileCreator ()
+{
+ ICCProfileCreator *iccpc = new ICCProfileCreator (this);
+ iccpc->run ();
+ delete iccpc;
+
+ fpanel->optionsChanged ();
+
+ if (epanel) {
+ epanel->defaultMonitorProfileChanged (options.rtSettings.monitorProfile, options.rtSettings.autoMonitorProfile);
+ }
+
+ for (const auto &p : epanels) {
+ p.second->defaultMonitorProfileChanged (options.rtSettings.monitorProfile, options.rtSettings.autoMonitorProfile);
+ }
+}
+
void RTWindow::showPreferences ()
{
Preferences *pref = new Preferences (this);
diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h
index e9fe51b1d..7bb818c7c 100644
--- a/rtgui/rtwindow.h
+++ b/rtgui/rtwindow.h
@@ -86,6 +86,7 @@ public:
bool on_window_state_event (GdkEventWindowState* event);
void on_mainNB_switch_page (Gtk::Widget* widget, guint page_num);
+ void showICCProfileCreator ();
void showPreferences ();
void on_realize ();
void toggle_fullscreen ();
diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc
index 951efc37f..8ed9fc6e2 100644
--- a/rtgui/toolpanelcoord.cc
+++ b/rtgui/toolpanelcoord.cc
@@ -515,7 +515,6 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool
ipc->setAutoBWListener (blackwhite);
ipc->setFrameCountListener (bayerprocess);
ipc->setAutoWBListener (whitebalance);
- ipc->setICMListener (icm);
ipc->setAutoColorTonListener (colortoning);
ipc->setAutoChromaListener (dirpyrdenoise);
ipc->setWaveletListener (wavelet);