[gimp] plug-ins: port some simple plug-ins to libgimp objects



commit dfe73bf4baf325389d1d9fd0bc55a6727b5d392a
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 30 19:27:19 2019 +0200

    plug-ins: port some simple plug-ins to libgimp objects
    
    (where simple == doesn't use much API)

 plug-ins/common/Makefile.am          |  10 ---
 plug-ins/common/animation-optimize.c | 146 ++++++++++++++++++-----------------
 plug-ins/common/cml-explorer.c       |  34 ++++----
 plug-ins/common/crop-zealous.c       |  76 +++++++++---------
 plug-ins/common/hot.c                |  26 +++----
 plug-ins/common/plugin-defs.pl       |  10 +--
 plug-ins/common/qbist.c              |  20 ++---
 7 files changed, 158 insertions(+), 164 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 0cd4add9ef..df2264101d 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -242,8 +242,6 @@ align_layers_LDADD = \
        $(INTLLIBS)             \
        $(align_layers_RC)
 
-animation_optimize_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 animation_optimize_SOURCES = \
        animation-optimize.c
 
@@ -350,8 +348,6 @@ checkerboard_LDADD = \
        $(INTLLIBS)             \
        $(checkerboard_RC)
 
-cml_explorer_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 cml_explorer_SOURCES = \
        cml-explorer.c
 
@@ -424,8 +420,6 @@ contrast_retinex_LDADD = \
        $(INTLLIBS)             \
        $(contrast_retinex_RC)
 
-crop_zealous_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 crop_zealous_SOURCES = \
        crop-zealous.c
 
@@ -1260,8 +1254,6 @@ guillotine_LDADD = \
        $(INTLLIBS)             \
        $(guillotine_RC)
 
-hot_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 hot_SOURCES = \
        hot.c
 
@@ -1367,8 +1359,6 @@ procedure_browser_LDADD = \
        $(INTLLIBS)             \
        $(procedure_browser_RC)
 
-qbist_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 qbist_SOURCES = \
        qbist.c
 
diff --git a/plug-ins/common/animation-optimize.c b/plug-ins/common/animation-optimize.c
index 63e23eb09a..9687bdbabf 100644
--- a/plug-ins/common/animation-optimize.c
+++ b/plug-ins/common/animation-optimize.c
@@ -68,7 +68,7 @@ static  void run   (const gchar      *name,
                     gint             *nreturn_vals,
                     GimpParam       **return_vals);
 
-static  gint32      do_optimizations    (GimpRunMode  run_mode,
+static  GimpImage * do_optimizations    (GimpRunMode  run_mode,
                                          gboolean     diff_only);
 
 /* tag util functions*/
@@ -99,10 +99,10 @@ const GimpPlugInInfo PLUG_IN_INFO =
 
 /* Global widgets'n'stuff */
 static  guint             width, height;
-static  gint32            image_id;
-static  gint32            new_image_id;
+static  GimpImage        *image;
+static  GimpImage        *new_image;
 static  gint32            total_frames;
-static  gint32           *layers;
+static  GimpLayer       **layers;
 static  GimpImageBaseType imagetype;
 static  GimpImageType     drawabletype_alpha;
 static  guchar            pixelstep;
@@ -142,7 +142,7 @@ query (void)
                           "1997-2003",
                           N_("Optimize (for _GIF)"),
                           "RGB*, INDEXED*, GRAY*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args),
                           G_N_ELEMENTS (return_args),
                           args, return_args);
@@ -160,7 +160,7 @@ query (void)
                           "1997-2001",
                           N_("_Optimize (Difference)"),
                           "RGB*, INDEXED*, GRAY*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args),
                           G_N_ELEMENTS (return_args),
                           args, return_args);
@@ -175,7 +175,7 @@ query (void)
                           "1997-2001",
                           N_("_Unoptimize"),
                           "RGB*, INDEXED*, GRAY*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args),
                           G_N_ELEMENTS (return_args),
                           args, return_args);
@@ -195,7 +195,7 @@ query (void)
                           "2001",
                           N_("_Remove Backdrop"),
                           "RGB*, INDEXED*, GRAY*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args),
                           G_N_ELEMENTS (return_args),
                           args, return_args);
@@ -211,7 +211,7 @@ query (void)
                           "2001",
                           N_("_Find Backdrop"),
                           "RGB*, INDEXED*, GRAY*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args),
                           G_N_ELEMENTS (return_args),
                           args, return_args);
@@ -266,9 +266,9 @@ run (const gchar      *name,
 
   if (status == GIMP_PDB_SUCCESS)
     {
-      image_id = param[1].data.d_image;
+      image = gimp_image_get_by_id (param[1].data.d_image);
 
-      new_image_id = do_optimizations (run_mode, diff_only);
+      new_image = do_optimizations (run_mode, diff_only);
 
       if (run_mode != GIMP_RUN_NONINTERACTIVE)
         gimp_displays_flush();
@@ -278,7 +278,7 @@ run (const gchar      *name,
   values[0].data.d_status = status;
 
   values[1].type         = GIMP_PDB_IMAGE;
-  values[1].data.d_image = new_image_id;
+  values[1].data.d_image = gimp_image_get_id (new_image);
 }
 
 
@@ -297,24 +297,24 @@ total_alpha (guchar  *imdata,
 }
 
 static const Babl *
-get_format (gint32 drawable_ID)
+get_format (GimpDrawable *drawable)
 {
-  if (gimp_drawable_is_rgb (drawable_ID))
+  if (gimp_drawable_is_rgb (drawable))
     {
-      if (gimp_drawable_has_alpha (drawable_ID))
+      if (gimp_drawable_has_alpha (drawable))
         return babl_format ("R'G'B'A u8");
       else
         return babl_format ("R'G'B' u8");
     }
-  else if (gimp_drawable_is_gray (drawable_ID))
+  else if (gimp_drawable_is_gray (drawable))
     {
-      if (gimp_drawable_has_alpha (drawable_ID))
+      if (gimp_drawable_has_alpha (drawable))
         return babl_format ("Y'A u8");
       else
         return babl_format ("Y' u8");
     }
 
-  return gimp_drawable_get_format (drawable_ID);
+  return gimp_drawable_get_format (drawable);
 }
 
 static void
@@ -323,7 +323,7 @@ compose_row (gint          frame_num,
              gint          row_num,
              guchar       *dest,
              gint          dest_width,
-             gint32        drawable_ID,
+             GimpDrawable *drawable,
              gboolean      cleanup)
 {
   static guchar *line_buf = NULL;
@@ -350,19 +350,19 @@ compose_row (gint          frame_num,
       total_alpha (dest, dest_width, pixelstep);
     }
 
-  gimp_drawable_offsets (drawable_ID, &rawx, &rawy);
+  gimp_drawable_offsets (drawable, &rawx, &rawy);
 
-  rawwidth  = gimp_drawable_width (drawable_ID);
-  rawheight = gimp_drawable_height (drawable_ID);
+  rawwidth  = gimp_drawable_width (drawable);
+  rawheight = gimp_drawable_height (drawable);
 
   /* this frame has nothing to give us for this row; return */
   if (row_num >= rawheight + rawy ||
       row_num < rawy)
     return;
 
-  format = get_format (drawable_ID);
+  format = get_format (drawable);
 
-  has_alpha = gimp_drawable_has_alpha (drawable_ID);
+  has_alpha = gimp_drawable_has_alpha (drawable);
   rawbpp    = babl_format_get_bytes_per_pixel (format);
 
   if (line_buf)
@@ -374,7 +374,7 @@ compose_row (gint          frame_num,
 
   /* Initialise and fetch the raw new frame row */
 
-  src_buffer = gimp_drawable_get_buffer (drawable_ID);
+  src_buffer = gimp_drawable_get_buffer (drawable);
 
   gegl_buffer_get (src_buffer, GEGL_RECTANGLE (0, row_num - rawy,
                                                rawwidth, 1), 1.0,
@@ -409,7 +409,7 @@ compose_row (gint          frame_num,
 }
 
 
-static gint32
+static GimpImage *
 do_optimizations (GimpRunMode run_mode,
                   gboolean    diff_only)
 {
@@ -418,7 +418,7 @@ do_optimizations (GimpRunMode run_mode,
   guchar        *destptr;
   gint           row, this_frame_num;
   guint32        frame_sizebytes;
-  gint32         new_layer_id;
+  GimpLayer     *new_layer;
   DisposeType    dispose;
   guchar        *this_frame = NULL;
   guchar        *last_frame = NULL;
@@ -427,7 +427,7 @@ do_optimizations (GimpRunMode run_mode,
 
   gint           this_delay;
   gint           cumulated_delay = 0;
-  gint           last_true_frame = -1;
+  GimpLayer     *last_true_frame = NULL;
   gint           buflen;
 
   gchar         *oldlayer_name;
@@ -455,10 +455,10 @@ do_optimizations (GimpRunMode run_mode,
       break;
     }
 
-  width     = gimp_image_width (image_id);
-  height    = gimp_image_height (image_id);
-  layers    = gimp_image_get_layers (image_id, &total_frames);
-  imagetype = gimp_image_base_type (image_id);
+  width     = gimp_image_width (image);
+  height    = gimp_image_height (image);
+  layers    = gimp_image_get_layers (image, &total_frames);
+  imagetype = gimp_image_base_type (image);
   pixelstep = (imagetype == GIMP_RGB) ? 4 : 2;
 
   drawabletype_alpha = (imagetype == GIMP_RGB) ? GIMP_RGBA_IMAGE :
@@ -477,13 +477,13 @@ do_optimizations (GimpRunMode run_mode,
   total_alpha (this_frame, width*height, pixelstep);
   total_alpha (last_frame, width*height, pixelstep);
 
-  new_image_id = gimp_image_new(width, height, imagetype);
-  gimp_image_undo_disable (new_image_id);
+  new_image = gimp_image_new (width, height, imagetype);
+  gimp_image_undo_disable (new_image);
 
   if (imagetype == GIMP_INDEXED)
     {
-      palette = gimp_image_get_colormap (image_id, &ncolors);
-      gimp_image_set_colormap (new_image_id, palette, ncolors);
+      palette = gimp_image_get_colormap (image, &ncolors);
+      gimp_image_set_colormap (new_image, palette, ncolors);
     }
 
 #if 1
@@ -525,7 +525,8 @@ do_optimizations (GimpRunMode run_mode,
 
           for (this_frame_num=0; this_frame_num<total_frames; this_frame_num++)
             {
-              gint32 drawable_ID = layers[total_frames-(this_frame_num+1)];
+              GimpDrawable *drawable =
+                GIMP_DRAWABLE (layers[total_frames-(this_frame_num+1)]);
 
               dispose = get_frame_disposal (this_frame_num);
 
@@ -534,7 +535,7 @@ do_optimizations (GimpRunMode run_mode,
                            row,
                            these_rows[this_frame_num],
                            width,
-                           drawable_ID,
+                           drawable,
                            FALSE);
             }
 
@@ -651,18 +652,18 @@ do_optimizations (GimpRunMode run_mode,
       GeglBuffer *buffer;
       const Babl *format;
 
-      new_layer_id = gimp_layer_new (new_image_id,
-                                     "Backgroundx",
-                                     width, height,
-                                     drawabletype_alpha,
-                                     100.0,
-                                     gimp_image_get_default_new_layer_mode (new_image_id));
+      new_layer = gimp_layer_new (new_image,
+                                  "Backgroundx",
+                                  width, height,
+                                  drawabletype_alpha,
+                                  100.0,
+                                  gimp_image_get_default_new_layer_mode (new_image));
 
-      gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
+      gimp_image_insert_layer (new_image, new_layer, NULL, 0);
 
-      buffer = gimp_drawable_get_buffer (new_layer_id);
+      buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (new_layer));
 
-      format = get_format (new_layer_id);
+      format = get_format (GIMP_DRAWABLE (new_layer));
 
       gegl_buffer_set (buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
                        format, back_frame,
@@ -678,11 +679,12 @@ do_optimizations (GimpRunMode run_mode,
            * BUILD THIS FRAME into our 'this_frame' buffer.
            */
 
-          gint32 drawable_ID = layers[total_frames-(this_frame_num+1)];
+          GimpDrawable *drawable =
+            GIMP_DRAWABLE (layers[total_frames-(this_frame_num+1)]);
 
           /* Image has been closed/etc since we got the layer list? */
           /* FIXME - How do we tell if a gimp_drawable_get() fails? */
-          if (gimp_drawable_width (drawable_ID) == 0)
+          if (gimp_drawable_width (drawable) == 0)
             {
               gimp_quit ();
             }
@@ -697,7 +699,7 @@ do_optimizations (GimpRunMode run_mode,
                            row,
                            &this_frame[pixelstep*width * row],
                            width,
-                           drawable_ID,
+                           drawable,
                            FALSE
                            );
             }
@@ -1011,7 +1013,7 @@ do_optimizations (GimpRunMode run_mode,
            */
 
           oldlayer_name =
-            gimp_item_get_name(layers[total_frames-(this_frame_num+1)]);
+            gimp_item_get_name (GIMP_ITEM (layers[total_frames-(this_frame_num+1)]));
 
           buflen = strlen(oldlayer_name) + 40;
 
@@ -1039,7 +1041,7 @@ do_optimizations (GimpRunMode run_mode,
 
               g_free (newlayer_name);
 
-              oldlayer_name = gimp_item_get_name (last_true_frame);
+              oldlayer_name = gimp_item_get_name (GIMP_ITEM (last_true_frame));
 
               buflen = strlen (oldlayer_name) + 40;
 
@@ -1057,7 +1059,7 @@ do_optimizations (GimpRunMode run_mode,
                           (this_frame_num ==  0) ? "" :
                           can_combine ? "(combine)" : "(replace)");
 
-              gimp_item_set_name (last_true_frame, newlayer_name);
+              gimp_item_set_name (GIMP_ITEM (last_true_frame), newlayer_name);
 
               g_free (newlayer_name);
             }
@@ -1069,20 +1071,20 @@ do_optimizations (GimpRunMode run_mode,
               cumulated_delay = this_delay;
 
               last_true_frame =
-                new_layer_id = gimp_layer_new (new_image_id,
-                                               newlayer_name,
-                                               bbox_right-bbox_left,
-                                               bbox_bottom-bbox_top,
-                                               drawabletype_alpha,
-                                               100.0,
-                                               gimp_image_get_default_new_layer_mode (new_image_id));
+                new_layer = gimp_layer_new (new_image,
+                                            newlayer_name,
+                                            bbox_right-bbox_left,
+                                            bbox_bottom-bbox_top,
+                                            drawabletype_alpha,
+                                            100.0,
+                                            gimp_image_get_default_new_layer_mode (new_image));
               g_free (newlayer_name);
 
-              gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
+              gimp_image_insert_layer (new_image, new_layer, NULL, 0);
 
-              buffer = gimp_drawable_get_buffer (new_layer_id);
+              buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (new_layer));
 
-              format = get_format (new_layer_id);
+              format = get_format (GIMP_DRAWABLE (new_layer));
 
               gegl_buffer_set (buffer,
                                GEGL_RECTANGLE (0, 0,
@@ -1101,10 +1103,10 @@ do_optimizations (GimpRunMode run_mode,
       gimp_progress_update (1.0);
     }
 
-  gimp_image_undo_enable (new_image_id);
+  gimp_image_undo_enable (new_image);
 
   if (run_mode != GIMP_RUN_NONINTERACTIVE)
-    gimp_display_new (new_image_id);
+    gimp_display_new (new_image);
 
   g_free (rawframe);
   rawframe = NULL;
@@ -1121,7 +1123,7 @@ do_optimizations (GimpRunMode run_mode,
   g_free (back_frame);
   back_frame = NULL;
 
-  return new_image_id;
+  return new_image;
 }
 
 /* Util. */
@@ -1132,9 +1134,9 @@ get_frame_disposal (guint whichframe)
   gchar       *layer_name;
   DisposeType  disposal;
 
-  layer_name = gimp_item_get_name(layers[total_frames-(whichframe+1)]);
-  disposal = parse_disposal_tag(layer_name);
-  g_free(layer_name);
+  layer_name = gimp_item_get_name (GIMP_ITEM (layers[total_frames-(whichframe+1)]));
+  disposal = parse_disposal_tag (layer_name);
+  g_free (layer_name);
 
   return disposal;
 }
@@ -1145,11 +1147,11 @@ get_frame_duration (guint whichframe)
   gchar* layer_name;
   gint   duration = 0;
 
-  layer_name = gimp_item_get_name(layers[total_frames-(whichframe+1)]);
+  layer_name = gimp_item_get_name (GIMP_ITEM (layers[total_frames-(whichframe+1)]));
   if (layer_name)
     {
-      duration = parse_ms_tag(layer_name);
-      g_free(layer_name);
+      duration = parse_ms_tag (layer_name);
+      g_free (layer_name);
     }
 
   if (duration < 0) duration = 100;  /* FIXME for default-if-not-said  */
diff --git a/plug-ins/common/cml-explorer.c b/plug-ins/common/cml-explorer.c
index 745056b65e..96c9821211 100644
--- a/plug-ins/common/cml-explorer.c
+++ b/plug-ins/common/cml-explorer.c
@@ -428,13 +428,13 @@ static CML_sensitive_widget_table random_sensitives[RANDOM_SENSITIVES_NUM] =
   { NULL, 0 }
 };
 
-static GRand    *gr;
-static gint      drawable_id = 0;
-static gint      copy_source = 0;
-static gint      copy_destination = 0;
-static gint      selective_load_source = 0;
-static gint      selective_load_destination = 0;
-static gboolean  CML_preview_defer = FALSE;
+static GRand        *gr;
+static GimpDrawable *drawable = NULL;
+static gint          copy_source = 0;
+static gint          copy_destination = 0;
+static gint          selective_load_source = 0;
+static gint          selective_load_destination = 0;
+static gboolean      CML_preview_defer = FALSE;
 
 static gdouble  *mem_chank0 = NULL;
 static gint      mem_chank0_size = 0;
@@ -470,7 +470,7 @@ query (void)
                           "1997",
                           N_("CML _Explorer..."),
                           "RGB*, GRAY*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args), 0,
                           args, NULL);
 
@@ -488,8 +488,8 @@ run (const gchar      *name,
   GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
   GimpRunMode       run_mode;
 
-  run_mode    = param[0].data.d_int32;
-  drawable_id = param[2].data.d_drawable;
+  run_mode = param[0].data.d_int32;
+  drawable = GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable));
 
   INIT_I18N ();
 
@@ -559,13 +559,13 @@ CML_main_function (gboolean preview_p)
   gdouble    *newh, *news, *newv;
   gdouble    *haux, *saux, *vaux;
 
-  if (! gimp_drawable_mask_intersect (drawable_id,
+  if (! gimp_drawable_mask_intersect (drawable,
                                       &x, &y,
                                       &width_by_pixel, &height_by_pixel))
     return GIMP_PDB_SUCCESS;
 
-  src_has_alpha = dest_has_alpha = gimp_drawable_has_alpha (drawable_id);
-  src_is_gray   = dest_is_gray   = gimp_drawable_is_gray (drawable_id);
+  src_has_alpha = dest_has_alpha = gimp_drawable_has_alpha (drawable);
+  src_is_gray   = dest_is_gray   = gimp_drawable_is_gray (drawable);
 
   if (src_is_gray)
     {
@@ -644,9 +644,9 @@ CML_main_function (gboolean preview_p)
   dest_buf = mem_chank2;
 
   if (! preview_p)
-    dest_buffer = gimp_drawable_get_shadow_buffer (drawable_id);
+    dest_buffer = gimp_drawable_get_shadow_buffer (drawable);
 
-  src_buffer = gimp_drawable_get_buffer (drawable_id);
+  src_buffer = gimp_drawable_get_buffer (drawable);
 
   gr = g_rand_new ();
   if (VALS.initial_value == CML_INITIAL_RANDOM_FROM_SEED)
@@ -948,8 +948,8 @@ CML_main_function (gboolean preview_p)
 
       g_object_unref (dest_buffer);
 
-      gimp_drawable_merge_shadow (drawable_id, TRUE);
-      gimp_drawable_update (drawable_id,
+      gimp_drawable_merge_shadow (drawable, TRUE);
+      gimp_drawable_update (drawable,
                             x, y, width_by_pixel, height_by_pixel);
     }
 
diff --git a/plug-ins/common/crop-zealous.c b/plug-ins/common/crop-zealous.c
index 6efc34bf59..6b8cbcb93c 100644
--- a/plug-ins/common/crop-zealous.c
+++ b/plug-ins/common/crop-zealous.c
@@ -41,8 +41,9 @@ static inline gboolean colors_equal (const gfloat     *col1,
                                      const gfloat     *col2,
                                      gint              components,
                                      gboolean          has_alpha);
-static void            do_zcrop     (gint32    drawable_id,
-                                     gint32    image_id);
+static void            do_zcrop     (GimpDrawable     *drawable,
+                                     GimpImage        *image);
+
 
 const GimpPlugInInfo PLUG_IN_INFO =
 {
@@ -73,7 +74,7 @@ query (void)
                           "1997",
                           N_("_Zealous Crop"),
                           "RGB*, GRAY*, INDEXED*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args), 0,
                           args, NULL);
 
@@ -90,8 +91,8 @@ run (const gchar      *name,
   static GimpParam   values[1];
   GimpRunMode        run_mode;
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
-  gint32             drawable_id;
-  gint32             image_id;
+  GimpDrawable      *drawable;
+  GimpImage         *image;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
@@ -112,17 +113,17 @@ run (const gchar      *name,
   if (status == GIMP_PDB_SUCCESS)
     {
       /*  Get the specified drawable  */
-      image_id    = param[1].data.d_int32;
-      drawable_id = param[2].data.d_int32;
+      image    = gimp_image_get_by_id (param[1].data.d_int32);
+      drawable = GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_int32));
 
       /*  Make sure that the drawable is gray or RGB or indexed  */
-      if (gimp_drawable_is_rgb (drawable_id) ||
-          gimp_drawable_is_gray (drawable_id) ||
-          gimp_drawable_is_indexed (drawable_id))
+      if (gimp_drawable_is_rgb (drawable) ||
+          gimp_drawable_is_gray (drawable) ||
+          gimp_drawable_is_indexed (drawable))
         {
           gimp_progress_init (_("Zealous cropping"));
 
-          do_zcrop (drawable_id, image_id);
+          do_zcrop (drawable, image);
 
           if (run_mode != GIMP_RUN_NONINTERACTIVE)
             gimp_displays_flush ();
@@ -166,28 +167,28 @@ colors_equal (const gfloat   *col1,
 }
 
 static void
-do_zcrop (gint32  drawable_id,
-          gint32  image_id)
+do_zcrop (GimpDrawable *drawable,
+          GimpImage    *image)
 {
-  GeglBuffer  *drawable_buffer;
-  GeglBuffer  *shadow_buffer;
-  gfloat      *linear_buf;
-  const Babl  *format;
-
-  gint         x, y, width, height;
-  gint         components;
-  gint8       *killrows;
-  gint8       *killcols;
-  gint32       livingrows, livingcols, destrow, destcol;
-  gint32       selection_copy_id;
-  gboolean     has_alpha;
-
-  drawable_buffer = gimp_drawable_get_buffer (drawable_id);
-  shadow_buffer   = gimp_drawable_get_shadow_buffer (drawable_id);
+  GeglBuffer   *drawable_buffer;
+  GeglBuffer   *shadow_buffer;
+  gfloat       *linear_buf;
+  const Babl   *format;
+
+  gint          x, y, width, height;
+  gint          components;
+  gint8        *killrows;
+  gint8        *killcols;
+  gint32        livingrows, livingcols, destrow, destcol;
+  GimpChannel  *selection_copy;
+  gboolean      has_alpha;
+
+  drawable_buffer = gimp_drawable_get_buffer (drawable);
+  shadow_buffer   = gimp_drawable_get_shadow_buffer (drawable);
 
   width  = gegl_buffer_get_width (drawable_buffer);
   height = gegl_buffer_get_height (drawable_buffer);
-  has_alpha = gimp_drawable_has_alpha (drawable_id);
+  has_alpha = gimp_drawable_has_alpha (drawable);
 
   if (has_alpha)
     format = babl_format ("R'G'B'A float");
@@ -301,21 +302,22 @@ do_zcrop (gint32  drawable_id,
 
   gimp_progress_update (1.00);
 
-  gimp_image_undo_group_start (image_id);
+  gimp_image_undo_group_start (image);
 
-  selection_copy_id = gimp_selection_save (image_id);
-  gimp_selection_none (image_id);
+  selection_copy = GIMP_CHANNEL (gimp_selection_save (image));
+  gimp_selection_none (image);
 
   gegl_buffer_flush (shadow_buffer);
-  gimp_drawable_merge_shadow (drawable_id, TRUE);
+  gimp_drawable_merge_shadow (drawable, TRUE);
   gegl_buffer_flush (drawable_buffer);
 
-  gimp_image_select_item (image_id, GIMP_CHANNEL_OP_REPLACE, selection_copy_id);
-  gimp_image_remove_channel (image_id, selection_copy_id);
+  gimp_image_select_item (image, GIMP_CHANNEL_OP_REPLACE,
+                          GIMP_ITEM (selection_copy));
+  gimp_image_remove_channel (image, selection_copy);
 
-  gimp_image_crop (image_id, livingcols, livingrows, 0, 0);
+  gimp_image_crop (image, livingcols, livingrows, 0, 0);
 
-  gimp_image_undo_group_end (image_id);
+  gimp_image_undo_group_end (image);
 
   g_object_unref (shadow_buffer);
   g_object_unref (drawable_buffer);
diff --git a/plug-ins/common/hot.c b/plug-ins/common/hot.c
index ef02350933..6c14860702 100644
--- a/plug-ins/common/hot.c
+++ b/plug-ins/common/hot.c
@@ -79,11 +79,11 @@
 
 typedef struct
 {
-  gint32 image;
-  gint32 drawable;
-  gint32 mode;
-  gint32 action;
-  gint32 new_layerp;
+  GimpImage    *image;
+  GimpDrawable *drawable;
+  gint32        mode;
+  gint32        action;
+  gint32        new_layerp;
 } piArgs;
 
 typedef enum
@@ -216,7 +216,7 @@ query (void)
                           "1997",
                           N_("_Hot..."),
                           "RGB",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args), 0,
                           args, NULL);
 
@@ -244,8 +244,8 @@ run (const gchar      *name,
 
   gimp_get_data (PLUG_IN_PROC, &args);
 
-  args.image    = param[1].data.d_image;
-  args.drawable = param[2].data.d_drawable;
+  args.image    = gimp_image_get_by_id (param[1].data.d_image);
+  args.drawable = GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable));
 
   rvals[0].type          = GIMP_PDB_STATUS;
   rvals[0].data.d_status = GIMP_PDB_SUCCESS;
@@ -314,7 +314,7 @@ pluginCore (piArgs *argp)
   gint        src_bpp;
   gint        dest_bpp;
   gboolean    success = TRUE;
-  gint        nl      = 0;
+  GimpLayer  *nl      = NULL;
   gint        y, i;
   gint        Y, I, Q;
   gint        width, height;
@@ -362,8 +362,8 @@ pluginCore (piArgs *argp)
                            100,
                            gimp_image_get_default_new_layer_mode (argp->image));
 
-      gimp_drawable_fill (nl, GIMP_FILL_TRANSPARENT);
-      gimp_image_insert_layer (argp->image, nl, -1, 0);
+      gimp_drawable_fill (GIMP_DRAWABLE (nl), GIMP_FILL_TRANSPARENT);
+      gimp_image_insert_layer (argp->image, nl, NULL, 0);
 
       dest_format = babl_format ("R'G'B'A u8");
     }
@@ -385,7 +385,7 @@ pluginCore (piArgs *argp)
 
   if (argp->new_layerp)
     {
-      dest_buffer = gimp_drawable_get_buffer (nl);
+      dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (nl));
     }
   else
     {
@@ -582,7 +582,7 @@ pluginCore (piArgs *argp)
 
   if (argp->new_layerp)
     {
-      gimp_drawable_update (nl, sel_x1, sel_y1, width, height);
+      gimp_drawable_update (GIMP_DRAWABLE (nl), sel_x1, sel_y1, width, height);
     }
   else
     {
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 993d23ffdc..519323cdd3 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -1,16 +1,16 @@
 %plugins = (
     'align-layers' => { ui => 1 },
-    'animation-optimize' => { gegl => 1, old_api => 1 },
+    'animation-optimize' => { gegl => 1 },
     'animation-play' => { ui => 1, gegl => 1 },
     'blinds' => { ui => 1, gegl => 1 },
     'border-average' => { ui => 1, gegl => 1 },
     'busy-dialog' => { ui => 1, gegl => 1 },
     'checkerboard' => { ui => 1, gegl => 1 },
-    'cml-explorer' => { ui => 1, gegl => 1, old_api => 1 },
+    'cml-explorer' => { ui => 1, gegl => 1 },
     'colormap-remap' => { ui => 1, gegl => 1 },
     'compose' => { ui => 1, gegl => 1 },
     'contrast-retinex' => { ui => 1, gegl => 1 },
-    'crop-zealous' => { gegl => 1, old_api => 1 },
+    'crop-zealous' => { gegl => 1 },
     'curve-bend' => { ui => 1, gegl => 1, old_api => 1 },
     'decompose' => { ui => 1, gegl => 1 },
     'depth-merge' => { ui => 1, gegl => 1, old_api => 1 },
@@ -55,13 +55,13 @@
     'gradient-map' => { gegl => 1 },
     'grid' => { ui => 1, gegl => 1 },
     'guillotine' => { },
-    'hot' => { ui => 1, gegl => 1, old_api => 1 },
+    'hot' => { ui => 1, gegl => 1 },
     'jigsaw' => { ui => 1, gegl => 1 },
     'mail' => { ui => 1, optional => 1 },
     'nl-filter' => { ui => 1, gegl => 1 },
     'plugin-browser' => { ui => 1 },
     'procedure-browser' => { ui => 1 },
-    'qbist' => { ui => 1, gegl => 1, old_api => 1 },
+    'qbist' => { ui => 1, gegl => 1 },
     'sample-colorize' => { ui => 1, gegl => 1 },
     'smooth-palette' => { ui => 1, gegl => 1, old_api => 1 },
     'sparkle' => { ui => 1, gegl => 1 },
diff --git a/plug-ins/common/qbist.c b/plug-ins/common/qbist.c
index 09e0c365ba..fee20cd78e 100644
--- a/plug-ins/common/qbist.c
+++ b/plug-ins/common/qbist.c
@@ -394,7 +394,7 @@ query (void)
                           PLUG_IN_VERSION,
                           N_("_Qbist..."),
                           "RGB*",
-                          GIMP_PLUGIN,
+                          GIMP_PDB_PROC_TYPE_PLUGIN,
                           G_N_ELEMENTS (args), 0,
                           args, NULL);
 
@@ -412,7 +412,7 @@ run (const gchar      *name,
   gint               sel_x1, sel_y1, sel_width, sel_height;
   gint               img_height, img_width;
   GimpRunMode        run_mode;
-  gint32             drawable_id;
+  GimpDrawable      *drawable;
   GimpPDBStatusType  status;
 
   *nreturn_vals = 1;
@@ -430,15 +430,15 @@ run (const gchar      *name,
   if (param[2].type != GIMP_PDB_DRAWABLE)
     status = GIMP_PDB_CALLING_ERROR;
 
-  drawable_id = param[2].data.d_drawable;
+  drawable = GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable));
 
-  img_width = gimp_drawable_width (drawable_id);
-  img_height = gimp_drawable_height (drawable_id);
+  img_width = gimp_drawable_width (drawable);
+  img_height = gimp_drawable_height (drawable);
 
-  if (! gimp_drawable_is_rgb (drawable_id))
+  if (! gimp_drawable_is_rgb (drawable))
     status = GIMP_PDB_CALLING_ERROR;
 
-  if (! gimp_drawable_mask_intersect (drawable_id,
+  if (! gimp_drawable_mask_intersect (drawable,
                                       &sel_x1, &sel_y1,
                                       &sel_width, &sel_height))
     {
@@ -494,7 +494,7 @@ run (const gchar      *name,
           gint                total_pixels = img_width * img_height;
           gint                done_pixels  = 0;
 
-          buffer = gimp_drawable_get_shadow_buffer (drawable_id);
+          buffer = gimp_drawable_get_shadow_buffer (drawable);
 
           iter = gegl_buffer_iterator_new (buffer,
                                            GEGL_RECTANGLE (0, 0,
@@ -535,8 +535,8 @@ run (const gchar      *name,
 
           gimp_progress_update (1.0);
 
-          gimp_drawable_merge_shadow (drawable_id, TRUE);
-          gimp_drawable_update (drawable_id, sel_x1, sel_y1,
+          gimp_drawable_merge_shadow (drawable, TRUE);
+          gimp_drawable_update (drawable, sel_x1, sel_y1,
                                 sel_width, sel_height);
 
           gimp_displays_flush ();


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