[gimp] pdb, app, libgimp: move the image transform procedures to their own PDB group
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb, app, libgimp: move the image transform procedures to their own PDB group
- Date: Sat, 30 May 2015 21:58:18 +0000 (UTC)
commit 4ef3c918a0d7b630dec3451a00dbb4f72958efff
Author: Michael Natterer <mitch gimp org>
Date: Sat May 30 23:55:58 2015 +0200
pdb, app, libgimp: move the image transform procedures to their own PDB group
because image.pdb is way too large.
app/pdb/Makefile.am | 1 +
app/pdb/image-cmds.c | 476 -------------------------------
app/pdb/image-transform-cmds.c | 522 ++++++++++++++++++++++++++++++++++
app/pdb/internal-procs.c | 1 +
app/pdb/internal-procs.h | 1 +
libgimp/Makefile.am | 2 +
libgimp/gimp_pdb_headers.h | 1 +
libgimp/gimpimage_pdb.c | 268 -----------------
libgimp/gimpimage_pdb.h | 347 +++++++++++------------
libgimp/gimpimagetransform_pdb.c | 303 ++++++++++++++++++++
libgimp/gimpimagetransform_pdb.h | 62 ++++
po/POTFILES.in | 1 +
tools/pdbgen/Makefile.am | 1 +
tools/pdbgen/groups.pl | 1 +
tools/pdbgen/pdb/image.pdb | 247 +----------------
tools/pdbgen/pdb/image_transform.pdb | 276 ++++++++++++++++++
16 files changed, 1335 insertions(+), 1175 deletions(-)
---
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
index 537144e..d69fe5b 100644
--- a/app/pdb/Makefile.am
+++ b/app/pdb/Makefile.am
@@ -61,6 +61,7 @@ libappinternal_procs_a_SOURCES = \
image-convert-cmds.c \
image-grid-cmds.c \
image-guides-cmds.c \
+ image-transform-cmds.c \
image-select-cmds.c \
image-undo-cmds.c \
item-cmds.c \
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 1633473..707fe91 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -38,16 +38,11 @@
#include "core/gimpcontainer.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage-colormap.h"
-#include "core/gimpimage-crop.h"
#include "core/gimpimage-duplicate.h"
-#include "core/gimpimage-flip.h"
#include "core/gimpimage-merge.h"
#include "core/gimpimage-metadata.h"
#include "core/gimpimage-pick-color.h"
#include "core/gimpimage-pick-layer.h"
-#include "core/gimpimage-resize.h"
-#include "core/gimpimage-rotate.h"
-#include "core/gimpimage-scale.h"
#include "core/gimpimage.h"
#include "core/gimpitem.h"
#include "core/gimplayer.h"
@@ -414,221 +409,6 @@ image_free_shadow_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
-image_resize_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpImage *image;
- gint32 new_width;
- gint32 new_height;
- gint32 offx;
- gint32 offy;
-
- image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
- new_width = g_value_get_int (gimp_value_array_index (args, 1));
- new_height = g_value_get_int (gimp_value_array_index (args, 2));
- offx = g_value_get_int (gimp_value_array_index (args, 3));
- offy = g_value_get_int (gimp_value_array_index (args, 4));
-
- if (success)
- {
- gimp_image_resize (image, context,
- new_width, new_height, offx, offy, NULL);
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
-image_resize_to_layers_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpImage *image;
-
- image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
-
- if (success)
- {
- gimp_image_resize_to_layers (image, context, NULL);
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
-image_scale_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpImage *image;
- gint32 new_width;
- gint32 new_height;
-
- image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
- new_width = g_value_get_int (gimp_value_array_index (args, 1));
- new_height = g_value_get_int (gimp_value_array_index (args, 2));
-
- if (success)
- {
- GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
-
- if (progress)
- gimp_progress_start (progress, FALSE, _("Scaling"));
-
- gimp_image_scale (image, new_width, new_height,
- pdb_context->interpolation,
- progress);
-
- if (progress)
- gimp_progress_end (progress);
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
-image_scale_full_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpImage *image;
- gint32 new_width;
- gint32 new_height;
- gint32 interpolation;
-
- image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
- new_width = g_value_get_int (gimp_value_array_index (args, 1));
- new_height = g_value_get_int (gimp_value_array_index (args, 2));
- interpolation = g_value_get_enum (gimp_value_array_index (args, 3));
-
- if (success)
- {
- if (progress)
- gimp_progress_start (progress, FALSE, _("Scaling"));
-
- gimp_image_scale (image, new_width, new_height, interpolation, progress);
-
- if (progress)
- gimp_progress_end (progress);
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
-image_crop_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpImage *image;
- gint32 new_width;
- gint32 new_height;
- gint32 offx;
- gint32 offy;
-
- image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
- new_width = g_value_get_int (gimp_value_array_index (args, 1));
- new_height = g_value_get_int (gimp_value_array_index (args, 2));
- offx = g_value_get_int (gimp_value_array_index (args, 3));
- offy = g_value_get_int (gimp_value_array_index (args, 4));
-
- if (success)
- {
- if (new_width > gimp_image_get_width (image) ||
- new_height > gimp_image_get_height (image) ||
- offx > (gimp_image_get_width (image) - new_width) ||
- offy > (gimp_image_get_height (image) - new_height))
- success = FALSE;
- else
- gimp_image_crop (image, context,
- offx, offy, offx + new_width, offy + new_height,
- TRUE);
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
-image_flip_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpImage *image;
- gint32 flip_type;
-
- image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
- flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
-
- if (success)
- {
- gimp_image_flip (image, context, flip_type, NULL);
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
-image_rotate_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpImage *image;
- gint32 rotate_type;
-
- image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
- rotate_type = g_value_get_enum (gimp_value_array_index (args, 1));
-
- if (success)
- {
- if (progress)
- gimp_progress_start (progress, FALSE, _("Rotating"));
-
- gimp_image_rotate (image, context, rotate_type, progress);
-
- if (progress)
- gimp_progress_end (progress);
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
image_get_layers_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -3290,262 +3070,6 @@ register_image_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
- * gimp-image-resize
- */
- procedure = gimp_procedure_new (image_resize_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-image-resize");
- gimp_procedure_set_static_strings (procedure,
- "gimp-image-resize",
- "Resize the image to the specified extents.",
- "This procedure resizes the image so that it's new width and height are
equal to the supplied parameters. Offsets are also provided which describe the position of the previous
image's content. All channels within the image are resized according to the specified parameters; this
includes the image selection mask. All layers within the image are repositioned according to the specified
offsets.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_image_id ("image",
- "image",
- "The image",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-width",
- "new width",
- "New image width",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-height",
- "new height",
- "New image height",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("offx",
- "offx",
- "x offset between upper left corner of old and new
images: (new - old)",
- G_MININT32, G_MAXINT32, 0,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("offy",
- "offy",
- "y offset between upper left corner of old and new
images: (new - old)",
- G_MININT32, G_MAXINT32, 0,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
- * gimp-image-resize-to-layers
- */
- procedure = gimp_procedure_new (image_resize_to_layers_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-image-resize-to-layers");
- gimp_procedure_set_static_strings (procedure,
- "gimp-image-resize-to-layers",
- "Resize the image to fit all layers.",
- "This procedure resizes the image to the bounding box of all layers of
the image. All channels within the image are resized to the new size; this includes the image selection mask.
All layers within the image are repositioned to the new image area.",
- "Simon Budig",
- "Simon Budig",
- "2004",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_image_id ("image",
- "image",
- "The image",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
- * gimp-image-scale
- */
- procedure = gimp_procedure_new (image_scale_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-image-scale");
- 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 interpolation method used can be set with
'gimp-context-set-interpolation'.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_image_id ("image",
- "image",
- "The image",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-width",
- "new width",
- "New image width",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-height",
- "new height",
- "New image height",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
- * gimp-image-scale-full
- */
- procedure = gimp_procedure_new (image_scale_full_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-image-scale-full");
- gimp_procedure_set_static_strings (procedure,
- "gimp-image-scale-full",
- "Deprecated: Use 'gimp-image-scale' instead.",
- "Deprecated: Use 'gimp-image-scale' instead.",
- "Sven Neumann <sven gimp org>",
- "Sven Neumann",
- "2008",
- "gimp-image-scale");
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_image_id ("image",
- "image",
- "The image",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-width",
- "new width",
- "New image width",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-height",
- "new height",
- "New image height",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- g_param_spec_enum ("interpolation",
- "interpolation",
- "Type of interpolation",
- GIMP_TYPE_INTERPOLATION_TYPE,
- GIMP_INTERPOLATION_NONE,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
- * gimp-image-crop
- */
- procedure = gimp_procedure_new (image_crop_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-image-crop");
- gimp_procedure_set_static_strings (procedure,
- "gimp-image-crop",
- "Crop the image to the specified extents.",
- "This procedure crops the image so that it's new width and height are
equal to the supplied parameters. Offsets are also provided which describe the position of the previous
image's content. All channels and layers within the image are cropped to the new image extents; this includes
the image selection mask. If any parameters are out of range, an error is returned.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_image_id ("image",
- "image",
- "The image",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-width",
- "new width",
- "New image width: (0 < new_width <= width)",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("new-height",
- "new height",
- "New image height: (0 < new_height <= height)",
- 1, GIMP_MAX_IMAGE_SIZE, 1,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("offx",
- "offx",
- "X offset: (0 <= offx <= (width - new_width))",
- 0, G_MAXINT32, 0,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_int32 ("offy",
- "offy",
- "Y offset: (0 <= offy <= (height - new_height))",
- 0, G_MAXINT32, 0,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
- * gimp-image-flip
- */
- procedure = gimp_procedure_new (image_flip_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-image-flip");
- gimp_procedure_set_static_strings (procedure,
- "gimp-image-flip",
- "Flips the image horizontally or vertically.",
- "This procedure flips (mirrors) the image.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_image_id ("image",
- "image",
- "The image",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_enum ("flip-type",
- "flip type",
- "Type of flip",
- GIMP_TYPE_ORIENTATION_TYPE,
- GIMP_ORIENTATION_HORIZONTAL,
- GIMP_PARAM_READWRITE));
- gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
- GIMP_ORIENTATION_UNKNOWN);
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
- * gimp-image-rotate
- */
- procedure = gimp_procedure_new (image_rotate_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-image-rotate");
- gimp_procedure_set_static_strings (procedure,
- "gimp-image-rotate",
- "Rotates the image by the specified degrees.",
- "This procedure rotates the image.",
- "Michael Natterer <mitch gimp org>",
- "Michael Natterer",
- "2003",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_image_id ("image",
- "image",
- "The image",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- g_param_spec_enum ("rotate-type",
- "rotate type",
- "Angle of rotation",
- GIMP_TYPE_ROTATION_TYPE,
- GIMP_ROTATE_90,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
* gimp-image-get-layers
*/
procedure = gimp_procedure_new (image_get_layers_invoker);
diff --git a/app/pdb/image-transform-cmds.c b/app/pdb/image-transform-cmds.c
new file mode 100644
index 0000000..50e8913
--- /dev/null
+++ b/app/pdb/image-transform-cmds.c
@@ -0,0 +1,522 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage-crop.h"
+#include "core/gimpimage-flip.h"
+#include "core/gimpimage-resize.h"
+#include "core/gimpimage-rotate.h"
+#include "core/gimpimage-scale.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+
+#include "gimppdb.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_resize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 offx;
+ gint32 offy;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ offx = g_value_get_int (gimp_value_array_index (args, 3));
+ offy = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gimp_image_resize (image, context,
+ new_width, new_height, offx, offy, NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_resize_to_layers_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_image_resize_to_layers (image, context, NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_scale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_image_scale (image, new_width, new_height,
+ pdb_context->interpolation,
+ progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_scale_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 interpolation;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_image_scale (image, new_width, new_height, interpolation, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_crop_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 offx;
+ gint32 offy;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ offx = g_value_get_int (gimp_value_array_index (args, 3));
+ offy = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (new_width > gimp_image_get_width (image) ||
+ new_height > gimp_image_get_height (image) ||
+ offx > (gimp_image_get_width (image) - new_width) ||
+ offy > (gimp_image_get_height (image) - new_height))
+ success = FALSE;
+ else
+ gimp_image_crop (image, context,
+ offx, offy, offx + new_width, offy + new_height,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_flip_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 flip_type;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_image_flip (image, context, flip_type, NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 rotate_type;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ rotate_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Rotating"));
+
+ gimp_image_rotate (image, context, rotate_type, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_image_transform_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-resize
+ */
+ procedure = gimp_procedure_new (image_resize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-resize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-resize",
+ "Resize the image to the specified extents.",
+ "This procedure resizes the image so that it's new width and height are
equal to the supplied parameters. Offsets are also provided which describe the position of the previous
image's content. All channels within the image are resized according to the specified parameters; this
includes the image selection mask. All layers within the image are repositioned according to the specified
offsets.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "x offset between upper left corner of old and new
images: (new - old)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "y offset between upper left corner of old and new
images: (new - old)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-resize-to-layers
+ */
+ procedure = gimp_procedure_new (image_resize_to_layers_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-resize-to-layers");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-resize-to-layers",
+ "Resize the image to fit all layers.",
+ "This procedure resizes the image to the bounding box of all layers of
the image. All channels within the image are resized to the new size; this includes the image selection mask.
All layers within the image are repositioned to the new image area.",
+ "Simon Budig",
+ "Simon Budig",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-scale
+ */
+ procedure = gimp_procedure_new (image_scale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-scale");
+ 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 interpolation method used can be set with
'gimp-context-set-interpolation'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-scale-full
+ */
+ procedure = gimp_procedure_new (image_scale_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-scale-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-scale-full",
+ "Deprecated: Use 'gimp-image-scale' instead.",
+ "Deprecated: Use 'gimp-image-scale' instead.",
+ "Sven Neumann <sven gimp org>",
+ "Sven Neumann",
+ "2008",
+ "gimp-image-scale");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-crop
+ */
+ procedure = gimp_procedure_new (image_crop_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-crop");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-crop",
+ "Crop the image to the specified extents.",
+ "This procedure crops the image so that it's new width and height are
equal to the supplied parameters. Offsets are also provided which describe the position of the previous
image's content. All channels and layers within the image are cropped to the new image extents; this includes
the image selection mask. If any parameters are out of range, an error is returned.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width: (0 < new_width <= width)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height: (0 < new_height <= height)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "X offset: (0 <= offx <= (width - new_width))",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "Y offset: (0 <= offy <= (height - new_height))",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-flip
+ */
+ procedure = gimp_procedure_new (image_flip_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-flip");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-flip",
+ "Flips the image horizontally or vertically.",
+ "This procedure flips (mirrors) the image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("flip-type",
+ "flip type",
+ "Type of flip",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-rotate
+ */
+ procedure = gimp_procedure_new (image_rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-rotate",
+ "Rotates the image by the specified degrees.",
+ "This procedure rotates the image.",
+ "Michael Natterer <mitch gimp org>",
+ "Michael Natterer",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("rotate-type",
+ "rotate type",
+ "Angle of rotation",
+ GIMP_TYPE_ROTATION_TYPE,
+ GIMP_ROTATE_90,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 6dad10a..d63b1da 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -63,6 +63,7 @@ internal_procs_init (GimpPDB *pdb)
register_image_grid_procs (pdb);
register_image_guides_procs (pdb);
register_image_select_procs (pdb);
+ register_image_transform_procs (pdb);
register_image_undo_procs (pdb);
register_item_procs (pdb);
register_item_transform_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index caf25e1..fc1f147 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -52,6 +52,7 @@ void register_image_convert_procs (GimpPDB *pdb);
void register_image_grid_procs (GimpPDB *pdb);
void register_image_guides_procs (GimpPDB *pdb);
void register_image_select_procs (GimpPDB *pdb);
+void register_image_transform_procs (GimpPDB *pdb);
void register_image_undo_procs (GimpPDB *pdb);
void register_item_procs (GimpPDB *pdb);
void register_item_transform_procs (GimpPDB *pdb);
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index a764cff..c69adf3 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -103,6 +103,7 @@ PDB_WRAPPERS_C = \
gimpimagegrid_pdb.c \
gimpimageguides_pdb.c \
gimpimageselect_pdb.c \
+ gimpimagetransform_pdb.c \
gimpimageundo_pdb.c \
gimpitem_pdb.c \
gimpitemtransform_pdb.c \
@@ -157,6 +158,7 @@ PDB_WRAPPERS_H = \
gimpimagegrid_pdb.h \
gimpimageguides_pdb.h \
gimpimageselect_pdb.h \
+ gimpimagetransform_pdb.h \
gimpimageundo_pdb.h \
gimpitem_pdb.h \
gimpitemtransform_pdb.h \
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index 37c4ca0..a0de235 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -55,6 +55,7 @@
#include <libgimp/gimpimagegrid_pdb.h>
#include <libgimp/gimpimageguides_pdb.h>
#include <libgimp/gimpimageselect_pdb.h>
+#include <libgimp/gimpimagetransform_pdb.h>
#include <libgimp/gimpimageundo_pdb.h>
#include <libgimp/gimpitem_pdb.h>
#include <libgimp/gimpitemtransform_pdb.h>
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 638f65a..4daa852 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -416,274 +416,6 @@ gimp_image_free_shadow (gint32 image_ID)
}
/**
- * gimp_image_resize:
- * @image_ID: The image.
- * @new_width: New image width.
- * @new_height: New image height.
- * @offx: x offset between upper left corner of old and new images: (new - old).
- * @offy: y offset between upper left corner of old and new images: (new - old).
- *
- * Resize the image to the specified extents.
- *
- * This procedure resizes the image so that it's new width and height
- * are equal to the supplied parameters. Offsets are also provided
- * which describe the position of the previous image's content. All
- * channels within the image are resized according to the specified
- * parameters; this includes the image selection mask. All layers
- * within the image are repositioned according to the specified
- * offsets.
- *
- * Returns: TRUE on success.
- **/
-gboolean
-gimp_image_resize (gint32 image_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-image-resize",
- &nreturn_vals,
- GIMP_PDB_IMAGE, image_ID,
- GIMP_PDB_INT32, new_width,
- GIMP_PDB_INT32, new_height,
- GIMP_PDB_INT32, offx,
- GIMP_PDB_INT32, offy,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
- * gimp_image_resize_to_layers:
- * @image_ID: The image.
- *
- * Resize the image to fit all layers.
- *
- * This procedure resizes the image to the bounding box of all layers
- * of the image. All channels within the image are resized to the new
- * size; this includes the image selection mask. All layers within the
- * image are repositioned to the new image area.
- *
- * Returns: TRUE on success.
- *
- * Since: GIMP 2.2
- **/
-gboolean
-gimp_image_resize_to_layers (gint32 image_ID)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-image-resize-to-layers",
- &nreturn_vals,
- GIMP_PDB_IMAGE, image_ID,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
- * gimp_image_scale:
- * @image_ID: The image.
- * @new_width: New image width.
- * @new_height: New image height.
- *
- * 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 interpolation method used can
- * be set with gimp_context_set_interpolation().
- *
- * Returns: TRUE on success.
- **/
-gboolean
-gimp_image_scale (gint32 image_ID,
- gint new_width,
- gint new_height)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-image-scale",
- &nreturn_vals,
- GIMP_PDB_IMAGE, image_ID,
- GIMP_PDB_INT32, new_width,
- GIMP_PDB_INT32, new_height,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
- * gimp_image_scale_full:
- * @image_ID: The image.
- * @new_width: New image width.
- * @new_height: New image height.
- * @interpolation: Type of interpolation.
- *
- * Deprecated: Use gimp_image_scale() instead.
- *
- * Returns: TRUE on success.
- *
- * Since: GIMP 2.6
- **/
-gboolean
-gimp_image_scale_full (gint32 image_ID,
- gint new_width,
- gint new_height,
- GimpInterpolationType interpolation)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-image-scale-full",
- &nreturn_vals,
- GIMP_PDB_IMAGE, image_ID,
- GIMP_PDB_INT32, new_width,
- GIMP_PDB_INT32, new_height,
- GIMP_PDB_INT32, interpolation,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
- * gimp_image_crop:
- * @image_ID: The image.
- * @new_width: New image width: (0 < new_width <= width).
- * @new_height: New image height: (0 < new_height <= height).
- * @offx: X offset: (0 <= offx <= (width - new_width)).
- * @offy: Y offset: (0 <= offy <= (height - new_height)).
- *
- * Crop the image to the specified extents.
- *
- * This procedure crops the image so that it's new width and height are
- * equal to the supplied parameters. Offsets are also provided which
- * describe the position of the previous image's content. All channels
- * and layers within the image are cropped to the new image extents;
- * this includes the image selection mask. If any parameters are out of
- * range, an error is returned.
- *
- * Returns: TRUE on success.
- **/
-gboolean
-gimp_image_crop (gint32 image_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-image-crop",
- &nreturn_vals,
- GIMP_PDB_IMAGE, image_ID,
- GIMP_PDB_INT32, new_width,
- GIMP_PDB_INT32, new_height,
- GIMP_PDB_INT32, offx,
- GIMP_PDB_INT32, offy,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
- * gimp_image_flip:
- * @image_ID: The image.
- * @flip_type: Type of flip.
- *
- * Flips the image horizontally or vertically.
- *
- * This procedure flips (mirrors) the image.
- *
- * Returns: TRUE on success.
- **/
-gboolean
-gimp_image_flip (gint32 image_ID,
- GimpOrientationType flip_type)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-image-flip",
- &nreturn_vals,
- GIMP_PDB_IMAGE, image_ID,
- GIMP_PDB_INT32, flip_type,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
- * gimp_image_rotate:
- * @image_ID: The image.
- * @rotate_type: Angle of rotation.
- *
- * Rotates the image by the specified degrees.
- *
- * This procedure rotates the image.
- *
- * Returns: TRUE on success.
- **/
-gboolean
-gimp_image_rotate (gint32 image_ID,
- GimpRotationType rotate_type)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-image-rotate",
- &nreturn_vals,
- GIMP_PDB_IMAGE, image_ID,
- GIMP_PDB_INT32, rotate_type,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
* gimp_image_get_layers:
* @image_ID: The image.
* @num_layers: The number of layers contained in the image.
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index e5a2466..22f321c 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -32,195 +32,172 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_is_valid (gint32 image_ID);
-gint* gimp_image_list (gint *num_images);
-gint32 gimp_image_new (gint width,
- gint height,
- GimpImageBaseType type);
-gint32 gimp_image_new_with_precision (gint width,
- gint height,
- GimpImageBaseType type,
- GimpPrecision precision);
-gint32 gimp_image_duplicate (gint32 image_ID);
-gboolean gimp_image_delete (gint32 image_ID);
-GimpImageBaseType gimp_image_base_type (gint32 image_ID);
-GimpPrecision gimp_image_get_precision (gint32 image_ID);
-gint gimp_image_width (gint32 image_ID);
-gint gimp_image_height (gint32 image_ID);
+gboolean gimp_image_is_valid (gint32 image_ID);
+gint* gimp_image_list (gint *num_images);
+gint32 gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type);
+gint32 gimp_image_new_with_precision (gint width,
+ gint height,
+ GimpImageBaseType type,
+ GimpPrecision precision);
+gint32 gimp_image_duplicate (gint32 image_ID);
+gboolean gimp_image_delete (gint32 image_ID);
+GimpImageBaseType gimp_image_base_type (gint32 image_ID);
+GimpPrecision gimp_image_get_precision (gint32 image_ID);
+gint gimp_image_width (gint32 image_ID);
+gint gimp_image_height (gint32 image_ID);
GIMP_DEPRECATED_FOR(gimp_drawable_free_shadow)
-gboolean gimp_image_free_shadow (gint32 image_ID);
-gboolean gimp_image_resize (gint32 image_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy);
-gboolean gimp_image_resize_to_layers (gint32 image_ID);
-gboolean gimp_image_scale (gint32 image_ID,
- gint new_width,
- gint new_height);
-GIMP_DEPRECATED_FOR(gimp_image_scale)
-gboolean gimp_image_scale_full (gint32 image_ID,
- gint new_width,
- gint new_height,
- GimpInterpolationType interpolation);
-gboolean gimp_image_crop (gint32 image_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy);
-gboolean gimp_image_flip (gint32 image_ID,
- GimpOrientationType flip_type);
-gboolean gimp_image_rotate (gint32 image_ID,
- GimpRotationType rotate_type);
-gint* gimp_image_get_layers (gint32 image_ID,
- gint *num_layers);
-gint* gimp_image_get_channels (gint32 image_ID,
- gint *num_channels);
-gint* gimp_image_get_vectors (gint32 image_ID,
- gint *num_vectors);
-gint32 gimp_image_get_active_drawable (gint32 image_ID);
-gboolean gimp_image_unset_active_channel (gint32 image_ID);
-gint32 gimp_image_get_floating_sel (gint32 image_ID);
-gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
-gboolean gimp_image_pick_color (gint32 image_ID,
- gint32 drawable_ID,
- gdouble x,
- gdouble y,
- gboolean sample_merged,
- gboolean sample_average,
- gdouble average_radius,
- GimpRGB *color);
-gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
- gint x,
- gint y);
+gboolean gimp_image_free_shadow (gint32 image_ID);
+gint* gimp_image_get_layers (gint32 image_ID,
+ gint *num_layers);
+gint* gimp_image_get_channels (gint32 image_ID,
+ gint *num_channels);
+gint* gimp_image_get_vectors (gint32 image_ID,
+ gint *num_vectors);
+gint32 gimp_image_get_active_drawable (gint32 image_ID);
+gboolean gimp_image_unset_active_channel (gint32 image_ID);
+gint32 gimp_image_get_floating_sel (gint32 image_ID);
+gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
+gboolean gimp_image_pick_color (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean sample_average,
+ gdouble average_radius,
+ GimpRGB *color);
+gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
+ gint x,
+ gint y);
GIMP_DEPRECATED_FOR(gimp_image_insert_layer)
-gboolean gimp_image_add_layer (gint32 image_ID,
- gint32 layer_ID,
- gint position);
-gboolean gimp_image_insert_layer (gint32 image_ID,
- gint32 layer_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_layer (gint32 image_ID,
- gint32 layer_ID);
+gboolean gimp_image_add_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint position);
+gboolean gimp_image_insert_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_layer (gint32 image_ID,
+ gint32 layer_ID);
GIMP_DEPRECATED_FOR(gimp_image_insert_channel)
-gboolean gimp_image_add_channel (gint32 image_ID,
- gint32 channel_ID,
- gint position);
-gboolean gimp_image_insert_channel (gint32 image_ID,
- gint32 channel_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_channel (gint32 image_ID,
- gint32 channel_ID);
+gboolean gimp_image_add_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint position);
+gboolean gimp_image_insert_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_channel (gint32 image_ID,
+ gint32 channel_ID);
GIMP_DEPRECATED_FOR(gimp_image_insert_vectors)
-gboolean gimp_image_add_vectors (gint32 image_ID,
- gint32 vectors_ID,
- gint position);
-gboolean gimp_image_insert_vectors (gint32 image_ID,
- gint32 vectors_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_vectors (gint32 image_ID,
- gint32 vectors_ID);
-gint gimp_image_get_item_position (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_raise_item (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_lower_item (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_raise_item_to_top (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_lower_item_to_bottom (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_reorder_item (gint32 image_ID,
- gint32 item_ID,
- gint32 parent_ID,
- gint position);
-gint32 gimp_image_flatten (gint32 image_ID);
-gint32 gimp_image_merge_visible_layers (gint32 image_ID,
- GimpMergeType merge_type);
-gint32 gimp_image_merge_down (gint32 image_ID,
- gint32 merge_layer_ID,
- GimpMergeType merge_type);
-G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32 image_ID,
- gint *num_bytes);
-G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
- gint num_bytes,
- const guint8 *colormap);
-G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (gint32 image_ID);
-G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (gint32 image_ID,
- const gchar *metadata_string);
-gboolean gimp_image_clean_all (gint32 image_ID);
-gboolean gimp_image_is_dirty (gint32 image_ID);
-G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,
- gint width,
- gint height,
- gint *actual_width,
- gint *actual_height,
- gint *bpp,
- gint *thumbnail_data_count,
- guint8 **thumbnail_data);
-gint32 gimp_image_get_active_layer (gint32 image_ID);
-gboolean gimp_image_set_active_layer (gint32 image_ID,
- gint32 active_layer_ID);
-gint32 gimp_image_get_active_channel (gint32 image_ID);
-gboolean gimp_image_set_active_channel (gint32 image_ID,
- gint32 active_channel_ID);
-gint32 gimp_image_get_active_vectors (gint32 image_ID);
-gboolean gimp_image_set_active_vectors (gint32 image_ID,
- gint32 active_vectors_ID);
-gint32 gimp_image_get_selection (gint32 image_ID);
-gboolean gimp_image_get_component_active (gint32 image_ID,
- GimpChannelType component);
-gboolean gimp_image_set_component_active (gint32 image_ID,
- GimpChannelType component,
- gboolean active);
-gboolean gimp_image_get_component_visible (gint32 image_ID,
- GimpChannelType component);
-gboolean gimp_image_set_component_visible (gint32 image_ID,
- GimpChannelType component,
- gboolean visible);
-gchar* gimp_image_get_filename (gint32 image_ID);
-gboolean gimp_image_set_filename (gint32 image_ID,
- const gchar *filename);
-gchar* gimp_image_get_uri (gint32 image_ID);
-gchar* gimp_image_get_xcf_uri (gint32 image_ID);
-gchar* gimp_image_get_imported_uri (gint32 image_ID);
-gchar* gimp_image_get_exported_uri (gint32 image_ID);
-gchar* gimp_image_get_name (gint32 image_ID);
-gboolean gimp_image_get_resolution (gint32 image_ID,
- gdouble *xresolution,
- gdouble *yresolution);
-gboolean gimp_image_set_resolution (gint32 image_ID,
- gdouble xresolution,
- gdouble yresolution);
-GimpUnit gimp_image_get_unit (gint32 image_ID);
-gboolean gimp_image_set_unit (gint32 image_ID,
- GimpUnit unit);
-gint gimp_image_get_tattoo_state (gint32 image_ID);
-gboolean gimp_image_set_tattoo_state (gint32 image_ID,
- gint tattoo_state);
-gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_layer_by_name (gint32 image_ID,
- const gchar *name);
-gint32 gimp_image_get_channel_by_name (gint32 image_ID,
- const gchar *name);
-gint32 gimp_image_get_vectors_by_name (gint32 image_ID,
- const gchar *name);
-gboolean gimp_image_attach_parasite (gint32 image_ID,
- const GimpParasite *parasite);
-gboolean gimp_image_detach_parasite (gint32 image_ID,
- const gchar *name);
-GimpParasite* gimp_image_get_parasite (gint32 image_ID,
- const gchar *name);
-gchar** gimp_image_get_parasite_list (gint32 image_ID,
- gint *num_parasites);
+gboolean gimp_image_add_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint position);
+gboolean gimp_image_insert_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+gint gimp_image_get_item_position (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item_to_top (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item_to_bottom (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_reorder_item (gint32 image_ID,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position);
+gint32 gimp_image_flatten (gint32 image_ID);
+gint32 gimp_image_merge_visible_layers (gint32 image_ID,
+ GimpMergeType merge_type);
+gint32 gimp_image_merge_down (gint32 image_ID,
+ gint32 merge_layer_ID,
+ GimpMergeType merge_type);
+G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *colormap);
+G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (gint32 image_ID,
+ const gchar *metadata_string);
+gboolean gimp_image_clean_all (gint32 image_ID);
+gboolean gimp_image_is_dirty (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+gint32 gimp_image_get_active_layer (gint32 image_ID);
+gboolean gimp_image_set_active_layer (gint32 image_ID,
+ gint32 active_layer_ID);
+gint32 gimp_image_get_active_channel (gint32 image_ID);
+gboolean gimp_image_set_active_channel (gint32 image_ID,
+ gint32 active_channel_ID);
+gint32 gimp_image_get_active_vectors (gint32 image_ID);
+gboolean gimp_image_set_active_vectors (gint32 image_ID,
+ gint32 active_vectors_ID);
+gint32 gimp_image_get_selection (gint32 image_ID);
+gboolean gimp_image_get_component_active (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_active (gint32 image_ID,
+ GimpChannelType component,
+ gboolean active);
+gboolean gimp_image_get_component_visible (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_visible (gint32 image_ID,
+ GimpChannelType component,
+ gboolean visible);
+gchar* gimp_image_get_filename (gint32 image_ID);
+gboolean gimp_image_set_filename (gint32 image_ID,
+ const gchar *filename);
+gchar* gimp_image_get_uri (gint32 image_ID);
+gchar* gimp_image_get_xcf_uri (gint32 image_ID);
+gchar* gimp_image_get_imported_uri (gint32 image_ID);
+gchar* gimp_image_get_exported_uri (gint32 image_ID);
+gchar* gimp_image_get_name (gint32 image_ID);
+gboolean gimp_image_get_resolution (gint32 image_ID,
+ gdouble *xresolution,
+ gdouble *yresolution);
+gboolean gimp_image_set_resolution (gint32 image_ID,
+ gdouble xresolution,
+ gdouble yresolution);
+GimpUnit gimp_image_get_unit (gint32 image_ID);
+gboolean gimp_image_set_unit (gint32 image_ID,
+ GimpUnit unit);
+gint gimp_image_get_tattoo_state (gint32 image_ID);
+gboolean gimp_image_set_tattoo_state (gint32 image_ID,
+ gint tattoo_state);
+gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_layer_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_channel_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_vectors_by_name (gint32 image_ID,
+ const gchar *name);
+gboolean gimp_image_attach_parasite (gint32 image_ID,
+ const GimpParasite *parasite);
+gboolean gimp_image_detach_parasite (gint32 image_ID,
+ const gchar *name);
+GimpParasite* gimp_image_get_parasite (gint32 image_ID,
+ const gchar *name);
+gchar** gimp_image_get_parasite_list (gint32 image_ID,
+ gint *num_parasites);
G_END_DECLS
diff --git a/libgimp/gimpimagetransform_pdb.c b/libgimp/gimpimagetransform_pdb.c
new file mode 100644
index 0000000..dc6c4f9
--- /dev/null
+++ b/libgimp/gimpimagetransform_pdb.c
@@ -0,0 +1,303 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagetransform_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimagetransform
+ * @title: gimpimagetransform
+ * @short_description: Transformations onm images.
+ *
+ * Operations to scale, resize, crop, flip and rotate images.
+ **/
+
+
+/**
+ * gimp_image_resize:
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ * @offx: x offset between upper left corner of old and new images: (new - old).
+ * @offy: y offset between upper left corner of old and new images: (new - old).
+ *
+ * Resize the image to the specified extents.
+ *
+ * This procedure resizes the image so that it's new width and height
+ * are equal to the supplied parameters. Offsets are also provided
+ * which describe the position of the previous image's content. All
+ * channels within the image are resized according to the specified
+ * parameters; this includes the image selection mask. All layers
+ * within the image are repositioned according to the specified
+ * offsets.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_resize (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-resize",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_resize_to_layers:
+ * @image_ID: The image.
+ *
+ * Resize the image to fit all layers.
+ *
+ * This procedure resizes the image to the bounding box of all layers
+ * of the image. All channels within the image are resized to the new
+ * size; this includes the image selection mask. All layers within the
+ * image are repositioned to the new image area.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.2
+ **/
+gboolean
+gimp_image_resize_to_layers (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-resize-to-layers",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_scale:
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ *
+ * 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 interpolation method used can
+ * be set with gimp_context_set_interpolation().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_scale (gint32 image_ID,
+ gint new_width,
+ gint new_height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-scale",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_scale_full:
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ * @interpolation: Type of interpolation.
+ *
+ * Deprecated: Use gimp_image_scale() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.6
+ **/
+gboolean
+gimp_image_scale_full (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ GimpInterpolationType interpolation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-scale-full",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_crop:
+ * @image_ID: The image.
+ * @new_width: New image width: (0 < new_width <= width).
+ * @new_height: New image height: (0 < new_height <= height).
+ * @offx: X offset: (0 <= offx <= (width - new_width)).
+ * @offy: Y offset: (0 <= offy <= (height - new_height)).
+ *
+ * Crop the image to the specified extents.
+ *
+ * This procedure crops the image so that it's new width and height are
+ * equal to the supplied parameters. Offsets are also provided which
+ * describe the position of the previous image's content. All channels
+ * and layers within the image are cropped to the new image extents;
+ * this includes the image selection mask. If any parameters are out of
+ * range, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_crop (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-crop",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_flip:
+ * @image_ID: The image.
+ * @flip_type: Type of flip.
+ *
+ * Flips the image horizontally or vertically.
+ *
+ * This procedure flips (mirrors) the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_flip (gint32 image_ID,
+ GimpOrientationType flip_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-flip",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, flip_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_rotate:
+ * @image_ID: The image.
+ * @rotate_type: Angle of rotation.
+ *
+ * Rotates the image by the specified degrees.
+ *
+ * This procedure rotates the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_rotate (gint32 image_ID,
+ GimpRotationType rotate_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-rotate",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, rotate_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpimagetransform_pdb.h b/libgimp/gimpimagetransform_pdb.h
new file mode 100644
index 0000000..624c635
--- /dev/null
+++ b/libgimp/gimpimagetransform_pdb.h
@@ -0,0 +1,62 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagetransform_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_TRANSFORM_PDB_H__
+#define __GIMP_IMAGE_TRANSFORM_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_image_resize (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_resize_to_layers (gint32 image_ID);
+gboolean gimp_image_scale (gint32 image_ID,
+ gint new_width,
+ gint new_height);
+GIMP_DEPRECATED_FOR(gimp_image_scale)
+gboolean gimp_image_scale_full (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ GimpInterpolationType interpolation);
+gboolean gimp_image_crop (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_flip (gint32 image_ID,
+ GimpOrientationType flip_type);
+gboolean gimp_image_rotate (gint32 image_ID,
+ GimpRotationType rotate_type);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_TRANSFORM_PDB_H__ */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4dad99e..8551a2e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -299,6 +299,7 @@ app/pdb/image-cmds.c
app/pdb/image-convert-cmds.c
app/pdb/image-guides-cmds.c
app/pdb/image-select-cmds.c
+app/pdb/image-transform-cmds.c
app/pdb/image-undo-cmds.c
app/pdb/item-transform-cmds.c
app/pdb/layer-cmds.c
diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am
index ffb5463..0c6bc5e 100644
--- a/tools/pdbgen/Makefile.am
+++ b/tools/pdbgen/Makefile.am
@@ -30,6 +30,7 @@ pdb_sources = \
pdb/image_grid.pdb \
pdb/image_guides.pdb \
pdb/image_select.pdb \
+ pdb/image_transform.pdb \
pdb/image_undo.pdb \
pdb/item.pdb \
pdb/item_transform.pdb \
diff --git a/tools/pdbgen/groups.pl b/tools/pdbgen/groups.pl
index 6bd5dcc..e2aaa53 100644
--- a/tools/pdbgen/groups.pl
+++ b/tools/pdbgen/groups.pl
@@ -28,6 +28,7 @@
image_grid
image_guides
image_select
+ image_transform
image_undo
item
item_transform
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index be468f8..cb5d4ca 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -239,248 +239,6 @@ CODE
);
}
-sub image_resize {
- $blurb = 'Resize the image to the specified extents.';
-
- $help = <<'HELP';
-This procedure resizes the image so that it's new width and height are
-equal to the supplied parameters. Offsets are also provided which
-describe the position of the previous image's content. All channels
-within the image are resized according to the specified parameters;
-this includes the image selection mask. All layers within the image
-are repositioned according to the specified offsets.
-HELP
-
- &std_pdb_misc;
-
- @inargs = (
- { name => 'image', type => 'image',
- desc => 'The image' },
- { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image width' },
- { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image height' },
- { name => 'offx', type => 'int32',
- desc => 'x offset between upper left corner of old and
- new images: (new - old)' },
- { name => 'offy', type => 'int32',
- desc => 'y offset between upper left corner of old and
- new images: (new - old)' }
- );
-
- %invoke = (
- headers => [ qw("core/gimpimage-resize.h") ],
- code => <<'CODE'
-{
- gimp_image_resize (image, context,
- new_width, new_height, offx, offy, NULL);
-}
-CODE
- );
-}
-
-sub image_resize_to_layers {
- $blurb = 'Resize the image to fit all layers.';
-
- $help = <<'HELP';
-This procedure resizes the image to the bounding box of all layers of
-the image. All channels within the image are resized to the new size;
-this includes the image selection mask. All layers within the image
-are repositioned to the new image area.
-HELP
-
- &simon_pdb_misc('2004', '2.2');
-
- @inargs = (
- { name => 'image', type => 'image',
- desc => 'The image' }
- );
-
- %invoke = (
- headers => [ qw("core/gimpimage-resize.h") ],
- code => <<'CODE'
-{
- gimp_image_resize_to_layers (image, context, NULL);
-}
-CODE
- );
-}
-
-sub image_scale {
- $blurb = 'Scale the image using the default 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. The interpolation method used can be set
-with gimp_context_set_interpolation().
-HELP
-
- &std_pdb_misc;
-
- @inargs = (
- { name => 'image', type => 'image',
- desc => 'The image' },
- { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image width' },
- { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image height' }
- );
-
- %invoke = (
- headers => [ qw("core/gimpimage-scale.h") ],
- code => <<'CODE'
-{
- GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
-
- if (progress)
- gimp_progress_start (progress, FALSE, _("Scaling"));
-
- gimp_image_scale (image, new_width, new_height,
- pdb_context->interpolation,
- progress);
-
- if (progress)
- gimp_progress_end (progress);
-}
-CODE
- );
-}
-
-sub image_scale_full {
- &std_pdb_deprecated('gimp-image-scale');
- &neo_pdb_misc('2008', '2.6');
-
- @inargs = (
- { name => 'image', type => 'image',
- desc => 'The image' },
- { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image width' },
- { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image height' },
- { name => 'interpolation', type => 'enum GimpInterpolationType',
- desc => 'Type of interpolation' }
- );
-
- %invoke = (
- headers => [ qw("core/gimpimage-scale.h") ],
- code => <<'CODE'
-{
- if (progress)
- gimp_progress_start (progress, FALSE, _("Scaling"));
-
- gimp_image_scale (image, new_width, new_height, interpolation, progress);
-
- if (progress)
- gimp_progress_end (progress);
-}
-CODE
- );
-}
-
-sub image_crop {
- $blurb = 'Crop the image to the specified extents.';
-
- $help = <<'HELP';
-This procedure crops the image so that it's new width and height are
-equal to the supplied parameters. Offsets are also provided which
-describe the position of the previous image's content. All channels
-and layers within the image are cropped to the new image extents; this
-includes the image selection mask. If any parameters are out of range,
-an error is returned.
-HELP
-
- &std_pdb_misc;
-
- @inargs = (
- { name => 'image', type => 'image',
- desc => 'The image' },
- { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image width: (0 < new_width <= width)' },
- { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
- desc => 'New image height: (0 < new_height <= height)' },
- { name => 'offx', type => '0 <= int32',
- desc => 'X offset: (0 <= offx <= (width - new_width))' },
- { name => 'offy', type => '0 <= int32',
- desc => 'Y offset: (0 <= offy <= (height - new_height))' }
- );
-
- %invoke = (
- headers => [ qw("core/gimpimage-crop.h") ],
- code => <<'CODE'
-{
- if (new_width > gimp_image_get_width (image) ||
- new_height > gimp_image_get_height (image) ||
- offx > (gimp_image_get_width (image) - new_width) ||
- offy > (gimp_image_get_height (image) - new_height))
- success = FALSE;
- else
- gimp_image_crop (image, context,
- offx, offy, offx + new_width, offy + new_height,
- TRUE);
-}
-CODE
- );
-}
-
-sub image_flip {
- $blurb = 'Flips the image horizontally or vertically.';
-
- $help = <<'HELP';
-This procedure flips (mirrors) the image.
-HELP
-
- &std_pdb_misc;
-
- @inargs = (
- { name => 'image', type => 'image',
- desc => 'The image' },
- { name => 'flip_type',
- type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
- desc => 'Type of flip' }
- );
-
- %invoke = (
- headers => [ qw("core/gimpimage-flip.h") ],
- code => <<'CODE'
-{
- gimp_image_flip (image, context, flip_type, NULL);
-}
-CODE
- );
-}
-
-sub image_rotate {
- $blurb = 'Rotates the image by the specified degrees.';
- $help = 'This procedure rotates the image.';
-
- &mitch_pdb_misc('2003');
-
- @inargs = (
- { name => 'image', type => 'image',
- desc => 'The image' },
- { name => 'rotate_type', type => 'enum GimpRotationType',
- desc => 'Angle of rotation' }
- );
-
- %invoke = (
- headers => [ qw("core/gimpimage-rotate.h") ],
- code => <<'CODE'
-{
- if (progress)
- gimp_progress_start (progress, FALSE, _("Rotating"));
-
- gimp_image_rotate (image, context, rotate_type, progress);
-
- if (progress)
- gimp_progress_end (progress);
-}
-CODE
- );
-}
-
sub image_free_shadow {
&std_pdb_deprecated ('gimp-drawable-free-shadow');
@@ -3073,9 +2831,6 @@ CODE
image_get_precision
image_width image_height
image_free_shadow
- image_resize image_resize_to_layers
- image_scale image_scale_full
- image_crop image_flip image_rotate
image_get_layers
image_get_channels
image_get_vectors
@@ -3127,7 +2882,7 @@ CODE
# image_add_layer_mask and image_remove_layer_mask.
# If adding or removing functions, make sure the range below is
# updated correctly!
-%exports = (app => [ procs], lib => [ procs[0 44,47..87]]);
+%exports = (app => [ procs], lib => [ procs[0 37,40..80]]);
$desc = 'Image';
$doc_title = 'gimpimage';
diff --git a/tools/pdbgen/pdb/image_transform.pdb b/tools/pdbgen/pdb/image_transform.pdb
new file mode 100644
index 0000000..cad7c06
--- /dev/null
+++ b/tools/pdbgen/pdb/image_transform.pdb
@@ -0,0 +1,276 @@
+# GIMP - The GNU Image Manipulation Program
+# Copyright (C) 1995 Spencer Kimball and Peter Mattis
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# "Perlized" from C source by Manish Singh <yosh gimp org>
+
+sub image_resize {
+ $blurb = 'Resize the image to the specified extents.';
+
+ $help = <<'HELP';
+This procedure resizes the image so that it's new width and height are
+equal to the supplied parameters. Offsets are also provided which
+describe the position of the previous image's content. All channels
+within the image are resized according to the specified parameters;
+this includes the image selection mask. All layers within the image
+are repositioned according to the specified offsets.
+HELP
+
+ &std_pdb_misc;
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image width' },
+ { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image height' },
+ { name => 'offx', type => 'int32',
+ desc => 'x offset between upper left corner of old and
+ new images: (new - old)' },
+ { name => 'offy', type => 'int32',
+ desc => 'y offset between upper left corner of old and
+ new images: (new - old)' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-resize.h") ],
+ code => <<'CODE'
+{
+ gimp_image_resize (image, context,
+ new_width, new_height, offx, offy, NULL);
+}
+CODE
+ );
+}
+
+sub image_resize_to_layers {
+ $blurb = 'Resize the image to fit all layers.';
+
+ $help = <<'HELP';
+This procedure resizes the image to the bounding box of all layers of
+the image. All channels within the image are resized to the new size;
+this includes the image selection mask. All layers within the image
+are repositioned to the new image area.
+HELP
+
+ &simon_pdb_misc('2004', '2.2');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-resize.h") ],
+ code => <<'CODE'
+{
+ gimp_image_resize_to_layers (image, context, NULL);
+}
+CODE
+ );
+}
+
+sub image_scale {
+ $blurb = 'Scale the image using the default 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. The interpolation method used can be set
+with gimp_context_set_interpolation().
+HELP
+
+ &std_pdb_misc;
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image width' },
+ { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image height' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-scale.h") ],
+ code => <<'CODE'
+{
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_image_scale (image, new_width, new_height,
+ pdb_context->interpolation,
+ progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+}
+CODE
+ );
+}
+
+sub image_scale_full {
+ &std_pdb_deprecated('gimp-image-scale');
+ &neo_pdb_misc('2008', '2.6');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image width' },
+ { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image height' },
+ { name => 'interpolation', type => 'enum GimpInterpolationType',
+ desc => 'Type of interpolation' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-scale.h") ],
+ code => <<'CODE'
+{
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_image_scale (image, new_width, new_height, interpolation, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+}
+CODE
+ );
+}
+
+sub image_crop {
+ $blurb = 'Crop the image to the specified extents.';
+
+ $help = <<'HELP';
+This procedure crops the image so that it's new width and height are
+equal to the supplied parameters. Offsets are also provided which
+describe the position of the previous image's content. All channels
+and layers within the image are cropped to the new image extents; this
+includes the image selection mask. If any parameters are out of range,
+an error is returned.
+HELP
+
+ &std_pdb_misc;
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image width: (0 < new_width <= width)' },
+ { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image height: (0 < new_height <= height)' },
+ { name => 'offx', type => '0 <= int32',
+ desc => 'X offset: (0 <= offx <= (width - new_width))' },
+ { name => 'offy', type => '0 <= int32',
+ desc => 'Y offset: (0 <= offy <= (height - new_height))' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-crop.h") ],
+ code => <<'CODE'
+{
+ if (new_width > gimp_image_get_width (image) ||
+ new_height > gimp_image_get_height (image) ||
+ offx > (gimp_image_get_width (image) - new_width) ||
+ offy > (gimp_image_get_height (image) - new_height))
+ success = FALSE;
+ else
+ gimp_image_crop (image, context,
+ offx, offy, offx + new_width, offy + new_height,
+ TRUE);
+}
+CODE
+ );
+}
+
+sub image_flip {
+ $blurb = 'Flips the image horizontally or vertically.';
+
+ $help = <<'HELP';
+This procedure flips (mirrors) the image.
+HELP
+
+ &std_pdb_misc;
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'flip_type',
+ type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
+ desc => 'Type of flip' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-flip.h") ],
+ code => <<'CODE'
+{
+ gimp_image_flip (image, context, flip_type, NULL);
+}
+CODE
+ );
+}
+
+sub image_rotate {
+ $blurb = 'Rotates the image by the specified degrees.';
+ $help = 'This procedure rotates the image.';
+
+ &mitch_pdb_misc('2003');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'rotate_type', type => 'enum GimpRotationType',
+ desc => 'Angle of rotation' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-rotate.h") ],
+ code => <<'CODE'
+{
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Rotating"));
+
+ gimp_image_rotate (image, context, rotate_type, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+}
+CODE
+ );
+}
+
+ headers = qw("core/gimpprogress.h"
+ "gimppdbcontext.h"
+ "gimp-intl.h");
+
+ procs = qw(image_resize image_resize_to_layers
+ image_scale image_scale_full
+ image_crop image_flip image_rotate);
+
+%exports = (app => [ procs], lib => [ procs]);
+
+$desc = 'Image Transform';
+$doc_title = 'gimpimagetransform';
+$doc_short_desc = 'Transformations onm images.';
+$doc_long_desc = 'Operations to scale, resize, crop, flip and rotate images.';
+
+1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]