1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-05 21:02:42 +02:00

app, libgimpbase, plug-ins: deprecate GimpPixPipe.

This really feels like internal API which we'd want to keep private (and
used by core plug-ins only).

Also as Jacob noticed, it's not even included in libgimpbase/gimpbase.h
so plug-ins wishing to use this API need to include this file
specifically anyway (but the header is still installed and the API is
introspected).

Since we cannot remove these functions now that GIMP 3 was published,
for API stability, I am only deprecating them both in the C API with
macros and in the bindings with GObject Introspection annotations.
Therefore any third-party plug-in developer trying to use these
functions in a plug-in will get build-time or run-time warnings.

Then when we'll move on to GIMP 4 development, we can remove the
deprecation and simply make this file private-only use instead.
This commit is contained in:
Jehan
2025-09-11 15:26:47 +02:00
parent 03beda6e2a
commit 7c947ef1af
6 changed files with 74 additions and 3 deletions

View File

@@ -351,8 +351,10 @@ gimp_brush_pipe_set_params (GimpBrushPipe *pipe,
{
GimpPixPipeParams params;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_init (&params);
gimp_pixpipe_params_parse (paramstring, &params);
G_GNUC_END_IGNORE_DEPRECATIONS
pipe->dimension = params.dim;
pipe->rank = g_new0 (gint, pipe->dimension);
@@ -384,7 +386,9 @@ gimp_brush_pipe_set_params (GimpBrushPipe *pipe,
pipe->index[i] = 0;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_free (&params);
G_GNUC_END_IGNORE_DEPRECATIONS
pipe->params = g_strdup (paramstring);
}

View File

@@ -215,15 +215,19 @@ file_gih_pipe_to_image (Gimp *gimp,
* described in the header" means) -- mitch
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_init (&params);
gimp_pixpipe_params_parse (pipe->params, &params);
G_GNUC_END_IGNORE_DEPRECATIONS
params.cellwidth = gimp_image_get_width (image);
params.cellheight = gimp_image_get_height (image);
params.cols = 1;
params.rows = 1;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
paramstring = gimp_pixpipe_params_build (&params);
G_GNUC_END_IGNORE_DEPRECATIONS
if (paramstring)
{
parasite = gimp_parasite_new ("gimp-brush-pipe-parameters",
@@ -235,7 +239,9 @@ file_gih_pipe_to_image (Gimp *gimp,
g_free (paramstring);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_free (&params);
G_GNUC_END_IGNORE_DEPRECATIONS
}
return image;
@@ -262,8 +268,10 @@ file_gih_image_to_pipe (GimpImage *image,
"spacing", spacing,
NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_init (&params);
gimp_pixpipe_params_parse (paramstring, &params);
G_GNUC_END_IGNORE_DEPRECATIONS
image_width = gimp_image_get_width (image);
image_height = gimp_image_get_height (image);
@@ -353,7 +361,9 @@ file_gih_image_to_pipe (GimpImage *image,
g_list_free (brushes);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_free (&params);
G_GNUC_END_IGNORE_DEPRECATIONS
gimp_brush_pipe_set_params (pipe, paramstring);

View File

@@ -33,6 +33,10 @@
#include <glib.h>
#include "gimpparasiteio.h"
#include "gimpversion-private.h"
GIMP_WARNING_API_BREAK("Undeprecate this whole API and make it private instead")
/**
@@ -47,6 +51,15 @@
**/
/**
* gimp_pixpipe_params_init:
* @params:
*
* Do not use this function. It is deprecated and will be removed
* eventually.
*
* Deprecated: 3.2: Only for core use.
*/
void
gimp_pixpipe_params_init (GimpPixPipeParams *params)
{
@@ -71,18 +84,28 @@ gimp_pixpipe_params_init (GimpPixPipeParams *params)
params->rank[i] = 0;
}
/**
* gimp_pixpipe_params_parse:
* @parameters:
* @params:
*
* Do not use this function. It is deprecated and will be removed
* eventually.
*
* Deprecated: 3.2: Only for core use.
*/
void
gimp_pixpipe_params_parse (const gchar *string,
gimp_pixpipe_params_parse (const gchar *parameters,
GimpPixPipeParams *params)
{
gchar *copy;
gchar *p, *q, *r;
gint i;
g_return_if_fail (string != NULL);
g_return_if_fail (parameters != NULL);
g_return_if_fail (params != NULL);
copy = g_strdup (string);
copy = g_strdup (parameters);
q = copy;
while ((p = strtok (q, " \r\n")) != NULL)
@@ -166,6 +189,15 @@ gimp_pixpipe_params_parse (const gchar *string,
g_free (copy);
}
/**
* gimp_pixpipe_params_build:
* @params:
*
* Do not use this function. It is deprecated and will be removed
* eventually.
*
* Deprecated: 3.2: Only for core use.
*/
gchar *
gimp_pixpipe_params_build (GimpPixPipeParams *params)
{
@@ -192,6 +224,15 @@ gimp_pixpipe_params_build (GimpPixPipeParams *params)
return g_string_free (str, FALSE);
}
/**
* gimp_pixpipe_params_free:
* @params:
*
* Do not use this function. It is deprecated and will be removed
* eventually.
*
* Deprecated: 3.2: Only for core use.
*/
void
gimp_pixpipe_params_free (GimpPixPipeParams *params)
{

View File

@@ -70,16 +70,20 @@ struct _GimpPixPipeParams
};
/* Initialize with dummy values */
G_DEPRECATED
void gimp_pixpipe_params_init (GimpPixPipeParams *params);
/* Parse a string into a GimpPixPipeParams */
G_DEPRECATED
void gimp_pixpipe_params_parse (const gchar *parameters,
GimpPixPipeParams *params);
/* Build a string representation of GimpPixPipeParams */
G_DEPRECATED
gchar * gimp_pixpipe_params_build (GimpPixPipeParams *params) G_GNUC_MALLOC;
/* Free the internal values. It does not free the struct itself. */
G_DEPRECATED
void gimp_pixpipe_params_free (GimpPixPipeParams *params);
G_END_DECLS

View File

@@ -291,7 +291,9 @@ gih_export (GimpProcedure *procedure,
gint cell_width;
gint cell_height;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_init (&gihparams);
G_GNUC_END_IGNORE_DEPRECATIONS
/* Possibly retrieve data */
parasite = gimp_image_get_parasite (orig_image,
@@ -331,7 +333,9 @@ gih_export (GimpProcedure *procedure,
&parasite_size);
parasite_data = g_strndup (parasite_data, parasite_size);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_parse (parasite_data, &gihparams);
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_set (config,
"num-cells", gihparams.ncells,
@@ -437,7 +441,9 @@ gih_export (GimpProcedure *procedure,
GimpValueArray *save_retvals;
gchar *paramstring;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
paramstring = gimp_pixpipe_params_build (&gihparams);
G_GNUC_END_IGNORE_DEPRECATIONS
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (),
"file-gih-export-internal");
@@ -474,7 +480,9 @@ gih_export (GimpProcedure *procedure,
g_free (paramstring);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_free (&gihparams);
G_GNUC_END_IGNORE_DEPRECATIONS
g_free (description);
out:

View File

@@ -2263,7 +2263,9 @@ read_tube_block (FILE *f,
GimpParasite *pipe_parasite;
gchar *parasite_text;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gimp_pixpipe_params_init (&params);
G_GNUC_END_IGNORE_DEPRECATIONS
if (psp_ver_major >= 4)
{
@@ -2331,7 +2333,9 @@ read_tube_block (FILE *f,
(selection_mode == tsmPressure ? "pressure" :
(selection_mode == tsmVelocity ? "velocity" :
"default")))));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
parasite_text = gimp_pixpipe_params_build (&params);
G_GNUC_END_IGNORE_DEPRECATIONS
IFDBG(2) g_message ("parasite: %s", parasite_text);