From acb62bca032566a8cd2fded5059914da75ef331e Mon Sep 17 00:00:00 2001 From: joncruz Date: Thu, 4 Oct 2007 05:58:08 +0000 Subject: [PATCH] few more CMS options --- src/color-profile.cpp | 23 ++++++++++++++-- src/preferences-skeleton.h | 2 ++ src/ui/dialog/inkscape-preferences.cpp | 38 ++++++++++++++++++++------ src/ui/dialog/inkscape-preferences.h | 8 ++++-- 4 files changed, 58 insertions(+), 13 deletions(-) diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 75757068f..609c14cc1 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -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 ); diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index b01d5a3de..242a9d919 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -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" " \n" " \n" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index e3d0de1f9..a747e0045 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -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); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index c41971fdd..823de92de 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -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; -- 2.30.2