diff --git a/app/core/gimpparamspecs.c b/app/core/gimpparamspecs.c
index ef576394e0..237bfab74a 100644
--- a/app/core/gimpparamspecs.c
+++ b/app/core/gimpparamspecs.c
@@ -40,6 +40,7 @@
#include "gimppalette.h"
#include "gimpparamspecs.h"
#include "gimppattern.h"
+#include "gimprasterizable.h"
#include "gimpselection.h"
#include "path/gimppath.h"
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index e4ebe98535..951d5bdc9f 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -30,7 +30,7 @@
#include "internal-procs.h"
-/* 777 procedures registered total */
+/* 780 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
@@ -90,6 +90,7 @@ internal_procs_init (GimpPDB *pdb)
register_pdb_procs (pdb);
register_plug_in_procs (pdb);
register_progress_procs (pdb);
+ register_rasterizable_procs (pdb);
register_resource_procs (pdb);
register_selection_procs (pdb);
register_text_layer_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index b2c82651d0..6a32d96b59 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -77,6 +77,7 @@ void register_patterns_procs (GimpPDB *pdb);
void register_pdb_procs (GimpPDB *pdb);
void register_plug_in_procs (GimpPDB *pdb);
void register_progress_procs (GimpPDB *pdb);
+void register_rasterizable_procs (GimpPDB *pdb);
void register_resource_procs (GimpPDB *pdb);
void register_selection_procs (GimpPDB *pdb);
void register_text_layer_procs (GimpPDB *pdb);
diff --git a/app/pdb/meson.build b/app/pdb/meson.build
index 3317b118f3..2bb52b9d6b 100644
--- a/app/pdb/meson.build
+++ b/app/pdb/meson.build
@@ -62,6 +62,7 @@ libappinternalprocs_sources = [
'pdb-cmds.c',
'plug-in-cmds.c',
'progress-cmds.c',
+ 'rasterizable-cmds.c',
'resource-cmds.c',
'selection-cmds.c',
'text-layer-cmds.c',
diff --git a/app/pdb/rasterizable-cmds.c b/app/pdb/rasterizable-cmds.c
new file mode 100644
index 0000000000..7ba6acc780
--- /dev/null
+++ b/app/pdb/rasterizable-cmds.c
@@ -0,0 +1,220 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include "stamp-pdbgen.h"
+
+#include
+
+#include
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpparamspecs.h"
+#include "core/gimprasterizable.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+rasterizable_rasterize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpRasterizable *item;
+
+ item = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (! gimp_rasterizable_is_rasterized (GIMP_RASTERIZABLE (item)))
+ {
+ gimp_rasterizable_rasterize (GIMP_RASTERIZABLE (item));
+ }
+ else
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("This item has already been rasterized."));
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+rasterizable_restore_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpRasterizable *item;
+
+ item = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp_rasterizable_is_rasterized (GIMP_RASTERIZABLE (item)))
+ {
+ gimp_rasterizable_restore (GIMP_RASTERIZABLE (item));
+ }
+ else
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("This item has not been rasterized."));
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+rasterizable_is_rasterized_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpRasterizable *item;
+ gboolean is_rasterized = FALSE;
+
+ item = g_value_get_object (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ is_rasterized = gimp_rasterizable_is_rasterized (GIMP_RASTERIZABLE (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_rasterized);
+
+ return return_vals;
+}
+
+void
+register_rasterizable_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-rasterizable-rasterize
+ */
+ procedure = gimp_procedure_new (rasterizable_rasterize_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-rasterizable-rasterize");
+ gimp_procedure_set_static_help (procedure,
+ "Rasterize the object.",
+ "This procedure makes the item behave like a typical raster layer.\n"
+ "\n"
+ "Note that the source information (text contents and properties for a text layer, source file for a link layer, path and render properties for a vector layer, etc.) are not actually discarded, and it is possible to retrieve the original behavior with [method@Gimp.Rasterizable.restore].",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Jehan",
+ "Jehan",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rasterizable ("item",
+ "item",
+ "The rasterizable item",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-rasterizable-restore
+ */
+ procedure = gimp_procedure_new (rasterizable_restore_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-rasterizable-restore");
+ gimp_procedure_set_static_help (procedure,
+ "Revert the rasterization of @item.",
+ "Restore the information making the item non-destructive, such as text contents and properties of a text layer, source file of a link layer, path and render properties of a vector layer, etc.\n"
+ "This item won't behave anymore like a raster item. In particular, it will prevent direct modification of its pixels and will be rendered when its properties are updated.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Jehan",
+ "Jehan",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rasterizable ("item",
+ "item",
+ "The rasterizable item",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-rasterizable-is-rasterized
+ */
+ procedure = gimp_procedure_new (rasterizable_is_rasterized_invoker, FALSE);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-rasterizable-is-rasterized");
+ gimp_procedure_set_static_help (procedure,
+ "Return whether @item has been rasterized.",
+ "This procedure returns %TRUE if the specified @item has been previously rasterized. In this case, you should treat this @item as the generic raster variant.\n"
+ "\n"
+ "For instance, a [class@Gimp.TextLayer] object implements the %GimpRasterizable interface. If a text layer instance were to return %TRUE, you should only consider its rendering as returned by [method@Gimp.Drawable.get_buffer].\n"
+ "\n"
+ "On the other hand, if this returned %FALSE, depending on your intents, you may prefer to use the text contents and its properties with the various procedures provided by the [class@Gimp.TextLayer] class interface.",
+ NULL);
+ gimp_procedure_set_static_attribution (procedure,
+ "Jehan",
+ "Jehan",
+ "2025");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rasterizable ("item",
+ "item",
+ "The rasterizable item",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("is-rasterized",
+ "is rasterized",
+ "TRUE if @item is rasterized",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index dce318e30d..49f3130654 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -739,6 +739,7 @@ EXPORTS
gimp_param_palette_get_type
gimp_param_path_get_type
gimp_param_pattern_get_type
+ gimp_param_rasterizable_get_type
gimp_param_resource_get_type
gimp_param_selection_get_type
gimp_param_spec_brush
@@ -762,6 +763,7 @@ EXPORTS
gimp_param_spec_palette
gimp_param_spec_path
gimp_param_spec_pattern
+ gimp_param_spec_rasterizable
gimp_param_spec_resource
gimp_param_spec_resource_defaults_to_context
gimp_param_spec_resource_none_allowed
@@ -1003,6 +1005,10 @@ EXPORTS
gimp_progress_uninstall
gimp_progress_update
gimp_quit
+ gimp_rasterizable_get_type
+ gimp_rasterizable_is_rasterized
+ gimp_rasterizable_rasterize
+ gimp_rasterizable_restore
gimp_resource_delete
gimp_resource_duplicate
gimp_resource_get_by_id
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index adba2a8377..76eecf5ff7 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -68,6 +68,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index 5fc08b21de..1dccc4246c 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -78,6 +78,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/libgimp/gimplinklayer.c b/libgimp/gimplinklayer.c
index 45e4a74708..26147afee0 100644
--- a/libgimp/gimplinklayer.c
+++ b/libgimp/gimplinklayer.c
@@ -30,8 +30,8 @@ struct _GimpLinkLayer
};
-
-G_DEFINE_TYPE (GimpLinkLayer, gimp_link_layer, GIMP_TYPE_LAYER)
+G_DEFINE_TYPE_WITH_CODE (GimpLinkLayer, gimp_link_layer, GIMP_TYPE_LAYER,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_RASTERIZABLE, NULL))
#define parent_class gimp_link_layer_parent_class
diff --git a/libgimp/gimpparamspecs-body.c b/libgimp/gimpparamspecs-body.c
index 80f79b8ca8..81cd9d76b8 100644
--- a/libgimp/gimpparamspecs-body.c
+++ b/libgimp/gimpparamspecs-body.c
@@ -692,6 +692,87 @@ gimp_param_spec_link_layer (const gchar *name,
}
+/*
+ * GIMP_TYPE_PARAM_RASTERIZABLE
+ */
+
+static void gimp_param_rasterizable_class_init (GParamSpecClass *klass);
+static void gimp_param_rasterizable_init (GParamSpec *pspec);
+
+GType
+gimp_param_rasterizable_get_type (void)
+{
+ static GType type = 0;
+
+ if (! type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (GParamSpecClass),
+ NULL, NULL,
+ (GClassInitFunc) gimp_param_rasterizable_class_init,
+ NULL, NULL,
+ sizeof (GimpParamSpecItem),
+ 0,
+ (GInstanceInitFunc) gimp_param_rasterizable_init
+ };
+
+ type = g_type_register_static (GIMP_TYPE_PARAM_DRAWABLE,
+ "GimpParamRasterizable", &info, 0);
+ }
+
+ return type;
+}
+
+static void
+gimp_param_rasterizable_class_init (GParamSpecClass *klass)
+{
+ klass->value_type = GIMP_TYPE_RASTERIZABLE;
+}
+
+static void
+gimp_param_rasterizable_init (GParamSpec *pspec)
+{
+}
+
+/**
+ * gimp_param_spec_rasterizable:
+ * @name: Canonical name of the property specified.
+ * @nick: Nick name of the property specified.
+ * @blurb: Description of the property specified.
+ * @none_ok: Whether no is a valid value.
+ * @flags: Flags for the property specified.
+ *
+ * Creates a new #GimpParamSpecRasterizable specifying a
+ * [type@Rasterizable] property.
+ *
+ * See g_param_spec_internal() for details on property names.
+ *
+ * Returns: (transfer floating): The newly created
+ * #GimpParamSpecRasterizable.
+ *
+ * Since: 3.2
+ **/
+GParamSpec *
+gimp_param_spec_rasterizable (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gboolean none_ok,
+ GParamFlags flags)
+{
+ GimpParamSpecItem *ispec;
+
+ ispec = g_param_spec_internal (GIMP_TYPE_PARAM_RASTERIZABLE,
+ name, nick, blurb, flags);
+
+ g_return_val_if_fail (ispec, NULL);
+
+ ispec->none_ok = none_ok ? TRUE : FALSE;
+
+ return G_PARAM_SPEC (ispec);
+}
+
+
/*
* GIMP_TYPE_PARAM_GROUP_LAYER
*/
diff --git a/libgimp/gimpparamspecs.h b/libgimp/gimpparamspecs.h
index b3c99b4a7b..e90ba9ce10 100644
--- a/libgimp/gimpparamspecs.h
+++ b/libgimp/gimpparamspecs.h
@@ -164,6 +164,24 @@ GParamSpec * gimp_param_spec_link_layer (const gchar *name,
gboolean none_ok,
GParamFlags flags);
+
+/*
+ * GIMP_TYPE_PARAM_RASTERIZABLE
+ */
+
+#define GIMP_VALUE_HOLDS_RASTERIZABLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_RASTERIZABLE))
+#define GIMP_TYPE_PARAM_RASTERIZABLE (gimp_param_rasterizable_get_type ())
+#define GIMP_IS_PARAM_SPEC_RASTERIZABLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RASTERIZABLE))
+
+GType gimp_param_rasterizable_get_type (void) G_GNUC_CONST;
+
+GParamSpec * gimp_param_spec_rasterizable (const gchar *name,
+ const gchar *nick,
+ const gchar *blurb,
+ gboolean none_ok,
+ GParamFlags flags);
+
+
/*
* GIMP_TYPE_PARAM_GROUP_LAYER
*/
diff --git a/libgimp/gimpprocedure-params.h b/libgimp/gimpprocedure-params.h
index ef0ab9fc70..1fceff073a 100644
--- a/libgimp/gimpprocedure-params.h
+++ b/libgimp/gimpprocedure-params.h
@@ -337,6 +337,18 @@ G_BEGIN_DECLS
g_value_set_object (gimp_value_array_index (args, n), value)
+/* rasterizable */
+
+#define GIMP_VALUES_GET_RASTERIZABLE(args, n) \
+ g_value_get_object (gimp_value_array_index (args, n))
+
+#define GIMP_VALUES_GET_RASTERIZABLE_ID(args, n) \
+ gimp_item_get_id (g_value_get_object (gimp_value_array_index (args, n)))
+
+#define GIMP_VALUES_SET_RASTERIZABLE(args, n, value) \
+ g_value_set_object (gimp_value_array_index (args, n), value)
+
+
/* group layer */
#define GIMP_VALUES_GET_GROUP_LAYER(args, n) \
diff --git a/libgimp/gimprasterizable.c b/libgimp/gimprasterizable.c
new file mode 100644
index 0000000000..f4b6dcff1f
--- /dev/null
+++ b/libgimp/gimprasterizable.c
@@ -0,0 +1,32 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimprasterizable.c
+ * Copyright (C) 2025 Jehan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+G_DEFINE_INTERFACE (GimpRasterizable, gimp_rasterizable, GIMP_TYPE_DRAWABLE)
+
+
+static void
+gimp_rasterizable_default_init (GimpRasterizableInterface *iface)
+{
+}
diff --git a/libgimp/gimprasterizable.h b/libgimp/gimprasterizable.h
new file mode 100644
index 0000000000..2727555f97
--- /dev/null
+++ b/libgimp/gimprasterizable.h
@@ -0,0 +1,48 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimprasterizable.h
+ * Copyright (C) 2025 Jehan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GIMP_RASTERIZABLE_H__
+#define __GIMP_RASTERIZABLE_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#include
+
+
+#define GIMP_TYPE_RASTERIZABLE (gimp_rasterizable_get_type ())
+G_DECLARE_INTERFACE (GimpRasterizable, gimp_rasterizable, GIMP, RASTERIZABLE, GimpDrawable)
+
+
+struct _GimpRasterizableInterface
+{
+ GTypeInterface base_iface;
+};
+
+
+G_END_DECLS
+
+#endif /* __GIMP_RASTERIZABLE_H__ */
diff --git a/libgimp/gimprasterizable_pdb.c b/libgimp/gimprasterizable_pdb.c
new file mode 100644
index 0000000000..40a27bad6b
--- /dev/null
+++ b/libgimp/gimprasterizable_pdb.c
@@ -0,0 +1,166 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimprasterizable_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "stamp-pdbgen.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimprasterizable
+ * @title: gimprasterizable
+ * @short_description: Functions for querying and manipulating rasterizable items.
+ *
+ * Functions for querying and manipulating rasterizable items.
+ **/
+
+
+/**
+ * gimp_rasterizable_rasterize:
+ * @item: The rasterizable item.
+ *
+ * Rasterize the object.
+ *
+ * This procedure makes the item behave like a typical raster layer.
+ *
+ * Note that the source information (text contents and properties for a
+ * text layer, source file for a link layer, path and render properties
+ * for a vector layer, etc.) are not actually discarded, and it is
+ * possible to retrieve the original behavior with
+ * [method@Gimp.Rasterizable.restore].
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_rasterizable_rasterize (GimpRasterizable *item)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_RASTERIZABLE, item,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-rasterizable-rasterize",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_rasterizable_restore:
+ * @item: The rasterizable item.
+ *
+ * Revert the rasterization of @item.
+ *
+ * Restore the information making the item non-destructive, such as
+ * text contents and properties of a text layer, source file of a link
+ * layer, path and render properties of a vector layer, etc.
+ * This item won't behave anymore like a raster item. In particular, it
+ * will prevent direct modification of its pixels and will be rendered
+ * when its properties are updated.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_rasterizable_restore (GimpRasterizable *item)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_RASTERIZABLE, item,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-rasterizable-restore",
+ args);
+ gimp_value_array_unref (args);
+
+ success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_rasterizable_is_rasterized:
+ * @item: The rasterizable item.
+ *
+ * Return whether @item has been rasterized.
+ *
+ * This procedure returns %TRUE if the specified @item has been
+ * previously rasterized. In this case, you should treat this @item as
+ * the generic raster variant.
+ *
+ * For instance, a [class@Gimp.TextLayer] object implements the
+ * %GimpRasterizable interface. If a text layer instance were to return
+ * %TRUE, you should only consider its rendering as returned by
+ * [method@Gimp.Drawable.get_buffer].
+ *
+ * On the other hand, if this returned %FALSE, depending on your
+ * intents, you may prefer to use the text contents and its properties
+ * with the various procedures provided by the [class@Gimp.TextLayer]
+ * class interface.
+ *
+ * Returns: TRUE if @item is rasterized.
+ *
+ * Since: 3.2
+ **/
+gboolean
+gimp_rasterizable_is_rasterized (GimpRasterizable *item)
+{
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_rasterized = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_RASTERIZABLE, item,
+ G_TYPE_NONE);
+
+ return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
+ "gimp-rasterizable-is-rasterized",
+ args);
+ gimp_value_array_unref (args);
+
+ if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
+ is_rasterized = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
+
+ gimp_value_array_unref (return_vals);
+
+ return is_rasterized;
+}
diff --git a/libgimp/gimprasterizable_pdb.h b/libgimp/gimprasterizable_pdb.h
new file mode 100644
index 0000000000..ef65783c15
--- /dev/null
+++ b/libgimp/gimprasterizable_pdb.h
@@ -0,0 +1,42 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimprasterizable_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GIMP_RASTERIZABLE_PDB_H__
+#define __GIMP_RASTERIZABLE_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_rasterizable_rasterize (GimpRasterizable *item);
+gboolean gimp_rasterizable_restore (GimpRasterizable *item);
+gboolean gimp_rasterizable_is_rasterized (GimpRasterizable *item);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_RASTERIZABLE_PDB_H__ */
diff --git a/libgimp/gimptextlayer.c b/libgimp/gimptextlayer.c
index 9ac92bc948..b62986d9b0 100644
--- a/libgimp/gimptextlayer.c
+++ b/libgimp/gimptextlayer.c
@@ -30,8 +30,8 @@ struct _GimpTextLayer
};
-
-G_DEFINE_TYPE (GimpTextLayer, gimp_text_layer, GIMP_TYPE_LAYER)
+G_DEFINE_TYPE_WITH_CODE (GimpTextLayer, gimp_text_layer, GIMP_TYPE_LAYER,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_RASTERIZABLE, NULL))
#define parent_class gimp_text_layer_parent_class
diff --git a/libgimp/gimpvectorlayer.c b/libgimp/gimpvectorlayer.c
index dbf3832626..957977676c 100644
--- a/libgimp/gimpvectorlayer.c
+++ b/libgimp/gimpvectorlayer.c
@@ -29,8 +29,8 @@ struct _GimpVectorLayer
};
-
-G_DEFINE_TYPE (GimpVectorLayer, gimp_vector_layer, GIMP_TYPE_LAYER)
+G_DEFINE_TYPE_WITH_CODE (GimpVectorLayer, gimp_vector_layer, GIMP_TYPE_LAYER,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_RASTERIZABLE, NULL))
#define parent_class gimp_vector_layer_parent_class
diff --git a/libgimp/meson.build b/libgimp/meson.build
index e6a5d36a40..3865e09025 100644
--- a/libgimp/meson.build
+++ b/libgimp/meson.build
@@ -110,6 +110,7 @@ pdb_wrappers_sources = [
'gimppatterns_pdb.c',
'gimppatternselect_pdb.c',
'gimpprogress_pdb.c',
+ 'gimprasterizable_pdb.c',
'gimpresource_pdb.c',
'gimpselection_pdb.c',
'gimptextlayer_pdb.c',
@@ -171,6 +172,7 @@ pdb_wrappers_headers = [
'gimppatterns_pdb.h',
'gimppatternselect_pdb.h',
'gimpprogress_pdb.h',
+ 'gimprasterizable_pdb.h',
'gimpresource_pdb.h',
'gimpselection_pdb.h',
'gimptextlayer_pdb.h',
@@ -214,6 +216,7 @@ libgimp_sources_introspectable = [
'gimpprocedure-params.c',
'gimpprocedureconfig.c',
'gimpprogress.c',
+ 'gimprasterizable.c',
'gimpresource.c',
'gimpexportprocedure.c',
'gimpselection.c',
@@ -278,6 +281,7 @@ libgimp_headers_introspectable = [
'gimpprocedure-params.h',
'gimpprocedureconfig.h',
'gimpprogress.h',
+ 'gimprasterizable.h',
'gimpresource.h',
'gimpexportprocedure.h',
'gimpselection.h',
diff --git a/pdb/app.pl b/pdb/app.pl
index 316d52598a..f41a2b9483 100644
--- a/pdb/app.pl
+++ b/pdb/app.pl
@@ -401,6 +401,16 @@ gimp_param_spec_link_layer ("$name",
"$blurb",
$none_ok,
$flags)
+CODE
+ }
+ elsif ($pdbtype eq 'rasterizable') {
+ $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
+ $pspec = <.
+
+
+sub rasterizable_rasterize {
+ $blurb = 'Rasterize the object.';
+
+ $help = <<'HELP';
+This procedure makes the item behave like a typical raster layer.
+
+
+Note that the source information (text contents and properties for a
+text layer, source file for a link layer, path and render properties for
+a vector layer, etc.) are not actually discarded, and it is possible to
+retrieve the original behavior with [method@Gimp.Rasterizable.restore].
+HELP
+
+ &jehan_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'item', type => 'rasterizable',
+ desc => 'The rasterizable item' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (! gimp_rasterizable_is_rasterized (GIMP_RASTERIZABLE (item)))
+ {
+ gimp_rasterizable_rasterize (GIMP_RASTERIZABLE (item));
+ }
+ else
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("This item has already been rasterized."));
+ success = FALSE;
+ }
+}
+CODE
+ );
+}
+
+sub rasterizable_restore {
+ $blurb = 'Revert the rasterization of @item.';
+
+ $help = <<'HELP';
+Restore the information making the item non-destructive, such as text
+contents and properties of a text layer, source file of a link layer,
+path and render properties of a vector layer, etc.
+
+This item won't behave anymore like a raster item. In particular, it
+will prevent direct modification of its pixels and will be rendered when
+its properties are updated.
+HELP
+
+ &jehan_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'item', type => 'rasterizable',
+ desc => 'The rasterizable item' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_rasterizable_is_rasterized (GIMP_RASTERIZABLE (item)))
+ {
+ gimp_rasterizable_restore (GIMP_RASTERIZABLE (item));
+ }
+ else
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("This item has not been rasterized."));
+ success = FALSE;
+ }
+}
+CODE
+ );
+}
+
+sub rasterizable_is_rasterized {
+ $blurb = 'Return whether @item has been rasterized.';
+
+ $help = <<'HELP';
+This procedure returns %TRUE if the specified @item has been previously
+rasterized. In this case, you should treat this @item as the generic
+raster variant.
+
+
+For instance, a [class@Gimp.TextLayer] object implements the
+%GimpRasterizable interface. If a text layer instance were to return
+%TRUE, you should only consider its rendering as returned by
+[method@Gimp.Drawable.get_buffer].
+
+
+On the other hand, if this returned %FALSE, depending on your intents,
+you may prefer to use the text contents and its properties with the
+various procedures provided by the [class@Gimp.TextLayer] class interface.
+HELP
+
+ &jehan_pdb_misc('2025', '3.2');
+
+ @inargs = (
+ { name => 'item', type => 'rasterizable',
+ desc => 'The rasterizable item' }
+ );
+ @outargs = (
+ { name => 'is_rasterized', type => 'boolean',
+ desc => 'TRUE if @item is rasterized' }
+ );
+
+
+ %invoke = (
+ code => <<'CODE'
+{
+ is_rasterized = gimp_rasterizable_is_rasterized (GIMP_RASTERIZABLE (item));
+}
+CODE
+ );
+}
+
+@headers = qw("core/gimprasterizable.h"
+ "gimppdberror.h"
+ "gimp-intl.h");
+
+@procs = qw(rasterizable_rasterize
+ rasterizable_restore
+ rasterizable_is_rasterized);
+
+%exports = (app => [@procs], lib => [@procs]);
+
+$desc = 'Rasterizable procedures';
+$doc_title = 'gimprasterizable';
+$doc_short_desc = 'Functions for querying and manipulating rasterizable items.';
+$doc_long_desc = 'Functions for querying and manipulating rasterizable items.';
+
+1;
diff --git a/pdb/meson.build b/pdb/meson.build
index 682de2492c..be32f9a0fc 100644
--- a/pdb/meson.build
+++ b/pdb/meson.build
@@ -55,6 +55,7 @@ pdb_names = [
'pdb',
'plug_in',
'progress',
+ 'rasterizable',
'resource',
'selection',
'text_layer',
diff --git a/pdb/pdb.pl b/pdb/pdb.pl
index 2aeb5bbc8f..6e136473bb 100644
--- a/pdb/pdb.pl
+++ b/pdb/pdb.pl
@@ -395,6 +395,18 @@ package Gimp::CodeGen::pdb;
take_value_func => 'g_value_set_object ($value, $var)',
headers => [ qw("core/gimplinklayer.h") ] },
+ rasterizable => { name => 'RASTERIZABLE',
+ gtype => 'GIMP_TYPE_RASTERIZABLE',
+ type => 'GimpRasterizable *',
+ const_type => 'GimpRasterizable *',
+ init_value => 'NULL',
+ out_annotate => '(transfer none)',
+ get_value_func => '$var = g_value_get_object ($value)',
+ dup_value_func => '$var = GIMP_VALUES_GET_RASTERIZABLE ($value)',
+ set_value_func => 'g_value_set_object ($value, $var)',
+ take_value_func => 'g_value_set_object ($value, $var)',
+ headers => [ qw("core/gimprasterizable.h") ] },
+
group_layer => { name => 'GROUP_LAYER',
gtype => 'GIMP_TYPE_GROUP_LAYER',
type => 'GimpGroupLayer *',