mirror of https://github.com/GNOME/gimp.git
Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Add gimp_color_profile_new_adobe_rgb(), will need this later to fix this bug.
This commit is contained in:
parent
e4d5f05373
commit
9fc64e3664
|
@ -38,6 +38,7 @@ EXPORTS
|
||||||
gimp_color_profile_is_cmyk
|
gimp_color_profile_is_cmyk
|
||||||
gimp_color_profile_is_equal
|
gimp_color_profile_is_equal
|
||||||
gimp_color_profile_is_rgb
|
gimp_color_profile_is_rgb
|
||||||
|
gimp_color_profile_new_adobe_rgb
|
||||||
gimp_color_profile_new_from_file
|
gimp_color_profile_new_from_file
|
||||||
gimp_color_profile_new_from_icc_profile
|
gimp_color_profile_new_from_icc_profile
|
||||||
gimp_color_profile_new_from_lcms_profile
|
gimp_color_profile_new_from_lcms_profile
|
||||||
|
|
|
@ -840,6 +840,84 @@ gimp_color_profile_new_linear_rgb (void)
|
||||||
return gimp_color_profile_new_from_icc_profile (data, length, NULL);
|
return gimp_color_profile_new_from_icc_profile (data, length, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cmsHPROFILE *
|
||||||
|
gimp_color_profile_new_adobe_rgb_internal (void)
|
||||||
|
{
|
||||||
|
cmsHPROFILE profile;
|
||||||
|
cmsCIExyY d65_srgb_specs = { 0.3127, 0.3290, 1.0 };
|
||||||
|
|
||||||
|
/* AdobeRGB1998 and sRGB have the same white point.
|
||||||
|
*
|
||||||
|
* The primaries below are technically correct, but because of
|
||||||
|
* hexadecimal rounding these primaries don't make a profile that
|
||||||
|
* matches the original.
|
||||||
|
*
|
||||||
|
* cmsCIExyYTRIPLE adobe_primaries = {
|
||||||
|
* { 0.6400, 0.3300, 1.0 },
|
||||||
|
* { 0.2100, 0.7100, 1.0 },
|
||||||
|
* { 0.1500, 0.0600, 1.0 }
|
||||||
|
* };
|
||||||
|
*/
|
||||||
|
cmsCIExyYTRIPLE adobe_compatible_primaries_prequantized =
|
||||||
|
{
|
||||||
|
{0.639996511, 0.329996864, 1.0},
|
||||||
|
{0.210005295, 0.710004866, 1.0},
|
||||||
|
{0.149997606, 0.060003644, 1.0}
|
||||||
|
};
|
||||||
|
|
||||||
|
cmsToneCurve *tone_curve[3];
|
||||||
|
cmsToneCurve *gamma22[3];
|
||||||
|
|
||||||
|
gamma22[0] = gamma22[1] = gamma22[2] = cmsBuildGamma (NULL, 2.19921875);
|
||||||
|
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma22[0];
|
||||||
|
|
||||||
|
profile = cmsCreateRGBProfile (&d65_srgb_specs,
|
||||||
|
&adobe_compatible_primaries_prequantized,
|
||||||
|
tone_curve);
|
||||||
|
|
||||||
|
gimp_color_profile_set_tag (profile, cmsSigProfileDescriptionTag,
|
||||||
|
"Compatible with Adobe RGB (1998)");
|
||||||
|
gimp_color_profile_set_tag (profile, cmsSigDeviceMfgDescTag,
|
||||||
|
"GIMP");
|
||||||
|
gimp_color_profile_set_tag (profile, cmsSigDeviceModelDescTag,
|
||||||
|
"Compatible with Adobe RGB (1998)");
|
||||||
|
gimp_color_profile_set_tag (profile, cmsSigCopyrightTag,
|
||||||
|
"Public Domain");
|
||||||
|
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_color_profile_new_adobe_rgb:
|
||||||
|
*
|
||||||
|
* This function creates a profile compatible with AbobeRGB (1998).
|
||||||
|
*
|
||||||
|
* Return value: the AdobeRGB-compatible #GimpColorProfile.
|
||||||
|
*
|
||||||
|
* Since: 2.10
|
||||||
|
**/
|
||||||
|
GimpColorProfile *
|
||||||
|
gimp_color_profile_new_adobe_rgb (void)
|
||||||
|
{
|
||||||
|
static GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
|
const guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (profile == NULL))
|
||||||
|
{
|
||||||
|
cmsHPROFILE lcms_profile = gimp_color_profile_new_adobe_rgb_internal ();
|
||||||
|
|
||||||
|
profile = gimp_color_profile_new_from_lcms_profile (lcms_profile, NULL);
|
||||||
|
|
||||||
|
cmsCloseProfile (lcms_profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
|
|
||||||
|
return gimp_color_profile_new_from_icc_profile (data, length, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_color_profile_get_format:
|
* gimp_color_profile_get_format:
|
||||||
* @format: a #Babl format
|
* @format: a #Babl format
|
||||||
|
|
|
@ -67,6 +67,8 @@ GType gimp_color_profile_get_type (void) G_GNUC_CONST;
|
||||||
GimpColorProfile * gimp_color_profile_new_srgb (void);
|
GimpColorProfile * gimp_color_profile_new_srgb (void);
|
||||||
GimpColorProfile * gimp_color_profile_new_linear_rgb (void);
|
GimpColorProfile * gimp_color_profile_new_linear_rgb (void);
|
||||||
|
|
||||||
|
GimpColorProfile * gimp_color_profile_new_adobe_rgb (void);
|
||||||
|
|
||||||
GimpColorProfile * gimp_color_profile_new_from_file (GFile *file,
|
GimpColorProfile * gimp_color_profile_new_from_file (GFile *file,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue