mirror of https://github.com/GNOME/gimp.git
libgimpcolor: add a function to check if a profile is linear RGB
This commit is contained in:
parent
ba14054a8e
commit
d8f19f31ce
|
@ -4,6 +4,7 @@
|
|||
* gimpcolorprofile.c
|
||||
* Copyright (C) 2014 Michael Natterer <mitch@gimp.org>
|
||||
* Elle Stone <ellestone@ninedegreesbelow.com>
|
||||
* Øyvind Kolås <pippin@gimp.org>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -1291,3 +1292,48 @@ 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;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ gboolean gimp_color_profile_is_equal (GimpColorProfile *
|
|||
GimpColorProfile *profile2);
|
||||
|
||||
gboolean gimp_color_profile_is_rgb (GimpColorProfile *profile);
|
||||
gboolean gimp_color_profile_is_linear (GimpColorProfile *profile);
|
||||
gboolean gimp_color_profile_is_cmyk (GimpColorProfile *profile);
|
||||
|
||||
const Babl * gimp_color_profile_get_format (const Babl *format,
|
||||
|
|
Loading…
Reference in New Issue