Added basic support for the proposed ICC Profiles In X Specification

2005-06-24  Sven Neumann  <sven@gimp.org>

	Added basic support for the proposed ICC Profiles In X Specification
	(http://burtonini.com/temp/xicc-specification-0.1.html).

	* libgimpconfig/gimpcolorconfig.[ch]: added a configuration option
	"display-profile-from-gdk", default to TRUE.

	* modules/cdisplay_lcms.c: try to retrieve the display color
	profile from the "_ICC_PROFILE" profile on the default screen's
	root window.
This commit is contained in:
Sven Neumann 2005-06-24 01:38:53 +00:00 committed by Sven Neumann
parent 745e71195c
commit 3490c49252
4 changed files with 68 additions and 3 deletions

View file

@ -1,3 +1,15 @@
2005-06-24 Sven Neumann <sven@gimp.org>
Added basic support for the proposed ICC Profiles In X Specification
(http://burtonini.com/temp/xicc-specification-0.1.html).
* libgimpconfig/gimpcolorconfig.[ch]: added a configuration option
"display-profile-from-gdk", default to TRUE.
* modules/cdisplay_lcms.c: try to retrieve the display color
profile from the "_ICC_PROFILE" profile on the default screen's
root window.
2005-06-23 Akkana Peck <akkana@shallowsky.com>
* app/actions/plug-in-actions.c

View file

@ -40,6 +40,9 @@
N_("Mode of operation for color management.")
#define DISPLAY_PROFILE_BLURB \
N_("Sets the color profile for the display.")
#define DISPLAY_PROFILE_FROM_GDK_BLURB \
N_("When enabled, the GIMP will try to use the display color profile " \
"from the windowing system.")
#define RGB_PROFILE_BLURB \
N_("Sets default RGB workspace color profile.")
#define CMYK_PROFILE_BLURB \
@ -50,6 +53,7 @@
N_("Sets how colors are mapped for your display.")
#define SIMULATION_RENDERING_INTENT_BLURB \
N_("Sets how colors are converted from workspace to simulation device.")
#define OPEN_BEHAVIOUR_NO_PROFILE_BLURB \
"Defines what will be done if no color profile is available."
#define OPEN_BEHAVIOUR_RGB_PROFILE_BLURB \
@ -65,6 +69,7 @@ enum
PROP_RGB_PROFILE,
PROP_CMYK_PROFILE,
PROP_DISPLAY_PROFILE,
PROP_DISPLAY_PROFILE_FROM_GDK,
PROP_PRINTER_PROFILE,
PROP_DISPLAY_RENDERING_INTENT,
PROP_SIMULATION_RENDERING_INTENT,
@ -160,6 +165,11 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
"display-profile", DISPLAY_PROFILE_BLURB,
GIMP_CONFIG_PATH_FILE, NULL,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DISPLAY_PROFILE_FROM_GDK,
"display-profile-from-gdk",
DISPLAY_PROFILE_FROM_GDK_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PRINTER_PROFILE,
"printer-profile", PRINTER_PROFILE_BLURB,
GIMP_CONFIG_PATH_FILE, NULL,
@ -250,6 +260,9 @@ gimp_color_config_set_property (GObject *object,
g_free (color_config->display_profile);
color_config->display_profile = g_value_dup_string (value);
break;
case PROP_DISPLAY_PROFILE_FROM_GDK:
color_config->display_profile_from_gdk = g_value_get_boolean (value);
break;
case PROP_PRINTER_PROFILE:
g_free (color_config->printer_profile);
color_config->printer_profile = g_value_dup_string (value);
@ -303,6 +316,9 @@ gimp_color_config_get_property (GObject *object,
case PROP_DISPLAY_PROFILE:
g_value_set_string (value, color_config->display_profile);
break;
case PROP_DISPLAY_PROFILE_FROM_GDK:
g_value_set_boolean (value, color_config->display_profile_from_gdk);
break;
case PROP_PRINTER_PROFILE:
g_value_set_string (value, color_config->printer_profile);
break;

View file

@ -41,6 +41,7 @@ struct _GimpColorConfig
gchar *rgb_profile;
gchar *cmyk_profile;
gchar *display_profile;
gboolean display_profile_from_gdk;
gchar *printer_profile;
GimpColorRenderingIntent display_intent;
GimpColorRenderingIntent simulation_intent;

View file

@ -88,6 +88,9 @@ static void cdisplay_lcms_changed (GimpColorDisplay *display);
static void cdisplay_lcms_set_config (CdisplayLcms *lcms,
GimpColorConfig *config);
static cmsHPROFILE cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
GimpColorConfig *config);
static const GimpModuleInfo cdisplay_lcms_info =
{
@ -278,9 +281,7 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
/* this should be taken from the image */
src_profile = cmsCreate_sRGBProfile ();
if (config->display_profile)
dest_profile = cmsOpenProfileFromFile (config->display_profile,"r");
dest_profile = cdisplay_lcms_get_display_profile (lcms, config);
break;
}
@ -337,3 +338,38 @@ cdisplay_lcms_set_config (CdisplayLcms *lcms,
gimp_color_display_changed (GIMP_COLOR_DISPLAY (lcms));
}
static cmsHPROFILE
cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
GimpColorConfig *config)
{
if (config->display_profile_from_gdk)
{
/* FIXME: need to access the display's screen here */
GdkScreen *screen = gdk_screen_get_default ();
GdkAtom type;
gint format;
gint nitems;
guchar *data;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
if (gdk_property_get (gdk_screen_get_root_window (screen),
gdk_atom_intern ("_ICC_PROFILE", FALSE),
GDK_NONE,
0, G_MAXLONG,
FALSE,
&type, &format, &nitems, &data) && nitems)
{
cmsHPROFILE *profile = cmsOpenProfileFromMem (data, nitems);
g_free (data);
return profile;
}
}
if (config->display_profile)
return cmsOpenProfileFromFile (config->display_profile, "r");
}