static void cdisplay_lcms_update_profile_label (CdisplayLcms *lcms, const gchar *name) { GimpColorConfig *config; GimpColorManaged *managed; GtkWidget *label; GimpColorProfile *profile = NULL; const gchar *text; const gchar *tooltip; config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms)); managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms)); label = g_object_get_data (G_OBJECT (lcms), name); if (! label) return; if (strcmp (name, "rgb-profile") == 0) { profile = gimp_color_managed_get_color_profile (managed); if (profile) g_object_ref (profile); } else if (g_str_has_prefix (name, "display-profile")) { profile = cdisplay_lcms_get_display_profile (lcms); } else if (strcmp (name, "printer-profile") == 0) { profile = gimp_color_config_get_simulation_color_profile (config, NULL); } else { g_return_if_reached (); } if (profile) { text = gimp_color_profile_get_label (profile); tooltip = gimp_color_profile_get_summary (profile); } else { text = _("None"); tooltip = NULL; } gtk_label_set_text (GTK_LABEL (label), text); gimp_help_set_help_data (label, tooltip, NULL); if (profile) g_object_unref (profile); }
static void colorsel_cmyk_config_changed (ColorselCmyk *module) { GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module); GimpColorConfig *config = module->config; cmsUInt32Number flags = 0; GimpColorProfile rgb_profile = NULL; GimpColorProfile cmyk_profile = NULL; gchar *label; gchar *summary; gchar *text; if (module->rgb2cmyk) { cmsDeleteTransform (module->rgb2cmyk); module->rgb2cmyk = NULL; } if (module->cmyk2rgb) { cmsDeleteTransform (module->cmyk2rgb); module->cmyk2rgb = NULL; } gtk_label_set_text (GTK_LABEL (module->name_label), _("Profile: (none)")); gimp_help_set_help_data (module->name_label, NULL, NULL); if (! config) goto out; rgb_profile = gimp_color_config_get_rgb_color_profile (config, NULL); cmyk_profile = gimp_color_config_get_cmyk_color_profile (config, NULL); if (! rgb_profile) rgb_profile = gimp_color_profile_new_srgb (); if (! cmyk_profile) goto out; label = gimp_color_profile_get_label (cmyk_profile); summary = gimp_color_profile_get_summary (cmyk_profile); text = g_strdup_printf (_("Profile: %s"), label); gtk_label_set_text (GTK_LABEL (module->name_label), text); gimp_help_set_help_data (module->name_label, summary, NULL); g_free (text); g_free (label); g_free (summary); if (config->display_intent == GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC) { flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; } module->rgb2cmyk = cmsCreateTransform (rgb_profile, TYPE_RGB_DBL, cmyk_profile, TYPE_CMYK_DBL, config->display_intent, flags); module->cmyk2rgb = cmsCreateTransform (cmyk_profile, TYPE_CMYK_DBL, rgb_profile, TYPE_RGB_DBL, config->display_intent, flags); out: if (rgb_profile) gimp_color_profile_close (rgb_profile); if (cmyk_profile) gimp_color_profile_close (cmyk_profile); if (! module->in_destruction) colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv); }