mirror of https://github.com/GNOME/gimp.git
libgimpcolor: clean up gimp_color_profile_is_linear(), add it to gimpcolor.def
This commit is contained in:
parent
e1af9a59c8
commit
0cf597d042
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue