From: JucaBlues Date: Fri, 14 Aug 2009 06:34:14 +0000 (+0000) Subject: Initial draft of the out-of-gamut check. It is not working yet. I will continue work... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9e09b67c6cd73c70ca6a8413e53d8add6a304ad4;p=inkscape.git Initial draft of the out-of-gamut check. It is not working yet. I will continue work on it tomorrow. --- diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 44de40115..5eb44c2cb 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -32,6 +32,10 @@ #include "sp-color-scales.h" #include "sp-color-icc-selector.h" #include "sp-color-wheel-selector.h" +#include "svg/svg-icc-color.h" +#include "../inkscape.h" +#include "../document.h" +#include "../profile-manager.h" struct SPColorNotebookTracker { const gchar* name; @@ -504,6 +508,35 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) /* update color management icon*/ gtk_widget_set_sensitive (_box_colormanaged, color.icc != NULL); + /* update out-of-gamut icon */ + gtk_widget_set_sensitive (_box_outofgamut, false); + if (color.icc){ + BYTE outofgamut; + cmsSetAlarmCodes(255, 255, 255); + 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, + INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, (cmsFLAGS_GAMUTCHECK|cmsFLAGS_SOFTPROOFING)); + + if ( trans ) { + guint32 val = color.toRGBA32(0); + guchar check_color[4] = { + SP_RGBA32_R_U(val), + SP_RGBA32_G_U(val), + SP_RGBA32_B_U(val), + 255}; + + cmsDoTransform(trans, &check_color, &outofgamut, 1); + gtk_widget_set_sensitive (_box_outofgamut, outofgamut == 255); + } + } + } + + if ( !_updatingrgba ) { gchar s[32];