[gimp] pdb, plug-ins: remove the rotate plug-in and add a PDB compat procedure
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb, plug-ins: remove the rotate plug-in and add a PDB compat procedure
- Date: Sat, 24 May 2014 20:48:25 +0000 (UTC)
commit 3e6a7f40128782c29791dd58dd094440e221f382
Author: Michael Natterer <mitch gimp org>
Date: Sat May 24 22:46:11 2014 +0200
pdb, plug-ins: remove the rotate plug-in and add a PDB compat procedure
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 100 +++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 16 -
plug-ins/common/gimprc.common | 1 -
plug-ins/common/plugin-defs.pl | 1 -
plug-ins/common/rotate.c | 538 -----------------------------------
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 62 ++++-
9 files changed, 161 insertions(+), 562 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 0c24e1e..3ced608 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 730 procedures registered total */
+/* 731 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 3756e7b..3eda5b2 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -33,10 +33,12 @@
#include "pdb-types.h"
+#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable-operation.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage-crop.h"
+#include "core/gimpimage-rotate.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage.h"
#include "core/gimpparamspecs.h"
@@ -1919,6 +1921,56 @@ plug_in_rgb_noise_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpDrawable *drawable;
+ gint32 angle;
+ gboolean everything;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ angle = g_value_get_int (gimp_value_array_index (args, 3));
+ everything = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpRotationType rotate_type = angle - 1;
+
+ if (everything)
+ {
+ gimp_image_rotate (image, context, rotate_type, progress);
+ }
+ else if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error))
+ {
+ GimpItem *item = GIMP_ITEM (drawable);
+ gint off_x, off_y;
+ gdouble center_x, center_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+
+ center_x = ((gdouble) off_x + (gdouble) gimp_item_get_width (item) / 2.0);
+ center_y = ((gdouble) off_y + (gdouble) gimp_item_get_height (item) / 2.0);
+
+ gimp_item_rotate (item, context, rotate_type, center_x, center_y,
+ GIMP_IS_CHANNEL (drawable));
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_noisify_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -4184,6 +4236,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-rotate
+ */
+ procedure = gimp_procedure_new (plug_in_rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-rotate",
+ "Rotates a layer or the whole image by 90, 180 or 270 degrees",
+ "This plug-in does rotate the active layer or the whole image clockwise
by multiples of 90 degrees. When the whole image is chosen, the image is resized if necessary.",
+ "Sven Neumann <sven gimp org>",
+ "Sven Neumann",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("angle",
+ "angle",
+ "Angle { 90 (1), 180 (2), 270 (3) } degrees",
+ 1, 3, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("everything",
+ "everything",
+ "Rotate the whole image",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-noisify
*/
procedure = gimp_procedure_new (plug_in_noisify_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 29069b9..299fdbe 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -192,8 +192,6 @@
/qbist.exe
/ripple
/ripple.exe
-/rotate
-/rotate.exe
/sample-colorize
/sample-colorize.exe
/screenshot
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 4e156b5..ce71c50 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -139,7 +139,6 @@ libexec_PROGRAMS = \
procedure-browser \
qbist \
ripple \
- rotate \
sample-colorize \
$(SCREENSHOT) \
sharpen \
@@ -1860,21 +1859,6 @@ ripple_LDADD = \
$(INTLLIBS) \
$(ripple_RC)
-rotate_SOURCES = \
- rotate.c
-
-rotate_LDADD = \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(CAIRO_LIBS) \
- $(GDK_PIXBUF_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(rotate_RC)
-
sample_colorize_SOURCES = \
sample-colorize.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 203d999..6b91d68 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -93,7 +93,6 @@ plugin_browser_RC = plugin-browser.rc.o
procedure_browser_RC = procedure-browser.rc.o
qbist_RC = qbist.rc.o
ripple_RC = ripple.rc.o
-rotate_RC = rotate.rc.o
sample_colorize_RC = sample-colorize.rc.o
screenshot_RC = screenshot.rc.o
sharpen_RC = sharpen.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 8f10de7..61bdf68 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -94,7 +94,6 @@
'procedure-browser' => { ui => 1 },
'qbist' => { ui => 1 },
'ripple' => { ui => 1 },
- 'rotate' => {},
'sample-colorize' => { ui => 1 },
'screenshot' => { ui => 1, optional => 1, libs => 'SCREENSHOT_LIBS', cflags => 'XFIXES_CFLAGS', gegl =>
1 },
'sharpen' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 6d1cb04..b8939f8 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -101,7 +101,6 @@ plug-ins/common/plugin-browser.c
plug-ins/common/procedure-browser.c
plug-ins/common/qbist.c
plug-ins/common/ripple.c
-plug-ins/common/rotate.c
plug-ins/common/sample-colorize.c
plug-ins/common/screenshot.c
plug-ins/common/sharpen.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 5808a19..8cbd1d6 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -1996,6 +1996,62 @@ CODE
);
}
+sub plug_in_rotate {
+ $blurb = 'Rotates a layer or the whole image by 90, 180 or 270 degrees';
+
+ $help = <<'HELP';
+This plug-in does rotate the active layer or the whole image clockwise
+by multiples of 90 degrees. When the whole image is chosen, the image
+is resized if necessary.
+HELP
+
+ &neo_pdb_misc;
+ $date = '2014';
+
+ @inargs = (
+ { name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
+ desc => 'The run mode' },
+ { name => 'image', type => 'image',
+ desc => 'Input image (unused)' },
+ { name => 'drawable', type => 'drawable',
+ desc => 'Input drawable' },
+ { name => 'angle', type => '1 <= int32 <= 3',
+ desc => 'Angle { 90 (1), 180 (2), 270 (3) } degrees' },
+ { name => 'everything', type => 'boolean',
+ desc => 'Rotate the whole image' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ GimpRotationType rotate_type = angle - 1;
+
+ if (everything)
+ {
+ gimp_image_rotate (image, context, rotate_type, progress);
+ }
+ else if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error))
+ {
+ GimpItem *item = GIMP_ITEM (drawable);
+ gint off_x, off_y;
+ gdouble center_x, center_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+
+ center_x = ((gdouble) off_x + (gdouble) gimp_item_get_width (item) / 2.0);
+ center_y = ((gdouble) off_y + (gdouble) gimp_item_get_height (item) / 2.0);
+
+ gimp_item_rotate (item, context, rotate_type, center_x, center_y,
+ GIMP_IS_CHANNEL (drawable));
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_noisify {
$blurb = 'Adds random noise to image channels';
@@ -2603,10 +2659,11 @@ CODE
"libgimpmath/gimpmath.h"
"gegl/gimp-babl.h"
"gegl/gimp-gegl-utils.h"
+ "core/gimpchannel.h"
"core/gimpcontext.h"
- "core/gimpdrawable.h"
"core/gimpdrawable-operation.h"
"core/gimpimage-crop.h"
+ "core/gimpimage-rotate.h"
"core/gimpimage-undo.h"
"core/gimppickable.h"
"core/gimppickable-auto-shrink.h"
@@ -2647,6 +2704,7 @@ CODE
plug_in_randomize_pick
plug_in_randomize_slur
plug_in_rgb_noise
+ plug_in_rotate
plug_in_noisify
plug_in_semiflatten
plug_in_shift
@@ -2661,6 +2719,6 @@ CODE
$desc = 'Plug-In Compat';
$doc_title = 'plugincolor';
$doc_short_desc = 'Compatibility for removed plug-ins.';
-$doc_long_desc = 'Functions that perform the operation of removed plug-ins using GEGL operations.';
+$doc_long_desc = 'Functions that perform the operation of removed plug-ins using GEGL operations or other
GIMP internal functions.';
1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]