From: JucaBlues Date: Sat, 15 Aug 2009 05:25:49 +0000 (+0000) Subject: refactoring ICC out-of-gamut check X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e1c7eb843559fe77b588d690445c726c160569e5;p=inkscape.git refactoring ICC out-of-gamut check --- diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 5eb44c2cb..52c78ba42 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -511,15 +511,13 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) /* update out-of-gamut icon */ gtk_widget_set_sensitive (_box_outofgamut, false); if (color.icc){ - BYTE outofgamut; - cmsSetAlarmCodes(255, 255, 255); + BYTE outofgamut = 0; static cmsHPROFILE hNULL = cmsCreateNULLProfile(); static cmsHPROFILE hsRGB = cmsCreate_sRGBProfile(); - cmsHTRANSFORM trans; Inkscape::ColorProfile* target_profile = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str()); if ( target_profile ) { - trans = cmsCreateProofingTransform(hsRGB, TYPE_RGB_DBL, hNULL, TYPE_GRAY_8, target_profile->profHandle, + cmsHTRANSFORM trans = cmsCreateProofingTransform(hsRGB, TYPE_RGBA_8, hNULL, TYPE_GRAY_8, target_profile->profHandle, INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, (cmsFLAGS_GAMUTCHECK|cmsFLAGS_SOFTPROOFING)); if ( trans ) { @@ -530,7 +528,11 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) SP_RGBA32_B_U(val), 255}; + int alarm_r, alarm_g, alarm_b; + cmsGetAlarmCodes(&alarm_r, &alarm_g, &alarm_b); + cmsSetAlarmCodes(255, 255, 255); cmsDoTransform(trans, &check_color, &outofgamut, 1); + cmsSetAlarmCodes(alarm_r, alarm_g, alarm_b); gtk_widget_set_sensitive (_box_outofgamut, outofgamut == 255); } }