Code

Added profile intent options
authorjoncruz <joncruz@users.sourceforge.net>
Wed, 3 Oct 2007 07:19:17 +0000 (07:19 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Wed, 3 Oct 2007 07:19:17 +0000 (07:19 +0000)
src/color-profile.cpp
src/preferences-skeleton.h
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h

index 7cd4df5986ef4cf216759b5a68344772de084913..b7c8c40ed8e432cd563b2bdb720f4a39e92d51b2 100644 (file)
@@ -546,6 +546,8 @@ int errorHandlerCB(int ErrorCode, const char *ErrorText)
 }
 
 static bool gamutWarn = false;
+static int lastIntent = INTENT_PERCEPTUAL;
+static int lastProofIntent = INTENT_PERCEPTUAL;
 static cmsHTRANSFORM transf = 0;
 static cmsHPROFILE srcprof = 0;
 
@@ -673,12 +675,17 @@ cmsHPROFILE Inkscape::colorprofile_get_proof_profile_handle()
 cmsHTRANSFORM Inkscape::colorprofile_get_display_transform()
 {
     bool warn = prefs_get_int_attribute_limited( "options.softproof", "gamutwarn", 0, 0, 1 );
-    if ( (warn != gamutWarn) ) {
+    int intent = prefs_get_int_attribute_limited( "options.displayprofile", "intent", 0, 0, 3 );
+    int proofIntent = prefs_get_int_attribute_limited( "options.softproof", "intent", 0, 0, 3 );
+
+    if ( (warn != gamutWarn) || (lastIntent != intent) || (lastProofIntent != proofIntent)) {
         gamutWarn = warn;
         if ( transf ) {
             cmsDeleteTransform(transf);
             transf = 0;
         }
+        lastIntent = intent;
+        lastProofIntent = proofIntent;
     }
 
     // Fecth these now, as they might clear the transform as a side effect.
@@ -695,9 +702,9 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_transform()
                 dwFlags |= cmsFLAGS_GAMUTCHECK;
             }
             cmsSetAlarmCodes(0, 255, 0);
-            transf = cmsCreateProofingTransform( srcprof, TYPE_RGB_8, hprof, TYPE_RGB_8, proofProf, INTENT_PERCEPTUAL, INTENT_PERCEPTUAL, dwFlags );
+            transf = cmsCreateProofingTransform( srcprof, TYPE_RGB_8, hprof, TYPE_RGB_8, proofProf, intent, proofIntent, dwFlags );
         } else if ( hprof ) {
-            transf = cmsCreateTransform( srcprof, TYPE_RGB_8, hprof, TYPE_RGB_8, INTENT_PERCEPTUAL, 0 );
+            transf = cmsCreateTransform( srcprof, TYPE_RGB_8, hprof, TYPE_RGB_8, intent, 0 );
         }
     }
 
index 3733230975508d5b11f8161cf8e75fc02862c774..b01d5a3de0cb47243a4b1783ab264d54307e6c91 100644 (file)
@@ -182,12 +182,14 @@ static char const preferences_skeleton[] =
 "    <group id=\"cursortolerance\" value=\"8.0\"/>\n"
 "    <group id=\"dragtolerance\" value=\"4.0\"/>\n"
 "    <group\n"
-"       id=\"displayprofile\""
+"       id=\"displayprofile\"\n"
 "       enable=\"0\"\n"
+"       intent=\"0\"\n"
 "       uri=\"\" />\n"
 "    <group\n"
-"       id=\"softproof\""
+"       id=\"softproof\"\n"
 "       enable=\"0\"\n"
+"       intent=\"0\"\n"
 "       gamutwarn=\"0\"\n"
 "       uri=\"\" />\n"
 "    <group id=\"savewindowgeometry\" value=\"1\"/>\n"
index 0e83addec8e0096282efd8ed67a7a6a205ed0043..964073782efd9dff3d7fd75bfea89117fc553554 100644 (file)
@@ -672,6 +672,14 @@ void InkscapePreferences::initPageMisc()
     _page_misc.add_line( false, "", _misc_cms_display, "",
                            _("Enables application of the display using an ICC profile."), true);
 
+    int const numIntents = 4;
+    Glib::ustring intentLabels[numIntents] = {_("Perceptual"), _("Relative Colorimetric"), _("Saturation"), _("Absolute Colorimetric")};
+    int intentValues[numIntents] = {0, 1, 2, 3};
+
+    _misc_cms_intent.init("options.displayprofile", "intent", intentLabels, intentValues, numIntents, 0);
+    _page_misc.add_line( false, _("Display intent:"), _misc_cms_intent, "",
+                         _("The rendering intent to use to calibrate display output."), true);
+
     _page_misc.add_line( false, _("Display profile:"), _misc_cms_display_profile, "",
                          _("The ICC profile to use to calibrate display output."), true);
 
@@ -684,6 +692,10 @@ void InkscapePreferences::initPageMisc()
     _page_misc.add_line( false, "", _misc_cms_gamutwarn, "",
                            _("Highlights colors that are out of gamut for the target device."), true);
 
+    _misc_cms_proof_intent.init("options.softproof", "intent", intentLabels, intentValues, numIntents, 0);
+    _page_misc.add_line( false, _("Device intent:"), _misc_cms_proof_intent, "",
+                         _("The rendering intent to use to calibrate display output."), true);
+
     _page_misc.add_line( false, _("Device profile:"), _misc_cms_proof_profile, "",
                          _("The ICC profile to use to simulate device output."), true);
 
@@ -720,6 +732,9 @@ void InkscapePreferences::initPageMisc()
     _misc_cms_softproof.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );
     _misc_cms_gamutwarn.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );
 
+    _misc_cms_intent.signal_changed().connect( sigc::ptr_fun(forceUpdates) );
+    _misc_cms_proof_intent.signal_changed().connect( sigc::ptr_fun(forceUpdates) );
+
     _misc_cms_display_profile.signal_changed().connect( sigc::bind( sigc::ptr_fun(profileComboChanged), &_misc_cms_display_profile) );
     _misc_cms_proof_profile.signal_changed().connect( sigc::bind( sigc::ptr_fun(proofComboChanged), &_misc_cms_proof_profile) );
 #else
index 58c908a9acc08b17f42def05e4d4357a452e785a..f88c5e0c69e00d9bf89fcdd37ac7583f287094cb 100644 (file)
@@ -163,10 +163,12 @@ protected:
     PrefCombo       _misc_overs_bitmap;
 
     PrefCheckButton     _misc_cms_display;
+    PrefCombo           _misc_cms_intent;
     Gtk::ComboBoxText   _misc_cms_display_profile;
 
     PrefCheckButton     _misc_cms_softproof;
     PrefCheckButton     _misc_cms_gamutwarn;
+    PrefCombo           _misc_cms_proof_intent;
     Gtk::ComboBoxText   _misc_cms_proof_profile;
 
     PrefEntryButtonHBox _importexport_ocal_url;