libgimpcolor: add GimpColorManaged::get_color_profile()

which returns a GimpColorProfile instead of just an ICC blob like
get_icc_profile(). Also, it will always return a profile, as in
fall back to the built-in profiles automatically.
This commit is contained in:
Michael Natterer 2015-05-13 00:43:16 +02:00
parent abef515ef8
commit cdb3b0aabb
3 changed files with 41 additions and 9 deletions

View File

@ -21,6 +21,7 @@ EXPORTS
gimp_cmyka_get_uchar
gimp_cmyka_set
gimp_cmyka_set_uchar
gimp_color_managed_get_color_profile
gimp_color_managed_get_icc_profile
gimp_color_managed_interface_get_type
gimp_color_managed_profile_changed

View File

@ -91,8 +91,9 @@ gimp_color_managed_base_init (GimpColorManagedInterface *iface)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
iface->get_icc_profile = NULL;
iface->profile_changed = NULL;
iface->get_icc_profile = NULL;
iface->get_color_profile = NULL;
iface->profile_changed = NULL;
initialized = TRUE;
}
@ -127,6 +128,31 @@ gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
return NULL;
}
/**
* gimp_color_managed_get_color_profile:
* @managed: an object the implements the #GimpColorManaged interface
*
* This function, if implemented, always returns a #GimpColorProfile.
*
* Return value: The @managed's #GimpColorProfile.
*
* Since: GIMP 2.10
**/
GimpColorProfile
gimp_color_managed_get_color_profile (GimpColorManaged *managed)
{
GimpColorManagedInterface *iface;
g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
iface = GIMP_COLOR_MANAGED_GET_INTERFACE (managed);
if (iface->get_color_profile)
return iface->get_color_profile (managed);
return NULL;
}
/**
* gimp_color_managed_profile_changed:
* @managed: an object the implements the #GimpColorManaged interface

View File

@ -44,19 +44,24 @@ struct _GimpColorManagedInterface
GTypeInterface base_iface;
/* virtual functions */
const guint8 * (* get_icc_profile) (GimpColorManaged *managed,
gsize *len);
const guint8 * (* get_icc_profile) (GimpColorManaged *managed,
gsize *len);
/* signals */
void (* profile_changed) (GimpColorManaged *managed);
void (* profile_changed) (GimpColorManaged *managed);
/* virtual functions */
GimpColorProfile (* get_color_profile) (GimpColorManaged *managed);
};
GType gimp_color_managed_interface_get_type (void) G_GNUC_CONST;
GType gimp_color_managed_interface_get_type (void) G_GNUC_CONST;
const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
gsize *len);
void gimp_color_managed_profile_changed (GimpColorManaged *managed);
const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
gsize *len);
GimpColorProfile gimp_color_managed_get_color_profile (GimpColorManaged *managed);
void gimp_color_managed_profile_changed (GimpColorManaged *managed);
G_END_DECLS