[gimp/goat-invasion] app: replace the polar-coords plug-in by gegl:polar-coordinates
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion] app: replace the polar-coords plug-in by gegl:polar-coordinates
- Date: Fri, 27 Apr 2012 19:47:51 +0000 (UTC)
commit 97e9649b29f666f5e2f4ff93a65f7534ecd8a8cf
Author: Michael Natterer <mitch gimp org>
Date: Fri Apr 27 21:47:09 2012 +0200
app: replace the polar-coords plug-in by gegl:polar-coordinates
app/actions/filters-actions.c | 23 +-
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 118 ++++++
app/tools/gimpgegltool.c | 3 +
menus/image-menu.xml.in | 4 +-
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 -
plug-ins/common/gimprc.common | 1 -
plug-ins/common/plugin-defs.pl | 1 -
plug-ins/common/polar-coords.c | 789 -----------------------------------
tools/pdbgen/pdb/plug_in_compat.pdb | 60 +++
11 files changed, 200 insertions(+), 821 deletions(-)
---
diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c
index 32dd68f..9b4a70f 100644
--- a/app/actions/filters-actions.c
+++ b/app/actions/filters-actions.c
@@ -45,17 +45,23 @@ static const GimpStringActionEntry filters_actions[] =
"gegl:color-to-alpha",
NULL /* FIXME GIMP_HELP_FILTER_PIXELIZE */ },
+ { "filters-gaussian-blur", GIMP_STOCK_GEGL,
+ NC_("filters-action", "_Gaussian Blur..."), NULL,
+ NC_("filters-action", "Apply a gaussian blur"),
+ "gegl:gaussian-blur",
+ NULL /* FIXME GIMP_HELP_FILTER_GAUSSIAN_BLUR */ },
+
{ "filters-pixelize", GIMP_STOCK_GEGL,
NC_("filters-action", "_Pixelize..."), NULL,
NC_("filters-action", "Simplify image into an array of solid-colored squares"),
"gegl:pixelize",
NULL /* FIXME GIMP_HELP_FILTER_PIXELIZE */ },
- { "filters-gaussian-blur", GIMP_STOCK_GEGL,
- NC_("filters-action", "_Gaussian Blur..."), NULL,
- NC_("filters-action", "Apply a gaussian blur"),
- "gegl:gaussian-blur",
- NULL /* FIXME GIMP_HELP_FILTER_GAUSSIAN_BLUR */ },
+ { "filters-polar-coordinates", GIMP_STOCK_GEGL,
+ NC_("filters-action", "P_olar Coordinates..."), NULL,
+ NC_("filters-action", "Convert image to or from polar coordinates"),
+ "gegl:polar-coordinates",
+ NULL /* FIXME GIMP_HELP_FILTER_POLAR_COORDINATES */ },
};
void
@@ -105,9 +111,10 @@ filters_actions_update (GimpActionGroup *group,
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
- SET_SENSITIVE ("filters-color-to-alpha", writable && !gray && alpha);
- SET_SENSITIVE ("filters-pixelize", writable);
- SET_SENSITIVE ("filters-gaussian-blur", writable);
+ SET_SENSITIVE ("filters-color-to-alpha", writable && !gray && alpha);
+ SET_SENSITIVE ("filters-gaussian-blur", writable);
+ SET_SENSITIVE ("filters-pixelize", writable);
+ SET_SENSITIVE ("filters-polar-coordinates", writable);
#undef SET_SENSITIVE
}
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index cd4492b..35daa18 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 673 procedures registered total */
+/* 674 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 6a5602a..8cd1ed6 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -170,6 +170,58 @@ plug_in_pixelize2_invoker (GimpProcedure *procedure,
}
static GValueArray *
+plug_in_polar_coords_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble circle;
+ gdouble angle;
+ gboolean backwards;
+ gboolean inverse;
+ gboolean polrec;
+
+ drawable = gimp_value_get_drawable (&args->values[2], gimp);
+ circle = g_value_get_double (&args->values[3]);
+ angle = g_value_get_double (&args->values[4]);
+ backwards = g_value_get_boolean (&args->values[5]);
+ inverse = g_value_get_boolean (&args->values[6]);
+ polrec = g_value_get_boolean (&args->values[7]);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:polar-coords",
+ "depth", circle,
+ "angle", angle,
+ "bw", backwards, /* XXX name */
+ "top", inverse,
+ "polar", polrec,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Polar Coordinates"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GValueArray *
plug_in_vinvert_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -345,6 +397,72 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-polar-coords
+ */
+ procedure = gimp_procedure_new (plug_in_polar_coords_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-polar-coords");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-polar-coords",
+ "Convert image to or from polar coordinates",
+ "Remaps and image from rectangular coordinates to polar coordinates or vice versa.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ 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,
+ g_param_spec_double ("circle",
+ "circle",
+ "Circle depth in %",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "Offset angle",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("backwards",
+ "backwards",
+ "Map backwards",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("inverse",
+ "inverse",
+ "Map from top",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("polrec",
+ "polrec",
+ "Polar to rectangular",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-vinvert
*/
procedure = gimp_procedure_new (plug_in_vinvert_invoker);
diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c
index ca58297..5a6d5cd 100644
--- a/app/tools/gimpgegltool.c
+++ b/app/tools/gimpgegltool.c
@@ -124,7 +124,10 @@ gimp_gegl_tool_operation_blacklisted (const gchar *name,
"gegl:colorize", /* in gimp */
"gegl:color-to-alpha", /* in gimp */
"gegl:invert", /* in gimp */
+ "gegl:gaussian-blur", /* in gimp */
"gegl:grey", /* in gimp */
+ "gegl:pixelize", /* in gimp */
+ "gegl:polar-coordinates", /* in gimp */
"gegl:posterize", /* in gimp */
"gegl:scale", /* in gimp */
"gegl:translate", /* pointless */
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index f2eef9a..56af4b6 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -602,7 +602,9 @@
<menuitem action="filters-pixelize" />
</menu>
<menu action="plug-in-enhance-menu" name="Enhance" />
- <menu action="plug-in-distorts-menu" name="Distorts" />
+ <menu action="plug-in-distorts-menu" name="Distorts">
+ <menuitem action="filters-polar-coordinates" />
+ </menu>
<menu action="plug-in-light-shadow-menu" name="Light and Shadow">
<placeholder name="Light" />
<separator />
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 1e7051b..47d1e73 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -222,8 +222,6 @@
/plasma.exe
/plugin-browser
/plugin-browser.exe
-/polar-coords
-/polar-coords.exe
/procedure-browser
/procedure-browser.exe
/qbist
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index d5d7712..99c7f89 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -154,7 +154,6 @@ libexec_PROGRAMS = \
photocopy \
plasma \
plugin-browser \
- polar-coords \
procedure-browser \
qbist \
red-eye-removal \
@@ -2094,23 +2093,6 @@ plugin_browser_LDADD = \
$(INTLLIBS) \
$(plugin_browser_RC)
-polar_coords_SOURCES = \
- polar-coords.c
-
-polar_coords_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(polar_coords_RC)
-
procedure_browser_SOURCES = \
procedure-browser.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index ab6c6b0..d13e123 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -108,7 +108,6 @@ oilify_RC = oilify.rc.o
photocopy_RC = photocopy.rc.o
plasma_RC = plasma.rc.o
plugin_browser_RC = plugin-browser.rc.o
-polar_coords_RC = polar-coords.rc.o
procedure_browser_RC = procedure-browser.rc.o
qbist_RC = qbist.rc.o
red_eye_removal_RC = red-eye-removal.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index b40a8a6..ba6a339 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -109,7 +109,6 @@
'photocopy' => { ui => 1 },
'plasma' => { ui => 1 },
'plugin-browser' => { ui => 1 },
- 'polar-coords' => { ui => 1 },
'procedure-browser' => { ui => 1 },
'qbist' => { ui => 1 },
'red-eye-removal' => { ui => 1 },
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index ee6c76e..d933e4c 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -165,6 +165,65 @@ CODE
);
}
+sub plug_in_polar_coords {
+ $blurb = 'Convert image to or from polar coordinates';
+
+ $help = <<'HELP';
+Remaps and image from rectangular coordinates to polar coordinates or
+vice versa.
+HELP
+
+ &std_pdb_misc;
+ $date = '1997';
+
+ @inargs = (
+ { name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
+ desc => 'The run mode' },
+ { name => 'image', type => 'image', dead => 1,
+ desc => 'Input image (unused)' },
+ { name => 'drawable', type => 'drawable',
+ desc => 'Input drawable' },
+ { name => 'circle', type => '0.0 <= float <= 100.0',
+ desc => 'Circle depth in %' },
+ { name => 'angle', type => '0.0 <= float < 360.0',
+ desc => 'Offset angle' },
+ { name => 'backwards', type => 'boolean',
+ desc => 'Map backwards' },
+ { name => 'inverse', type => 'boolean',
+ desc => 'Map from top' },
+ { name => 'polrec', type => 'boolean',
+ desc => 'Polar to rectangular' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:polar-coords",
+ "depth", circle,
+ "angle", angle,
+ "bw", backwards, /* XXX name */
+ "top", inverse,
+ "polar", polrec,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Polar Coordinates"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_vinvert {
$blurb = 'Invert the brightness of each pixel';
@@ -223,6 +282,7 @@ CODE
@procs = qw(plug_in_colortoalpha
plug_in_pixelize
plug_in_pixelize2
+ plug_in_polar_coords
plug_in_vinvert);
%exports = (app => [ procs], lib => []);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]