minor script-fu and plug-in tweaks

--Sven
This commit is contained in:
Sven Neumann 1999-12-21 13:57:58 +00:00
parent 9e9fbd07fc
commit f806fa9524
10 changed files with 185 additions and 145 deletions

View File

@ -1,3 +1,18 @@
Tue Dec 21 14:53:33 CET 1999 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/scripts/blend-anim.scm
* plug-ins/script-fu/scripts/copy-visible.scm
* plug-ins/script-fu/scripts/drop-shadow.scm
* plug-ins/script-fu/scripts/perspective-shadow.scm
* plug-ins/script-fu/scripts/round-corners.scm
* plug-ins/script-fu/scripts/selection-round.scm
* plug-ins/script-fu/scripts/slide.scm
* plug-ins/script-fu/scripts/waves-anim.scm: avoid calling gauss_blur
with blur-radius < 1, minor UI tweaks and email address updates
* plug-ins/common/animationplay.c: try not to crash when the image
is deleted, while playing is active
Tue Dec 21 00:07:03 EST 1999 Gregory McLean <gregm@comstar.net>
* gimp.spec: evil perl is dealt with now.

View File

@ -144,33 +144,33 @@ typedef enum
/* Declare local functions. */
static void query(void);
static void run(char *name,
int nparams,
GParam * param,
int *nreturn_vals,
GParam ** return_vals);
static void query (void);
static void run (char *name,
int nparams,
GParam *param,
int *nreturn_vals,
GParam **return_vals);
static void do_playback (void);
static int parse_ms_tag (char *str);
static DisposeType parse_disposal_tag (char *str);
static gint window_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void window_close_callback (GtkWidget *widget,
gpointer data);
static void playstop_callback (GtkWidget *widget,
gpointer data);
static void rewind_callback (GtkWidget *widget,
gpointer data);
static void step_callback (GtkWidget *widget,
gpointer data);
static gint window_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void window_close_callback (GtkWidget *widget,
gpointer data);
static void playstop_callback (GtkWidget *widget,
gpointer data);
static void rewind_callback (GtkWidget *widget,
gpointer data);
static void step_callback (GtkWidget *widget,
gpointer data);
#ifdef RAPH_IS_HOME
static void repaint_sda (GtkWidget *darea,
gpointer data);
static void repaint_da (GtkWidget *darea,
gpointer data);
static void repaint_sda (GtkWidget *darea,
gpointer data);
static void repaint_da (GtkWidget *darea,
gpointer data);
#endif
static DisposeType get_frame_disposal (guint whichframe);
@ -240,35 +240,40 @@ static GdkWindow *root_win = NULL;
MAIN()
static void query()
static void
query (void)
{
static GParamDef args[] =
{
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image"},
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image"},
{PARAM_DRAWABLE, "drawable", "Input drawable (unused)"},
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof(args) / sizeof(args[0]);
static int nreturn_vals = 0;
INIT_I18N();
INIT_I18N ();
gimp_install_procedure("plug_in_animationplay",
_("This plugin allows you to preview a GIMP layer-based animation."),
"",
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997, 1998...",
N_("<Image>/Filters/Animation/Animation Playback..."),
"RGB*, INDEXED*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
gimp_install_procedure ("plug_in_animationplay",
_("This plugin allows you to preview a GIMP layer-based animation."),
"",
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997, 1998...",
N_("<Image>/Filters/Animation/Animation Playback..."),
"RGB*, INDEXED*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
}
static void run(char *name, int n_params, GParam * param, int *nreturn_vals,
GParam ** return_vals)
static void
run (char *name,
int n_params,
GParam *param,
int *nreturn_vals,
GParam **return_vals)
{
static GParam values[1];
GRunModeType run_mode;
@ -279,24 +284,28 @@ static void run(char *name, int n_params, GParam * param, int *nreturn_vals,
run_mode = param[0].data.d_int32;
if (run_mode == RUN_NONINTERACTIVE) {
if (n_params != 3) {
status = STATUS_CALLING_ERROR;
if (run_mode == RUN_NONINTERACTIVE)
{
if (n_params != 3)
{
status = STATUS_CALLING_ERROR;
}
INIT_I18N();
}
else
{
INIT_I18N_UI();
}
INIT_I18N();
} else {
INIT_I18N_UI();
}
if (status == STATUS_SUCCESS) {
image_id = param[1].data.d_image;
do_playback();
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush();
}
if (status == STATUS_SUCCESS)
{
image_id = param[1].data.d_image;
do_playback();
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush();
}
values[0].type = PARAM_STATUS;
values[0].data.d_status = status;
@ -364,7 +373,7 @@ parse_disposal_tag (char *str)
static void
reshape_from_bitmap(gchar* bitmap)
reshape_from_bitmap (gchar* bitmap)
{
GdkBitmap *shape_mask;
static gchar *prev_bitmap = NULL;
@ -388,7 +397,8 @@ reshape_from_bitmap(gchar* bitmap)
static void
shape_pressed (GtkWidget *widget, GdkEventButton *event)
shape_pressed (GtkWidget *widget,
GdkEventButton *event)
{
CursorOffset *p;
@ -412,7 +422,8 @@ shape_pressed (GtkWidget *widget, GdkEventButton *event)
#ifdef RAPH_IS_HOME
static void
maybeblocked_expose (GtkWidget *widget, GdkEventExpose *event)
maybeblocked_expose (GtkWidget *widget,
GdkEventExpose *event)
{
if (playing)
gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "expose_event");
@ -423,7 +434,8 @@ maybeblocked_expose (GtkWidget *widget, GdkEventExpose *event)
static void
blocked_expose (GtkWidget *widget, GdkEventExpose *event)
blocked_expose (GtkWidget *widget,
GdkEventExpose *event)
{
gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "expose_event");
}
@ -432,14 +444,16 @@ blocked_expose (GtkWidget *widget, GdkEventExpose *event)
#ifdef I_AM_STUPID
static void
xblocked_expose (GtkWidget *widget, GdkEventExpose *event)
xblocked_expose (GtkWidget *widget,
GdkEventExpose *event)
{
printf("eep!\n");fflush(stdout);
abort();
}
static void
unblocked_expose (GtkWidget *widget, GdkEventExpose *event)
unblocked_expose (GtkWidget *widget,
GdkEventExpose *event)
{
gboolean should_block;
@ -527,7 +541,8 @@ shape_motion (GtkWidget *widget,
#ifdef RAPH_IS_HOME
static void
repaint_da (GtkWidget *darea, gpointer data)
repaint_da (GtkWidget *darea,
gpointer data)
{
/* printf("Repaint! Woohoo!\n");*/
gdk_draw_rgb_image (drawing_area->window,
@ -539,7 +554,8 @@ repaint_da (GtkWidget *darea, gpointer data)
static void
repaint_sda (GtkWidget *darea, gpointer data)
repaint_sda (GtkWidget *darea,
gpointer data)
{
/*printf("Repaint! Woohoo!\n");*/
gdk_draw_rgb_image (shape_drawing_area->window,
@ -552,7 +568,8 @@ repaint_sda (GtkWidget *darea, gpointer data)
static void
preview_pressed (GtkWidget *widget, GdkEventButton *event)
preview_pressed (GtkWidget *widget,
GdkEventButton *event)
{
#ifdef RAPH_IS_HOME
#else
@ -620,8 +637,8 @@ preview_pressed (GtkWidget *widget, GdkEventButton *event)
static void
build_dialog(GImageType basetype,
char* imagename)
build_dialog (GImageType basetype,
char *imagename)
{
gchar** argv;
gint argc;
@ -905,7 +922,8 @@ build_dialog(GImageType basetype,
static void do_playback(void)
static void
do_playback (void)
{
int i;
@ -969,7 +987,7 @@ static void do_playback(void)
/* Rendering Functions */
static void
render_frame(gint32 whichframe)
render_frame (gint32 whichframe)
{
GPixelRgn pixel_rgn;
static guchar *rawframe = NULL;
@ -995,9 +1013,7 @@ render_frame(gint32 whichframe)
/* Image has been closed/etc since we got the layer list? */
/* FIXME - How do we tell if a gimp_drawable_get() fails? */
if (gimp_drawable_width(drawable->id)==0)
{
window_close_callback(NULL, NULL);
}
window_close_callback (NULL, NULL);
if (((dispose==DISPOSE_REPLACE)||(whichframe==0)) &&
gimp_drawable_has_alpha(drawable->id))
@ -1616,7 +1632,7 @@ render_frame(gint32 whichframe)
it's too late (GDKRGB is synchronous). So this just updates the
progress bar. */
static void
show_frame(void)
show_frame (void)
{
#ifndef RAPH_IS_HOME
GdkGC *gc;
@ -1656,7 +1672,7 @@ show_frame(void)
static void
init_preview_misc(void)
init_preview_misc (void)
{
int i;
@ -1695,7 +1711,7 @@ init_preview_misc(void)
static void
total_alpha_preview(guchar* ptr)
total_alpha_preview (guchar* ptr)
{
int i;
@ -1720,7 +1736,7 @@ total_alpha_preview(guchar* ptr)
/* Util. */
static void
remove_timer(void)
remove_timer (void)
{
if (timer)
{
@ -1730,7 +1746,7 @@ remove_timer(void)
}
static void
do_step(void)
do_step (void)
{
frame_number = (frame_number+1)%total_frames;
render_frame(frame_number);
@ -1740,13 +1756,16 @@ static guint32
get_frame_duration (guint whichframe)
{
gchar* layer_name;
gint duration;
gint duration = 0;
layer_name = gimp_layer_get_name(layers[total_frames-(whichframe+1)]);
duration = parse_ms_tag(layer_name);
g_free(layer_name);
if (duration < 0) duration = 125; /* FIXME for default-if-not-said */
if (layer_name != NULL)
{
duration = parse_ms_tag(layer_name);
g_free(layer_name);
}
if (duration < 0) duration = 125; /* FIXME for default-if-not-said */
if (duration == 0) duration = 125; /* FIXME - 0-wait is nasty */
return ((guint32) duration);
@ -1756,17 +1775,19 @@ static DisposeType
get_frame_disposal (guint whichframe)
{
gchar* layer_name;
DisposeType disposal;
DisposeType disposal = DISPOSE_UNDEFINED;
layer_name = gimp_layer_get_name(layers[total_frames-(whichframe+1)]);
disposal = parse_disposal_tag(layer_name);
g_free(layer_name);
if (layer_name != NULL)
{
disposal = parse_disposal_tag (layer_name);
g_free (layer_name);
}
return(disposal);
return (disposal);
}
/* Callbacks */
static gint

View File

@ -16,17 +16,18 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
; blend-anim.scm version 1.02 05/28/98
; blend-anim.scm version 1.03 1999/12/21
;
; CHANGE-LOG:
; 1.00 - initial release
; 1.01 - some code cleanup, no real changes
; 1.02 - use gimp-message to output an error message if called
; with less than three layers
; 1.03 - only call blur plugin when blut-radius >= 1.0
;
; Copyright (C) 1997-98 Sven Neumann (neumanns@uni-duesseldorf.de)
;
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
;
;
; Blends two or more layers over a backgound, so that an animation can
; be saved. A minimum of three layers is required.
@ -128,11 +129,12 @@
(+ layer-height (* blur 2))
blur
blur)
(plug-in-gauss-rle 1
image
upper-copy
blur
TRUE TRUE)
(if (>= blur 1.0)
(plug-in-gauss-rle 1
image
upper-copy
blur
TRUE TRUE))
(set! blur (- max-blur blur))
(gimp-layer-set-preserve-trans lower-copy FALSE)
(set! layer-width (car (gimp-drawable-width
@ -144,11 +146,12 @@
(+ layer-height (* blur 2))
blur
blur)
(plug-in-gauss-rle 1
image
lower-copy
blur
TRUE TRUE)))
(if (>= blur 1.0)
(plug-in-gauss-rle 1
image
lower-copy
blur
TRUE TRUE))))
(gimp-layer-resize bg-copy
max-width
max-height
@ -217,14 +220,14 @@
"<Image>/Script-Fu/Animators/Blend..."
"Blend two or more layers over a background, so that an
animation can be saved"
"Sven Neumann (neumanns@uni-duesseldorf.de)"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"05/28/1998"
"1999/12/21"
"RGB RGBA GRAY GRAYA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-VALUE "Intermediate Frames" "3"
SF-VALUE "Max. Blur Radius" "0"
SF-ADJUSTMENT "Intermediate Frames" '(3 1 1024 1 10 0 1)
SF-ADJUSTMENT "Max. Blur Radius" '(0 0 1024 1 10 0 1)
SF-TOGGLE "Looped" TRUE)

View File

@ -73,7 +73,7 @@
(script-fu-register "script-fu-copy-visible"
"<Image>/Edit/Copy Visible"
"Copy the visible selction"
"Sven Neumann (neumanns@uni-duesseldorf.de), Adrian Likins <adrian@gimp.org>"
"Sven Neumann <sven@gimp.org>, Adrian Likins <adrian@gimp.org>"
"Sven Neumann, Adrian Likins"
"01/24/1998"
"RGB* INDEXED* GRAY*"

View File

@ -16,7 +16,7 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
; drop-shadow.scm version 1.03 06/03/99
; drop-shadow.scm version 1.04 1999/12/21
;
; CHANGE-LOG:
; 1.00 - initial release
@ -25,7 +25,7 @@
; 1.03 - can't call gimp-edit-fill until layer is added to image!
;
;
; Copyright (C) 1997 Sven Neumann (neumanns@uni-duesseldorf.de)
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
;
;
; Adds a drop-shadow of the current selection or alpha-channel.
@ -131,12 +131,12 @@
(gimp-edit-fill shadow-layer)
(gimp-selection-none image)
(gimp-layer-set-preserve-trans shadow-layer FALSE)
(if (> shadow-blur 0) (plug-in-gauss-rle 1
image
shadow-layer
shadow-blur
TRUE
TRUE))
(if (>= shadow-blur 1.0) (plug-in-gauss-rle 1
image
shadow-layer
shadow-blur
TRUE
TRUE))
(gimp-layer-translate shadow-layer shadow-transl-x shadow-transl-y)
(if (= from-selection TRUE)
@ -159,17 +159,17 @@
"<Image>/Script-Fu/Shadow/Drop-Shadow..."
"Add a drop-shadow of the current selection or
alpha-channel"
"Sven Neumann (neumanns@uni-duesseldorf.de)"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"12/13/1997"
"1999/12/21"
"RGB RGBA GRAY GRAYA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-VALUE "X offset" "8"
SF-VALUE "Y offset" "8"
SF-VALUE "Blur Radius" "15"
SF-ADJUSTMENT "X Offset" '(8 -4096 4096 1 10 0 1)
SF-ADJUSTMENT "Y Offset" '(8 -4096 4096 1 10 0 1)
SF-ADJUSTMENT "Blur Radius" '(15 0 1024 1 10 0 1)
SF-COLOR "Color" '(0 0 0)
SF-VALUE "Opacity" "80"
SF-ADJUSTMENT "Opacity" '(80 0 100 1 10 0 0)
SF-TOGGLE "Allow Resizing" TRUE)

View File

@ -16,15 +16,16 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
; perspective-shadow.scm version 1.02 12/13/97
; perspective-shadow.scm version 1.03 1999/12/21
;
; CHANGE-LOG:
; 1.00 - initial release
; 1.01 - fixed the problem with a remaining copy of the selection
; 1.02 - some code cleanup, no real changes
; 1.03 - only call blur plugin when blut-radius >= 1.0
;
;
; Copyright (C) 1997 Sven Neumann (neumanns@uni-duesseldorf.de)
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
;
;
; Adds a perspective shadow of the current selection or alpha-channel
@ -145,7 +146,7 @@
x2 y2
x3 y3)
(if (> shadow-blur 0)
(if (>= shadow-blur 1.0)
(begin
(gimp-layer-set-preserve-trans shadow-layer FALSE)
(gimp-layer-resize shadow-layer
@ -179,16 +180,16 @@
(script-fu-register "script-fu-perspective-shadow"
"<Image>/Script-Fu/Shadow/Perspective..."
"Add a perspective shadow"
"Sven Neumann (neumanns@uni-duesseldorf.de)"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"12/13/1997"
"1999/12/21"
"RGB RGBA GRAY GRAYA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Angle" '(45 0 180 1 10 1 0)
SF-ADJUSTMENT "Relative horizon distance" '(5 0 24 .1 1 1 1)
SF-ADJUSTMENT "Relative shadow length" '(1 0 24 .1 1 1 1)
SF-ADJUSTMENT "Blur Radius" '(3 0 64 1 10 0 0)
SF-ADJUSTMENT "Blur Radius" '(3 0 1024 1 10 0 0)
SF-COLOR "Color" '(0 0 0)
SF-ADJUSTMENT "Opacity" '(80 0 100 1 10 0 0)
SF-TOGGLE "Interpolate?" TRUE

View File

@ -16,13 +16,13 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
; round-corners.scm version 1.01 12/13/97
; round-corners.scm version 1.02 1999/12/21
;
; CHANGE-LOG:
; 1.00 - initial release
; 1.01 - some code cleanup, no real changes
;
; Copyright (C) 1997 Sven Neumann (neumanns@uni-duesseldorf.de)
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
;
;
; Rounds the corners of an image, optionally adding a drop-shadow and
@ -117,19 +117,19 @@
(script-fu-register "script-fu-round-corners"
"<Image>/Script-Fu/Decor/Round Corners..."
"Round the corners of an image and optionally adds a drop-shadow and a background"
"Sven Neumann (neumanns@uni-duesseldorf.de)"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"12/13/1997"
"1999/12/21"
"RGB GRAY"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-VALUE "Radius of Edges" "12"
SF-TOGGLE "Add drop-shadow" TRUE
SF-VALUE "Shadow x" "8"
SF-VALUE "Shadow y" "8"
SF-VALUE "Blur Radius" "15"
SF-TOGGLE "Add background" TRUE
SF-TOGGLE "Work on copy" TRUE)
SF-ADJUSTMENT "Edge Radius" '(15 0 4096 1 10 0 1)
SF-TOGGLE "Add Drop-Shadow" TRUE
SF-ADJUSTMENT "Shadow X Offset" '(8 -4096 4096 1 10 0 1)
SF-ADJUSTMENT "Shadow Y Offset" '(8 -4096 4096 1 10 0 1)
SF-ADJUSTMENT "Blur Radius" '(15 0 1024 1 10 0 1)
SF-TOGGLE "Add Background" TRUE
SF-TOGGLE "Work on Copy" TRUE)

View File

@ -16,14 +16,14 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
; selection-round.scm version 1.02 02/06/98
; selection-round.scm version 1.02 1998/02/06
;
; CHANGE-LOG:
; 1.00 - initial release
; 1.01 - some code cleanup, no real changes
; 1.02 - made script undoable
;
; Copyright (C) 1997,1998 Sven Neumann (neumanns@uni-duesseldorf.de)
; Copyright (C) 1997, 1998 Sven Neumann <sven@gimp.org>
;
;
; Rounds the current selection by cutting of rectangles from the edges and
@ -126,9 +126,9 @@
"<Image>/Script-Fu/Selection/Round..."
"Rounds the active selection. The selection should be
rectangular."
"Sven Neumann (neumanns@uni-duesseldorf.de)"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"02/06/98"
"1998/02/06"
"RGB RGBA GRAY GRAYA INDEXED INDEXEDA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0

View File

@ -16,7 +16,7 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
; slide.scm version 0.40 99/5/11
; slide.scm version 0.40 1999/5/11
;
; CHANGE-LOG:
; 0.20 - first public release
@ -31,7 +31,7 @@
; - make 'add background' an option
; - ?
;
; Copyright (C) 1997,1999 Sven Neumann (neumanns@uni-duesseldorf.de)
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
;
; makes your picture look like a slide
;
@ -229,7 +229,7 @@
"Gives the image the look of a slide"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"1999/5/11"
"1999/05/11"
"RGB GRAY"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0

View File

@ -16,13 +16,13 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
; waves-anim.scm version 1.01 12/13/97
; waves-anim.scm version 1.01 1997/12/13
;
; CHANGE-LOG:
; 1.00 - initial release
; 1.01 - some code cleanup, no real changes
;
; Copyright (C) 1997 Sven Neumann (neumanns@uni-duesseldorf.de)
; Copyright (C) 1997 Sven Neumann <sven@gimp.org>
;
;
; Makes a copy of your image and creates an animation of the active layer
@ -87,9 +87,9 @@
(script-fu-register "script-fu-waves-anim"
"<Image>/Script-Fu/Animators/Waves..."
"Animate an image like a stone's been thrown into it"
"Sven Neumann (neumanns@uni-duesseldorf.de)"
"Sven Neumann <sven@gimp.org>"
"Sven Neumann"
"12/13/1997"
"1997/13/12"
"RGB RGBA GRAY GRAYA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0