Commit 3490c492 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

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.
parent 745e7119
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> 2005-06-23 Akkana Peck <akkana@shallowsky.com>
* app/actions/plug-in-actions.c * app/actions/plug-in-actions.c
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
N_("Mode of operation for color management.") N_("Mode of operation for color management.")
#define DISPLAY_PROFILE_BLURB \ #define DISPLAY_PROFILE_BLURB \
N_("Sets the color profile for the display.") 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 \ #define RGB_PROFILE_BLURB \
N_("Sets default RGB workspace color profile.") N_("Sets default RGB workspace color profile.")
#define CMYK_PROFILE_BLURB \ #define CMYK_PROFILE_BLURB \
...@@ -50,6 +53,7 @@ ...@@ -50,6 +53,7 @@
N_("Sets how colors are mapped for your display.") N_("Sets how colors are mapped for your display.")
#define SIMULATION_RENDERING_INTENT_BLURB \ #define SIMULATION_RENDERING_INTENT_BLURB \
N_("Sets how colors are converted from workspace to simulation device.") N_("Sets how colors are converted from workspace to simulation device.")
#define OPEN_BEHAVIOUR_NO_PROFILE_BLURB \ #define OPEN_BEHAVIOUR_NO_PROFILE_BLURB \
"Defines what will be done if no color profile is available." "Defines what will be done if no color profile is available."
#define OPEN_BEHAVIOUR_RGB_PROFILE_BLURB \ #define OPEN_BEHAVIOUR_RGB_PROFILE_BLURB \
...@@ -65,6 +69,7 @@ enum ...@@ -65,6 +69,7 @@ enum
PROP_RGB_PROFILE, PROP_RGB_PROFILE,
PROP_CMYK_PROFILE, PROP_CMYK_PROFILE,
PROP_DISPLAY_PROFILE, PROP_DISPLAY_PROFILE,
PROP_DISPLAY_PROFILE_FROM_GDK,
PROP_PRINTER_PROFILE, PROP_PRINTER_PROFILE,
PROP_DISPLAY_RENDERING_INTENT, PROP_DISPLAY_RENDERING_INTENT,
PROP_SIMULATION_RENDERING_INTENT, PROP_SIMULATION_RENDERING_INTENT,
...@@ -160,6 +165,11 @@ gimp_color_config_class_init (GimpColorConfigClass *klass) ...@@ -160,6 +165,11 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
"display-profile", DISPLAY_PROFILE_BLURB, "display-profile", DISPLAY_PROFILE_BLURB,
GIMP_CONFIG_PATH_FILE, NULL, GIMP_CONFIG_PATH_FILE, NULL,
0); 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, GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PRINTER_PROFILE,
"printer-profile", PRINTER_PROFILE_BLURB, "printer-profile", PRINTER_PROFILE_BLURB,
GIMP_CONFIG_PATH_FILE, NULL, GIMP_CONFIG_PATH_FILE, NULL,
...@@ -250,6 +260,9 @@ gimp_color_config_set_property (GObject *object, ...@@ -250,6 +260,9 @@ gimp_color_config_set_property (GObject *object,
g_free (color_config->display_profile); g_free (color_config->display_profile);
color_config->display_profile = g_value_dup_string (value); color_config->display_profile = g_value_dup_string (value);
break; break;
case PROP_DISPLAY_PROFILE_FROM_GDK:
color_config->display_profile_from_gdk = g_value_get_boolean (value);
break;
case PROP_PRINTER_PROFILE: case PROP_PRINTER_PROFILE:
g_free (color_config->printer_profile); g_free (color_config->printer_profile);
color_config->printer_profile = g_value_dup_string (value); color_config->printer_profile = g_value_dup_string (value);
...@@ -303,6 +316,9 @@ gimp_color_config_get_property (GObject *object, ...@@ -303,6 +316,9 @@ gimp_color_config_get_property (GObject *object,
case PROP_DISPLAY_PROFILE: case PROP_DISPLAY_PROFILE:
g_value_set_string (value, color_config->display_profile); g_value_set_string (value, color_config->display_profile);
break; break;
case PROP_DISPLAY_PROFILE_FROM_GDK:
g_value_set_boolean (value, color_config->display_profile_from_gdk);
break;
case PROP_PRINTER_PROFILE: case PROP_PRINTER_PROFILE:
g_value_set_string (value, color_config->printer_profile); g_value_set_string (value, color_config->printer_profile);
break; break;
......
...@@ -41,6 +41,7 @@ struct _GimpColorConfig ...@@ -41,6 +41,7 @@ struct _GimpColorConfig
gchar *rgb_profile; gchar *rgb_profile;
gchar *cmyk_profile; gchar *cmyk_profile;
gchar *display_profile; gchar *display_profile;
gboolean display_profile_from_gdk;
gchar *printer_profile; gchar *printer_profile;
GimpColorRenderingIntent display_intent; GimpColorRenderingIntent display_intent;
GimpColorRenderingIntent simulation_intent; GimpColorRenderingIntent simulation_intent;
......
...@@ -88,6 +88,9 @@ static void cdisplay_lcms_changed (GimpColorDisplay *display); ...@@ -88,6 +88,9 @@ static void cdisplay_lcms_changed (GimpColorDisplay *display);
static void cdisplay_lcms_set_config (CdisplayLcms *lcms, static void cdisplay_lcms_set_config (CdisplayLcms *lcms,
GimpColorConfig *config); GimpColorConfig *config);
static cmsHPROFILE cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
GimpColorConfig *config);
static const GimpModuleInfo cdisplay_lcms_info = static const GimpModuleInfo cdisplay_lcms_info =
{ {
...@@ -278,9 +281,7 @@ cdisplay_lcms_changed (GimpColorDisplay *display) ...@@ -278,9 +281,7 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
/* this should be taken from the image */ /* this should be taken from the image */
src_profile = cmsCreate_sRGBProfile (); src_profile = cmsCreate_sRGBProfile ();
if (config->display_profile) dest_profile = cdisplay_lcms_get_display_profile (lcms, config);
dest_profile = cmsOpenProfileFromFile (config->display_profile,"r");
break; break;
} }
...@@ -337,3 +338,38 @@ cdisplay_lcms_set_config (CdisplayLcms *lcms, ...@@ -337,3 +338,38 @@ cdisplay_lcms_set_config (CdisplayLcms *lcms,
gimp_color_display_changed (GIMP_COLOR_DISPLAY (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");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment