[gimp] libgimpcolor: clean up gimp_color_profile_is_linear(), add it to gimpcolor.def



commit 0cf597d0420aea53585f83d08f2bfbb4cafdd5ad
Author: Michael Natterer <mitch gimp org>
Date:   Mon Nov 23 01:29:17 2015 +0100

    libgimpcolor: clean up gimp_color_profile_is_linear(), add it to gimpcolor.def

 libgimpcolor/gimpcolor.def      |    1 +
 libgimpcolor/gimpcolorprofile.c |   93 ++++++++++++++++++++-------------------
 2 files changed, 49 insertions(+), 45 deletions(-)
---
diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def
index 897575a..70f3168 100644
--- a/libgimpcolor/gimpcolor.def
+++ b/libgimpcolor/gimpcolor.def
@@ -37,6 +37,7 @@ EXPORTS
        gimp_color_profile_get_type
        gimp_color_profile_is_cmyk
        gimp_color_profile_is_equal
+       gimp_color_profile_is_linear
        gimp_color_profile_is_rgb
        gimp_color_profile_new_adobe_rgb
        gimp_color_profile_new_from_file
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index 14a80eb..3159497 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -634,6 +634,54 @@ gimp_color_profile_is_rgb (GimpColorProfile *profile)
   return (cmsGetColorSpace (profile->priv->lcms_profile) == cmsSigRgbData);
 }
 
+
+/**
+ * gimp_color_profile_is_linear:
+ * @profile: a #GimpColorProfile
+ *
+ * This function determines is the ICC profile represented by a GimpColorProfile
+ * is a linear RGB profile or not, some profiles that are LUTs though linear
+ * will also return FALSE;
+ *
+ * Return value: %TRUE if the profile is a matrix shaping profile with linear
+ * TRCs, %FALSE otherwise.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_color_profile_is_linear (GimpColorProfile *profile)
+{
+  cmsHPROFILE prof;
+  cmsToneCurve *curve;
+
+  g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), FALSE);
+
+  prof = profile->priv->lcms_profile;
+
+  if (! cmsIsMatrixShaper (prof))
+    return FALSE;
+
+  if (cmsIsCLUT (prof, INTENT_PERCEPTUAL, LCMS_USED_AS_INPUT))
+    return FALSE;
+
+  if (cmsIsCLUT (prof, INTENT_PERCEPTUAL, LCMS_USED_AS_OUTPUT))
+    return FALSE;
+
+  curve = cmsReadTag(prof, cmsSigRedTRCTag);
+  if (curve == NULL || ! cmsIsToneCurveLinear (curve))
+    return FALSE;
+
+  curve = cmsReadTag (prof, cmsSigGreenTRCTag);
+  if (curve == NULL || ! cmsIsToneCurveLinear (curve))
+    return FALSE;
+
+  curve = cmsReadTag (prof, cmsSigBlueTRCTag);
+  if (curve == NULL || ! cmsIsToneCurveLinear (curve))
+    return FALSE;
+
+  return TRUE;
+}
+
 /**
  * gimp_color_profile_is_cmyk:
  * @profile: a #GimpColorProfile
@@ -1292,48 +1340,3 @@ gimp_color_profile_get_format (const Babl *format,
 
   return output_format;
 }
-
-/**
- * gimp_color_profile_is_linear:
- * @profile: a #GimpColorProfile
- *
- * This function determines is the ICC profile represented by a GimpColorProfile
- * is a linear RGB profile or not, some profiles that are LUTs though linear
- * will also return FALSE;
- *
- * Return value: TRUE if the profile is a matrix shaping profile with linear
- * TRCs.
- *
- * Since: 2.10
- **/
-gboolean
-gimp_color_profile_is_linear (GimpColorProfile *profile)
-{
-  cmsHPROFILE prof;
-  cmsToneCurve *curve;
-
-  if (!profile)
-    return FALSE;
-  prof = profile->priv->lcms_profile;
-
-  if (!cmsIsMatrixShaper (prof))
-    return FALSE;
-
-  if(cmsIsCLUT(prof, INTENT_PERCEPTUAL, LCMS_USED_AS_INPUT))
-    return FALSE;
-
-  if(cmsIsCLUT(prof, INTENT_PERCEPTUAL, LCMS_USED_AS_OUTPUT))
-    return FALSE;
-
-  curve = cmsReadTag(prof, cmsSigRedTRCTag);
-  if (curve == NULL || !cmsIsToneCurveLinear (curve))
-    return FALSE;
-  curve = cmsReadTag(prof, cmsSigGreenTRCTag);
-  if (curve == NULL || !cmsIsToneCurveLinear (curve))
-    return FALSE;
-  curve = cmsReadTag(prof, cmsSigBlueTRCTag);
-  if (curve == NULL || !cmsIsToneCurveLinear (curve))
-    return FALSE;
-
-  return TRUE;
-}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]