[gimp] pdb: deprecate gimp_layer_scale_full() and gimp_image_scale_full()



commit 54001221d75cb6b7b928a86635791da02f42b6cf
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 16 20:33:56 2010 +0200

    pdb: deprecate gimp_layer_scale_full() and gimp_image_scale_full()
    
    Make gimp_layer_scale() and gimp_image_scale() honor GimpPDBContext's
    interpolation property and update the documentation accordingly.

 app/pdb/context-cmds.c       |    2 +-
 app/pdb/image-cmds.c         |   14 ++++++++------
 app/pdb/layer-cmds.c         |   14 ++++++++------
 libgimp/gimpcontext_pdb.c    |    5 +++--
 libgimp/gimpimage_pdb.c      |   12 +++---------
 libgimp/gimpimage_pdb.h      |    2 ++
 libgimp/gimplayer_pdb.c      |   15 ++++++---------
 libgimp/gimplayer_pdb.h      |    2 ++
 tools/pdbgen/pdb/context.pdb |    5 +++--
 tools/pdbgen/pdb/image.pdb   |   23 +++++++++--------------
 tools/pdbgen/pdb/layer.pdb   |   21 +++++++--------------
 11 files changed, 52 insertions(+), 63 deletions(-)
---
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index 7b5ff5c..33c3e79 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -1711,7 +1711,7 @@ register_context_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-context-set-interpolation",
                                      "Set the interpolation type.",
-                                     "This procedure modifies the interpolation setting. It affects all transform procedures which can produce sub-pixel results.",
+                                     "This procedure modifies the interpolation setting. It affects the following procedures: all transform procedures which can produce sub-pixel results, 'gimp-image-scale', 'gimp-layer-scale'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2010",
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 940e21d..8b1b859 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -28,7 +28,6 @@
 #include "pdb-types.h"
 
 #include "base/temp-buf.h"
-#include "config/gimpcoreconfig.h"
 #include "core/gimp.h"
 #include "core/gimpchannel.h"
 #include "core/gimpcontainer.h"
@@ -57,6 +56,7 @@
 #include "gimppdb.h"
 #include "gimppdberror.h"
 #include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
 #include "gimpprocedure.h"
 #include "internal-procs.h"
 
@@ -402,11 +402,13 @@ image_scale_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
+      GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
       if (progress)
         gimp_progress_start (progress, _("Scaling"), FALSE);
 
       gimp_image_scale (image, new_width, new_height,
-                        gimp->config->interpolation_type,
+                        pdb_context->interpolation,
                         progress);
 
       if (progress)
@@ -3204,7 +3206,7 @@ register_image_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-scale",
                                      "Scale the image using the default interpolation method.",
-                                     "This procedure scales the image so that its new width and height are equal to the supplied parameters. All layers and channels within the image are scaled according to the specified parameters; this includes the image selection mask. The default interpolation method is used.",
+                                     "This procedure scales the image so that its new width and height are equal to the supplied parameters. All layers and channels within the image are scaled according to the specified parameters; this includes the image selection mask. The interpolation method used can be set with 'gimp-context-set-interpolation'.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -3238,12 +3240,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-scale-full");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-scale-full",
-                                     "Scale the image using a specific interpolation method.",
-                                     "This procedure scales the image so that its new width and height are equal to the supplied parameters. All layers and channels within the image are scaled according to the specified parameters; this includes the image selection mask. This procedure allows you to specify the interpolation method explicitly.",
+                                     "Deprecated: Use 'gimp-image-scale' instead.",
+                                     "Deprecated: Use 'gimp-image-scale' instead.",
                                      "Sven Neumann <sven gimp org>",
                                      "Sven Neumann",
                                      "2008",
-                                     NULL);
+                                     "gimp-image-scale");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index 6ba8d7f..1f88381 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -25,7 +25,6 @@
 
 #include "pdb-types.h"
 
-#include "config/gimpcoreconfig.h"
 #include "core/gimp.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpimage-undo.h"
@@ -39,6 +38,7 @@
 
 #include "gimppdb.h"
 #include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
 #include "gimpprocedure.h"
 #include "internal-procs.h"
 
@@ -326,11 +326,13 @@ layer_scale_invoker (GimpProcedure      *procedure,
     {
       if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
         {
+          GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
           if (progress)
             gimp_progress_start (progress, _("Scaling"), FALSE);
 
           gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
-                                     gimp->config->interpolation_type, progress,
+                                     pdb_context->interpolation, progress,
                                      local_origin);
 
           if (progress)
@@ -1328,7 +1330,7 @@ register_layer_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-layer-scale",
                                      "Scale the layer using the default interpolation method.",
-                                     "This procedure scales the layer so that its new width and height are equal to the supplied parameters. The 'local-origin' parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image. The default interpolation method is used for scaling.",
+                                     "This procedure scales the layer so that its new width and height are equal to the supplied parameters. The 'local-origin' parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image. The interpolation method used can be set with 'gimp-context-set-interpolation'.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -1368,12 +1370,12 @@ register_layer_procs (GimpPDB *pdb)
                                "gimp-layer-scale-full");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-layer-scale-full",
-                                     "Scale the layer using a specific interpolation method.",
-                                     "This procedure scales the layer so that its new width and height are equal to the supplied parameters. The 'local-origin' parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image. This procedure allows you to specify the interpolation method explicitly.",
+                                     "Deprecated: Use 'gimp-layer-scale' instead.",
+                                     "Deprecated: Use 'gimp-layer-scale' instead.",
                                      "Sven Neumann <sven gimp org>",
                                      "Sven Neumann",
                                      "2008",
-                                     NULL);
+                                     "gimp-layer-scale");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_layer_id ("layer",
                                                          "layer",
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index a057614..7b358ca 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -1104,8 +1104,9 @@ gimp_context_get_interpolation (void)
  *
  * Set the interpolation type.
  *
- * This procedure modifies the interpolation setting. It affects all
- * transform procedures which can produce sub-pixel results.
+ * This procedure modifies the interpolation setting. It affects the
+ * following procedures: all transform procedures which can produce
+ * sub-pixel results, gimp_image_scale(), gimp_layer_scale().
  *
  * Returns: TRUE on success.
  *
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index c0dd7ec..7f0f94e 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -428,8 +428,8 @@ gimp_image_resize_to_layers (gint32 image_ID)
  * This procedure scales the image so that its new width and height are
  * equal to the supplied parameters. All layers and channels within the
  * image are scaled according to the specified parameters; this
- * includes the image selection mask. The default interpolation method
- * is used.
+ * includes the image selection mask. The interpolation method used can
+ * be set with gimp_context_set_interpolation().
  *
  * Returns: TRUE on success.
  **/
@@ -463,13 +463,7 @@ gimp_image_scale (gint32 image_ID,
  * @new_height: New image height.
  * @interpolation: Type of interpolation.
  *
- * Scale the image using a specific interpolation method.
- *
- * This procedure scales the image so that its new width and height are
- * equal to the supplied parameters. All layers and channels within the
- * image are scaled according to the specified parameters; this
- * includes the image selection mask. This procedure allows you to
- * specify the interpolation method explicitly.
+ * Deprecated: Use gimp_image_scale() instead.
  *
  * Returns: TRUE on success.
  *
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index 0469ff5..88472f9 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -50,10 +50,12 @@ gboolean                 gimp_image_resize_to_layers         (gint32
 gboolean                 gimp_image_scale                    (gint32                  image_ID,
                                                               gint                    new_width,
                                                               gint                    new_height);
+#ifndef GIMP_DISABLE_DEPRECATED
 gboolean                 gimp_image_scale_full               (gint32                  image_ID,
                                                               gint                    new_width,
                                                               gint                    new_height,
                                                               GimpInterpolationType   interpolation);
+#endif /* GIMP_DISABLE_DEPRECATED */
 gboolean                 gimp_image_crop                     (gint32                  image_ID,
                                                               gint                    new_width,
                                                               gint                    new_height,
diff --git a/libgimp/gimplayer_pdb.c b/libgimp/gimplayer_pdb.c
index 0f29df3..d8e4702 100644
--- a/libgimp/gimplayer_pdb.c
+++ b/libgimp/gimplayer_pdb.c
@@ -23,6 +23,9 @@
 #include "config.h"
 
 #include "gimp.h"
+#undef GIMP_DISABLE_DEPRECATED
+#undef __GIMP_LAYER_PDB_H__
+#include "gimplayer_pdb.h"
 
 
 /**
@@ -319,7 +322,8 @@ gimp_layer_flatten (gint32 layer_ID)
  * equal to the supplied parameters. The 'local-origin' parameter
  * specifies whether to scale from the center of the layer, or from the
  * image origin. This operation only works if the layer has been added
- * to an image. The default interpolation method is used for scaling.
+ * to an image. The interpolation method used can be set with
+ * gimp_context_set_interpolation().
  *
  * Returns: TRUE on success.
  **/
@@ -356,14 +360,7 @@ gimp_layer_scale (gint32   layer_ID,
  * @local_origin: Use a local origin (as opposed to the image origin).
  * @interpolation: Type of interpolation.
  *
- * Scale the layer using a specific interpolation method.
- *
- * This procedure scales the layer so that its new width and height are
- * equal to the supplied parameters. The 'local-origin' parameter
- * specifies whether to scale from the center of the layer, or from the
- * image origin. This operation only works if the layer has been added
- * to an image. This procedure allows you to specify the interpolation
- * method explicitly.
+ * Deprecated: Use gimp_layer_scale() instead.
  *
  * Returns: TRUE on success.
  *
diff --git a/libgimp/gimplayer_pdb.h b/libgimp/gimplayer_pdb.h
index 80dc102..9d77ab8 100644
--- a/libgimp/gimplayer_pdb.h
+++ b/libgimp/gimplayer_pdb.h
@@ -49,11 +49,13 @@ gboolean               gimp_layer_scale                (gint32                 l
                                                         gint                   new_width,
                                                         gint                   new_height,
                                                         gboolean               local_origin);
+#ifndef GIMP_DISABLE_DEPRECATED
 gboolean               gimp_layer_scale_full           (gint32                 layer_ID,
                                                         gint                   new_width,
                                                         gint                   new_height,
                                                         gboolean               local_origin,
                                                         GimpInterpolationType  interpolation);
+#endif /* GIMP_DISABLE_DEPRECATED */
 gboolean               gimp_layer_resize               (gint32                 layer_ID,
                                                         gint                   new_width,
                                                         gint                   new_height,
diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb
index d3c3fbc..c017643 100644
--- a/tools/pdbgen/pdb/context.pdb
+++ b/tools/pdbgen/pdb/context.pdb
@@ -895,8 +895,9 @@ sub context_set_interpolation {
     $blurb = 'Set the interpolation type.';
 
     $help = <<'HELP';
-This procedure modifies the interpolation setting. It affects all
-transform procedures which can produce sub-pixel results.
+This procedure modifies the interpolation setting. It affects the
+following procedures: all transform procedures which can produce
+sub-pixel results, gimp_image_scale(), gimp_layer_scale().
 HELP
 
     &mitch_pdb_misc('2010', '2.8');
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index 57d03ca..5e83d3d 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -261,7 +261,8 @@ sub image_scale {
 This procedure scales the image so that its new width and height are
 equal to the supplied parameters. All layers and channels within the
 image are scaled according to the specified parameters; this includes
-the image selection mask. The default interpolation method is used.
+the image selection mask. The interpolation method used can be set
+with gimp_context_set_interpolation().
 HELP
 
     &std_pdb_misc;
@@ -276,14 +277,16 @@ HELP
     );
 
     %invoke = (
-	headers => [ qw("config/gimpcoreconfig.h" "core/gimpimage-scale.h") ],
+	headers => [ qw("core/gimpimage-scale.h") ],
 	code => <<'CODE'
 {
+  GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
   if (progress)
     gimp_progress_start (progress, _("Scaling"), FALSE);
 
   gimp_image_scale (image, new_width, new_height,
-                    gimp->config->interpolation_type,
+                    pdb_context->interpolation,
                     progress);
 
   if (progress)
@@ -294,16 +297,7 @@ CODE
 }
 
 sub image_scale_full {
-    $blurb = 'Scale the image using a specific interpolation method.';
-
-    $help = <<'HELP';
-This procedure scales the image so that its new width and height are
-equal to the supplied parameters. All layers and channels within the
-image are scaled according to the specified parameters; this includes
-the image selection mask. This procedure allows you to specify the
-interpolation method explicitly.
-HELP
-
+    &std_pdb_deprecated('gimp-image-scale');
     &neo_pdb_misc('2008', '2.6');
 
     @inargs = (
@@ -318,7 +312,7 @@ HELP
     );
 
     %invoke = (
-	headers => [ qw("config/gimpcoreconfig.h" "core/gimpimage-scale.h") ],
+	headers => [ qw("core/gimpimage-scale.h") ],
 	code => <<'CODE'
 {
   if (progress)
@@ -2912,6 +2906,7 @@ CODE
               "core/gimpcontainer.h"
               "core/gimpprogress.h"
               "core/gimpunit.h"
+              "gimppdbcontext.h"
               "gimppdberror.h"
               "gimppdb-utils.h"
               "gimp-intl.h");
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index 0d32a73..4118d99 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -362,7 +362,8 @@ This procedure scales the layer so that its new width and height are
 equal to the supplied parameters. The 'local-origin' parameter
 specifies whether to scale from the center of the layer, or from the
 image origin. This operation only works if the layer has been added to
-an image. The default interpolation method is used for scaling.
+an image. The interpolation method used can be set with
+gimp_context_set_interpolation().
 HELP
 
     &std_pdb_misc;
@@ -383,11 +384,13 @@ HELP
 {
   if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
     {
+      GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
       if (progress)
         gimp_progress_start (progress, _("Scaling"), FALSE);
 
       gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
-                                 gimp->config->interpolation_type, progress,
+                                 pdb_context->interpolation, progress,
                                  local_origin);
 
       if (progress)
@@ -403,17 +406,7 @@ CODE
 }
 
 sub layer_scale_full {
-    $blurb = 'Scale the layer using a specific interpolation method.';
-
-    $help = <<'HELP';
-This procedure scales the layer so that its new width and height are
-equal to the supplied parameters. The 'local-origin' parameter
-specifies whether to scale from the center of the layer, or from the
-image origin. This operation only works if the layer has been added to
-an image. This procedure allows you to specify the interpolation
-method explicitly.
-HELP
-
+    &std_pdb_deprecated('gimp-layer-scale');
     &neo_pdb_misc('2008', '2.6');
 
     @inargs = (
@@ -1105,12 +1098,12 @@ CODE
 }
 
 @headers = qw("libgimpbase/gimpbase.h"
-              "config/gimpcoreconfig.h"
               "core/gimp.h"
               "core/gimpimage-undo.h"
               "core/gimpitem-linked.h"
               "core/gimppickable.h"
               "core/gimpprogress.h"
+              "gimppdbcontext.h"
               "gimppdb-utils.h"
               "gimp-intl.h");
 



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