From dff3e7584ed407ac94e21da0490dbc7725de6553 Mon Sep 17 00:00:00 2001 From: Sven Neumann <sven@gimp.org> Date: Wed, 24 Aug 2005 09:51:17 +0000 Subject: [PATCH] plug-ins/script-fu/scripts/i26-gunya2.scm reverted the last change... 2005-08-24 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/scripts/i26-gunya2.scm * plug-ins/script-fu/scripts/ripply-anim.scm: reverted the last change... * plug-ins/common/displace.c: ... and fixed the plug-in instead. The number of parameters must not change. Provide a new procedure for polar mode instead. --- ChangeLog | 10 +++++++ plug-ins/common/displace.c | 35 +++++++++++++++------- plug-ins/script-fu/scripts/i26-gunya2.scm | 4 +-- plug-ins/script-fu/scripts/ripply-anim.scm | 2 +- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02435a472e..fcadc5f59d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-08-24 Sven Neumann <sven@gimp.org> + + * plug-ins/script-fu/scripts/i26-gunya2.scm + * plug-ins/script-fu/scripts/ripply-anim.scm: reverted the last + change... + + * plug-ins/common/displace.c: ... and fixed the plug-in instead. + The number of parameters must not change. Provide a new procedure + for polar mode instead. + 2005-08-24 Tor Lillqvist <tml@novell.com> * plug-ins/script-fu/scripts/i26-gunya2.scm diff --git a/plug-ins/common/displace.c b/plug-ins/common/displace.c index 0263b16f8c..30874ea3bd 100644 --- a/plug-ins/common/displace.c +++ b/plug-ins/common/displace.c @@ -44,6 +44,8 @@ #include "config.h" +#include <string.h> + #include <libgimp/gimp.h> #include <libgimp/gimpui.h> @@ -62,7 +64,7 @@ typedef enum { CARTESIAN_MODE = 0, - POLAR_MODE = 1 + POLAR_MODE = 1 } DisplaceMode; typedef struct @@ -163,8 +165,7 @@ query (void) { GIMP_PDB_INT32, "do-y", "Displace in Y or tangent direction?" }, { GIMP_PDB_DRAWABLE, "displace-map-x", "Displacement map for X or radial direction" }, { GIMP_PDB_DRAWABLE, "displace-map-y", "Displacement map for Y or tangent direction" }, - { GIMP_PDB_INT32, "displace-type", "Edge behavior: { WRAP (0), SMEAR (1), BLACK (2) }" }, - { GIMP_PDB_INT32, "mode", "Mode of displacement: { CARTESIAN (0), POLAR (1) }"} + { GIMP_PDB_INT32, "displace-type", "Edge behavior: { WRAP (0), SMEAR (1), BLACK (2) }" } }; gimp_install_procedure (PLUG_IN_PROC, @@ -173,8 +174,7 @@ query (void) "by the amounts specified by 'amount_x' and " "'amount_y' multiplied by the luminance of " "corresponding pixels in the 'displace_map' " - "drawables. If mode is polar coordinates" - "drawable is whirled and pinched according to map.", + "drawables.", "Stephen Robert Norris & (ported to 1.0 by) " "Spencer Kimball", "Stephen Robert Norris", @@ -186,6 +186,21 @@ query (void) args, NULL); gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Map"); + + gimp_install_procedure ("plug-in-displace-polar", + "Displace the contents of the specified drawable", + "Just like plug-in-displace but working in " + "polar coordinates. The drawable is whirled and " + "pinched according to the map.", + "Stephen Robert Norris & (ported to 1.0 by) " + "Spencer Kimball", + "Stephen Robert Norris", + "1996", + "Displace Polar", + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); } static void @@ -229,8 +244,7 @@ run (const gchar *name, case GIMP_RUN_NONINTERACTIVE: /* Make sure all the arguments are there! */ - /* The mode argument is optional to ensure backwards compatibility */ - if (nparams != 10 && nparams != 11) + if (nparams != 10) { status = GIMP_PDB_CALLING_ERROR; } @@ -243,10 +257,9 @@ run (const gchar *name, dvals.displace_map_x = param[7].data.d_int32; dvals.displace_map_y = param[8].data.d_int32; dvals.displace_type = param[9].data.d_int32; - if (nparams == 11) - dvals.mode = param[10].data.d_int32; - else - dvals.mode = CARTESIAN_MODE; + + dvals.mode = (strcmp (name, "plug-in-displace-polar") == 0 ? + POLAR_MODE : CARTESIAN_MODE); } break; diff --git a/plug-ins/script-fu/scripts/i26-gunya2.scm b/plug-ins/script-fu/scripts/i26-gunya2.scm index 6c93c84694..186e137368 100644 --- a/plug-ins/script-fu/scripts/i26-gunya2.scm +++ b/plug-ins/script-fu/scripts/i26-gunya2.scm @@ -59,7 +59,7 @@ (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1) ;; OK, apply it to dist-text-layer (plug-in-displace 1 img dist-text-layer radius radius 1 1 - distortion-layer distortion-layer 0 0) + distortion-layer distortion-layer 0) ;; make the distortion data once again fro the frame (gimp-edit-fill distortion-layer BACKGROUND-FILL) (plug-in-noisify 1 distortion-img distortion-layer FALSE prob prob prob 0.0) @@ -68,7 +68,7 @@ (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1) ;; then, apply it to dist-frame-layer (plug-in-displace 1 img dist-frame-layer radius radius 1 1 - distortion-layer distortion-layer 0 0) + distortion-layer distortion-layer 0) ;; Finally, clear the bottom layer (text-layer) (gimp-selection-all img) (gimp-context-set-background '(255 255 255)) diff --git a/plug-ins/script-fu/scripts/ripply-anim.scm b/plug-ins/script-fu/scripts/ripply-anim.scm index 2d2cbe7410..a28a5f14f8 100644 --- a/plug-ins/script-fu/scripts/ripply-anim.scm +++ b/plug-ins/script-fu/scripts/ripply-anim.scm @@ -93,7 +93,7 @@ (set! dup-layer (car (gimp-image-get-active-layer dup-image))) (plug-in-displace 1 out-imagestack this-layer displacement displacement - TRUE TRUE dup-layer dup-layer edge-type 0) + TRUE TRUE dup-layer dup-layer edge-type) (gimp-image-undo-enable dup-image) (gimp-image-delete dup-image)