Improvments to ICC profile creator
This commit is contained in:
parent
83975938ef
commit
c5c04769e4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -141,12 +141,15 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow)
|
|||||||
setExpandAlignProperties(trcPresets, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
|
setExpandAlignProperties(trcPresets, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
|
||||||
std::vector<Glib::ustring> outputTRCPresets;
|
std::vector<Glib::ustring> outputTRCPresets;
|
||||||
outputTRCPresets.push_back(M("ICCPROFCREATOR_CUSTOM"));
|
outputTRCPresets.push_back(M("ICCPROFCREATOR_CUSTOM"));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < sizeof(sTRCPreset) / sizeof(sTRCPreset[0]); i++) {
|
for (unsigned int i = 0; i < sizeof(sTRCPreset) / sizeof(sTRCPreset[0]); i++) {
|
||||||
outputTRCPresets.push_back(sTRCPreset[i]);
|
outputTRCPresets.push_back(sTRCPreset[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < outputTRCPresets.size(); i++) {
|
for (size_t i = 0; i < outputTRCPresets.size(); i++) {
|
||||||
trcPresets->append(outputTRCPresets[i]);
|
trcPresets->append(outputTRCPresets[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainGrid->attach(*trcPresets, 1, 2, 1, 1);
|
mainGrid->attach(*trcPresets, 1, 2, 1, 1);
|
||||||
|
|
||||||
//--------------------------------- sliders gampos and slpos
|
//--------------------------------- sliders gampos and slpos
|
||||||
@ -157,6 +160,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow)
|
|||||||
if (aGamma->delay < options.adjusterMaxDelay) {
|
if (aGamma->delay < options.adjusterMaxDelay) {
|
||||||
aGamma->delay = options.adjusterMaxDelay;
|
aGamma->delay = options.adjusterMaxDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
aGamma->show();
|
aGamma->show();
|
||||||
mainGrid->attach(*aGamma, 1, 3, 1, 1); //gamma
|
mainGrid->attach(*aGamma, 1, 3, 1, 1); //gamma
|
||||||
|
|
||||||
@ -166,6 +170,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow)
|
|||||||
if (aSlope->delay < options.adjusterMaxDelay) {
|
if (aSlope->delay < options.adjusterMaxDelay) {
|
||||||
aSlope->delay = options.adjusterMaxDelay;
|
aSlope->delay = options.adjusterMaxDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
aSlope->show();
|
aSlope->show();
|
||||||
mainGrid->attach(*aSlope, 1, 4, 1, 1); //slope
|
mainGrid->attach(*aSlope, 1, 4, 1, 1); //slope
|
||||||
|
|
||||||
@ -273,6 +278,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
trcPresets->set_active(0);
|
trcPresets->set_active(0);
|
||||||
|
|
||||||
if (gammaPreset != "Custom") {
|
if (gammaPreset != "Custom") {
|
||||||
trcPresets->set_active_text(gammaPreset);
|
trcPresets->set_active_text(gammaPreset);
|
||||||
}
|
}
|
||||||
@ -309,6 +315,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
iccVersion->set_active(0);
|
iccVersion->set_active(0);
|
||||||
|
|
||||||
if (profileVersion == "v2") {
|
if (profileVersion == "v2") {
|
||||||
iccVersion->set_active(1);
|
iccVersion->set_active(1);
|
||||||
}
|
}
|
||||||
@ -367,8 +374,7 @@ void ICCProfileCreator::adjusterChanged(Adjuster* a, double newval)
|
|||||||
{
|
{
|
||||||
if (a == aPrimariesRedX || a == aPrimariesRedY ||
|
if (a == aPrimariesRedX || a == aPrimariesRedY ||
|
||||||
a == aPrimariesGreenX || a == aPrimariesGreenY ||
|
a == aPrimariesGreenX || a == aPrimariesGreenY ||
|
||||||
a == aPrimariesBlueX || a == aPrimariesBlueY)
|
a == aPrimariesBlueX || a == aPrimariesBlueY) {
|
||||||
{
|
|
||||||
if (primaries->get_active_row_number() > 0) {
|
if (primaries->get_active_row_number() > 0) {
|
||||||
ConnectionBlocker blocker(primariesconn);
|
ConnectionBlocker blocker(primariesconn);
|
||||||
primaries->set_active(0);
|
primaries->set_active(0);
|
||||||
@ -401,6 +407,7 @@ void ICCProfileCreator::primariesChanged()
|
|||||||
aPrimariesBlueX->setValue(p[4]);
|
aPrimariesBlueX->setValue(p[4]);
|
||||||
aPrimariesBlueY->setValue(p[5]);
|
aPrimariesBlueY->setValue(p[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateICCVersion();
|
updateICCVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,6 +504,7 @@ Glib::ustring ICCProfileCreator::getPrimariesPresetName(const Glib::ustring &pre
|
|||||||
void ICCProfileCreator::getPrimaries(const Glib::ustring &preset, float *p, ColorTemp &temp)
|
void ICCProfileCreator::getPrimaries(const Glib::ustring &preset, float *p, ColorTemp &temp)
|
||||||
{
|
{
|
||||||
temp = ColorTemp::D50;
|
temp = ColorTemp::D50;
|
||||||
|
|
||||||
if (preset == "Widegamut") {
|
if (preset == "Widegamut") {
|
||||||
p[0] = 0.7350; //Widegamut primaries
|
p[0] = 0.7350; //Widegamut primaries
|
||||||
p[1] = 0.2650;
|
p[1] = 0.2650;
|
||||||
@ -595,9 +603,11 @@ void ICCProfileCreator::getPrimaries(const Glib::ustring &preset, float *p, Colo
|
|||||||
Glib::ustring ICCProfileCreator::getGammaPresetName(const Glib::ustring &preset)
|
Glib::ustring ICCProfileCreator::getGammaPresetName(const Glib::ustring &preset)
|
||||||
{
|
{
|
||||||
Glib::ustring name(trcPresets->get_active_text());
|
Glib::ustring name(trcPresets->get_active_text());
|
||||||
|
|
||||||
if (name == M("ICCPROFCREATOR_CUSTOM")) {
|
if (name == M("ICCPROFCREATOR_CUSTOM")) {
|
||||||
name = "Custom";
|
name = "Custom";
|
||||||
}
|
}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,6 +656,8 @@ void ICCProfileCreator::onResetCopyright()
|
|||||||
void ICCProfileCreator::savePressed()
|
void ICCProfileCreator::savePressed()
|
||||||
{
|
{
|
||||||
cmsHPROFILE newProfile = nullptr;
|
cmsHPROFILE newProfile = nullptr;
|
||||||
|
cmsHPROFILE profile_v2_except = nullptr;
|
||||||
|
|
||||||
Glib::ustring sNewProfile;
|
Glib::ustring sNewProfile;
|
||||||
Glib::ustring sPrimariesPreset;
|
Glib::ustring sPrimariesPreset;
|
||||||
Glib::ustring sGammaPreset;
|
Glib::ustring sGammaPreset;
|
||||||
@ -653,8 +665,14 @@ void ICCProfileCreator::savePressed()
|
|||||||
storeValues();
|
storeValues();
|
||||||
|
|
||||||
// -------------------------------------------- Compute the default file name
|
// -------------------------------------------- Compute the default file name
|
||||||
|
// -----------------setmedia white point for monitor profile sRGB or AdobeRGB in case of profile used for monitor---------------------
|
||||||
|
//instead of calculations made by LCMS..small differences
|
||||||
|
|
||||||
|
v2except = (profileVersion == "v2" && (primariesPreset == "sRGB" || primariesPreset == "Adobe") && illuminant == "DEF");
|
||||||
|
|
||||||
//necessary for V2 profile
|
//necessary for V2 profile
|
||||||
|
|
||||||
|
if (!v2except) {
|
||||||
if (primariesPreset == "ACES-AP0" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESp0)) {
|
if (primariesPreset == "ACES-AP0" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESp0)) {
|
||||||
sNewProfile = options.rtSettings.ACESp0;
|
sNewProfile = options.rtSettings.ACESp0;
|
||||||
sPrimariesPreset = "ACES-AP0";
|
sPrimariesPreset = "ACES-AP0";
|
||||||
@ -693,8 +711,12 @@ void ICCProfileCreator::savePressed()
|
|||||||
if (rtengine::settings->verbose) {
|
if (rtengine::settings->verbose) {
|
||||||
printf("\"%s\": unknown working profile! - use LCMS2 substitution\n", primariesPreset.c_str());
|
printf("\"%s\": unknown working profile! - use LCMS2 substitution\n", primariesPreset.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sNewProfile = "RTv2_Beta";
|
||||||
|
}
|
||||||
|
|
||||||
//begin adaptation rTRC gTRC bTRC
|
//begin adaptation rTRC gTRC bTRC
|
||||||
//"newProfile" profile has the same characteristics than RGB values, but TRC are adapted... for applying profile
|
//"newProfile" profile has the same characteristics than RGB values, but TRC are adapted... for applying profile
|
||||||
@ -702,16 +724,23 @@ void ICCProfileCreator::savePressed()
|
|||||||
printf("Output Gamma - profile Primaries as RT profile: \"%s\"\n", sNewProfile.c_str());
|
printf("Output Gamma - profile Primaries as RT profile: \"%s\"\n", sNewProfile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!v2except) {
|
||||||
newProfile = rtengine::ICCStore::getInstance()->getProfile(sNewProfile); //get output profile
|
newProfile = rtengine::ICCStore::getInstance()->getProfile(sNewProfile); //get output profile
|
||||||
|
} else {
|
||||||
|
profile_v2_except = rtengine::ICCStore::getInstance()->getProfile(sNewProfile); //get output profile
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (newProfile == nullptr ) {
|
if (newProfile == nullptr ) {
|
||||||
|
|
||||||
if (rtengine::settings->verbose) {
|
if (rtengine::settings->verbose) {
|
||||||
printf("\"%s\" ICC output profile not found!\n", sNewProfile.c_str());
|
printf("\"%s\" ICC output profile not found!\n", sNewProfile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//change desc Tag , to "free gamma", or "BT709", etc.
|
//change desc Tag , to "free gamma", or "BT709", etc.
|
||||||
Glib::ustring fName;
|
Glib::ustring fName;
|
||||||
Glib::ustring sPrimariesAndIlluminant;
|
Glib::ustring sPrimariesAndIlluminant;
|
||||||
@ -719,6 +748,7 @@ void ICCProfileCreator::savePressed()
|
|||||||
double presetSlope = 12.92310;
|
double presetSlope = 12.92310;
|
||||||
const double eps = 0.000000001; // not divide by zero
|
const double eps = 0.000000001; // not divide by zero
|
||||||
getGamma(gammaPreset, presetGamma, presetSlope);
|
getGamma(gammaPreset, presetGamma, presetSlope);
|
||||||
|
|
||||||
if (gammaPreset == "High_g1.3_s3.35") {
|
if (gammaPreset == "High_g1.3_s3.35") {
|
||||||
sGammaPreset = "High_g=1.3_s=3.35";
|
sGammaPreset = "High_g=1.3_s=3.35";
|
||||||
ga[0] = 1.3 ; //for high dynamic images
|
ga[0] = 1.3 ; //for high dynamic images
|
||||||
@ -797,6 +827,7 @@ void ICCProfileCreator::savePressed()
|
|||||||
presetGamma = gamma;
|
presetGamma = gamma;
|
||||||
presetSlope = slope;
|
presetSlope = slope;
|
||||||
}
|
}
|
||||||
|
|
||||||
ga[5] = 0.0;
|
ga[5] = 0.0;
|
||||||
ga[6] = 0.0;
|
ga[6] = 0.0;
|
||||||
|
|
||||||
@ -805,7 +836,6 @@ void ICCProfileCreator::savePressed()
|
|||||||
|
|
||||||
if (profileVersion == "v4" && illuminant != "DEF") {
|
if (profileVersion == "v4" && illuminant != "DEF") {
|
||||||
sPrimariesPreset += "-" + illuminant;
|
sPrimariesPreset += "-" + illuminant;
|
||||||
// printf("outpr=%s \n",outPr.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring profileDesc;
|
Glib::ustring profileDesc;
|
||||||
@ -825,6 +855,7 @@ void ICCProfileCreator::savePressed()
|
|||||||
fName = Glib::ustring::compose("RT%1_%2_%3.icc", profileVersion, sPrimariesAndIlluminant, sGammaPreset);
|
fName = Glib::ustring::compose("RT%1_%2_%3.icc", profileVersion, sPrimariesAndIlluminant, sGammaPreset);
|
||||||
profileDesc == sPrimariesPreset + sGammaPreset;
|
profileDesc == sPrimariesPreset + sGammaPreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
sGammaSlopeParam = Glib::ustring::compose("g%1s%2!", sGamma, sSlope);
|
sGammaSlopeParam = Glib::ustring::compose("g%1s%2!", sGamma, sSlope);
|
||||||
sGammaSlopeDesc = Glib::ustring::compose("g=%1 s=%2", sGamma, sSlope);
|
sGammaSlopeDesc = Glib::ustring::compose("g=%1 s=%2", sGamma, sSlope);
|
||||||
|
|
||||||
@ -876,12 +907,13 @@ void ICCProfileCreator::savePressed()
|
|||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
// --------------- main tags ------------------
|
// --------------- main tags ------------------
|
||||||
|
/*
|
||||||
if (profileVersion == "v4") {
|
if (profileVersion == "v4") {
|
||||||
cmsSetProfileVersion(newProfile, 4.3);
|
cmsSetProfileVersion(newProfile, 4.3);
|
||||||
} else {
|
} else {
|
||||||
cmsSetProfileVersion(newProfile, 2.0);
|
cmsSetProfileVersion(newProfile, 2.0);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//change
|
//change
|
||||||
float p[6]; //primaries
|
float p[6]; //primaries
|
||||||
@ -897,8 +929,17 @@ void ICCProfileCreator::savePressed()
|
|||||||
{p[4], p[5], 1.0} // blue
|
{p[4], p[5], 1.0} // blue
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (v2except) {
|
||||||
|
cmsSetDeviceClass(profile_v2_except, cmsSigDisplayClass);
|
||||||
|
cmsSetPCS(profile_v2_except, cmsSigXYZData);
|
||||||
|
cmsSetHeaderRenderingIntent(profile_v2_except, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (profileVersion == "v4" && illuminant != "DEF") {
|
if (profileVersion == "v4" && illuminant != "DEF") {
|
||||||
double tempv4 = 5000.;
|
double tempv4 = 5000.;
|
||||||
|
|
||||||
if (illuminant == "D41") {
|
if (illuminant == "D41") {
|
||||||
tempv4 = 4100.;
|
tempv4 = 4100.;
|
||||||
} else if (illuminant == "D50") {
|
} else if (illuminant == "D50") {
|
||||||
@ -914,35 +955,148 @@ void ICCProfileCreator::savePressed()
|
|||||||
} else if (illuminant == "stdA") {
|
} else if (illuminant == "stdA") {
|
||||||
tempv4 = 5003.;
|
tempv4 = 5003.;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsWhitePointFromTemp(&xyD, tempv4);
|
cmsWhitePointFromTemp(&xyD, tempv4);
|
||||||
|
} else {
|
||||||
|
if (v2except) {
|
||||||
|
|
||||||
|
cmsCIExyY XYZ;
|
||||||
|
|
||||||
|
{
|
||||||
|
// XYZ = {0.950486322, 1.0, 1.08902736};//White D65 point calculated from white point xy 0,312710 y 0,3290
|
||||||
|
// XYZ = {0.95047, 1.0, 1.088830};//White D65 point from B.Lindbloom
|
||||||
|
XYZ = {0.95045471, 1.0, 1.08905029};
|
||||||
|
}
|
||||||
|
cmsCIExyY blackpoint;
|
||||||
|
|
||||||
|
{
|
||||||
|
blackpoint = {0., 0., 0.};//White D65 point from the sRGB.icm and AdobeRGB1998 profile specs
|
||||||
|
}
|
||||||
|
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigMediaBlackPointTag, &blackpoint);
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigMediaWhitePointTag, &XYZ);
|
||||||
|
cmsCIExyY rt;
|
||||||
|
cmsCIExyY bt;
|
||||||
|
cmsCIExyY gt;
|
||||||
|
|
||||||
|
if (primariesPreset == "sRGB") {
|
||||||
|
|
||||||
|
//Matrix value from B.Lindbloom
|
||||||
|
/*
|
||||||
|
rt = {0.4360747, 0.2225045, 0.0139322};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigRedColorantTag, &rt);
|
||||||
|
bt = {0.1430804, 0.0606169, 0.7141733};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigBlueColorantTag, &bt);
|
||||||
|
gt = {0.3850649, 0.7168786, 0.0971045};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigGreenColorantTag, >);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
//Matrix value from spec Adobe
|
||||||
|
rt = {0.43607, 0.22249, 0.01392};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigRedColorantTag, &rt);
|
||||||
|
bt = {0.14307, 0.06061, 0.71410};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigBlueColorantTag, &bt);
|
||||||
|
gt = {0.38515, 0.71687, 0.09708};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigGreenColorantTag, >);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (primariesPreset == "Adobe") {
|
||||||
|
{
|
||||||
|
//B.Lindbloom
|
||||||
|
/*
|
||||||
|
rt = {0.6097559, 0.3111242, 0.0194811};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigRedColorantTag, &rt);
|
||||||
|
bt = {0.1492240, 0.0632197, 0.7448387};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigBlueColorantTag, &bt);
|
||||||
|
gt = {0.2052401, 0.6256560, 0.0608902};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigGreenColorantTag, >);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//Adobe spec
|
||||||
|
rt = {0.60974, 0.31111, 0.01947};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigRedColorantTag, &rt);
|
||||||
|
bt = {0.14919, 0.06322, 0.74457};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigBlueColorantTag, &bt);
|
||||||
|
gt = {0.20528, 0.62567, 0.06087};
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigGreenColorantTag, >);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cmsWhitePointFromTemp(&xyD, (double)temp);
|
cmsWhitePointFromTemp(&xyD, (double)temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (illuminant == "stdA") {
|
if (illuminant == "stdA") {
|
||||||
xyD = {0.447573, 0.407440, 1.0};
|
xyD = {0.447573, 0.407440, 1.0};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate output profile's rTRC gTRC bTRC
|
// Calculate output profile's rTRC gTRC bTRC
|
||||||
|
|
||||||
|
|
||||||
cmsToneCurve* GammaTRC[3];
|
cmsToneCurve* GammaTRC[3];
|
||||||
|
|
||||||
|
if (gammaPreset != "standard_g2.2" || gammaPreset != "standard_g1.8" || gammaPreset != "linear_g1.0") {
|
||||||
GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, ga);
|
GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, ga);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gammaPreset == "standard_g2.2") {
|
||||||
|
GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildGamma(NULL, 2.19921875);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gammaPreset == "standard_g1.8") {
|
||||||
|
GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildGamma(NULL, 1.80078125);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gammaPreset == "linear_g1.0") {
|
||||||
|
GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildGamma(NULL, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (profileVersion == "v4") {
|
if (profileVersion == "v4") {
|
||||||
newProfile = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC);
|
newProfile = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (profileVersion == "v2") {
|
||||||
|
if (v2except) {
|
||||||
|
cmsSetProfileVersion(profile_v2_except, 2.2);
|
||||||
|
} else {
|
||||||
|
cmsSetProfileVersion(newProfile, 2.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!v2except) {
|
||||||
cmsWriteTag(newProfile, cmsSigRedTRCTag, GammaTRC[0]);
|
cmsWriteTag(newProfile, cmsSigRedTRCTag, GammaTRC[0]);
|
||||||
cmsWriteTag(newProfile, cmsSigGreenTRCTag, GammaTRC[1]);
|
cmsWriteTag(newProfile, cmsSigGreenTRCTag, GammaTRC[1]);
|
||||||
cmsWriteTag(newProfile, cmsSigBlueTRCTag, GammaTRC[2]);
|
cmsWriteTag(newProfile, cmsSigBlueTRCTag, GammaTRC[2]);
|
||||||
|
} else {
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigRedTRCTag, GammaTRC[0]);
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigGreenTRCTag, GammaTRC[1]);
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigBlueTRCTag, GammaTRC[2]);
|
||||||
|
}
|
||||||
|
|
||||||
// --------------- set dmnd tag ------------------
|
// --------------- set dmnd tag ------------------
|
||||||
|
|
||||||
cmsMLU *dmnd;
|
cmsMLU *dmnd;
|
||||||
dmnd = cmsMLUalloc(nullptr, 1);
|
dmnd = cmsMLUalloc(nullptr, 1);
|
||||||
cmsMLUsetASCII(dmnd, "en", "US", "RawTherapee");
|
cmsMLUsetASCII(dmnd, "en", "US", "RawTherapee");
|
||||||
|
|
||||||
|
if (!v2except) {
|
||||||
cmsWriteTag(newProfile, cmsSigDeviceMfgDescTag, dmnd);
|
cmsWriteTag(newProfile, cmsSigDeviceMfgDescTag, dmnd);
|
||||||
|
} else {
|
||||||
|
cmsWriteTag(profile_v2_except, cmsSigDeviceMfgDescTag, dmnd);
|
||||||
|
}
|
||||||
|
|
||||||
cmsMLUfree(dmnd);
|
cmsMLUfree(dmnd);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------- set dmdd tag ------------------
|
// --------------- set dmdd tag ------------------
|
||||||
|
|
||||||
if (profileVersion == "v2") {
|
if (profileVersion == "v2") {
|
||||||
@ -951,27 +1105,43 @@ void ICCProfileCreator::savePressed()
|
|||||||
wGammaSlopeParam << sGammaSlopeParam;
|
wGammaSlopeParam << sGammaSlopeParam;
|
||||||
|
|
||||||
cmsMLU *dmdd = cmsMLUalloc(nullptr, 1);
|
cmsMLU *dmdd = cmsMLUalloc(nullptr, 1);
|
||||||
|
|
||||||
// Language code (2 letters code) : https://www.iso.org/obp/ui/
|
// Language code (2 letters code) : https://www.iso.org/obp/ui/
|
||||||
// Country code (2 letters code) : http://www.loc.gov/standards/iso639-2/php/code_list.php
|
// Country code (2 letters code) : http://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||||
if (sGammaSlopeParam.is_ascii()) {
|
if (sGammaSlopeParam.is_ascii()) {
|
||||||
if (cmsMLUsetASCII(dmdd, "en", "US", sGammaSlopeParam.c_str())) {
|
if (cmsMLUsetASCII(dmdd, "en", "US", sGammaSlopeParam.c_str())) {
|
||||||
|
if (!v2except) {
|
||||||
if (!cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, dmdd)) {
|
if (!cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, dmdd)) {
|
||||||
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!cmsWriteTag(profile_v2_except, cmsSigProfileDescriptionTag, dmdd)) {
|
||||||
|
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (cmsMLUsetWide(dmdd, "en", "US", wGammaSlopeParam.str().c_str())) {
|
} else if (cmsMLUsetWide(dmdd, "en", "US", wGammaSlopeParam.str().c_str())) {
|
||||||
|
if (!v2except) {
|
||||||
if (!cmsWriteTag(newProfile, cmsSigDeviceModelDescTag, dmdd)) {
|
if (!cmsWriteTag(newProfile, cmsSigDeviceModelDescTag, dmdd)) {
|
||||||
printf("Error: Can't write cmsSigDeviceModelDescTag!\n");
|
printf("Error: Can't write cmsSigDeviceModelDescTag!\n");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!cmsWriteTag(profile_v2_except, cmsSigDeviceModelDescTag, dmdd)) {
|
||||||
|
printf("Error: Can't write cmsSigDeviceModelDescTag!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Error: cmsMLUsetWide failed for dmdd \"%s\" !\n", sGammaSlopeParam.c_str());
|
printf("Error: cmsMLUsetWide failed for dmdd \"%s\" !\n", sGammaSlopeParam.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsMLUfree(dmdd);
|
cmsMLUfree(dmdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------- set desc tag ------------------
|
// --------------- set desc tag ------------------
|
||||||
|
|
||||||
Glib::ustring sDescription;
|
Glib::ustring sDescription;
|
||||||
|
|
||||||
if (!description.empty()) {
|
if (!description.empty()) {
|
||||||
if (cAppendParamsToDesc->get_active()) {
|
if (cAppendParamsToDesc->get_active()) {
|
||||||
sDescription = description + " / " + sGammaSlopeDesc;
|
sDescription = description + " / " + sGammaSlopeDesc;
|
||||||
@ -991,21 +1161,36 @@ void ICCProfileCreator::savePressed()
|
|||||||
wDescription << sDescription;
|
wDescription << sDescription;
|
||||||
|
|
||||||
cmsMLU *descMLU = cmsMLUalloc(nullptr, 1);
|
cmsMLU *descMLU = cmsMLUalloc(nullptr, 1);
|
||||||
|
|
||||||
// Language code (2 letters code) : https://www.iso.org/obp/ui/
|
// Language code (2 letters code) : https://www.iso.org/obp/ui/
|
||||||
// Country code (2 letters code) : http://www.loc.gov/standards/iso639-2/php/code_list.php
|
// Country code (2 letters code) : http://www.loc.gov/standards/iso639-2/php/code_list.php
|
||||||
if (sDescription.is_ascii()) {
|
if (sDescription.is_ascii()) {
|
||||||
if (cmsMLUsetASCII(descMLU, "en", "US", sDescription.c_str())) {
|
if (cmsMLUsetASCII(descMLU, "en", "US", sDescription.c_str())) {
|
||||||
if (!cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, descMLU)) {
|
if (!v2except) {
|
||||||
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (cmsMLUsetWide(descMLU, "en", "US", wDescription.str().c_str())) {
|
|
||||||
if (!cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, descMLU)) {
|
if (!cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, descMLU)) {
|
||||||
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!cmsWriteTag(profile_v2_except, cmsSigProfileDescriptionTag, descMLU)) {
|
||||||
|
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (cmsMLUsetWide(descMLU, "en", "US", wDescription.str().c_str())) {
|
||||||
|
if (!v2except) {
|
||||||
|
|
||||||
|
if (!cmsWriteTag(newProfile, cmsSigProfileDescriptionTag, descMLU)) {
|
||||||
|
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!cmsWriteTag(profile_v2_except, cmsSigProfileDescriptionTag, descMLU)) {
|
||||||
|
printf("Error: Can't write cmsSigProfileDescriptionTag!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Error: cmsMLUsetWide failed for desc \"%s\" !\n", sDescription.c_str());
|
printf("Error: cmsMLUsetWide failed for desc \"%s\" !\n", sDescription.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsMLUfree(descMLU);
|
cmsMLUfree(descMLU);
|
||||||
|
|
||||||
// --------------- set cprt tag ------------------
|
// --------------- set cprt tag ------------------
|
||||||
@ -1014,13 +1199,23 @@ void ICCProfileCreator::savePressed()
|
|||||||
wCopyright << copyright;
|
wCopyright << copyright;
|
||||||
|
|
||||||
cmsMLU *copyMLU = cmsMLUalloc(nullptr, 1);
|
cmsMLU *copyMLU = cmsMLUalloc(nullptr, 1);
|
||||||
|
|
||||||
if (cmsMLUsetWide(copyMLU, "en", "US", wCopyright.str().c_str())) {
|
if (cmsMLUsetWide(copyMLU, "en", "US", wCopyright.str().c_str())) {
|
||||||
|
if (!v2except) {
|
||||||
|
|
||||||
if (!cmsWriteTag(newProfile, cmsSigCopyrightTag, copyMLU)) {
|
if (!cmsWriteTag(newProfile, cmsSigCopyrightTag, copyMLU)) {
|
||||||
printf("Error: Can't write cmsSigCopyrightTag!\n");
|
printf("Error: Can't write cmsSigCopyrightTag!\n");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!cmsWriteTag(profile_v2_except, cmsSigCopyrightTag, copyMLU)) {
|
||||||
|
printf("Error: Can't write cmsSigCopyrightTag!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Error: cmsMLUsetWide failed for cprt \"%s\" !\n", copyright.c_str());
|
printf("Error: cmsMLUsetWide failed for cprt \"%s\" !\n", copyright.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsMLUfree(copyMLU);
|
cmsMLUfree(copyMLU);
|
||||||
|
|
||||||
|
|
||||||
@ -1030,8 +1225,13 @@ void ICCProfileCreator::savePressed()
|
|||||||
cmsCIEXYZ *blueT = static_cast<cmsCIEXYZ*>(cmsReadTag(newProfile, cmsSigBlueMatrixColumnTag));
|
cmsCIEXYZ *blueT = static_cast<cmsCIEXYZ*>(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);
|
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);
|
||||||
*/
|
*/
|
||||||
|
if (!v2except) {
|
||||||
cmsSaveProfileToFile(newProfile, absoluteFName.c_str());
|
cmsSaveProfileToFile(newProfile, absoluteFName.c_str());
|
||||||
|
} else {
|
||||||
|
printf("save except\n");
|
||||||
|
cmsSaveProfileToFile(profile_v2_except, absoluteFName.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
cmsFreeToneCurve(GammaTRC[0]);
|
cmsFreeToneCurve(GammaTRC[0]);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ private:
|
|||||||
double gamma;
|
double gamma;
|
||||||
double slope;
|
double slope;
|
||||||
bool appendParamsToDesc;
|
bool appendParamsToDesc;
|
||||||
|
bool v2except;
|
||||||
Glib::ustring profileVersion;
|
Glib::ustring profileVersion;
|
||||||
Glib::ustring illuminant;
|
Glib::ustring illuminant;
|
||||||
Glib::ustring description;
|
Glib::ustring description;
|
||||||
|
@ -770,9 +770,14 @@ Gtk::Widget* Preferences::getColorManPanel ()
|
|||||||
|
|
||||||
for (const auto profile : profiles) {
|
for (const auto profile : profiles) {
|
||||||
if (profile.find("file:") != 0) {
|
if (profile.find("file:") != 0) {
|
||||||
|
std::string fileis_RTv4 = profile.substr(0, 4);
|
||||||
|
|
||||||
|
if (fileis_RTv4 != "RTv4") {
|
||||||
|
// printf("pro=%s \n", profile.c_str());
|
||||||
monProfile->append(profile);
|
monProfile->append(profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// same order as the enum
|
// same order as the enum
|
||||||
monIntent->append (M ("PREFERENCES_INTENT_PERCEPTUAL"));
|
monIntent->append (M ("PREFERENCES_INTENT_PERCEPTUAL"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user