app, libgimp*, pdb, plug-ins: GimpContext is now using only GeglColor.

- app: gimp_context_get_(foreground|background)() are now returning a GeglColor.
- libgimp: PDB functions named similarly in libgimp are returning a newly
  allocated GeglColor too.
- A few other PDB functions (the ones using these functions) were updated and
  their signature changed to use GeglColor too, when relevant. Plug-ins which
  use any of the changed libgimp functions were fixed.
- GimpContext: signals "(foreground|background)-changed" are now passing a
  GeglColor.
- libgimpconfig: new macro GIMP_CONFIG_PROP_COLOR using gegl_param_spec_color().
- GimpContext: properties "foreground" and "background" are now GeglParamColor
  properties.
- app: All code interacting with GimpContext objects were updated to receive a
  GeglColor (that they may still convert, or no, to GimpRGB for now).
- app: gimp_prop_gegl_color_button_new() was added as an alternative to
  gimp_prop_color_button_new() when the property is a GeglParamColor. Eventually
  the former should replace completely the latter.
- libgimpwidgets: gimp_prop_color_area_new() now works on GeglParamColor
  properties only.
- libgimp: gimp_procedure_dialog_get_widget() will generate a GimpColorArea for
  GeglTypeParamColor arguments.
This commit is contained in:
Jehan 2023-11-14 20:04:14 +01:00
parent 229994957c
commit dbbcfb16d5
68 changed files with 1107 additions and 836 deletions

View file

@ -328,7 +328,6 @@ gimp_context_set_stroke_method (GimpStrokeMethod stroke_method)
/**
* gimp_context_get_foreground:
* @foreground: (out caller-allocates): The foreground color.
*
* Get the current GIMP foreground color.
*
@ -336,16 +335,16 @@ gimp_context_set_stroke_method (GimpStrokeMethod stroke_method)
* used in a variety of tools such as paint tools, blending, and bucket
* fill.
*
* Returns: TRUE on success.
* Returns: (transfer full): The foreground color.
*
* Since: 2.2
**/
gboolean
gimp_context_get_foreground (GimpRGB *foreground)
GeglColor *
gimp_context_get_foreground (void)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
GeglColor *foreground = NULL;
args = gimp_value_array_new_from_types (NULL,
G_TYPE_NONE);
@ -355,14 +354,12 @@ gimp_context_get_foreground (GimpRGB *foreground)
args);
gimp_value_array_unref (args);
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
if (success)
GIMP_VALUES_GET_RGB (return_vals, 1, &*foreground);
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
foreground = g_value_dup_object (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return success;
return foreground;
}
/**
@ -404,7 +401,6 @@ gimp_context_set_foreground (GeglColor *foreground)
/**
* gimp_context_get_background:
* @background: (out caller-allocates): The background color.
*
* Get the current GIMP background color.
*
@ -412,16 +408,16 @@ gimp_context_set_foreground (GeglColor *foreground)
* used in a variety of tools such as blending, erasing (with non-alpha
* images), and image filling.
*
* Returns: TRUE on success.
* Returns: (transfer full): The background color.
*
* Since: 2.2
**/
gboolean
gimp_context_get_background (GimpRGB *background)
GeglColor *
gimp_context_get_background (void)
{
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
GeglColor *background = NULL;
args = gimp_value_array_new_from_types (NULL,
G_TYPE_NONE);
@ -431,14 +427,12 @@ gimp_context_get_background (GimpRGB *background)
args);
gimp_value_array_unref (args);
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
if (success)
GIMP_VALUES_GET_RGB (return_vals, 1, &*background);
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
background = g_value_dup_object (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return success;
return background;
}
/**

View file

@ -40,9 +40,9 @@ gchar* gimp_context_get_paint_method (void)
gboolean gimp_context_set_paint_method (const gchar *name);
GimpStrokeMethod gimp_context_get_stroke_method (void);
gboolean gimp_context_set_stroke_method (GimpStrokeMethod stroke_method);
gboolean gimp_context_get_foreground (GimpRGB *foreground);
GeglColor* gimp_context_get_foreground (void);
gboolean gimp_context_set_foreground (GeglColor *foreground);
gboolean gimp_context_get_background (GimpRGB *background);
GeglColor* gimp_context_get_background (void);
gboolean gimp_context_set_background (GeglColor *background);
gboolean gimp_context_set_default_colors (void);
gboolean gimp_context_swap_colors (void);

View file

@ -606,6 +606,7 @@ gimp_procedure_dialog_set_ok_label (GimpProcedureDialog *dialog,
* Please use gimp_procedure_dialog_get_color_widget() for a
* non-editable color area with a label.
* * %GIMP_TYPE_COLOR_BUTTON: a color button with no label.
* - %GEGL_TYPE_COLOR:
* * %GIMP_TYPE_COLOR_AREA: a color area with no label.
* - %G_TYPE_PARAM_FILE:
* * %GTK_FILE_CHOOSER_BUTTON (default): generic file chooser button
@ -755,7 +756,10 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog,
gtk_widget_set_vexpand (widget, FALSE);
gtk_widget_set_hexpand (widget, FALSE);
}
else if (widget_type == GIMP_TYPE_COLOR_AREA)
}
else if (G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
{
if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_COLOR_AREA)
{
widget = gimp_prop_color_area_new (G_OBJECT (dialog->priv->config),
property, 20, 20,