Code

few more CMS options
authorjoncruz <joncruz@users.sourceforge.net>
Thu, 4 Oct 2007 05:58:08 +0000 (05:58 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Thu, 4 Oct 2007 05:58:08 +0000 (05:58 +0000)
src/color-profile.cpp
src/preferences-skeleton.h
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h

index 75757068fdfb13b7faaf741d4df58f19a42b34e4..609c14cc1c72b33fe6741566d59e271af330bae5 100644 (file)
@@ -548,6 +548,8 @@ int errorHandlerCB(int ErrorCode, const char *ErrorText)
 }
 
 static bool gamutWarn = false;
+static bool lastBPC = false;
+static bool lastPreserveBlack = false;
 static int lastIntent = INTENT_PERCEPTUAL;
 static int lastProofIntent = INTENT_PERCEPTUAL;
 static cmsHTRANSFORM transf = 0;
@@ -679,8 +681,15 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_transform()
     bool warn = prefs_get_int_attribute_limited( "options.softproof", "gamutwarn", 0, 0, 1 );
     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)) {
+    bool bpc = prefs_get_int_attribute_limited( "options.softproof", "bpc", 0, 0, 1 );
+    bool preserveBlack = prefs_get_int_attribute_limited( "options.softproof", "preserveblack", 0, 0, 1 );
+
+    if ( (warn != gamutWarn)
+         || (lastIntent != intent)
+         || (lastProofIntent != proofIntent)
+         || (bpc != lastBPC)
+         || (preserveBlack != lastPreserveBlack)
+        ) {
         gamutWarn = warn;
         if ( transf ) {
             cmsDeleteTransform(transf);
@@ -688,6 +697,8 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_transform()
         }
         lastIntent = intent;
         lastProofIntent = proofIntent;
+        lastBPC = bpc;
+        lastPreserveBlack = preserveBlack;
     }
 
     // Fecth these now, as they might clear the transform as a side effect.
@@ -702,8 +713,14 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_transform()
             DWORD dwFlags = cmsFLAGS_SOFTPROOFING;
             if ( gamutWarn ) {
                 dwFlags |= cmsFLAGS_GAMUTCHECK;
+                cmsSetAlarmCodes(0, 255, 0);
+            }
+            if ( bpc ) {
+                dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
+            }
+            if ( preserveBlack ) {
+                dwFlags |= cmsFLAGS_PRESERVEBLACK;
             }
-            cmsSetAlarmCodes(0, 255, 0);
             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, 0 );
index b01d5a3de0cb47243a4b1783ab264d54307e6c91..242a9d919a20f0eb40b33fb5d02285dcbe0dcca2 100644 (file)
@@ -191,6 +191,8 @@ static char const preferences_skeleton[] =
 "       enable=\"0\"\n"
 "       intent=\"0\"\n"
 "       gamutwarn=\"0\"\n"
+"       bpc=\"0\"\n"
+"       preserveblack=\"0\"\n"
 "       uri=\"\" />\n"
 "    <group id=\"savewindowgeometry\" value=\"1\"/>\n"
 "    <group id=\"defaultoffsetwidth\" value=\"2\"/>\n"
index e3d0de1f9a9f7cb0835fd2965f26402d910cf6b2..a747e004577346a36cc1584c8c822220ddfe4b24 100644 (file)
@@ -660,21 +660,24 @@ static void proofComboChanged( Gtk::ComboBoxText* combo )
 
 void InkscapePreferences::initPageCMS()
 {
+    int const numIntents = 4;
+    Glib::ustring intentLabels[numIntents] = {_("Perceptual"), _("Relative Colorimetric"), _("Saturation"), _("Absolute Colorimetric")};
+    int intentValues[numIntents] = {0, 1, 2, 3};
+
+    _page_cms.add_group_header( _("Disply Calibration"));
+
     _cms_display.init( _("Enable display calibration"), "options.displayprofile", "enable", false);
     _page_cms.add_line( false, "", _cms_display, "",
                         _("Enables application of the display using an ICC profile."), false);
 
-    int const numIntents = 4;
-    Glib::ustring intentLabels[numIntents] = {_("Perceptual"), _("Relative Colorimetric"), _("Saturation"), _("Absolute Colorimetric")};
-    int intentValues[numIntents] = {0, 1, 2, 3};
+    _page_cms.add_line( false, _("Display profile:"), _cms_display_profile, "",
+                        _("The ICC profile to use to calibrate display output."), false);
 
     _cms_intent.init("options.displayprofile", "intent", intentLabels, intentValues, numIntents, 0);
     _page_cms.add_line( false, _("Display intent:"), _cms_intent, "",
                         _("The rendering intent to use to calibrate display output."), false);
 
-    _page_cms.add_line( false, _("Display profile:"), _cms_display_profile, "",
-                        _("The ICC profile to use to calibrate display output."), false);
-
+    _page_cms.add_group_header( _("Proofing"));
 
     _cms_softproof.init( _("Simulate output on screen."), "options.softproof", "enable", false);
     _page_cms.add_line( false, "", _cms_softproof, "",
@@ -684,12 +687,26 @@ void InkscapePreferences::initPageCMS()
     _page_cms.add_line( false, "", _cms_gamutwarn, "",
                         _("Highlights colors that are out of gamut for the target device."), false);
 
+    Gdk::Color tmpColor("#00ff00");
+    _cms_gamutcolor.set_color( tmpColor );
+    _cms_gamutcolor.set_sensitive( false );
+    _page_cms.add_line( true, "Out of gamut warning color:", _cms_gamutcolor, "",
+                        _("Selects the color used for out of gamut warning."), false);
+
+    _page_cms.add_line( false, _("Device profile:"), _cms_proof_profile, "",
+                        _("The ICC profile to use to simulate device output."), false);
+
     _cms_proof_intent.init("options.softproof", "intent", intentLabels, intentValues, numIntents, 0);
     _page_cms.add_line( false, _("Device intent:"), _cms_proof_intent, "",
                         _("The rendering intent to use to calibrate display output."), false);
 
-    _page_cms.add_line( false, _("Device profile:"), _cms_proof_profile, "",
-                        _("The ICC profile to use to simulate device output."), false);
+    _cms_proof_blackpoint.init( _("Black Point Compensation."), "options.softproof", "bpc", false);
+    _page_cms.add_line( false, "", _cms_proof_blackpoint, "",
+                        _("Enables black point compensation."), false);
+
+    _cms_proof_preserveblack.init( _("Preserve black."), "options.softproof", "preserveblack", false);
+    _page_cms.add_line( false, "", _cms_proof_preserveblack, "",
+                        "", false);
 
 #if ENABLE_LCMS
     {
@@ -723,6 +740,8 @@ void InkscapePreferences::initPageCMS()
     _cms_display.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );
     _cms_softproof.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );
     _cms_gamutwarn.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );
+    _cms_proof_blackpoint.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );
+    _cms_proof_preserveblack.signal_toggled().connect( sigc::ptr_fun(forceUpdates) );
 
     _cms_intent.signal_changed().connect( sigc::ptr_fun(forceUpdates) );
     _cms_proof_intent.signal_changed().connect( sigc::ptr_fun(forceUpdates) );
@@ -736,8 +755,11 @@ void InkscapePreferences::initPageCMS()
     _cms_display_profile.set_sensitive( false );
     _cms_softproof.set_sensitive( false );
     _cms_gamutwarn.set_sensitive( false );
+    _cms_gamutcolor.set_sensitive( false );
     _cms_proof_intent.set_sensitive( false );
     _cms_proof_profile.set_sensitive( false );
+    _cms_proof_blackpoint.set_sensitive( false );
+    _cms_proof_preserveblack_sensitive( false );
 #endif // ENABLE_LCMS
 
     this->AddPage(_page_cms, _("Color Management"), PREFS_PAGE_CMS);
index c41971fddfa264bbc43afda69c3db41280ee34ad..823de92deba3046f37fccdf895af9e07a3a35fc3 100644 (file)
@@ -18,6 +18,7 @@
 #include <iostream>
 #include <vector>
 #include <gtkmm/table.h>
+#include <gtkmm/colorbutton.h>
 #include <gtkmm/comboboxtext.h>
 #include <gtkmm/spinbutton.h>
 #include <gtkmm/treestore.h>
@@ -164,13 +165,16 @@ protected:
     PrefCombo       _misc_overs_bitmap;
 
     PrefCheckButton     _cms_display;
-    PrefCombo           _cms_intent;
     Gtk::ComboBoxText   _cms_display_profile;
+    PrefCombo           _cms_intent;
 
     PrefCheckButton     _cms_softproof;
     PrefCheckButton     _cms_gamutwarn;
-    PrefCombo           _cms_proof_intent;
+    Gtk::ColorButton    _cms_gamutcolor;
     Gtk::ComboBoxText   _cms_proof_profile;
+    PrefCombo           _cms_proof_intent;
+    PrefCheckButton     _cms_proof_blackpoint;
+    PrefCheckButton     _cms_proof_preserveblack;
 
     PrefEntryButtonHBox _importexport_ocal_url;
     PrefEntry       _importexport_ocal_username;