[gimp/wip/Jehan/classy-GIMP: 7/50] libgimp: update non-generated API to allow old and new API.



commit 09f0530dab08c8803b34743f576095a20b14b46f
Author: Jehan <jehan girinstud io>
Date:   Tue Aug 13 00:42:10 2019 +0200

    libgimp: update non-generated API to allow old and new API.
    
    Same as previous commit: by default the new API will be used. But if a
    plug-in builds with GIMP_DEPRECATED_REPLACE_NEW_API macro, then the same
    function names will call the old API with ids.

 libgimp/gimpchannel.c           |  44 ++++++++++
 libgimp/gimpchannel.h           |  16 ++++
 libgimp/gimpexport.c            |  57 +++++++++++++
 libgimp/gimpexport.h            |  23 +++++-
 libgimp/gimpimage.c             | 177 ++++++++++++++++++++++++++++++++++++++++
 libgimp/gimpimage.h             |  34 ++++++++
 libgimp/gimpimagecolorprofile.c | 114 ++++++++++++++++++++++++++
 libgimp/gimpimagecolorprofile.h |  23 ++++++
 libgimp/gimpimagecombobox.c     |  60 +++++++++++++-
 libgimp/gimpimagecombobox.h     |  23 +++++-
 libgimp/gimpimagemetadata.c     | 161 ++++++++++++++++++++++++++++++++++++
 libgimp/gimpimagemetadata.h     |  41 +++++++++-
 libgimp/gimpitemcombobox.c      | 149 ++++++++++++++++++++++++++++++++-
 libgimp/gimpitemcombobox.h      |  41 ++++++++--
 libgimp/gimplayer.c             | 129 +++++++++++++++++++++++++++++
 libgimp/gimplayer.h             |  36 +++++++-
 16 files changed, 1111 insertions(+), 17 deletions(-)
---
diff --git a/libgimp/gimpchannel.c b/libgimp/gimpchannel.c
index b8fca7cb00..2fd111b6c0 100644
--- a/libgimp/gimpchannel.c
+++ b/libgimp/gimpchannel.c
@@ -59,3 +59,47 @@ gimp_channel_new (GimpImage     *image,
                             opacity,
                             color);
 }
+
+
+/* Deprecated API. */
+
+
+/**
+ * gimp_channel_new_deprecated: (skip)
+ * @image_ID: The image to which to add the channel.
+ * @name: The channel name.
+ * @width: The channel width.
+ * @height: The channel height.
+ * @opacity: The channel opacity.
+ * @color: The channel compositing color.
+ *
+ * Create a new channel.
+ *
+ * This procedure creates a new channel with the specified width and
+ * height. Name, opacity, and color are also supplied parameters. The
+ * new channel still needs to be added to the image, as this is not
+ * automatic. Add the new channel with the gimp_image_insert_channel()
+ * command. Other attributes such as channel show masked, should be
+ * set with explicit procedure calls. The channel's contents are
+ * undefined initially.
+ *
+ * Returns: The newly created channel.
+ */
+gint32
+gimp_channel_new_deprecated (gint32         image_id,
+                             const gchar   *name,
+                             guint          width,
+                             guint          height,
+                             gdouble        opacity,
+                             const GimpRGB *color)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gint32     channel_id;
+
+  channel_id = gimp_channel_new (image, name, width, height,
+                                 opacity, color);
+
+  g_object_unref (image);
+
+  return channel_id;
+}
diff --git a/libgimp/gimpchannel.h b/libgimp/gimpchannel.h
index 54a3179408..1771e6f2c4 100644
--- a/libgimp/gimpchannel.h
+++ b/libgimp/gimpchannel.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
 gint32  gimp_channel_new (GimpImage     *image,
                           const gchar   *name,
                           guint          width,
@@ -37,6 +39,20 @@ gint32  gimp_channel_new (GimpImage     *image,
                           gdouble        opacity,
                           const GimpRGB *color);
 
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define gimp_channel_new gimp_channel_new_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+gint32  gimp_channel_new_deprecated (gint32         image_ID,
+                                     const gchar   *name,
+                                     guint          width,
+                                     guint          height,
+                                     gdouble        opacity,
+                                     const GimpRGB *color);
+
 
 G_END_DECLS
 
diff --git a/libgimp/gimpexport.c b/libgimp/gimpexport.c
index 02dce6ad18..0c4725db9d 100644
--- a/libgimp/gimpexport.c
+++ b/libgimp/gimpexport.c
@@ -1085,3 +1085,60 @@ gimp_export_dialog_get_content_area (GtkWidget *dialog)
 {
   return gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 }
+
+
+/* Deprecated API. */
+
+
+/**
+ * gimp_export_image_deprecated: (skip)
+ * @image_id:     Pointer to the image ID.
+ * @drawable_ID:  Pointer to the drawable_ID.
+ * @format_name:  The (short) name of the image_format (e.g. JPEG or GIF).
+ * @capabilities: What can the image_format do?
+ *
+ * Takes an image and a drawable to be saved together with a
+ * description of the capabilities of the image_format. If the
+ * type of image doesn't match the capabilities of the format
+ * a dialog is opened that informs the user that the image has
+ * to be exported and offers to do the necessary conversions.
+ *
+ * If the user chooses to export the image, a copy is created.
+ * This copy is then converted, @image and @drawable_ID are changed to
+ * point to the new image and the procedure returns GIMP_EXPORT_EXPORT.
+ * The save_plugin has to take care of deleting the created image using
+ * gimp_image_delete() when it has saved it.
+ *
+ * If the user chooses to Ignore the export problem, @image and
+ * @drawable_ID are not altered, GIMP_EXPORT_IGNORE is returned and the
+ * save_plugin should try to save the original image. If the user
+ * chooses Cancel, GIMP_EXPORT_CANCEL is returned and the save_plugin
+ * should quit itself with status %GIMP_PDB_CANCEL.
+ *
+ * If @format_name is NULL, no dialogs will be shown and this function
+ * will behave as if the user clicked on the 'Export' button, if a
+ * dialog would have been shown.
+ *
+ * Returns: An enum of #GimpExportReturn describing the user_action.
+ **/
+GimpExportReturn
+gimp_export_image_deprecated (gint32                 *image_ID,
+                              gint32                 *drawable_ID,
+                              const gchar            *format_name,
+                              GimpExportCapabilities  capabilities)
+{
+  GimpImage        *image     = gimp_image_new_by_id (*image_ID);
+  GimpImage        *new_image = image;
+  GimpExportReturn  retval;
+
+  retval = gimp_export_image (&new_image, drawable_ID,
+                              format_name, capabilities);
+
+  *image_ID = gimp_image_get_id (new_image);
+  if (retval == GIMP_EXPORT_EXPORT)
+    g_object_unref (new_image);
+
+  g_object_unref (image);
+
+  return retval;
+}
diff --git a/libgimp/gimpexport.h b/libgimp/gimpexport.h
index eda0debe5d..325ca9f3ca 100644
--- a/libgimp/gimpexport.h
+++ b/libgimp/gimpexport.h
@@ -75,15 +75,30 @@ typedef enum
 } GimpExportReturn;
 
 
+GtkWidget        * gimp_export_dialog_new              (const gchar            *format_name,
+                                                        const gchar            *role,
+                                                        const gchar            *help_id);
+GtkWidget        * gimp_export_dialog_get_content_area (GtkWidget              *dialog);
+
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
 GimpExportReturn   gimp_export_image                   (GimpImage             **image,
                                                         gint32                 *drawable_ID,
                                                         const gchar            *format_name,
                                                         GimpExportCapabilities  capabilities);
 
-GtkWidget        * gimp_export_dialog_new              (const gchar            *format_name,
-                                                        const gchar            *role,
-                                                        const gchar            *help_id);
-GtkWidget        * gimp_export_dialog_get_content_area (GtkWidget              *dialog);
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define gimp_export_image gimp_export_image_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+GimpExportReturn   gimp_export_image_deprecated        (gint32                 *image_id,
+                                                        gint32                 *drawable_ID,
+                                                        const gchar            *format_name,
+                                                        GimpExportCapabilities  capabilities);
 
 
 G_END_DECLS
diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c
index 696a0f10cf..bfa6785dd1 100644
--- a/libgimp/gimpimage.c
+++ b/libgimp/gimpimage.c
@@ -351,3 +351,180 @@ gimp_image_set_metadata (GimpImage    *image,
 
   return success;
 }
+
+
+/* Deprecated API. */
+
+
+/**
+ * gimp_image_get_colormap_deprecated: (skip)
+ * @image_id:   The image.
+ * @num_colors: Returns the number of colors in the colormap array.
+ *
+ * Returns the image's colormap
+ *
+ * This procedure returns an actual pointer to the image's colormap, as
+ * well as the number of colors contained in the colormap. If the image
+ * is not of base type INDEXED, this pointer will be NULL.
+ *
+ * Returns: The image's colormap.
+ */
+guchar *
+gimp_image_get_colormap_deprecated (gint32  image_id,
+                                    gint   *num_colors)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  guchar    *colormap;
+
+  colormap = gimp_image_get_colormap (image, num_colors);
+
+  g_object_unref (image);
+
+  return colormap;
+}
+
+/**
+ * gimp_image_set_colormap_deprecated: (skip)
+ * @image_id:   The image.
+ * @colormap:   The new colormap values.
+ * @num_colors: Number of colors in the colormap array.
+ *
+ * Sets the entries in the image's colormap.
+ *
+ * This procedure sets the entries in the specified image's colormap.
+ * The number of colors is specified by the \"num_colors\" parameter
+ * and corresponds to the number of INT8 triples that must be contained
+ * in the \"cmap\" array.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_image_set_colormap_deprecated (gint32        image_id,
+                                    const guchar *colormap,
+                                    gint          num_colors)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gboolean   success;
+
+  success = gimp_image_set_colormap (image, colormap, num_colors);
+
+  g_object_unref (image);
+
+  return success;
+}
+
+/**
+ * gimp_image_get_thumbnail_data_deprecated: (skip)
+ * @image_id: The image.
+ * @width:   (inout): The requested thumbnail width.
+ * @height:  (inout): The requested thumbnail height.
+ * @bpp:     (out): The previews bpp.
+ *
+ * Get a thumbnail of an image.
+ *
+ * This function gets data from which a thumbnail of an image preview
+ * can be created. Maximum x or y dimension is 1024 pixels. The pixels
+ * are returned in RGB[A] or GRAY[A] format. The bpp return value
+ * gives the number of bytes per pixel in the image.
+ *
+ * Returns: (transfer full): the thumbnail data.
+ **/
+guchar *
+gimp_image_get_thumbnail_data_deprecated (gint32  image_id,
+                                          gint   *width,
+                                          gint   *height,
+                                          gint   *bpp)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  guchar    *thumbdata;
+
+  thumbdata = gimp_image_get_thumbnail_data (image, width, height, bpp);
+
+  g_object_unref (image);
+
+  return thumbdata;
+}
+
+/**
+ * gimp_image_get_thumbnail_deprecated: (skip)
+ * @image_id: the image ID
+ * @width:    the requested thumbnail width  (<= 1024 pixels)
+ * @height:   the requested thumbnail height (<= 1024 pixels)
+ * @alpha:    how to handle an alpha channel
+ *
+ * Retrieves a thumbnail pixbuf for the image identified by @image->priv->id.
+ * The thumbnail will be not larger than the requested size.
+ *
+ * Returns: (transfer full): a new #GdkPixbuf
+ *
+ * Since: 2.2
+ **/
+GdkPixbuf *
+gimp_image_get_thumbnail_deprecated (gint32                 image_id,
+                                     gint                   width,
+                                     gint                   height,
+                                     GimpPixbufTransparency alpha)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  GdkPixbuf *thumbnail;
+
+  thumbnail = gimp_image_get_thumbnail (image, width, height, alpha);
+
+  g_object_unref (image);
+
+  return thumbnail;
+}
+
+/**
+ * gimp_image_get_metadata_deprecated: (skip)
+ * @image_id: The image.
+ *
+ * Returns the image's metadata.
+ *
+ * Returns exif/iptc/xmp metadata from the image.
+ *
+ * Returns: (nullable) (transfer full): The exif/ptc/xmp metadata,
+ *          or %NULL if there is none.
+ *
+ * Since: 2.10
+ **/
+GimpMetadata *
+gimp_image_get_metadata_deprecated (gint32 image_id)
+{
+  GimpImage    *image = gimp_image_new_by_id (image_id);
+  GimpMetadata *metadata;
+
+  metadata = gimp_image_get_metadata (image);
+
+  g_object_unref (image);
+
+  return metadata;
+}
+
+/**
+ * gimp_image_set_metadata_deprecated: (skip)
+ * @image_id: The image.
+ * @metadata: The exif/ptc/xmp metadata.
+ *
+ * Set the image's metadata.
+ *
+ * Sets exif/iptc/xmp metadata on the image, or deletes it if
+ * @metadata is %NULL.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_set_metadata_deprecated (gint32        image_id,
+                                    GimpMetadata *metadata)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gboolean   success;
+
+  success = gimp_image_set_metadata (image, metadata);
+
+  g_object_unref (image);
+
+  return success;
+}
diff --git a/libgimp/gimpimage.h b/libgimp/gimpimage.h
index ed19c8f073..2334ea89a9 100644
--- a/libgimp/gimpimage.h
+++ b/libgimp/gimpimage.h
@@ -68,6 +68,9 @@ GType          gimp_image_get_type           (void) G_GNUC_CONST;
 gint32         gimp_image_get_id             (GimpImage    *image);
 GimpImage    * gimp_image_new_by_id          (gint32        image_id);
 
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
 guchar       * gimp_image_get_colormap       (GimpImage    *image,
                                               gint         *num_colors);
 gboolean       gimp_image_set_colormap       (GimpImage    *image,
@@ -87,6 +90,37 @@ GimpMetadata * gimp_image_get_metadata       (GimpImage    *image);
 gboolean       gimp_image_set_metadata       (GimpImage    *image,
                                               GimpMetadata *metadata);
 
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define gimp_image_get_colormap       gimp_image_get_colormap_deprecated
+#define gimp_image_set_colormap       gimp_image_set_colormap_deprecated
+#define gimp_image_get_thumbnail_data gimp_image_get_thumbnail_data_deprecated
+#define gimp_image_get_thumbnail      gimp_image_get_thumbnail_deprecated
+#define gimp_image_get_metadata       gimp_image_get_metadata_deprecated
+#define gimp_image_set_metadata       gimp_image_set_metadata_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+guchar       * gimp_image_get_colormap_deprecated       (gint32        image_id,
+                                                         gint         *num_colors);
+gboolean       gimp_image_set_colormap_deprecated       (gint32        image_id,
+                                                         const guchar *colormap,
+                                                         gint          num_colors);
+
+guchar       * gimp_image_get_thumbnail_data_deprecated (gint32        image_id,
+                                                         gint         *width,
+                                                         gint         *height,
+                                                         gint         *bpp);
+GdkPixbuf    * gimp_image_get_thumbnail_deprecated      (gint32        image_id,
+                                                         gint          width,
+                                                         gint          height,
+                                                         GimpPixbufTransparency  alpha);
+
+GimpMetadata * gimp_image_get_metadata_deprecated       (gint32        image_id);
+gboolean       gimp_image_set_metadata_deprecated       (gint32        image_id,
+                                                         GimpMetadata *metadata);
+
 
 G_END_DECLS
 
diff --git a/libgimp/gimpimagecolorprofile.c b/libgimp/gimpimagecolorprofile.c
index bb22bd5ce8..68d9e44b42 100644
--- a/libgimp/gimpimagecolorprofile.c
+++ b/libgimp/gimpimagecolorprofile.c
@@ -171,3 +171,117 @@ gimp_image_convert_color_profile (GimpImage                 *image,
   return _gimp_image_convert_color_profile (image, length, data,
                                             intent, bpc);
 }
+
+
+/* Deprecated API. */
+
+
+/**
+ * gimp_image_get_color_profile_deprecated: (skip)
+ * @image_id: The image.
+ *
+ * Returns the image's color profile
+ *
+ * This procedure returns the image's color profile, or NULL if the
+ * image has no color profile assigned.
+ *
+ * Returns: (transfer full): The image's color profile. The returned
+ *          value must be freed with g_object_unref().
+ **/
+GimpColorProfile *
+gimp_image_get_color_profile_deprecated (gint32 image_id)
+{
+  GimpImage        *image = gimp_image_new_by_id (image_id);
+  GimpColorProfile *profile;
+
+  profile = gimp_image_get_color_profile (image);
+
+  g_object_unref (image);
+
+  return profile;
+}
+
+/**
+ * gimp_image_set_color_profile_deprecated: (skip)
+ * @image_id: The image.
+ * @profile:  A #GimpColorProfile, or %NULL.
+ *
+ * Sets the image's color profile
+ *
+ * This procedure sets the image's color profile.
+ *
+ * Returns: %TRUE on success.
+ **/
+gboolean
+gimp_image_set_color_profile_deprecated (gint32            image_id,
+                                         GimpColorProfile *profile)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gboolean   success;
+
+  success = gimp_image_set_color_profile (image, profile);
+
+  g_object_unref (image);
+
+  return success;
+}
+
+/**
+ * gimp_image_get_effective_color_profile_deprecated: (skip)
+ * @image_id: The image.
+ *
+ * Returns the color profile that is used for the image.
+ *
+ * This procedure returns the color profile that is actually used for
+ * this image, which is the profile returned by
+ * gimp_image_get_color_profile()_deprecated if the image has a profile assigned,
+ * or the default RGB profile from preferences if no profile is
+ * assigned to the image. If there is no default RGB profile configured
+ * in preferences either, a generated default RGB profile is returned.
+ *
+ * Returns: (transfer full): The color profile. The returned value must
+ *          be freed with g_object_unref().
+ **/
+GimpColorProfile *
+gimp_image_get_effective_color_profile_deprecated (gint32 image_id)
+{
+  GimpImage        *image = gimp_image_new_by_id (image_id);
+  GimpColorProfile *profile;
+
+  profile = gimp_image_get_effective_color_profile (image);
+
+  g_object_unref (image);
+
+  return profile;
+}
+
+/**
+ * gimp_image_convert_color_profile_deprecated: (skip)
+ * @image_id: The image.
+ * @profile:  The color profile to convert to.
+ * @intent:   Rendering intent.
+ * @bpc:      Black point compensation.
+ *
+ * Convert the image's layers to a color profile
+ *
+ * This procedure converts from the image's color profile (or the
+ * default RGB profile if none is set) to the given color profile. Only
+ * RGB color profiles are accepted.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_convert_color_profile_deprecated (gint32                    image_id,
+                                             GimpColorProfile         *profile,
+                                             GimpColorRenderingIntent  intent,
+                                             gboolean                  bpc)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gboolean   success;
+
+  success = gimp_image_convert_color_profile (image, profile, intent, bpc);
+
+  g_object_unref (image);
+
+  return success;
+}
diff --git a/libgimp/gimpimagecolorprofile.h b/libgimp/gimpimagecolorprofile.h
index 63ae015f04..803a9ce129 100644
--- a/libgimp/gimpimagecolorprofile.h
+++ b/libgimp/gimpimagecolorprofile.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
 GimpColorProfile * gimp_image_get_color_profile           (GimpImage                 *image);
 gboolean           gimp_image_set_color_profile           (GimpImage                 *image,
                                                            GimpColorProfile          *profile);
@@ -41,6 +43,27 @@ gboolean           gimp_image_convert_color_profile       (GimpImage
                                                            GimpColorRenderingIntent   intent,
                                                            gboolean                   bpc);
 
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define gimp_image_get_color_profile           gimp_image_get_color_profile_deprecated
+#define gimp_image_set_color_profile           gimp_image_set_color_profile_deprecated
+#define gimp_image_get_effective_color_profile gimp_image_get_effective_color_profile_deprecated
+#define gimp_image_convert_color_profile       gimp_image_convert_color_profile_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+GimpColorProfile * gimp_image_get_color_profile_deprecated           (gint32                     image_id);
+gboolean           gimp_image_set_color_profile_deprecated           (gint32                     image_id,
+                                                                      GimpColorProfile          *profile);
+
+GimpColorProfile * gimp_image_get_effective_color_profile_deprecated (gint32                     image_id);
+
+gboolean           gimp_image_convert_color_profile_deprecated       (gint32                     image_id,
+                                                                      GimpColorProfile          *profile,
+                                                                      GimpColorRenderingIntent   intent,
+                                                                      gboolean                   bpc);
+
 
 G_END_DECLS
 
diff --git a/libgimp/gimpimagecombobox.c b/libgimp/gimpimagecombobox.c
index f6c339ff4a..804f6cb5d7 100644
--- a/libgimp/gimpimagecombobox.c
+++ b/libgimp/gimpimagecombobox.c
@@ -57,6 +57,8 @@ struct _GimpImageComboBox
   GimpImageConstraintFunc  constraint;
   gpointer                 data;
   GDestroyNotify           data_destroy;
+
+  GimpImageConstraintDeprecatedFunc  constraint_d;
 };
 
 struct _GimpImageComboBoxClass
@@ -72,6 +74,8 @@ static void  gimp_image_combo_box_model_add (GtkListStore            *store,
                                              gint                     num_images,
                                              gint32                  *images,
                                              GimpImageConstraintFunc  constraint,
+                                             GimpImageConstraintDeprecatedFunc
+                                                                      constraint_d,
                                              gpointer                 data);
 
 static void  gimp_image_combo_box_drag_data_received (GtkWidget        *widget,
@@ -187,6 +191,7 @@ gimp_image_combo_box_populate (GimpImageComboBox *combo_box)
   gimp_image_combo_box_model_add (GTK_LIST_STORE (model),
                                   num_images, images,
                                   combo_box->constraint,
+                                  combo_box->constraint_d,
                                   combo_box->data);
 
   g_free (images);
@@ -200,6 +205,8 @@ gimp_image_combo_box_model_add (GtkListStore            *store,
                                 gint                     num_images,
                                 gint32                  *images,
                                 GimpImageConstraintFunc  constraint,
+                                GimpImageConstraintDeprecatedFunc
+                                                         constraint_d,
                                 gpointer                 data)
 {
   GtkTreeIter  iter;
@@ -210,7 +217,9 @@ gimp_image_combo_box_model_add (GtkListStore            *store,
       GimpImage *image;
 
       image = gimp_image_new_by_id (images[i]);
-      if (! constraint || (* constraint) (image, data))
+      if ((! constraint && ! constraint_d)             ||
+          (constraint && (* constraint) (image, data)) ||
+          (constraint_d && (* constraint_d) (images[i], data)))
         {
           gchar     *image_name = gimp_image_get_name (image);
           gchar     *label;
@@ -301,3 +310,52 @@ gimp_image_combo_box_changed (GimpImageComboBox *combo_box)
       g_object_unref (image);
     }
 }
+
+
+/* Deprecated API. */
+
+
+/**
+ * gimp_image_combo_box_new_deprecated: (skip)
+ * @constraint:   a #GimpImageConstraintDeprecatedFunc or %NULL
+ * @data:         a pointer that is passed to @constraint
+ * @data_destroy: Destroy function for @data.
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * images. If a @constraint function is specified, it is called for
+ * each image and only if the function returns %TRUE, the image is
+ * added to the combobox.
+ *
+ * You should use gimp_int_combo_box_connect() to initialize and
+ * connect the combo. Use gimp_int_combo_box_set_active() to get the
+ * active image ID and gimp_int_combo_box_get_active() to retrieve the
+ * ID of the selected image.
+ *
+ * Returns: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_image_combo_box_new_deprecated (GimpImageConstraintDeprecatedFunc constraint,
+                                     gpointer                          data,
+                                     GDestroyNotify                    data_destroy)
+{
+  GimpImageComboBox *combo_box;
+
+  combo_box = g_object_new (GIMP_TYPE_IMAGE_COMBO_BOX,
+                            "width-request", WIDTH_REQUEST,
+                            "ellipsize",     PANGO_ELLIPSIZE_MIDDLE,
+                            NULL);
+
+  combo_box->constraint_d = constraint;
+  combo_box->data         = data;
+  combo_box->data_destroy = data_destroy;
+
+  gimp_image_combo_box_populate (combo_box);
+
+  g_signal_connect (combo_box, "changed",
+                    G_CALLBACK (gimp_image_combo_box_changed),
+                    NULL);
+
+  return GTK_WIDGET (combo_box);
+}
diff --git a/libgimp/gimpimagecombobox.h b/libgimp/gimpimagecombobox.h
index 28f4bd8fd3..ce5de0734e 100644
--- a/libgimp/gimpimagecombobox.h
+++ b/libgimp/gimpimagecombobox.h
@@ -36,16 +36,33 @@ G_BEGIN_DECLS
 #define GIMP_IS_IMAGE_COMBO_BOX(obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE_COMBO_BOX)
 
 
-typedef gboolean (* GimpImageConstraintFunc) (GimpImage *image,
-                                              gpointer   data);
+GType       gimp_image_combo_box_get_type (void) G_GNUC_CONST;
 
 
-GType       gimp_image_combo_box_get_type (void) G_GNUC_CONST;
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
+typedef gboolean (* GimpImageConstraintFunc) (GimpImage *image,
+                                              gpointer   data);
 
 GtkWidget * gimp_image_combo_box_new (GimpImageConstraintFunc  constraint,
                                       gpointer                 data,
                                       GDestroyNotify           data_destroy);
 
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define GimpImageConstraintFunc  GimpImageConstraintDeprecatedFunc
+#define gimp_image_combo_box_new gimp_image_combo_box_new_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+typedef gboolean (* GimpImageConstraintDeprecatedFunc) (gint32   image_id,
+                                                        gpointer data);
+
+GtkWidget * gimp_image_combo_box_new_deprecated (GimpImageConstraintDeprecatedFunc constraint,
+                                                 gpointer                          data,
+                                                 GDestroyNotify                    data_destroy);
+
 
 G_END_DECLS
 
diff --git a/libgimp/gimpimagemetadata.c b/libgimp/gimpimagemetadata.c
index 8445489afa..d4eebb31cb 100644
--- a/libgimp/gimpimagemetadata.c
+++ b/libgimp/gimpimagemetadata.c
@@ -1033,3 +1033,164 @@ gimp_image_metadata_rotate_dialog (GimpImage         *image,
 
   return (response == GTK_RESPONSE_OK);
 }
+
+
+/* Deprecated API. */
+
+
+/**
+ * gimp_image_metadata_load_prepare_deprecated: (skip)
+ * @image_id:  The image
+ * @mime_type: The loaded file's mime-type
+ * @file:      The file to load the metadata from
+ * @error:     Return location for error
+ *
+ * Loads and returns metadata from @file to be passed into
+ * gimp_image_metadata_load_finish().
+ *
+ * Returns: (transfer full): The file's metadata.
+ *
+ * Since: 2.10
+ */
+GimpMetadata *
+gimp_image_metadata_load_prepare_deprecated (gint32        image_id,
+                                             const gchar  *mime_type,
+                                             GFile        *file,
+                                             GError      **error)
+{
+  GimpImage    *image = gimp_image_new_by_id (image_id);
+  GimpMetadata *metadata;
+
+  metadata = gimp_image_metadata_load_prepare (image, mime_type, file, error);
+
+  g_object_unref (image);
+
+  return metadata;
+}
+
+/**
+ * gimp_image_metadata_load_finish_deprecated: (skip)
+ * @image_id:    The image
+ * @mime_type:   The loaded file's mime-type
+ * @metadata:    The metadata to set on the image
+ * @flags:       Flags to specify what of the metadata to apply to the image
+ * @interactive: Whether this function is allowed to query info with dialogs
+ *
+ * Applies the @metadata previously loaded with
+ * gimp_image_metadata_load_prepare()_deprecated to the image, taking into account
+ * the passed @flags.
+ *
+ * Since: 2.10
+ */
+void
+gimp_image_metadata_load_finish_deprecated (gint32                 image_id,
+                                            const gchar           *mime_type,
+                                            GimpMetadata          *metadata,
+                                            GimpMetadataLoadFlags  flags,
+                                            gboolean               interactive)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+
+  gimp_image_metadata_load_finish (image, mime_type, metadata, flags, interactive);
+  g_object_unref (image);
+}
+
+/**
+ * gimp_image_metadata_save_prepare_deprecated: (skip)
+ * @image_id:        The image
+ * @mime_type:       The saved file's mime-type
+ * @suggested_flags: Suggested default values for the @flags passed to
+ *                   gimp_image_metadata_save_finish()
+ *
+ * Gets the image metadata for saving it using
+ * gimp_image_metadata_save_finish().
+ *
+ * The @suggested_flags are determined from what kind of metadata
+ * (Exif, XMP, ...) is actually present in the image and the preferences
+ * for metadata exporting.
+ * The calling application may still update @available_flags, for
+ * instance to follow the settings from a previous export in the same
+ * session, or a previous export of the same image. But it should not
+ * override the preferences without a good reason since it is a data
+ * leak.
+ *
+ * The suggested value for GIMP_METADATA_SAVE_THUMBNAIL is determined by
+ * whether there was a thumbnail in the previously imported image.
+ *
+ * Returns: (transfer full): The image's metadata, prepared for saving.
+ *
+ * Since: 2.10
+ */
+GimpMetadata *
+gimp_image_metadata_save_prepare_deprecated (gint32                 image_id,
+                                             const gchar           *mime_type,
+                                             GimpMetadataSaveFlags *suggested_flags)
+{
+  GimpImage    *image = gimp_image_new_by_id (image_id);
+  GimpMetadata *metadata;
+
+  metadata = gimp_image_metadata_save_prepare (image, mime_type, suggested_flags);
+
+  g_object_unref (image);
+
+  return metadata;
+}
+
+/**
+ * gimp_image_metadata_save_finish_deprecated: (skip)
+ * @image_id:  The image
+ * @mime_type: The saved file's mime-type
+ * @metadata:  The metadata to set on the image
+ * @flags:     Flags to specify what of the metadata to save
+ * @file:      The file to load the metadata from
+ * @error:     Return location for error message
+ *
+ * Saves the @metadata retrieved from the image with
+ * gimp_image_metadata_save_prepare()_deprecated to @file, taking into account
+ * the passed @flags.
+ *
+ * Returns: Whether the save was successful.
+ *
+ * Since: 2.10
+ */
+gboolean
+gimp_image_metadata_save_finish_deprecated (gint32                  image_id,
+                                            const gchar            *mime_type,
+                                            GimpMetadata           *metadata,
+                                            GimpMetadataSaveFlags   flags,
+                                            GFile                  *file,
+                                            GError                **error)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gboolean   success;
+
+  success = gimp_image_metadata_save_finish (image, mime_type, metadata,
+                                             flags, file, error);
+
+  g_object_unref (image);
+
+  return success;
+}
+
+/**
+ * gimp_image_metadata_load_thumbnail_deprecated: (skip)
+ * @file:  A #GFile image
+ * @error: Return location for error message
+ *
+ * Retrieves a thumbnail from metadata if present.
+ *
+ * Returns: an image id of the @file thumbnail.
+ */
+gint32
+gimp_image_metadata_load_thumbnail_deprecated (GFile   *file,
+                                               GError **error)
+{
+  GimpImage *image;
+  gint32     image_id;
+
+  image = gimp_image_metadata_load_thumbnail (file, error);
+  image_id = gimp_image_get_id (image);
+  g_object_unref (image);
+
+  return image_id;
+}
diff --git a/libgimp/gimpimagemetadata.h b/libgimp/gimpimagemetadata.h
index 2445716119..4cba41c19e 100644
--- a/libgimp/gimpimagemetadata.h
+++ b/libgimp/gimpimagemetadata.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
 GimpMetadata * gimp_image_metadata_load_prepare (GimpImage             *image,
                                                  const gchar           *mime_type,
                                                  GFile                 *file,
@@ -54,7 +56,44 @@ gboolean       gimp_image_metadata_save_finish  (GimpImage             *image,
 /* this is experimental API, to be finished for 2.10 */
 
 GimpImage    * gimp_image_metadata_load_thumbnail (GFile                 *file,
-                                                 GError               **error);
+                                                   GError               **error);
+
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define gimp_image_metadata_load_prepare   gimp_image_metadata_load_prepare_deprecated
+#define gimp_image_metadata_load_finish    gimp_image_metadata_load_finish_deprecated
+#define gimp_image_metadata_save_prepare   gimp_image_metadata_save_prepare_deprecated
+#define gimp_image_metadata_save_finish    gimp_image_metadata_save_finish_deprecated
+#define gimp_image_metadata_load_thumbnail gimp_image_metadata_load_thumbnail_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+GimpMetadata * gimp_image_metadata_load_prepare_deprecated (gint32                 image_id,
+                                                            const gchar           *mime_type,
+                                                            GFile                 *file,
+                                                            GError               **error);
+void           gimp_image_metadata_load_finish_deprecated  (gint32                 image_id,
+                                                            const gchar           *mime_type,
+                                                            GimpMetadata          *metadata,
+                                                            GimpMetadataLoadFlags  flags,
+                                                            gboolean               interactive);
+
+GimpMetadata * gimp_image_metadata_save_prepare_deprecated (gint32                 image_id,
+                                                            const gchar           *mime_type,
+                                                            GimpMetadataSaveFlags *suggested_flags);
+gboolean       gimp_image_metadata_save_finish_deprecated  (gint32                 image_id,
+                                                            const gchar           *mime_type,
+                                                            GimpMetadata          *metadata,
+                                                            GimpMetadataSaveFlags  flags,
+                                                            GFile                 *file,
+                                                            GError               **error);
+
+/* this is experimental API, to be finished for 2.10 */
+
+gint32         gimp_image_metadata_load_thumbnail_deprecated (GFile                 *file,
+                                                              GError               **error);
+
 
 G_END_DECLS
 
diff --git a/libgimp/gimpitemcombobox.c b/libgimp/gimpitemcombobox.c
index d7c5021c0d..91650c92de 100644
--- a/libgimp/gimpitemcombobox.c
+++ b/libgimp/gimpitemcombobox.c
@@ -60,6 +60,8 @@ struct _GimpItemComboBoxPrivate
 {
   GimpItemConstraintFunc  constraint;
   gpointer                data;
+
+  GimpItemConstraintDeprecatedFunc  constraint_d;
 };
 
 typedef struct _GimpDrawableComboBoxClass GimpDrawableComboBoxClass;
@@ -465,8 +467,9 @@ gimp_item_combo_box_model_add (GimpIntComboBox *combo_box,
 
   for (i = 0; i < num_items; i++)
     {
-      if (! private->constraint ||
-          (* private->constraint) (image, items[i], private->data))
+      if ((! private->constraint && ! private->constraint_d)                                ||
+          (private->constraint && (* private->constraint) (image, items[i], private->data)) ||
+          (private->constraint_d && (* private->constraint_d) (gimp_image_get_id (image), items[i], 
private->data)))
         {
           gchar     *image_name = gimp_image_get_name (image);
           gchar     *item_name  = gimp_item_get_name (items[i]);
@@ -603,3 +606,145 @@ gimp_item_combo_box_changed (GimpIntComboBox *combo_box)
         }
     }
 }
+
+
+/* Deprecated API. */
+
+
+static GtkWidget * gimp_item_combo_box_new_deprecated (GType                            type,
+                                                       GimpItemConstraintDeprecatedFunc constraint,
+                                                       gpointer                         data,
+                                                       GDestroyNotify                   data_destroy);
+
+/**
+ * gimp_drawable_combo_box_new_deprecated: (skip)
+ * @constraint:   a #GimpItemConstraintDeprecatedFunc or %NULL
+ * @data  :       a pointer that is passed to @constraint
+ * @data_destroy: Destroy function for @data
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * drawables. If a @constraint function is specified, it is called for
+ * each drawable and only if the function returns %TRUE, the drawable
+ * is added to the combobox.
+ *
+ * You should use gimp_int_combo_box_connect() to initialize and connect
+ * the combo.  Use gimp_int_combo_box_set_active() to get the active
+ * drawable ID and gimp_int_combo_box_get_active() to retrieve the ID
+ * of the selected drawable.
+ *
+ * Returns: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_drawable_combo_box_new_deprecated (GimpItemConstraintDeprecatedFunc constraint,
+                                        gpointer                         data,
+                                        GDestroyNotify                   data_destroy)
+{
+  return gimp_item_combo_box_new_deprecated (GIMP_TYPE_DRAWABLE_COMBO_BOX,
+                                             constraint, data, data_destroy);
+}
+
+/**
+ * gimp_channel_combo_box_new_deprecated: (skip)
+ * @constraint:   a #GimpItemConstraintDeprecatedFunc or %NULL
+ * @data:         a pointer that is passed to @constraint
+ * @data_destroy: Destroy function for @data
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * channels. See gimp_drawable_combo_box_new() for more information.
+ *
+ * Returns: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_channel_combo_box_new_deprecated (GimpItemConstraintDeprecatedFunc constraint,
+                                       gpointer                         data,
+                                       GDestroyNotify                   data_destroy)
+{
+  return gimp_item_combo_box_new_deprecated (GIMP_TYPE_CHANNEL_COMBO_BOX,
+                                             constraint, data, data_destroy);
+}
+
+/**
+ * gimp_layer_combo_box_new_deprecated: (skip)
+ * @constraint:   a #GimpItemConstraintDeprecatedFunc or %NULL
+ * @data:         a pointer that is passed to @constraint
+ * @data_destroy: Destroy function for @data
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * layers. See gimp_drawable_combo_box_new() for more information.
+ *
+ * Returns: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_layer_combo_box_new_deprecated (GimpItemConstraintDeprecatedFunc constraint,
+                                     gpointer                         data,
+                                     GDestroyNotify                   data_destroy)
+{
+  return gimp_item_combo_box_new_deprecated (GIMP_TYPE_LAYER_COMBO_BOX,
+                                             constraint, data, data_destroy);
+}
+
+/**
+ * gimp_vectors_combo_box_new_deprecated: (skip)
+ * @constraint:   a #GimpItemConstraintDeprecatedFunc or %NULL
+ * @data:         a pointer that is passed to @constraint
+ * @data_destroy: Destroy function for @data
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * vectors objects. If a @constraint function is specified, it is called for
+ * each vectors object and only if the function returns %TRUE, the vectors
+ * object is added to the combobox.
+ *
+ * You should use gimp_int_combo_box_connect() to initialize and connect
+ * the combo.  Use gimp_int_combo_box_set_active() to set the active
+ * vectors ID and gimp_int_combo_box_get_active() to retrieve the ID
+ * of the selected vectors object.
+ *
+ * Returns: a new #GimpIntComboBox.
+ *
+ * Since: 2.4
+ **/
+GtkWidget *
+gimp_vectors_combo_box_new_deprecated (GimpItemConstraintDeprecatedFunc constraint,
+                                       gpointer                         data,
+                                       GDestroyNotify                   data_destroy)
+{
+  return gimp_item_combo_box_new_deprecated (GIMP_TYPE_VECTORS_COMBO_BOX,
+                                             constraint, data, data_destroy);
+}
+
+static GtkWidget *
+gimp_item_combo_box_new_deprecated (GType                            type,
+                                    GimpItemConstraintDeprecatedFunc constraint,
+                                    gpointer                         data,
+                                    GDestroyNotify                   data_destroy)
+{
+  GimpIntComboBox         *combo_box;
+  GimpItemComboBoxPrivate *private;
+
+  combo_box = g_object_new (type,
+                            "width-request", WIDTH_REQUEST,
+                            "ellipsize",     PANGO_ELLIPSIZE_MIDDLE,
+                            NULL);
+
+  private = GET_PRIVATE (combo_box);
+
+  private->constraint_d = constraint;
+  private->data         = data;
+
+  if (data_destroy)
+    g_object_weak_ref (G_OBJECT (combo_box), (GWeakNotify) data_destroy, data);
+
+  gimp_item_combo_box_populate (combo_box);
+
+  g_signal_connect (combo_box, "changed",
+                    G_CALLBACK (gimp_item_combo_box_changed),
+                    NULL);
+
+  return GTK_WIDGET (combo_box);
+}
diff --git a/libgimp/gimpitemcombobox.h b/libgimp/gimpitemcombobox.h
index 013179f9b1..f5b92527b5 100644
--- a/libgimp/gimpitemcombobox.h
+++ b/libgimp/gimpitemcombobox.h
@@ -49,16 +49,18 @@ G_BEGIN_DECLS
 #define GIMP_IS_VECTORS_COMBO_BOX(obj)  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_COMBO_BOX))
 
 
-typedef gboolean (* GimpItemConstraintFunc) (GimpImage *image,
-                                             gint32     item_id,
-                                             gpointer   data);
-
-
 GType       gimp_drawable_combo_box_get_type (void) G_GNUC_CONST;
 GType       gimp_channel_combo_box_get_type  (void) G_GNUC_CONST;
 GType       gimp_layer_combo_box_get_type    (void) G_GNUC_CONST;
 GType       gimp_vectors_combo_box_get_type  (void) G_GNUC_CONST;
 
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
+typedef gboolean (* GimpItemConstraintFunc) (GimpImage *image,
+                                             gint32     item_id,
+                                             gpointer   data);
+
 GtkWidget * gimp_drawable_combo_box_new (GimpItemConstraintFunc constraint,
                                          gpointer               data,
                                          GDestroyNotify         data_destroy);
@@ -72,6 +74,35 @@ GtkWidget * gimp_vectors_combo_box_new  (GimpItemConstraintFunc constraint,
                                          gpointer               data,
                                          GDestroyNotify         data_destroy);
 
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define GimpItemConstraintFunc      GimpItemConstraintDeprecatedFunc
+#define gimp_drawable_combo_box_new gimp_drawable_combo_box_new_deprecated
+#define gimp_channel_combo_box_new  gimp_channel_combo_box_new_deprecated
+#define gimp_layer_combo_box_new    gimp_layer_combo_box_new_deprecated
+#define gimp_vectors_combo_box_new  gimp_vectors_combo_box_new_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+typedef gboolean (* GimpItemConstraintDeprecatedFunc) (gint     image_id,
+                                                       gint32   item_id,
+                                                       gpointer data);
+
+
+GtkWidget * gimp_drawable_combo_box_new_deprecated (GimpItemConstraintDeprecatedFunc constraint,
+                                                    gpointer                         data,
+                                                    GDestroyNotify                   data_destroy);
+GtkWidget * gimp_channel_combo_box_new_deprecated  (GimpItemConstraintDeprecatedFunc constraint,
+                                                    gpointer                         data,
+                                                    GDestroyNotify                   data_destroy);
+GtkWidget * gimp_layer_combo_box_new_deprecated    (GimpItemConstraintDeprecatedFunc constraint,
+                                                    gpointer                         data,
+                                                    GDestroyNotify                   data_destroy);
+GtkWidget * gimp_vectors_combo_box_new_deprecated  (GimpItemConstraintDeprecatedFunc constraint,
+                                                    gpointer                         data,
+                                                    GDestroyNotify                   data_destroy);
+
 
 G_END_DECLS
 
diff --git a/libgimp/gimplayer.c b/libgimp/gimplayer.c
index 64f8b41a5d..dcff5daf57 100644
--- a/libgimp/gimplayer.c
+++ b/libgimp/gimplayer.c
@@ -243,3 +243,132 @@ gimp_layer_new_from_surface (GimpImage            *image,
 
   return layer;
 }
+
+
+/* Deprecate API. */
+
+
+/**
+ * gimp_layer_new_deprecated: (skip)
+ * @image_id: The image to which to add the layer.
+ * @name:     The layer name.
+ * @width:    The layer width.
+ * @height:   The layer height.
+ * @type:     The layer type.
+ * @opacity:  The layer opacity.
+ * @mode:     The layer combination mode.
+ *
+ * Create a new layer.
+ *
+ * This procedure creates a new layer with the specified width, height,
+ * and type. Name, opacity, and mode are also supplied parameters. The
+ * new layer still needs to be added to the image, as this is not
+ * automatic. Add the new layer with the gimp_image_insert_layer()
+ * command. Other attributes such as layer mask modes, and offsets
+ * should be set with explicit procedure calls.
+ *
+ * Returns: The newly created layer.
+ */
+gint32
+gimp_layer_new_deprecated (gint32         image_id,
+                           const gchar   *name,
+                           gint           width,
+                           gint           height,
+                           GimpImageType  type,
+                           gdouble        opacity,
+                           GimpLayerMode  mode)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gint32     layer_id;
+
+  layer_id = gimp_layer_new (image, name, width, height,
+                             type, opacity, mode);
+
+  g_object_unref (image);
+
+  return layer_id;
+}
+
+/**
+ * gimp_layer_new_from_pixbuf_deprecated: (skip)
+ * @image_id:       The RGB image to which to add the layer.
+ * @name:           The layer name.
+ * @pixbuf:         A GdkPixbuf.
+ * @opacity:        The layer opacity.
+ * @mode:           The layer combination mode.
+ * @progress_start: start of progress
+ * @progress_end:   end of progress
+ *
+ * Create a new layer from a %GdkPixbuf.
+ *
+ * This procedure creates a new layer from the given %GdkPixbuf.  The
+ * image has to be an RGB image and just like with gimp_layer_new()
+ * you will still need to add the layer to it.
+ *
+ * If you pass @progress_end > @progress_start to this function,
+ * gimp_progress_update() will be called for. You have to call
+ * gimp_progress_init() beforehand then.
+ *
+ * Returns: The newly created layer.
+ *
+ * Since: 2.4
+ */
+gint32
+gimp_layer_new_from_pixbuf_deprecated (gint32         image_id,
+                                       const gchar   *name,
+                                       GdkPixbuf     *pixbuf,
+                                       gdouble        opacity,
+                                       GimpLayerMode  mode,
+                                       gdouble        progress_start,
+                                       gdouble        progress_end)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gint32     layer_id;
+
+  layer_id = gimp_layer_new_from_pixbuf (image, name, pixbuf, opacity, mode,
+                                          progress_start, progress_end);
+
+  g_object_unref (image);
+
+  return layer_id;
+}
+
+/**
+ * gimp_layer_new_from_surface_deprecated: (skip)
+ * @image_id:        The RGB image to which to add the layer.
+ * @name:            The layer name.
+ * @surface:         A Cairo image surface.
+ * @progress_start:  start of progress
+ * @progress_end:    end of progress
+ *
+ * Create a new layer from a #cairo_surface_t.
+ *
+ * This procedure creates a new layer from the given
+ * #cairo_surface_t. The image has to be an RGB image and just like
+ * with gimp_layer_new() you will still need to add the layer to it.
+ *
+ * If you pass @progress_end > @progress_start to this function,
+ * gimp_progress_update() will be called for. You have to call
+ * gimp_progress_init() beforehand then.
+ *
+ * Returns: The newly created layer.
+ *
+ * Since: 2.8
+ */
+gint32
+gimp_layer_new_from_surface_deprecated (gint32                image_id,
+                                        const gchar          *name,
+                                        cairo_surface_t      *surface,
+                                        gdouble               progress_start,
+                                        gdouble               progress_end)
+{
+  GimpImage *image = gimp_image_new_by_id (image_id);
+  gint32     layer_id;
+
+  layer_id = gimp_layer_new_from_surface (image, name, surface,
+                                          progress_start, progress_end);
+
+  g_object_unref (image);
+
+  return layer_id;
+}
diff --git a/libgimp/gimplayer.h b/libgimp/gimplayer.h
index df3e6059c4..f6895b94a7 100644
--- a/libgimp/gimplayer.h
+++ b/libgimp/gimplayer.h
@@ -30,6 +30,11 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
+gint32   gimp_layer_copy               (gint32           layer_ID);
+
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
 gint32   gimp_layer_new                (GimpImage       *image,
                                         const gchar     *name,
                                         gint             width,
@@ -37,7 +42,6 @@ gint32   gimp_layer_new                (GimpImage       *image,
                                         GimpImageType    type,
                                         gdouble          opacity,
                                         GimpLayerMode    mode);
-gint32   gimp_layer_copy               (gint32           layer_ID);
 
 gint32   gimp_layer_new_from_pixbuf    (GimpImage       *image,
                                         const gchar     *name,
@@ -52,6 +56,36 @@ gint32   gimp_layer_new_from_surface   (GimpImage       *image,
                                         gdouble          progress_start,
                                         gdouble          progress_end);
 
+#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+#define gimp_layer_new              gimp_layer_new_deprecated
+#define gimp_layer_new_from_pixbuf  gimp_layer_new_from_pixbuf_deprecated
+#define gimp_layer_new_from_surface gimp_layer_new_from_surface_deprecated
+
+#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
+
+
+gint32   gimp_layer_new_deprecated              (gint32           image_id,
+                                                 const gchar     *name,
+                                                 gint             width,
+                                                 gint             height,
+                                                 GimpImageType    type,
+                                                 gdouble          opacity,
+                                                 GimpLayerMode    mode);
+
+gint32   gimp_layer_new_from_pixbuf_deprecated  (gint32           image_id,
+                                                 const gchar     *name,
+                                                 GdkPixbuf       *pixbuf,
+                                                 gdouble          opacity,
+                                                 GimpLayerMode    mode,
+                                                 gdouble          progress_start,
+                                                 gdouble          progress_end);
+gint32   gimp_layer_new_from_surface_deprecated (gint32           image_id,
+                                                 const gchar     *name,
+                                                 cairo_surface_t *surface,
+                                                 gdouble          progress_start,
+                                                 gdouble          progress_end);
+
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]