From f34aa5fa6bfa91b2c73fe21c4370aa3e70e6ae44 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 9 Apr 2016 18:47:51 +0200 Subject: [PATCH] Bug 756389 - Color-managing grayscale images Rename profile constructors to say "d65_gray" instead of just "gray", "srgb_trc" instead of "srgb_gamma", and drop the "srgb" from "srgb_linear" because we now say "d65". This should be a naming scheme that doesn't conflict with whatever future functions we might add. --- app/core/gimpimage-color-profile.c | 4 ++-- app/core/gimpimage-convert-precision.c | 4 ++-- app/core/gimplayer.c | 4 ++-- app/gegl/gimp-gegl-loops.c | 8 +++++--- libgimpcolor/gimpcolor.def | 8 ++++---- libgimpcolor/gimpcolorprofile.c | 24 ++++++++++++------------ libgimpcolor/gimpcolorprofile.h | 8 ++++---- 7 files changed, 31 insertions(+), 29 deletions(-) diff --git a/app/core/gimpimage-color-profile.c b/app/core/gimpimage-color-profile.c index 587d072ab8..218ed1d9bd 100644 --- a/app/core/gimpimage-color-profile.c +++ b/app/core/gimpimage-color-profile.c @@ -323,7 +323,7 @@ gimp_image_get_builtin_color_profile (GimpImage *image) { if (! linear_gray_profile) { - linear_gray_profile = gimp_color_profile_new_gray_srgb_linear (); + linear_gray_profile = gimp_color_profile_new_d65_gray_linear (); g_object_add_weak_pointer (G_OBJECT (linear_gray_profile), (gpointer) &linear_gray_profile); } @@ -334,7 +334,7 @@ gimp_image_get_builtin_color_profile (GimpImage *image) { if (! gray_profile) { - gray_profile = gimp_color_profile_new_gray_srgb (); + gray_profile = gimp_color_profile_new_d65_gray_srgb_trc (); g_object_add_weak_pointer (G_OBJECT (gray_profile), (gpointer) &gray_profile); } diff --git a/app/core/gimpimage-convert-precision.c b/app/core/gimpimage-convert-precision.c index ab36fefdbd..4b3770453e 100644 --- a/app/core/gimpimage-convert-precision.c +++ b/app/core/gimpimage-convert-precision.c @@ -173,12 +173,12 @@ gimp_image_convert_precision (GimpImage *image, if (gimp_babl_format_get_linear (new_format)) { new_profile = - gimp_color_profile_new_linear_gamma_from_color_profile (old_profile); + gimp_color_profile_new_linear_from_color_profile (old_profile); } else { new_profile = - gimp_color_profile_new_srgb_gamma_from_color_profile (old_profile); + gimp_color_profile_new_srgb_trc_from_color_profile (old_profile); } gimp_image_set_color_profile (image, new_profile, NULL); diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index dab1df6d53..b6f313e2dc 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -1138,12 +1138,12 @@ gimp_layer_convert_type (GimpDrawable *drawable, if (gimp_babl_format_get_linear (new_format)) { dest_profile = - gimp_color_profile_new_linear_gamma_from_color_profile (src_profile); + gimp_color_profile_new_linear_from_color_profile (src_profile); } else { dest_profile = - gimp_color_profile_new_srgb_gamma_from_color_profile (src_profile); + gimp_color_profile_new_srgb_trc_from_color_profile (src_profile); } /* if a new profile cannot be be generated, convert to diff --git a/app/gegl/gimp-gegl-loops.c b/app/gegl/gimp-gegl-loops.c index 2707301638..0bcbda5651 100644 --- a/app/gegl/gimp-gegl-loops.c +++ b/app/gegl/gimp-gegl-loops.c @@ -679,8 +679,8 @@ gimp_color_profile_can_gegl_copy (GimpColorProfile *src_profile, { srgb_profile = gimp_color_profile_new_rgb_srgb (); srgb_linear_profile = gimp_color_profile_new_rgb_srgb_linear (); - gray_profile = gimp_color_profile_new_gray_srgb (); - gray_linear_profile = gimp_color_profile_new_gray_srgb_linear (); + gray_profile = gimp_color_profile_new_d65_gray_srgb_trc (); + gray_linear_profile = gimp_color_profile_new_d65_gray_linear (); } if ((gimp_color_profile_is_equal (src_profile, srgb_profile) || @@ -692,7 +692,9 @@ gimp_color_profile_can_gegl_copy (GimpColorProfile *src_profile, gimp_color_profile_is_equal (dest_profile, srgb_linear_profile) || gimp_color_profile_is_equal (dest_profile, gray_profile) || gimp_color_profile_is_equal (dest_profile, gray_linear_profile))) - return TRUE; + { + return TRUE; + } return FALSE; } diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def index 040f66b867..127f79e3d0 100644 --- a/libgimpcolor/gimpcolor.def +++ b/libgimpcolor/gimpcolor.def @@ -40,16 +40,16 @@ EXPORTS gimp_color_profile_is_gray gimp_color_profile_is_linear gimp_color_profile_is_rgb + gimp_color_profile_new_d65_gray_linear + gimp_color_profile_new_d65_gray_srgb_trc gimp_color_profile_new_from_file gimp_color_profile_new_from_icc_profile gimp_color_profile_new_from_lcms_profile - gimp_color_profile_new_gray_srgb - gimp_color_profile_new_gray_srgb_linear - gimp_color_profile_new_linear_gamma_from_color_profile + gimp_color_profile_new_linear_from_color_profile gimp_color_profile_new_rgb_adobe gimp_color_profile_new_rgb_srgb gimp_color_profile_new_rgb_srgb_linear - gimp_color_profile_new_srgb_gamma_from_color_profile + gimp_color_profile_new_srgb_trc_from_color_profile gimp_hsl_get_type gimp_hsl_set gimp_hsl_set_alpha diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c index 28eaedd7aa..8c1ae71f8e 100644 --- a/libgimpcolor/gimpcolorprofile.c +++ b/libgimpcolor/gimpcolorprofile.c @@ -921,7 +921,7 @@ gimp_color_profile_new_from_color_profile (GimpColorProfile *profile, } /** - * gimp_color_profile_new_srgb_gamma_from_color_profile: + * gimp_color_profile_new_srgb_trc_from_color_profile: * @profile: a #GimpColorProfile * * This function creates a new RGB #GimpColorProfile with a sRGB gamma @@ -933,7 +933,7 @@ gimp_color_profile_new_from_color_profile (GimpColorProfile *profile, * Since: 2.10 **/ GimpColorProfile * -gimp_color_profile_new_srgb_gamma_from_color_profile (GimpColorProfile *profile) +gimp_color_profile_new_srgb_trc_from_color_profile (GimpColorProfile *profile) { g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL); @@ -941,7 +941,7 @@ gimp_color_profile_new_srgb_gamma_from_color_profile (GimpColorProfile *profile) } /** - * gimp_color_profile_new_linear_gamma_from_color_profile: + * gimp_color_profile_new_linear_from_color_profile: * @profile: a #GimpColorProfile * * This function creates a new RGB #GimpColorProfile with a linear TRC @@ -953,7 +953,7 @@ gimp_color_profile_new_srgb_gamma_from_color_profile (GimpColorProfile *profile) * Since: 2.10 **/ GimpColorProfile * -gimp_color_profile_new_linear_gamma_from_color_profile (GimpColorProfile *profile) +gimp_color_profile_new_linear_from_color_profile (GimpColorProfile *profile) { g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL); @@ -1225,7 +1225,7 @@ gimp_color_profile_new_rgb_adobe (void) } static cmsHPROFILE * -gimp_color_profile_new_gray_srgb_internal (void) +gimp_color_profile_new_d65_gray_srgb_trc_internal (void) { cmsHPROFILE profile; @@ -1255,7 +1255,7 @@ gimp_color_profile_new_gray_srgb_internal (void) } /** - * gimp_color_profile_new_gray_srgb + * gimp_color_profile_new_d65_gray_srgb_trc * * This function creates a grayscale #GimpColorProfile with an * sRGB TRC. See gimp_color_profile_new_srgb(). @@ -1265,7 +1265,7 @@ gimp_color_profile_new_gray_srgb_internal (void) * Since: 2.10 **/ GimpColorProfile * -gimp_color_profile_new_gray_srgb (void) +gimp_color_profile_new_d65_gray_srgb_trc (void) { static GimpColorProfile *profile = NULL; @@ -1274,7 +1274,7 @@ gimp_color_profile_new_gray_srgb (void) if (G_UNLIKELY (profile == NULL)) { - cmsHPROFILE lcms_profile = gimp_color_profile_new_gray_srgb_internal (); + cmsHPROFILE lcms_profile = gimp_color_profile_new_d65_gray_srgb_trc_internal (); profile = gimp_color_profile_new_from_lcms_profile (lcms_profile, NULL); @@ -1287,7 +1287,7 @@ gimp_color_profile_new_gray_srgb (void) } static cmsHPROFILE -gimp_color_profile_new_gray_srgb_linear_internal (void) +gimp_color_profile_new_d65_gray_linear_internal (void) { cmsHPROFILE profile; @@ -1313,7 +1313,7 @@ gimp_color_profile_new_gray_srgb_linear_internal (void) } /** - * gimp_color_profile_new_gray_srgb_linear_gray: + * gimp_color_profile_new_d65_gray_srgb_gray: * * This function creates a profile for babl_model("Y"). Please * somebody write someting smarter here. @@ -1323,7 +1323,7 @@ gimp_color_profile_new_gray_srgb_linear_internal (void) * Since: 2.10 **/ GimpColorProfile * -gimp_color_profile_new_gray_srgb_linear (void) +gimp_color_profile_new_d65_gray_linear (void) { static GimpColorProfile *profile = NULL; @@ -1332,7 +1332,7 @@ gimp_color_profile_new_gray_srgb_linear (void) if (G_UNLIKELY (profile == NULL)) { - cmsHPROFILE lcms_profile = gimp_color_profile_new_gray_srgb_linear_internal (); + cmsHPROFILE lcms_profile = gimp_color_profile_new_d65_gray_linear_internal (); profile = gimp_color_profile_new_from_lcms_profile (lcms_profile, NULL); diff --git a/libgimpcolor/gimpcolorprofile.h b/libgimpcolor/gimpcolorprofile.h index 2c2e6a0627..881385eecb 100644 --- a/libgimpcolor/gimpcolorprofile.h +++ b/libgimpcolor/gimpcolorprofile.h @@ -68,13 +68,13 @@ GimpColorProfile * gimp_color_profile_new_rgb_srgb (void); GimpColorProfile * gimp_color_profile_new_rgb_srgb_linear (void); GimpColorProfile * gimp_color_profile_new_rgb_adobe (void); -GimpColorProfile * gimp_color_profile_new_gray_srgb (void); -GimpColorProfile * gimp_color_profile_new_gray_srgb_linear (void); +GimpColorProfile * gimp_color_profile_new_d65_gray_srgb_trc (void); +GimpColorProfile * gimp_color_profile_new_d65_gray_linear (void); GimpColorProfile * - gimp_color_profile_new_srgb_gamma_from_color_profile (GimpColorProfile *profile); + gimp_color_profile_new_srgb_trc_from_color_profile (GimpColorProfile *profile); GimpColorProfile * - gimp_color_profile_new_linear_gamma_from_color_profile (GimpColorProfile *profile); + gimp_color_profile_new_linear_from_color_profile (GimpColorProfile *profile); GimpColorProfile * gimp_color_profile_new_from_file (GFile *file, GError **error);