ICM profiles improvements

see issue 889
This commit is contained in:
Oliver Duis
2011-08-05 15:58:43 +02:00
parent a62078112d
commit 20e434ecfc
7 changed files with 26 additions and 28 deletions

View File

@@ -220,8 +220,11 @@ void Crop::update (int todo) {
}
*/
if (cropImageListener) {
// this in workinging space is held in parallel to allow analysis like shadow/highlight
Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, params.icm.working);
// this in output space held in parallel to allow analysis like shadow/highlight
Glib::ustring outProfile=params.icm.output;
if (params.icm.output=="" || params.icm.output==ColorManagementParams::NoICMString) outProfile="sRGB";
printf("Using profile %s\n", outProfile.c_str());
Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, outProfile);
int finalW = rqcropw;
if (cropImg->getWidth()-leftBorder < finalW)

View File

@@ -60,11 +60,6 @@ std::vector<std::string> getWorkingProfiles () {
return res;
}
std::vector<std::string> getOutputProfiles () {
return iccStore->getOutputProfiles ();
}
std::vector<std::string> ICCStore::getOutputProfiles () {
Glib::Mutex::Lock lock(mutex_);

View File

@@ -928,6 +928,8 @@ if (keyFile.has_group ("IPTC")) {
}
}
const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring("No ICM: sRGB output");
bool operator==(const EqualizerParams & a, const EqualizerParams & b) {
if(a.enabled != b.enabled)
return false;

View File

@@ -341,6 +341,8 @@ class ColorManagementParams {
bool gammaOnInput;
Glib::ustring working;
Glib::ustring output;
static const Glib::ustring NoICMString;
Glib::ustring gamma;
double gampos;
double slpos;

View File

@@ -314,10 +314,6 @@ namespace rtengine {
/** Cleanup the RT engine (static variables) */
void cleanup ();
/** Returns the available output profile names
* @return a vector of the available output profile names */
std::vector<std::string> getOutputProfiles ();
/** Returns the available working profile names
* @return a vector of the available working profile names */
std::vector<std::string> getWorkingProfiles ();

View File

@@ -292,12 +292,12 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
ProfileContent pc;
Glib::ustring chpro;
Glib::ustring chpro, outProfile;
int present_space[7]={0,0,0,0,0,0,0};
std::vector<std::string> opnames = rtengine::getOutputProfiles ();
std::vector<std::string> opnames = iccStore->getOutputProfiles ();
//test if files are in system
for (int j=0; j<7;j++) {
//one can modify "option" [Color Management] to adapt name of profile ih there are different for windows, MacOS, Linux ??
// one can modify "option" [Color Management] to adapt name of profile if there are different for windows, MacOS, Linux ??
if(j==0) chpro=options.rtSettings.prophoto;
else if(j==1) chpro=options.rtSettings.adobe;
else if(j==2) chpro=options.rtSettings.widegamut;
@@ -309,18 +309,17 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
if(chpro.compare(opnames[i]) ==0) present_space[j]=1;
if (present_space[j]==0) { if (pl) pl->setProgressStr ("Missing file..");pl->setProgress (0.0);}// display file not present: not very good display information...!!
}
//choose output profile
if(params.icm.working=="ProPhoto" && present_space[0]==1) params.icm.output=options.rtSettings.prophoto;
else if(params.icm.working=="Adobe RGB" && present_space[1]==1) params.icm.output=options.rtSettings.adobe;
else if(params.icm.working=="WideGamut" && present_space[2]==1) params.icm.output=options.rtSettings.widegamut;
else if(params.icm.working=="Beta RGB" && present_space[3]==1) params.icm.output=options.rtSettings.beta;
else if(params.icm.working=="BestRGB" && present_space[4]==1) params.icm.output=options.rtSettings.best;
else if(params.icm.working=="BruceRGB" && present_space[5]==1) params.icm.output=options.rtSettings.bruce;
else params.icm.output=options.rtSettings.srgb; //if not found or choice=srgb
// Check that output profiles exist, otherwise revert to sRGB
if (params.icm.output=="ProPhoto" && present_space[0]==1) outProfile=options.rtSettings.prophoto;
else if (params.icm.output=="Adobe RGB" && present_space[1]==1) outProfile=options.rtSettings.adobe;
else if (params.icm.output=="WideGamut" && present_space[2]==1) outProfile=options.rtSettings.widegamut;
else if (params.icm.output=="Beta RGB" && present_space[3]==1) outProfile=options.rtSettings.beta;
else if (params.icm.output=="BestRGB" && present_space[4]==1) outProfile=options.rtSettings.best;
else if (params.icm.output=="BruceRGB" && present_space[5]==1) outProfile=options.rtSettings.bruce;
else outProfile=options.rtSettings.srgb; //if not found or choice=srgb
if (params.icm.output.compare (0, 6, "No ICM") && params.icm.output!="")
pc = iccStore->getContent (params.icm.output);
pc = iccStore->getContent (outProfile);
readyImg->setOutputProfile (pc.data, pc.length);
@@ -413,7 +412,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
ProfileContent pc;
if (params.icm.output.compare (0, 6, "No ICM") && params.icm.output!="")
if (params.icm.output!="" && params.icm.output!=ColorManagementParams::NoICMString)
pc = iccStore->getContent (params.icm.output);
readyImg->setOutputProfile (pc.data, pc.length);

View File

@@ -20,6 +20,7 @@
#include <options.h>
#include <guiutils.h>
#include <safegtk.h>
#include <iccstore.h>
using namespace rtengine;
using namespace rtengine::procparams;
@@ -134,7 +135,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
onames->append_text (M("TP_ICM_NOICM"));
onames->set_active (0);
std::vector<std::string> opnames = rtengine::getOutputProfiles ();
std::vector<std::string> opnames = iccStore->getOutputProfiles ();
for (int i=0; i<opnames.size(); i++)
onames->append_text (opnames[i]);
@@ -201,7 +202,7 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited) {
wnames->set_active_text (pp->icm.working);
wgamma->set_active_text (pp->icm.gamma);
if (pp->icm.output=="No ICM: sRGB output")
if (pp->icm.output==ColorManagementParams::NoICMString)
onames->set_active_text (M("TP_ICM_NOICM"));
else
onames->set_active_text (pp->icm.output);
@@ -258,7 +259,7 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited) {
pp->icm.gamma = wgamma->get_active_text ();
if (onames->get_active_text()==M("TP_ICM_NOICM"))
pp->icm.output = "No ICM: sRGB output";
pp->icm.output = ColorManagementParams::NoICMString;
else
pp->icm.output = onames->get_active_text();
pp->icm.freegamma = freegamma->get_active();