core: Add simulation intent and BPC to GimpImage

Adds a simulation_bpc and simulation_intent to GimpImage to allow 
plug-ins to access it
for CMYK import/export.
Four pdb functions were added to enable this access:
image_get_simulation_bpc (), image_set_simulation_bpc (), 
image_get_simulation_intent (), and image_set_simulation_intent ().
Next, it updates menu options and code to support GimpImage's
internal simulation intent and bpc.
New 'simulation-intent-changed' and 'simulation-bpc-changed signal 
are emitted via
GimpColorManagedInterface so that relevant tools 
(such as the
CYMK color picker, GimpColorFrame, and future pop-overs)
 are aware of these changes.
This commit is contained in:
Alx Sa 2022-08-10 15:01:15 +00:00 committed by Jehan
parent 08686fff8b
commit 0587a10543
29 changed files with 915 additions and 127 deletions

View file

@ -21,9 +21,13 @@ EXPORTS
gimp_cmyka_set_uchar
gimp_color_managed_get_color_profile
gimp_color_managed_get_icc_profile
gimp_color_managed_get_simulation_bpc
gimp_color_managed_get_simulation_intent
gimp_color_managed_get_simulation_profile
gimp_color_managed_get_type
gimp_color_managed_profile_changed
gimp_color_managed_simulation_bpc_changed
gimp_color_managed_simulation_intent_changed
gimp_color_managed_simulation_profile_changed
gimp_color_profile_get_copyright
gimp_color_profile_get_description

View file

@ -43,6 +43,8 @@ enum
{
PROFILE_CHANGED,
SIMULATION_PROFILE_CHANGED,
SIMULATION_INTENT_CHANGED,
SIMULATION_BPC_CHANGED,
LAST_SIGNAL
};
@ -76,6 +78,24 @@ gimp_color_managed_default_init (GimpColorManagedInterface *iface)
simulation_profile_changed),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
gimp_color_managed_signals[SIMULATION_INTENT_CHANGED] =
g_signal_new ("simulation-intent-changed",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorManagedInterface,
simulation_intent_changed),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
gimp_color_managed_signals[SIMULATION_BPC_CHANGED] =
g_signal_new ("simulation-bpc-changed",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorManagedInterface,
simulation_bpc_changed),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
@ -162,6 +182,59 @@ gimp_color_managed_get_simulation_profile (GimpColorManaged *managed)
return NULL;
}
/**
* gimp_color_managed_get_simulation_intent:
* @managed: an object the implements the #GimpColorManaged interface
*
* This function always returns a #GimpColorRenderingIntent
*
* Returns: The @managed's simulation #GimpColorRenderingIntent.
*
* Since: 3.0
**/
GimpColorRenderingIntent
gimp_color_managed_get_simulation_intent (GimpColorManaged *managed)
{
GimpColorManagedInterface *iface;
g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed),
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC);
iface = GIMP_COLOR_MANAGED_GET_IFACE (managed);
if (iface->get_simulation_intent)
return iface->get_simulation_intent (managed);
return GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC;
}
/**
* gimp_color_managed_get_simulation_bpc:
* @managed: an object the implements the #GimpColorManaged interface
*
* This function always returns a gboolean representing whether
* Black Point Compensation is enabled
*
* Returns: The @managed's simulation Black Point Compensation value.
*
* Since: 3.0
**/
gboolean
gimp_color_managed_get_simulation_bpc (GimpColorManaged *managed)
{
GimpColorManagedInterface *iface;
g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), FALSE);
iface = GIMP_COLOR_MANAGED_GET_IFACE (managed);
if (iface->get_simulation_bpc)
return iface->get_simulation_bpc (managed);
return FALSE;
}
/**
* gimp_color_managed_profile_changed:
* @managed: an object that implements the #GimpColorManaged interface
@ -193,3 +266,35 @@ gimp_color_managed_simulation_profile_changed (GimpColorManaged *managed)
g_signal_emit (managed, gimp_color_managed_signals[SIMULATION_PROFILE_CHANGED], 0);
}
/**
* gimp_color_managed_simulation_intent_changed:
* @managed: an object that implements the #GimpColorManaged interface
*
* Emits the "simulation-intent-changed" signal.
*
* Since: 3.0
**/
void
gimp_color_managed_simulation_intent_changed (GimpColorManaged *managed)
{
g_return_if_fail (GIMP_IS_COLOR_MANAGED (managed));
g_signal_emit (managed, gimp_color_managed_signals[SIMULATION_INTENT_CHANGED], 0);
}
/**
* gimp_color_managed_simulation_bpc_changed:
* @managed: an object that implements the #GimpColorManaged interface
*
* Emits the "simulation-bpc-changed" signal.
*
* Since: 3.0
**/
void
gimp_color_managed_simulation_bpc_changed (GimpColorManaged *managed)
{
g_return_if_fail (GIMP_IS_COLOR_MANAGED (managed));
g_signal_emit (managed, gimp_color_managed_signals[SIMULATION_BPC_CHANGED], 0);
}

View file

@ -45,6 +45,10 @@ G_DECLARE_INTERFACE (GimpColorManaged, gimp_color_managed, GIMP, COLOR_MANAGED,
* by the object
* @get_simulation_profile: Returns the simulation #GimpColorProfile of the
* pixels managed by the object
* @get_simulation_rendering_intent: Returns the simulation #GimpColorRenderingIntent
* of the pixels managed by the object
* @get_simulation_bpc: Returns whether black point compensation is enabled for the
* simulation of the pixels managed by the object
**/
struct _GimpColorManagedInterface
{
@ -60,29 +64,44 @@ struct _GimpColorManagedInterface
*
* Since: 2.4
*/
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);
void (* simulation_profile_changed) (GimpColorManaged *managed);
void (* simulation_profile_changed) (GimpColorManaged *managed);
void (* simulation_intent_changed) (GimpColorManaged *managed);
void (* simulation_bpc_changed) (GimpColorManaged *managed);
/* virtual functions */
GimpColorProfile * (* get_color_profile) (GimpColorManaged *managed);
GimpColorProfile * (* get_simulation_profile) (GimpColorManaged *managed);
GimpColorProfile * (* get_color_profile) (GimpColorManaged *managed);
GimpColorProfile * (* get_simulation_profile) (GimpColorManaged *managed);
GimpColorRenderingIntent
(* get_simulation_intent) (GimpColorManaged *managed);
gboolean (* get_simulation_bpc) (GimpColorManaged *managed);
};
const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
gsize *len);
GimpColorProfile * gimp_color_managed_get_color_profile (GimpColorManaged *managed);
const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
gsize *len);
GimpColorProfile * gimp_color_managed_get_color_profile (GimpColorManaged *managed);
GimpColorProfile * gimp_color_managed_get_simulation_profile (GimpColorManaged *managed);
GimpColorProfile * gimp_color_managed_get_simulation_profile (GimpColorManaged *managed);
void gimp_color_managed_profile_changed (GimpColorManaged *managed);
GimpColorRenderingIntent gimp_color_managed_get_simulation_intent (GimpColorManaged *managed);
void gimp_color_managed_simulation_profile_changed (GimpColorManaged *managed);
gboolean gimp_color_managed_get_simulation_bpc (GimpColorManaged *managed);
void gimp_color_managed_profile_changed (GimpColorManaged *managed);
void gimp_color_managed_simulation_profile_changed (GimpColorManaged *managed);
void gimp_color_managed_simulation_intent_changed (GimpColorManaged *managed);
void gimp_color_managed_simulation_bpc_changed (GimpColorManaged *managed);
G_END_DECLS