With this commit we finally say goodbye to SIOD. This large set of changes

2006-10-15  Kevin Cozens  <kcozens@cvs.gnome.org>

	With this commit we finally say goodbye to SIOD. This large set of
	changes updates the Script-Fu plug-in to use the TinyScheme Scheme
	interpreter. These changes originated with changes originally made
	to Script-Fu which created Tiny-Fu (aka. the gimp-tiny-fu module).

	* plug-ins/script-fu/Makefile.am
	* plug-ins/script-fu/script-fu-console.c
	* plug-ins/script-fu/script-fu-interface.c
	* plug-ins/script-fu/script-fu-scripts.c
	* plug-ins/script-fu/script-fu-scripts.h
	* plug-ins/script-fu/script-fu-server.c
	* plug-ins/script-fu/script-fu-text-console.c
	* plug-ins/script-fu/script-fu.c: Updated with the changes made to
	these files as part of the work on the Tiny-Fu project.

	* plug-ins/script-fu/scheme-wrapper.c
	* plug-ins/script-fu/scheme-wrapper.h: Renamed from siod-wrapper.[ch]
	and updated based on differences to ts-wrapper.[ch] from gimp-tiny-fu.

	* plug-ins/script-fu/ftx/*
	* plug-ins/script-fu/re/*
	* plug-ins/script-fu/tinyscheme/*
	* plug-ins/script-fu/scripts/script-fu.init
	* plug-ins/script-fu/scripts/script-fu-compat.init
	* plug-ins/script-fu/scripts/contactsheet.scm
	* plug-ins/script-fu/scripts/script-fu-set-cmap.scm
	* plug-ins/script-fu/scripts/script-fu-util-setpt.scm
	* plug-ins/script-fu/scripts/ts-helloworld.scm: Added all of these
	files and directories from Tiny-Fu. Updated the Makefile.am files
	of ftx, re, and tinyscheme now they are in the GIMP source tree.

	* plug-ins/script-fu/scripts/*.scm: All scripts have been updated as
	needed to ensure they will work with the TinyScheme interpreter. Most
	of the files have been reformatted making it easier to see the syntax
	of Scheme and making them easier to read.

	* plug-ins/script-fu/scripts/Makefile.am: Updated script file lists.

	* plug-ins/script-fu/siod-wrapper.c
	* plug-ins/script-fu/siod-wrapper.h
	* plug-ins/script-fu/siod/*: Removed obsolete files.

	* configure.in: Updated list of files in AC_CONFIG_FILES. Changed
	--disable-script-fu to --without-script-fu which it should have
	been when originally added.

	* INSTALL: Updated to show change to --without-script-fu.
This commit is contained in:
Kevin Cozens
2006-10-16 01:08:54 +00:00
committed by Kevin Cozens
parent 9314c3ea8e
commit 6239dddda3
127 changed files with 9946 additions and 17357 deletions

View File

@ -1,3 +1,53 @@
2006-10-15 Kevin Cozens <kcozens@cvs.gnome.org>
With this commit we finally say goodbye to SIOD. This large set of
changes updates the Script-Fu plug-in to use the TinyScheme Scheme
interpreter. These changes originated with changes originally made
to Script-Fu which created Tiny-Fu (aka. the gimp-tiny-fu module).
* plug-ins/script-fu/Makefile.am
* plug-ins/script-fu/script-fu-console.c
* plug-ins/script-fu/script-fu-interface.c
* plug-ins/script-fu/script-fu-scripts.c
* plug-ins/script-fu/script-fu-scripts.h
* plug-ins/script-fu/script-fu-server.c
* plug-ins/script-fu/script-fu-text-console.c
* plug-ins/script-fu/script-fu.c: Updated with the changes made to
these files as part of the work on the Tiny-Fu project.
* plug-ins/script-fu/scheme-wrapper.c
* plug-ins/script-fu/scheme-wrapper.h: Renamed from siod-wrapper.[ch]
and updated based on differences to ts-wrapper.[ch] from gimp-tiny-fu.
* plug-ins/script-fu/ftx/*
* plug-ins/script-fu/re/*
* plug-ins/script-fu/tinyscheme/*
* plug-ins/script-fu/scripts/script-fu.init
* plug-ins/script-fu/scripts/script-fu-compat.init
* plug-ins/script-fu/scripts/contactsheet.scm
* plug-ins/script-fu/scripts/script-fu-set-cmap.scm
* plug-ins/script-fu/scripts/script-fu-util-setpt.scm
* plug-ins/script-fu/scripts/ts-helloworld.scm: Added all of these
files and directories from Tiny-Fu. Updated the Makefile.am files
of ftx, re, and tinyscheme now they are in the GIMP source tree.
* plug-ins/script-fu/scripts/*.scm: All scripts have been updated as
needed to ensure they will work with the TinyScheme interpreter. Most
of the files have been reformatted making it easier to see the syntax
of Scheme and making them easier to read.
* plug-ins/script-fu/scripts/Makefile.am: Updated script file lists.
* plug-ins/script-fu/siod-wrapper.c
* plug-ins/script-fu/siod-wrapper.h
* plug-ins/script-fu/siod/*: Removed obsolete files.
* configure.in: Updated list of files in AC_CONFIG_FILES. Changed
--disable-script-fu to --without-script-fu which it should have
been when originally added.
* INSTALL: Updated to show change to --without-script-fu.
2006-10-15 Michael Natterer <mitch@gimp.org> 2006-10-15 Michael Natterer <mitch@gimp.org>
* app/file/file-utils.c (file_utils_filename_to_uri): if the * app/file/file-utils.c (file_utils_filename_to_uri): if the

View File

@ -197,8 +197,8 @@ These are:
--disable-python. If for some reason you don't want to build the --disable-python. If for some reason you don't want to build the
Python based pygimp plug-in, you can use --disable-python. Python based pygimp plug-in, you can use --disable-python.
--disable-script-fu. If for some reason you don't want to build the --without-script-fu. If for some reason you don't want to build the
Script-Fu plug-in, you can use --disable-script-fu. Script-Fu plug-in, you can use --without-script-fu.
The `make' command builds several things: The `make' command builds several things:
- A bunch of public libraries in the directories starting with 'libgimp'. - A bunch of public libraries in the directories starting with 'libgimp'.

View File

@ -1479,16 +1479,17 @@ AM_CONDITIONAL(BUILD_PYTHON, test "x$enable_python" != xno)
# Check whether script_fu should be built # Check whether script_fu should be built
######################################### #########################################
AC_ARG_ENABLE(script-fu, have_script_fu=yes
AC_HELP_STRING([--disable-script-fu], AC_ARG_WITH(script-fu,
AC_HELP_STRING([--without-script-fu],
[do not build the script-fu extension])) [do not build the script-fu extension]))
if test "x$enable_script_fu" != "xno"; then if test "x$have_script_fu" = "xyes"; then
enable_script_fu="yes" have_script_fu="yes"
else else
enable_script_fu="no (script-fu extension disabled)" have_script_fu="no (script-fu extension disabled)"
fi fi
AM_CONDITIONAL(BUILD_SCRIPT_FU, test "x$enable_script_fu" == "xyes") AM_CONDITIONAL(BUILD_SCRIPT_FU, test "x$have_script_fu" == "xyes")
########################################################### ###########################################################
@ -1737,7 +1738,9 @@ app/widgets/Makefile
app/xcf/Makefile app/xcf/Makefile
plug-ins/Makefile plug-ins/Makefile
plug-ins/script-fu/Makefile plug-ins/script-fu/Makefile
plug-ins/script-fu/siod/Makefile plug-ins/script-fu/ftx/Makefile
plug-ins/script-fu/re/Makefile
plug-ins/script-fu/tinyscheme/Makefile
plug-ins/script-fu/scripts/Makefile plug-ins/script-fu/scripts/Makefile
plug-ins/script-fu/scripts/images/Makefile plug-ins/script-fu/scripts/images/Makefile
plug-ins/xjt/Makefile plug-ins/xjt/Makefile
@ -1878,7 +1881,8 @@ Optional Plug-Ins:
PNG: $have_libpng PNG: $have_libpng
Print: $enable_print Print: $enable_print
PSP: $have_zlib PSP: $have_zlib
Script-Fu: $enable_script_fu Python: $enable_python
Script-Fu: $have_script_fu
SVG: $have_librsvg SVG: $have_librsvg
TIFF: $have_libtiff TIFF: $have_libtiff
TWAIN (MacOS X): $mac_twain_ok TWAIN (MacOS X): $mac_twain_ok

View File

@ -8,14 +8,27 @@ libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
libtinyscheme=tinyscheme/libtinyscheme.a
libftx=ftx/libftx.a
libre=re/libre.a
if OS_WIN32 if OS_WIN32
mwindows = -mwindows mwindows = -mwindows
WINSOCK_LIBS = -lws2_32 WINSOCK_LIBS = -lws2_32
endif endif
AM_CFLAGS = \
-DUSE_INTERFACE=1 \
-DUSE_STRCASECMP=1 \
-DUSE_STRLWR=1 \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
-I$(includedir)
AM_LDFLAGS = $(mwindows) AM_LDFLAGS = $(mwindows)
SUBDIRS = siod scripts SUBDIRS = tinyscheme ftx re scripts
libexecdir = $(gimpplugindir)/plug-ins libexecdir = $(gimpplugindir)/plug-ins
@ -36,13 +49,8 @@ script_fu_SOURCES = \
script-fu-server.h \ script-fu-server.h \
script-fu-types.h \ script-fu-types.h \
script-fu-enums.h \ script-fu-enums.h \
siod-wrapper.c \ scheme-wrapper.c \
siod-wrapper.h scheme-wrapper.h
INCLUDES = \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
-I$(includedir)
if HAVE_GLIBC_REGEX if HAVE_GLIBC_REGEX
REGEXREPL = REGEXREPL =
@ -58,7 +66,9 @@ LDADD = \
$(libgimp) \ $(libgimp) \
$(libgimpcolor) \ $(libgimpcolor) \
$(libgimpbase) \ $(libgimpbase) \
siod/libsiod.a \ $(libtinyscheme) \
$(libftx) \
$(libre) \
$(REGEXREPL) \ $(REGEXREPL) \
$(GTK_LIBS) \ $(GTK_LIBS) \
$(SOCKET_LIBS) \ $(SOCKET_LIBS) \

View File

@ -2,8 +2,8 @@
AM_CFLAGS = \ AM_CFLAGS = \
-DUSE_INTERFACE=1 \ -DUSE_INTERFACE=1 \
-I$(top_srcdir) \ -I.. \
$(GIMP_CFLAGS) $(GLIB_CFLAGS)
noinst_LIBRARIES = libftx.a noinst_LIBRARIES = libftx.a

View File

@ -2,8 +2,8 @@
AM_CFLAGS = \ AM_CFLAGS = \
-DUSE_INTERFACE=1 \ -DUSE_INTERFACE=1 \
-I$(top_srcdir) \ -I.. \
$(GIMP_CFLAGS) $(GLIB_CFLAGS)
noinst_LIBRARIES = libre.a noinst_LIBRARIES = libre.a

File diff suppressed because it is too large Load Diff

View File

@ -16,31 +16,29 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef SIOD_WRAPPER_H #ifndef SCHEME_WRAPPER_H
#define SIOD_WRAPPER_H #define SCHEME_WRAPPER_H
FILE * ts_get_output_file (void);
void ts_set_output_file (FILE *file);
void siod_init (gboolean register_scripts); void ts_set_console_mode (int flag);
FILE * siod_get_output_file (void); gint ts_get_verbose_level (void);
void siod_set_output_file (FILE *file); void ts_set_verbose_level (gint);
void siod_set_console_mode (int flag); void ts_set_print_flag (gint);
void ts_print_welcome (void);
gint siod_get_verbose_level (void); const gchar * ts_get_error_msg (void);
void siod_set_verbose_level (gint verbose_level); const gchar * ts_get_success_msg (void);
void siod_print_welcome (void); void tinyscheme_init (gboolean);
void tinyscheme_deinit (void);
const gchar * siod_get_error_msg (void); void ts_output_string (FILE *fp, char *string, int len);
const gchar * siod_get_success_msg (void);
void siod_output_string (FILE *fp,
const gchar *format,
...) G_GNUC_PRINTF (2, 3);
/* if the return value is 0, success. error otherwise. */ /* if the return value is 0, success. error otherwise. */
gint siod_interpret_string (const gchar *expr); gint ts_interpret_string (const gchar *);
#endif /* SCHEME_WRAPPER_H */
#endif /* SIOD_WRAPPER_H */

View File

@ -18,6 +18,7 @@
#include "config.h" #include "config.h"
#include <errno.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
@ -25,7 +26,8 @@
#include "script-fu-intl.h" #include "script-fu-intl.h"
#include "siod-wrapper.h" #include "tinyscheme/scheme.h"
#include "scheme-wrapper.h"
#include "script-fu-console.h" #include "script-fu-console.h"
@ -54,6 +56,10 @@ typedef struct
} ConsoleInterface; } ConsoleInterface;
enum TF_RESPONSES {
RESPONSE_CLEAR, RESPONSE_SAVE
};
/* /*
* Local Functions * Local Functions
*/ */
@ -61,6 +67,10 @@ static void script_fu_console_interface (void);
static void script_fu_response (GtkWidget *widget, static void script_fu_response (GtkWidget *widget,
gint response_id, gint response_id,
ConsoleInterface *console); ConsoleInterface *console);
static void script_fu_save_dialog (GtkWidget *parent);
static void script_fu_save_output (GtkWidget *dialog,
gint response_id,
gpointer data);
static void script_fu_browse_callback (GtkWidget *widget, static void script_fu_browse_callback (GtkWidget *widget,
ConsoleInterface *console); ConsoleInterface *console);
static void script_fu_browse_response (GtkWidget *widget, static void script_fu_browse_response (GtkWidget *widget,
@ -72,8 +82,8 @@ static gboolean script_fu_cc_key_function (GtkWidget *widget,
GdkEventKey *event, GdkEventKey *event,
ConsoleInterface *console); ConsoleInterface *console);
static void script_fu_open_siod_console (void); static void script_fu_open_ts_console (void);
static void script_fu_close_siod_console (void); static void script_fu_close_ts_console (void);
/* /*
@ -102,18 +112,18 @@ static ConsoleInterface cint =
void void
script_fu_console_run (const gchar *name, script_fu_console_run (const gchar *name,
gint nparams, gint nparams,
const GimpParam *params, const GimpParam *params,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
static GimpParam values[1]; static GimpParam values[1];
script_fu_open_siod_console (); script_fu_open_ts_console ();
script_fu_console_interface (); script_fu_console_interface ();
script_fu_close_siod_console (); script_fu_close_ts_console ();
*nreturn_vals = 1; *nreturn_vals = 1;
*return_vals = values; *return_vals = values;
@ -146,29 +156,31 @@ script_fu_console_interface (void)
NULL, 0, NULL, 0,
gimp_standard_help_func, PROC_NAME, gimp_standard_help_func, PROC_NAME,
_("_Save Output"), RESPONSE_SAVE,
_("Cl_ear Output"), RESPONSE_CLEAR,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL); NULL);
g_signal_connect (console->dialog, "response", g_signal_connect (console->dialog, "response",
G_CALLBACK (script_fu_response), G_CALLBACK (script_fu_response),
console); console);
g_signal_connect (console->dialog, "destroy", g_signal_connect (console->dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
&console->dialog); &console->dialog);
/* The main vbox */ /* The main vbox */
vbox = gtk_vbox_new (FALSE, 12); vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (console->dialog)->vbox), vbox, gtk_box_pack_start (GTK_BOX (GTK_DIALOG (console->dialog)->vbox), vbox,
TRUE, TRUE, 0); TRUE, TRUE, 0);
gtk_widget_show (vbox); gtk_widget_show (vbox);
/* The output text widget */ /* The output text widget */
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS); GTK_POLICY_ALWAYS);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window); gtk_widget_show (scrolled_window);
@ -184,25 +196,24 @@ script_fu_console_interface (void)
gtk_widget_show (console->text_view); gtk_widget_show (console->text_view);
gtk_text_buffer_create_tag (console->console, "strong", gtk_text_buffer_create_tag (console->console, "strong",
"weight", PANGO_WEIGHT_BOLD, "weight", PANGO_WEIGHT_BOLD,
"size", 12 * PANGO_SCALE, "size", 12 * PANGO_SCALE,
NULL); NULL);
gtk_text_buffer_create_tag (console->console, "emphasis", gtk_text_buffer_create_tag (console->console, "emphasis",
"style", PANGO_STYLE_OBLIQUE, "style", PANGO_STYLE_OBLIQUE,
"size", 10 * PANGO_SCALE, "size", 10 * PANGO_SCALE,
NULL); NULL);
gtk_text_buffer_create_tag (console->console, "weak", gtk_text_buffer_create_tag (console->console, "weak",
"size", 10 * PANGO_SCALE, "size", 10 * PANGO_SCALE,
NULL); NULL);
{ {
const gchar *greeting_texts[] = const gchar *greeting_texts[] =
{ {
"weak", "\n", "strong", _("Welcome to TinyScheme\n"),
"strong", "Welcome to SIOD, Scheme In One Defun\n", "weak", _("Copyright (c) Dimitrios Souflis\n\n"),
"weak", "(C) Copyright 1988-1994 Paradigm Associates Inc.\n\n", "strong", _("Script-Fu Console - "),
"strong", "Script-Fu Console - ", "emphasis", _("Interactive Scheme Development"),
"emphasis", "Interactive Scheme Development\n",
NULL NULL
}; };
@ -213,10 +224,10 @@ script_fu_console_interface (void)
for (i = 0; greeting_texts[i]; i += 2) for (i = 0; greeting_texts[i]; i += 2)
{ {
gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor, gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor,
greeting_texts[i + 1], -1, greeting_texts[i + 1], -1,
greeting_texts[i], greeting_texts[i],
NULL); NULL);
} }
} }
@ -231,8 +242,8 @@ script_fu_console_interface (void)
gtk_widget_show (console->cc); gtk_widget_show (console->cc);
g_signal_connect (console->cc, "key-press-event", g_signal_connect (console->cc, "key-press-event",
G_CALLBACK (script_fu_cc_key_function), G_CALLBACK (script_fu_cc_key_function),
console); console);
button = gtk_button_new_with_mnemonic (_("_Browse...")); button = gtk_button_new_with_mnemonic (_("_Browse..."));
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0); gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
@ -240,8 +251,8 @@ script_fu_console_interface (void)
gtk_widget_show (button); gtk_widget_show (button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (script_fu_browse_callback), G_CALLBACK (script_fu_browse_callback),
console); console);
/* Initialize the history */ /* Initialize the history */
console->history = g_list_append (console->history, NULL); console->history = g_list_append (console->history, NULL);
@ -262,12 +273,95 @@ script_fu_response (GtkWidget *widget,
gint response_id, gint response_id,
ConsoleInterface *console) ConsoleInterface *console)
{ {
GtkTextIter start, end;
switch (response_id)
{
case RESPONSE_CLEAR:
gtk_text_buffer_get_start_iter (console->console, &start);
gtk_text_buffer_get_end_iter (console->console, &end);
gtk_text_buffer_delete (console->console, &start, &end);
break;
case RESPONSE_SAVE:
script_fu_save_dialog(widget);
break;
default:
gtk_main_quit (); gtk_main_quit ();
break;
}
}
static void
script_fu_save_dialog(GtkWidget *parent)
{
static GtkWidget *dialog = NULL;
if (! dialog)
{
dialog =
gtk_file_chooser_dialog_new (_("Save TinyScheme Output"),
NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (script_fu_save_output),
NULL);
}
gtk_window_present (GTK_WINDOW (dialog));
}
static void
script_fu_save_output (GtkWidget *dialog,
gint response_id,
gpointer data)
{
GtkTextIter start, end;
if (response_id == GTK_RESPONSE_ACCEPT)
{
gchar *filename;
gchar *str;
FILE *fh;
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
fh = fopen (filename, "w");
if (! fh)
{
gchar *message =
g_strdup_printf ("Could not open '%s' for writing: %s",
gimp_filename_to_utf8 (filename),
g_strerror (errno));
g_message (message);
g_free (message);
g_free (filename);
return;
}
gtk_text_buffer_get_start_iter (cint.console, &start);
gtk_text_buffer_get_end_iter (cint.console, &end);
str = gtk_text_buffer_get_text (cint.console, &start, &end, TRUE);
fputs (str, fh);
fclose (fh);
}
gtk_widget_destroy (dialog);
} }
static void static void
script_fu_browse_callback (GtkWidget *widget, script_fu_browse_callback (GtkWidget *widget,
ConsoleInterface *console) ConsoleInterface *console)
{ {
if (! console->proc_browser) if (! console->proc_browser)
{ {
@ -415,7 +509,7 @@ script_fu_cc_is_empty (ConsoleInterface *console)
while (*str) while (*str)
{ {
if (*str != ' ' && *str != '\t' && *str != '\n') if (*str != ' ' && *str != '\t' && *str != '\n')
return FALSE; return FALSE;
str ++; str ++;
} }
@ -425,8 +519,8 @@ script_fu_cc_is_empty (ConsoleInterface *console)
static gboolean static gboolean
script_fu_cc_key_function (GtkWidget *widget, script_fu_cc_key_function (GtkWidget *widget,
GdkEventKey *event, GdkEventKey *event,
ConsoleInterface *console) ConsoleInterface *console)
{ {
GList *list; GList *list;
gint direction = 0; gint direction = 0;
@ -436,20 +530,20 @@ script_fu_cc_key_function (GtkWidget *widget,
{ {
case GDK_Return: case GDK_Return:
if (script_fu_cc_is_empty (console)) if (script_fu_cc_is_empty (console))
return TRUE; return TRUE;
list = g_list_nth (console->history, list = g_list_nth (console->history,
(g_list_length (console->history) - 1)); (g_list_length (console->history) - 1));
if (list->data) if (list->data)
g_free (list->data); g_free (list->data);
list->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (console->cc))); list->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (console->cc)));
gtk_text_buffer_get_end_iter (console->console, &cursor); gtk_text_buffer_get_end_iter (console->console, &cursor);
gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor, gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor,
"\n=> ", -1, "\n=> ", -1,
"strong", "strong",
NULL); NULL);
gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor, gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor,
gtk_entry_get_text (GTK_ENTRY (console->cc)), -1, gtk_entry_get_text (GTK_ENTRY (console->cc)), -1,
@ -457,27 +551,27 @@ script_fu_cc_key_function (GtkWidget *widget,
NULL); NULL);
gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor, gtk_text_buffer_insert_with_tags_by_name (console->console, &cursor,
"\n", -1, "\n", -1,
"weak", "weak",
NULL); NULL);
script_fu_console_scroll_end (console); script_fu_console_scroll_end (console);
gtk_entry_set_text (GTK_ENTRY (console->cc), ""); gtk_entry_set_text (GTK_ENTRY (console->cc), "");
siod_interpret_string ((const gchar *) list->data); ts_interpret_string ((char *) list->data);
gimp_displays_flush (); gimp_displays_flush ();
console->history = g_list_append (console->history, NULL); console->history = g_list_append (console->history, NULL);
if (console->history_len == console->history_max) if (console->history_len == console->history_max)
{ {
console->history = g_list_remove (console->history, console->history = g_list_remove (console->history,
console->history->data); console->history->data);
if (console->history->data) if (console->history->data)
g_free (console->history->data); g_free (console->history->data);
} }
else else
console->history_len++; console->history_len++;
console->history_cur = g_list_length (console->history) - 1; console->history_cur = g_list_length (console->history) - 1;
return TRUE; return TRUE;
@ -513,21 +607,21 @@ script_fu_cc_key_function (GtkWidget *widget,
{ {
/* Make sure we keep track of the current one */ /* Make sure we keep track of the current one */
if (console->history_cur == g_list_length (console->history) - 1) if (console->history_cur == g_list_length (console->history) - 1)
{ {
list = g_list_nth (console->history, console->history_cur); list = g_list_nth (console->history, console->history_cur);
if (list->data) if (list->data)
g_free (list->data); g_free (list->data);
list->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (console->cc))); list->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (console->cc)));
} }
console->history_cur += direction; console->history_cur += direction;
if (console->history_cur < 0) if (console->history_cur < 0)
console->history_cur = 0; console->history_cur = 0;
if (console->history_cur >= console->history_len) if (console->history_cur >= console->history_len)
console->history_cur = console->history_len - 1; console->history_cur = console->history_len - 1;
gtk_entry_set_text (GTK_ENTRY (console->cc), gtk_entry_set_text (GTK_ENTRY (console->cc),
(gchar *) (g_list_nth (console->history, (gchar *) (g_list_nth (console->history,
console->history_cur))->data); console->history_cur))->data);
gtk_editable_set_position (GTK_EDITABLE (console->cc), -1); gtk_editable_set_position (GTK_EDITABLE (console->cc), -1);
@ -539,31 +633,34 @@ script_fu_cc_key_function (GtkWidget *widget,
} }
static void static void
script_fu_open_siod_console (void) script_fu_open_ts_console (void)
{ {
siod_set_console_mode (1); ts_set_print_flag (1);
siod_set_verbose_level (2); ts_set_console_mode (1);
ts_set_verbose_level (2);
ts_print_welcome ();
} }
static void static void
script_fu_close_siod_console (void) script_fu_close_ts_console (void)
{ {
FILE *siod_output; FILE *output_file;
siod_output = siod_get_output_file (); ts_set_print_flag (0);
output_file = ts_get_output_file ();
if (siod_output != stdout) if (output_file != stdout)
fclose (siod_output); fclose (output_file);
siod_set_console_mode (0); ts_set_console_mode (0);
} }
void void
script_fu_eval_run (const gchar *name, script_fu_eval_run (const gchar *name,
gint nparams, gint nparams,
const GimpParam *params, const GimpParam *params,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
static GimpParam values[1]; static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
@ -574,15 +671,11 @@ script_fu_eval_run (const gchar *name,
switch (run_mode) switch (run_mode)
{ {
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
if (siod_interpret_string (params[1].data.d_string) != 0) /* Disable Script-Fu output */
{ ts_set_output_file (stdout);
const gchar *msg = siod_get_error_msg (); ts_set_verbose_level (0);
if (ts_interpret_string (params[1].data.d_string) != 0)
if (msg)
g_printerr (msg);
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
}
break; break;
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_INTERACTIVE:

View File

@ -23,7 +23,8 @@
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h> #include <libgimp/gimpui.h>
#include "siod/siod.h" #include "tinyscheme/scheme-private.h"
#include "scheme-wrapper.h"
#include "script-fu-types.h" #include "script-fu-types.h"
@ -108,7 +109,7 @@ static void script_fu_brush_callback (gpointer data,
*/ */
static SFInterface *sf_interface = NULL; /* there can only be at most one static SFInterface *sf_interface = NULL; /* there can only be at most one
interactive interface */ interactive interface */
/* /*
@ -135,9 +136,9 @@ script_fu_interface_report_cc (const gchar *command)
sf_interface->command_count++; sf_interface->command_count++;
new_command = g_strdup_printf ("%s <%d>", new_command = g_strdup_printf ("%s <%d>",
command, sf_interface->command_count); command, sf_interface->command_count);
gtk_label_set_text (GTK_LABEL (sf_interface->progress_label), gtk_label_set_text (GTK_LABEL (sf_interface->progress_label),
new_command); new_command);
g_free (new_command); g_free (new_command);
} }
else else
@ -289,241 +290,241 @@ script_fu_interface (SFScript *script)
gettext (script->arg_labels[i])); gettext (script->arg_labels[i]));
switch (script->arg_types[i]) switch (script->arg_types[i])
{ {
case SF_IMAGE: case SF_IMAGE:
case SF_DRAWABLE: case SF_DRAWABLE:
case SF_LAYER: case SF_LAYER:
case SF_CHANNEL: case SF_CHANNEL:
switch (script->arg_types[i]) switch (script->arg_types[i])
{ {
case SF_IMAGE: case SF_IMAGE:
widget = gimp_image_combo_box_new (NULL, NULL); widget = gimp_image_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_image; ID_ptr = &script->arg_values[i].sfa_image;
break; break;
case SF_DRAWABLE: case SF_DRAWABLE:
widget = gimp_drawable_combo_box_new (NULL, NULL); widget = gimp_drawable_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_drawable; ID_ptr = &script->arg_values[i].sfa_drawable;
break; break;
case SF_LAYER: case SF_LAYER:
widget = gimp_layer_combo_box_new (NULL, NULL); widget = gimp_layer_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_layer; ID_ptr = &script->arg_values[i].sfa_layer;
break; break;
case SF_CHANNEL: case SF_CHANNEL:
widget = gimp_channel_combo_box_new (NULL, NULL); widget = gimp_channel_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_channel; ID_ptr = &script->arg_values[i].sfa_channel;
break; break;
default: default:
menu = NULL; menu = NULL;
break; break;
} }
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (widget), *ID_ptr, gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (widget), *ID_ptr,
G_CALLBACK (gimp_int_combo_box_get_active), G_CALLBACK (gimp_int_combo_box_get_active),
ID_ptr); ID_ptr);
break; break;
case SF_COLOR: case SF_COLOR:
left_align = TRUE; left_align = TRUE;
widget = gimp_color_button_new (_("Script-Fu Color Selection"), widget = gimp_color_button_new (_("Script-Fu Color Selection"),
COLOR_SAMPLE_WIDTH, COLOR_SAMPLE_WIDTH,
COLOR_SAMPLE_HEIGHT, COLOR_SAMPLE_HEIGHT,
&script->arg_values[i].sfa_color, &script->arg_values[i].sfa_color,
GIMP_COLOR_AREA_FLAT); GIMP_COLOR_AREA_FLAT);
gimp_color_button_set_update (GIMP_COLOR_BUTTON (widget), TRUE); gimp_color_button_set_update (GIMP_COLOR_BUTTON (widget), TRUE);
g_signal_connect (widget, "color-changed", g_signal_connect (widget, "color-changed",
G_CALLBACK (gimp_color_button_get_color), G_CALLBACK (gimp_color_button_get_color),
&script->arg_values[i].sfa_color); &script->arg_values[i].sfa_color);
break; break;
case SF_TOGGLE: case SF_TOGGLE:
g_free (label_text); g_free (label_text);
label_text = NULL; label_text = NULL;
widget = widget =
gtk_check_button_new_with_mnemonic (gettext (script->arg_labels[i])); gtk_check_button_new_with_mnemonic (gettext (script->arg_labels[i]));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
script->arg_values[i].sfa_toggle); script->arg_values[i].sfa_toggle);
g_signal_connect (widget, "toggled", g_signal_connect (widget, "toggled",
G_CALLBACK (gimp_toggle_button_update), G_CALLBACK (gimp_toggle_button_update),
&script->arg_values[i].sfa_toggle); &script->arg_values[i].sfa_toggle);
break; break;
case SF_VALUE: case SF_VALUE:
case SF_STRING: case SF_STRING:
widget = gtk_entry_new (); widget = gtk_entry_new ();
gtk_widget_set_size_request (widget, TEXT_WIDTH, -1); gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
gtk_entry_set_text (GTK_ENTRY (widget), gtk_entry_set_text (GTK_ENTRY (widget),
script->arg_values[i].sfa_value); script->arg_values[i].sfa_value);
break; break;
case SF_TEXT: case SF_TEXT:
{
GtkWidget *view;
GtkTextBuffer *buffer;
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);
view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (widget), view);
gtk_widget_show (view);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);
gtk_text_buffer_set_text (buffer,
script->arg_values[i].sfa_value, -1);
label_yalign = 0.0;
}
break;
case SF_ADJUSTMENT:
switch (script->arg_defaults[i].sfa_adjustment.type)
{ {
GtkWidget *view; case SF_SLIDER:
GtkTextBuffer *buffer; script->arg_values[i].sfa_adjustment.adj = (GtkAdjustment *)
gimp_scale_entry_new (GTK_TABLE (sf_interface->table),
widget = gtk_scrolled_window_new (NULL, NULL); 0, row,
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget), label_text, SLIDER_WIDTH, -1,
GTK_SHADOW_IN); script->arg_values[i].sfa_adjustment.value,
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget), script->arg_defaults[i].sfa_adjustment.lower,
GTK_POLICY_AUTOMATIC, script->arg_defaults[i].sfa_adjustment.upper,
GTK_POLICY_AUTOMATIC); script->arg_defaults[i].sfa_adjustment.step,
gtk_widget_set_size_request (widget, TEXT_WIDTH, -1); script->arg_defaults[i].sfa_adjustment.page,
script->arg_defaults[i].sfa_adjustment.digits,
view = gtk_text_view_new (); TRUE, 0.0, 0.0,
gtk_container_add (GTK_CONTAINER (widget), view); NULL, NULL);
gtk_widget_show (view);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);
gtk_text_buffer_set_text (buffer,
script->arg_values[i].sfa_value, -1);
label_yalign = 0.0;
}
break;
case SF_ADJUSTMENT:
switch (script->arg_defaults[i].sfa_adjustment.type)
{
case SF_SLIDER:
script->arg_values[i].sfa_adjustment.adj = (GtkAdjustment *)
gimp_scale_entry_new (GTK_TABLE (sf_interface->table),
0, row,
label_text, SLIDER_WIDTH, -1,
script->arg_values[i].sfa_adjustment.value,
script->arg_defaults[i].sfa_adjustment.lower,
script->arg_defaults[i].sfa_adjustment.upper,
script->arg_defaults[i].sfa_adjustment.step,
script->arg_defaults[i].sfa_adjustment.page,
script->arg_defaults[i].sfa_adjustment.digits,
TRUE, 0.0, 0.0,
NULL, NULL);
gtk_entry_set_activates_default (GIMP_SCALE_ENTRY_SPINBUTTON (script->arg_values[i].sfa_adjustment.adj), TRUE); gtk_entry_set_activates_default (GIMP_SCALE_ENTRY_SPINBUTTON (script->arg_values[i].sfa_adjustment.adj), TRUE);
break; break;
case SF_SPINNER: case SF_SPINNER:
left_align = TRUE; left_align = TRUE;
widget = widget =
gimp_spin_button_new (&adj, gimp_spin_button_new (&adj,
script->arg_values[i].sfa_adjustment.value, script->arg_values[i].sfa_adjustment.value,
script->arg_defaults[i].sfa_adjustment.lower, script->arg_defaults[i].sfa_adjustment.lower,
script->arg_defaults[i].sfa_adjustment.upper, script->arg_defaults[i].sfa_adjustment.upper,
script->arg_defaults[i].sfa_adjustment.step, script->arg_defaults[i].sfa_adjustment.step,
script->arg_defaults[i].sfa_adjustment.page, script->arg_defaults[i].sfa_adjustment.page,
0, 0, 0, 0,
script->arg_defaults[i].sfa_adjustment.digits); script->arg_defaults[i].sfa_adjustment.digits);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
script->arg_values[i].sfa_adjustment.adj = GTK_ADJUSTMENT (adj); script->arg_values[i].sfa_adjustment.adj = GTK_ADJUSTMENT (adj);
break; break;
} }
g_signal_connect (script->arg_values[i].sfa_adjustment.adj, g_signal_connect (script->arg_values[i].sfa_adjustment.adj,
"value-changed", "value-changed",
G_CALLBACK (gimp_double_adjustment_update), G_CALLBACK (gimp_double_adjustment_update),
&script->arg_values[i].sfa_adjustment.value); &script->arg_values[i].sfa_adjustment.value);
break; break;
case SF_FILENAME: case SF_FILENAME:
case SF_DIRNAME: case SF_DIRNAME:
if (script->arg_types[i] == SF_FILENAME) if (script->arg_types[i] == SF_FILENAME)
widget = gtk_file_chooser_button_new (_("Script-Fu File Selection"), widget = gtk_file_chooser_button_new (_("Script-Fu File Selection"),
GTK_FILE_CHOOSER_ACTION_OPEN); GTK_FILE_CHOOSER_ACTION_OPEN);
else else
widget = gtk_file_chooser_button_new (_("Script-Fu Folder Selection"), widget = gtk_file_chooser_button_new (_("Script-Fu Folder Selection"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
if (script->arg_values[i].sfa_file.filename) if (script->arg_values[i].sfa_file.filename)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget),
script->arg_values[i].sfa_file.filename); script->arg_values[i].sfa_file.filename);
g_signal_connect (widget, "selection-changed", g_signal_connect (widget, "selection-changed",
G_CALLBACK (script_fu_file_callback), G_CALLBACK (script_fu_file_callback),
&script->arg_values[i].sfa_file); &script->arg_values[i].sfa_file);
break; break;
case SF_FONT: case SF_FONT:
widget = gimp_font_select_button_new (_("Script-Fu Font Selection"), widget = gimp_font_select_button_new (_("Script-Fu Font Selection"),
script->arg_values[i].sfa_font); script->arg_values[i].sfa_font);
g_signal_connect_swapped (widget, "font-set", g_signal_connect_swapped (widget, "font-set",
G_CALLBACK (script_fu_font_callback), G_CALLBACK (script_fu_font_callback),
&script->arg_values[i].sfa_font); &script->arg_values[i].sfa_font);
break; break;
case SF_PALETTE: case SF_PALETTE:
widget = gimp_palette_select_button_new (_("Script-Fu Palette Selection"), widget = gimp_palette_select_button_new (_("Script-Fu Palette Selection"),
script->arg_values[i].sfa_palette); script->arg_values[i].sfa_palette);
g_signal_connect_swapped (widget, "palette-set", g_signal_connect_swapped (widget, "palette-set",
G_CALLBACK (script_fu_palette_callback), G_CALLBACK (script_fu_palette_callback),
&script->arg_values[i].sfa_palette); &script->arg_values[i].sfa_palette);
break; break;
case SF_PATTERN: case SF_PATTERN:
left_align = TRUE; left_align = TRUE;
widget = gimp_pattern_select_button_new (_("Script-fu Pattern Selection"), widget = gimp_pattern_select_button_new (_("Script-Fu Pattern Selection"),
script->arg_values[i].sfa_pattern); script->arg_values[i].sfa_pattern);
g_signal_connect_swapped (widget, "pattern-set", g_signal_connect_swapped (widget, "pattern-set",
G_CALLBACK (script_fu_pattern_callback), G_CALLBACK (script_fu_pattern_callback),
&script->arg_values[i].sfa_pattern); &script->arg_values[i].sfa_pattern);
break; break;
case SF_GRADIENT: case SF_GRADIENT:
left_align = TRUE; left_align = TRUE;
widget = gimp_gradient_select_button_new (_("Script-Fu Gradient Selection"), widget = gimp_gradient_select_button_new (_("Script-Fu Gradient Selection"),
script->arg_values[i].sfa_gradient); script->arg_values[i].sfa_gradient);
g_signal_connect_swapped (widget, "gradient-set", g_signal_connect_swapped (widget, "gradient-set",
G_CALLBACK (script_fu_gradient_callback), G_CALLBACK (script_fu_gradient_callback),
&script->arg_values[i].sfa_gradient); &script->arg_values[i].sfa_gradient);
break; break;
case SF_BRUSH: case SF_BRUSH:
left_align = TRUE; left_align = TRUE;
widget = gimp_brush_select_button_new (_("Script-Fu Brush Selection"), widget = gimp_brush_select_button_new (_("Script-Fu Brush Selection"),
script->arg_values[i].sfa_brush.name, script->arg_values[i].sfa_brush.name,
script->arg_values[i].sfa_brush.opacity, script->arg_values[i].sfa_brush.opacity,
script->arg_values[i].sfa_brush.spacing, script->arg_values[i].sfa_brush.spacing,
script->arg_values[i].sfa_brush.paint_mode); script->arg_values[i].sfa_brush.paint_mode);
g_signal_connect_swapped (widget, "brush-set", g_signal_connect_swapped (widget, "brush-set",
G_CALLBACK (script_fu_brush_callback), G_CALLBACK (script_fu_brush_callback),
&script->arg_values[i].sfa_brush); &script->arg_values[i].sfa_brush);
break; break;
case SF_OPTION: case SF_OPTION:
widget = gtk_combo_box_new_text (); widget = gtk_combo_box_new_text ();
for (list = script->arg_defaults[i].sfa_option.list; for (list = script->arg_defaults[i].sfa_option.list;
list; list;
list = g_slist_next (list)) list = g_slist_next (list))
{ {
gtk_combo_box_append_text (GTK_COMBO_BOX (widget), gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
gettext ((const gchar *) list->data)); gettext ((const gchar *) list->data));
} }
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), gtk_combo_box_set_active (GTK_COMBO_BOX (widget),
script->arg_values[i].sfa_option.history); script->arg_values[i].sfa_option.history);
g_signal_connect (widget, "changed", g_signal_connect (widget, "changed",
G_CALLBACK (script_fu_combo_callback), G_CALLBACK (script_fu_combo_callback),
&script->arg_values[i].sfa_option); &script->arg_values[i].sfa_option);
break; break;
case SF_ENUM: case SF_ENUM:
widget = gimp_enum_combo_box_new (g_type_from_name (script->arg_defaults[i].sfa_enum.type_name)); widget = gimp_enum_combo_box_new (g_type_from_name (script->arg_defaults[i].sfa_enum.type_name));
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget), gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget),
script->arg_values[i].sfa_enum.history); script->arg_values[i].sfa_enum.history);
g_signal_connect (widget, "changed", g_signal_connect (widget, "changed",
G_CALLBACK (gimp_int_combo_box_get_active), G_CALLBACK (gimp_int_combo_box_get_active),
&script->arg_values[i].sfa_enum.history); &script->arg_values[i].sfa_enum.history);
break; break;
} }
if (widget) if (widget)
{ {
@ -596,12 +597,12 @@ script_fu_interface_quit (SFScript *script)
case SF_PATTERN: case SF_PATTERN:
case SF_GRADIENT: case SF_GRADIENT:
case SF_BRUSH: case SF_BRUSH:
gimp_select_button_close_popup gimp_select_button_close_popup
(GIMP_SELECT_BUTTON (sf_interface->widgets[i])); (GIMP_SELECT_BUTTON (sf_interface->widgets[i]));
break; break;
default: default:
break; break;
} }
g_free (sf_interface->widgets); g_free (sf_interface->widgets);
@ -871,7 +872,7 @@ script_fu_ok (SFScript *script)
command = g_string_free (s, FALSE); command = g_string_free (s, FALSE);
/* run the command through the interpreter */ /* run the command through the interpreter */
if (repl_c_string (command, 0, 0, 1) != 0) if (ts_interpret_string (command))
script_fu_error_msg (command); script_fu_error_msg (command);
g_free (command); g_free (command);
@ -897,12 +898,12 @@ script_fu_reset (SFScript *script)
case SF_COLOR: case SF_COLOR:
gimp_color_button_set_color (GIMP_COLOR_BUTTON (widget), gimp_color_button_set_color (GIMP_COLOR_BUTTON (widget),
&script->arg_defaults[i].sfa_color); &script->arg_defaults[i].sfa_color);
break; break;
case SF_TOGGLE: case SF_TOGGLE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
script->arg_defaults[i].sfa_toggle); script->arg_defaults[i].sfa_toggle);
break; break;
case SF_VALUE: case SF_VALUE:
case SF_STRING: case SF_STRING:
@ -949,7 +950,7 @@ script_fu_reset (SFScript *script)
break; break;
case SF_PATTERN: case SF_PATTERN:
gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (widget), gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (widget),
script->arg_defaults[i].sfa_pattern); script->arg_defaults[i].sfa_pattern);
break; break;

View File

@ -30,17 +30,21 @@
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h> #include <libgimp/gimpui.h>
#include "siod/siod.h" #include "tinyscheme/scheme-private.h"
#include "scheme-wrapper.h"
#include "script-fu-types.h" #include "script-fu-types.h"
#include "script-fu-interface.h" #include "script-fu-interface.h"
#include "script-fu-scripts.h" #include "script-fu-scripts.h"
#include "siod-wrapper.h"
#include "script-fu-intl.h" #include "script-fu-intl.h"
#define RESPONSE_RESET 1
#define RESPONSE_ABOUT 2
typedef struct typedef struct
{ {
SFScript *script; SFScript *script;
@ -48,34 +52,30 @@ typedef struct
} SFMenu; } SFMenu;
/* External functions
*/
extern long nlength (LISP obj);
/* /*
* Local Functions * Local Functions
*/ */
static void script_fu_load_script (const GimpDatafileData *file_data, static void script_fu_load_script (const GimpDatafileData *file_data,
gpointer user_data); gpointer user_data);
static gboolean script_fu_install_script (gpointer foo, static gboolean script_fu_install_script (gpointer foo,
GList *scripts, GList *scripts,
gpointer bar); gpointer bar);
static void script_fu_install_menu (SFMenu *menu); static void script_fu_install_menu (SFMenu *menu);
static gboolean script_fu_remove_script (gpointer foo, static gboolean script_fu_remove_script (gpointer foo,
GList *scripts, GList *scripts,
gpointer bar); gpointer bar);
static void script_fu_script_proc (const gchar *name, static void script_fu_script_proc (const gchar *name,
gint nparams, gint nparams,
const GimpParam *params, const GimpParam *params,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals); GimpParam **return_vals);
static SFScript * script_fu_find_script (const gchar *name); static SFScript *script_fu_find_script (const gchar *name);
static void script_fu_free_script (SFScript *script); static void script_fu_free_script (SFScript *script);
static gint script_fu_menu_compare (gconstpointer a, static gint script_fu_menu_compare (gconstpointer a,
gconstpointer b); gconstpointer b);
/* /*
@ -146,8 +146,17 @@ script_fu_find_scripts (void)
script_menu_list = NULL; script_menu_list = NULL;
} }
LISP #if 1 /* ~~~~~ */
script_fu_add_script (LISP a) static pointer
my_err(scheme *sc, char *msg)
{
fprintf(stderr, msg);
return sc->F;
}
#endif
pointer
script_fu_add_script (scheme *sc, pointer a)
{ {
GimpParamDef *args; GimpParamDef *args;
SFScript *script; SFScript *script;
@ -156,63 +165,70 @@ script_fu_add_script (LISP a)
gchar *val; gchar *val;
gint i; gint i;
guchar r, g, b; guchar r, g, b;
LISP color_list; pointer color_list;
LISP adj_list; pointer adj_list;
LISP brush_list; pointer brush_list;
LISP option_list; pointer option_list;
/* Check the length of a */ /* Check the length of a */
if (nlength (a) < 7) if (sc->vptr->list_length (sc, a) < 7)
return my_err ("Too few arguments to script-fu-register", NIL); {
g_message ("Too few arguments to script-fu-register");
return sc->NIL;
}
/* Create a new script */ /* Create a new script */
script = g_new0 (SFScript, 1); script = g_new0 (SFScript, 1);
/* Find the script name */ /* Find the script name */
val = get_c_string (car (a)); val = sc->vptr->string_value (sc->vptr->pair_car (a));
script->name = g_strdup (val); script->name = g_strdup (val);
a = cdr (a); a = sc->vptr->pair_cdr (a);
/* Find the script menu_path */ /* Find the script menu_path */
val = get_c_string (car (a)); val = sc->vptr->string_value (sc->vptr->pair_car (a));
script->menu_path = g_strdup (val); script->menu_path = g_strdup (val);
a = cdr (a); if (strncmp (script->menu_path, "<Image>", 7) == 0)
script->image_based = TRUE;
else
script->image_based = FALSE;
a = sc->vptr->pair_cdr (a);
/* Find the script blurb */ /* Find the script blurb */
val = get_c_string (car (a)); val = sc->vptr->string_value (sc->vptr->pair_car (a));
script->blurb = g_strdup (val); script->blurb = g_strdup (val);
a = cdr (a); a = sc->vptr->pair_cdr (a);
/* Find the script author */ /* Find the script author */
val = get_c_string (car (a)); val = sc->vptr->string_value (sc->vptr->pair_car (a));
script->author = g_strdup (val); script->author = g_strdup (val);
a = cdr (a); a = sc->vptr->pair_cdr (a);
/* Find the script copyright */ /* Find the script copyright */
val = get_c_string (car (a)); val = sc->vptr->string_value (sc->vptr->pair_car (a));
script->copyright = g_strdup (val); script->copyright = g_strdup (val);
a = cdr (a); a = sc->vptr->pair_cdr (a);
/* Find the script date */ /* Find the script date */
val = get_c_string (car (a)); val = sc->vptr->string_value (sc->vptr->pair_car (a));
script->date = g_strdup (val); script->date = g_strdup (val);
a = cdr (a); a = sc->vptr->pair_cdr (a);
/* Find the script image types */ /* Find the script image types */
if (TYPEP (a, tc_cons)) if (sc->vptr->is_pair (a))
{ {
val = get_c_string (car (a)); val = sc->vptr->string_value (sc->vptr->pair_car (a));
a = cdr (a); a = sc->vptr->pair_cdr (a);
} }
else else
{ {
val = get_c_string (a); val = sc->vptr->string_value (a);
a = NIL; a = sc->NIL;
} }
script->img_types = g_strdup (val); script->img_types = g_strdup (val);
/* Check the supplied number of arguments */ /* Check the supplied number of arguments */
script->num_args = nlength (a) / 3; script->num_args = sc->vptr->list_length (sc, a) / 3;
args = g_new0 (GimpParamDef, script->num_args + 1); args = g_new0 (GimpParamDef, script->num_args + 1);
@ -229,27 +245,27 @@ script_fu_add_script (LISP a)
{ {
for (i = 0; i < script->num_args; i++) for (i = 0; i < script->num_args; i++)
{ {
if (a != NIL) if (a != sc->NIL)
{ {
if (!TYPEP (car (a), tc_flonum)) if (!sc->vptr->is_integer (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: argument types must be integer values", NIL); return my_err (sc, "script-fu-register: argument types must be integer values");
script->arg_types[i] = get_c_long (car (a)); script->arg_types[i] = sc->vptr->ivalue (sc->vptr->pair_car (a));
a = cdr (a); a = sc->vptr->pair_cdr (a);
} }
else else
return my_err ("script-fu-register: missing type specifier", NIL); return my_err (sc, "script-fu-register: missing type specifier");
if (a != NIL) if (a != sc->NIL)
{ {
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: argument labels must be strings", NIL); return my_err (sc, "script-fu-register: argument labels must be strings");
script->arg_labels[i] = g_strdup (get_c_string (car (a))); script->arg_labels[i] = g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
a = cdr (a); a = sc->vptr->pair_cdr (a);
} }
else else
return my_err ("script-fu-register: missing arguments label", NIL); return my_err (sc, "script-fu-register: missing arguments label");
if (a != NIL) if (a != sc->NIL)
{ {
switch (script->arg_types[i]) switch (script->arg_types[i])
{ {
@ -257,11 +273,10 @@ script_fu_add_script (LISP a)
case SF_DRAWABLE: case SF_DRAWABLE:
case SF_LAYER: case SF_LAYER:
case SF_CHANNEL: case SF_CHANNEL:
if (!TYPEP (car (a), tc_flonum)) if (!sc->vptr->is_integer (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: drawable defaults must be integer values", NIL); return my_err (sc, "script-fu-register: drawable defaults must be integer values");
script->arg_defaults[i].sfa_image = script->arg_defaults[i].sfa_image =
get_c_long (car (a)); sc->vptr->ivalue (sc->vptr->pair_car (a));
script->arg_values[i].sfa_image = script->arg_values[i].sfa_image =
script->arg_defaults[i].sfa_image; script->arg_defaults[i].sfa_image;
@ -295,33 +310,33 @@ script_fu_add_script (LISP a)
break; break;
case SF_COLOR: case SF_COLOR:
if (TYPEP (car (a), tc_string)) if (sc->vptr->is_string (sc->vptr->pair_car (a)))
{ {
if (! gimp_rgb_parse_css (&script->arg_defaults[i].sfa_color, if (! gimp_rgb_parse_css (&script->arg_defaults[i].sfa_color,
get_c_string (car (a)), -1)) sc->vptr->string_value (sc->vptr->pair_car (a)),
return my_err ("script-fu-register: invalid default color name", NIL); -1))
return my_err (sc, "script-fu-register: invalid default color name");
gimp_rgb_set_alpha (&script->arg_defaults[i].sfa_color, gimp_rgb_set_alpha (&script->arg_defaults[i].sfa_color,
1.0); 1.0);
} }
else if (TYPEP (car (a), tc_cons)) else if (sc->vptr->is_list (sc, sc->vptr->pair_car (a)) &&
sc->vptr->list_length(sc, sc->vptr->pair_car (a)) == 3)
{ {
color_list = car (a); color_list = sc->vptr->pair_car (a);
r = CLAMP (get_c_long (car (color_list)), 0, 255); r = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)), 0, 255);
color_list = cdr (color_list); color_list = sc->vptr->pair_cdr (color_list);
g = CLAMP (get_c_long (car (color_list)), 0, 255); g = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)), 0, 255);
color_list = cdr (color_list); color_list = sc->vptr->pair_cdr (color_list);
b = CLAMP (get_c_long (car (color_list)), 0, 255); b = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)), 0, 255);
gimp_rgb_set_uchar (&script->arg_defaults[i].sfa_color, gimp_rgb_set_uchar (&script->arg_defaults[i].sfa_color, r, g, b);
r, g, b);
} }
else else
{ {
return my_err ("script-fu-register: color defaults must be a list of 3 integers or a color name", NIL); return my_err (sc, "script-fu-register: color defaults must be a list of 3 integers or a color name");
} }
script->arg_values[i].sfa_color = script->arg_values[i].sfa_color = script->arg_defaults[i].sfa_color;
script->arg_defaults[i].sfa_color;
args[i + 1].type = GIMP_PDB_COLOR; args[i + 1].type = GIMP_PDB_COLOR;
args[i + 1].name = "color"; args[i + 1].name = "color";
@ -329,11 +344,11 @@ script_fu_add_script (LISP a)
break; break;
case SF_TOGGLE: case SF_TOGGLE:
if (!TYPEP (car (a), tc_flonum)) if (!sc->vptr->is_integer (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: toggle default must be an integer value", NIL); return my_err (sc, "script-fu-register: toggle default must be an integer value");
script->arg_defaults[i].sfa_toggle = script->arg_defaults[i].sfa_toggle =
(get_c_long (car (a))) ? TRUE : FALSE; (sc->vptr->ivalue (sc->vptr->pair_car (a))) ? TRUE : FALSE;
script->arg_values[i].sfa_toggle = script->arg_values[i].sfa_toggle =
script->arg_defaults[i].sfa_toggle; script->arg_defaults[i].sfa_toggle;
@ -343,11 +358,11 @@ script_fu_add_script (LISP a)
break; break;
case SF_VALUE: case SF_VALUE:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: value defaults must be string values", NIL); return my_err (sc, "script-fu-register: value defaults must be string values");
script->arg_defaults[i].sfa_value = script->arg_defaults[i].sfa_value =
g_strdup (get_c_string (car (a))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
script->arg_values[i].sfa_value = script->arg_values[i].sfa_value =
g_strdup (script->arg_defaults[i].sfa_value); g_strdup (script->arg_defaults[i].sfa_value);
@ -358,11 +373,11 @@ script_fu_add_script (LISP a)
case SF_STRING: case SF_STRING:
case SF_TEXT: case SF_TEXT:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: string defaults must be string values", NIL); return my_err (sc, "script-fu-register: string defaults must be string values");
script->arg_defaults[i].sfa_value = script->arg_defaults[i].sfa_value =
g_strdup (get_c_string (car (a))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
script->arg_values[i].sfa_value = script->arg_values[i].sfa_value =
g_strdup (script->arg_defaults[i].sfa_value); g_strdup (script->arg_defaults[i].sfa_value);
@ -372,32 +387,32 @@ script_fu_add_script (LISP a)
break; break;
case SF_ADJUSTMENT: case SF_ADJUSTMENT:
if (!TYPEP (car (a), tc_cons)) if (!sc->vptr->is_list (sc, a))
return my_err ("script-fu-register: adjustment defaults must be a list", NIL); return my_err (sc, "script-fu-register: adjustment defaults must be a list");
adj_list = car (a); adj_list = sc->vptr->pair_car (a);
script->arg_defaults[i].sfa_adjustment.value = script->arg_defaults[i].sfa_adjustment.value =
get_c_double (car (adj_list)); sc->vptr->rvalue (sc->vptr->pair_car (adj_list));
adj_list = cdr (adj_list); adj_list = sc->vptr->pair_cdr (adj_list);
script->arg_defaults[i].sfa_adjustment.lower = script->arg_defaults[i].sfa_adjustment.lower =
get_c_double (car (adj_list)); sc->vptr->rvalue (sc->vptr->pair_car (adj_list));
adj_list = cdr (adj_list); adj_list = sc->vptr->pair_cdr (adj_list);
script->arg_defaults[i].sfa_adjustment.upper = script->arg_defaults[i].sfa_adjustment.upper =
get_c_double (car (adj_list)); sc->vptr->rvalue (sc->vptr->pair_car (adj_list));
adj_list = cdr (adj_list); adj_list = sc->vptr->pair_cdr (adj_list);
script->arg_defaults[i].sfa_adjustment.step = script->arg_defaults[i].sfa_adjustment.step =
get_c_double (car (adj_list)); sc->vptr->rvalue (sc->vptr->pair_car (adj_list));
adj_list = cdr (adj_list); adj_list = sc->vptr->pair_cdr (adj_list);
script->arg_defaults[i].sfa_adjustment.page = script->arg_defaults[i].sfa_adjustment.page =
get_c_double (car (adj_list)); sc->vptr->rvalue (sc->vptr->pair_car (adj_list));
adj_list = cdr (adj_list); adj_list = sc->vptr->pair_cdr (adj_list);
script->arg_defaults[i].sfa_adjustment.digits = script->arg_defaults[i].sfa_adjustment.digits =
get_c_long (car (adj_list)); sc->vptr->ivalue (sc->vptr->pair_car (adj_list));
adj_list = cdr (adj_list); adj_list = sc->vptr->pair_cdr (adj_list);
script->arg_defaults[i].sfa_adjustment.type = script->arg_defaults[i].sfa_adjustment.type =
get_c_long (car (adj_list)); sc->vptr->ivalue (sc->vptr->pair_car (adj_list));
script->arg_values[i].sfa_adjustment.adj = NULL;
script->arg_values[i].sfa_adjustment.adj = NULL;
script->arg_values[i].sfa_adjustment.value = script->arg_values[i].sfa_adjustment.value =
script->arg_defaults[i].sfa_adjustment.value; script->arg_defaults[i].sfa_adjustment.value;
@ -407,16 +422,16 @@ script_fu_add_script (LISP a)
break; break;
case SF_FILENAME: case SF_FILENAME:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: filename defaults must be string values", NIL); return my_err (sc, "script-fu-register: filename defaults must be string values");
/* fallthrough */ /* fallthrough */
case SF_DIRNAME: case SF_DIRNAME:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: dirname defaults must be string values", NIL); return my_err (sc, "script-fu-register: dirname defaults must be string values");
script->arg_defaults[i].sfa_file.filename = script->arg_defaults[i].sfa_file.filename =
g_strdup (get_c_string (car (a))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* Replace POSIX slashes with Win32 backslashes. This /* Replace POSIX slashes with Win32 backslashes. This
@ -441,11 +456,11 @@ script_fu_add_script (LISP a)
break; break;
case SF_FONT: case SF_FONT:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: font defaults must be string values", NIL); return my_err (sc, "script-fu-register: font defaults must be string values");
script->arg_defaults[i].sfa_font = script->arg_defaults[i].sfa_font =
g_strdup (get_c_string (car (a))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
script->arg_values[i].sfa_font = script->arg_values[i].sfa_font =
g_strdup (script->arg_defaults[i].sfa_font); g_strdup (script->arg_defaults[i].sfa_font);
@ -455,13 +470,13 @@ script_fu_add_script (LISP a)
break; break;
case SF_PALETTE: case SF_PALETTE:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: palette defaults must be string values", NIL); return my_err (sc, "script-fu-register: palette defaults must be string values");
script->arg_defaults[i].sfa_palette = script->arg_defaults[i].sfa_palette =
g_strdup (get_c_string (car (a))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
script->arg_values[i].sfa_palette = script->arg_values[i].sfa_palette =
g_strdup (script->arg_defaults[i].sfa_palette); g_strdup (script->arg_defaults[i].sfa_pattern);
args[i + 1].type = GIMP_PDB_STRING; args[i + 1].type = GIMP_PDB_STRING;
args[i + 1].name = "palette"; args[i + 1].name = "palette";
@ -469,11 +484,11 @@ script_fu_add_script (LISP a)
break; break;
case SF_PATTERN: case SF_PATTERN:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: pattern defaults must be string values", NIL); return my_err (sc, "script-fu-register: pattern defaults must be string values");
script->arg_defaults[i].sfa_pattern = script->arg_defaults[i].sfa_pattern =
g_strdup (get_c_string (car (a))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
script->arg_values[i].sfa_pattern = script->arg_values[i].sfa_pattern =
g_strdup (script->arg_defaults[i].sfa_pattern); g_strdup (script->arg_defaults[i].sfa_pattern);
@ -483,30 +498,30 @@ script_fu_add_script (LISP a)
break; break;
case SF_BRUSH: case SF_BRUSH:
if (!TYPEP (car (a), tc_cons)) if (!sc->vptr->is_list (sc, a))
return my_err ("script-fu-register: brush defaults must be a list", NIL); return my_err (sc, "script-fu-register: brush defaults must be a list");
brush_list = car (a); brush_list = sc->vptr->pair_car (a);
script->arg_defaults[i].sfa_brush.name = script->arg_defaults[i].sfa_brush.name =
g_strdup (get_c_string (car (brush_list))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (brush_list)));
script->arg_values[i].sfa_brush.name = script->arg_values[i].sfa_brush.name =
g_strdup (script->arg_defaults[i].sfa_brush.name); g_strdup (script->arg_defaults[i].sfa_brush.name);
brush_list = cdr (brush_list); brush_list = sc->vptr->pair_cdr (brush_list);
script->arg_defaults[i].sfa_brush.opacity = script->arg_defaults[i].sfa_brush.opacity =
get_c_double (car (brush_list)); sc->vptr->rvalue (sc->vptr->pair_car (brush_list));
script->arg_values[i].sfa_brush.opacity = script->arg_values[i].sfa_brush.opacity =
script->arg_defaults[i].sfa_brush.opacity; script->arg_defaults[i].sfa_brush.opacity;
brush_list = cdr (brush_list); brush_list = sc->vptr->pair_cdr (brush_list);
script->arg_defaults[i].sfa_brush.spacing = script->arg_defaults[i].sfa_brush.spacing =
get_c_long (car (brush_list)); sc->vptr->ivalue (sc->vptr->pair_car (brush_list));
script->arg_values[i].sfa_brush.spacing = script->arg_values[i].sfa_brush.spacing =
script->arg_defaults[i].sfa_brush.spacing; script->arg_defaults[i].sfa_brush.spacing;
brush_list = cdr (brush_list); brush_list = sc->vptr->pair_cdr (brush_list);
script->arg_defaults[i].sfa_brush.paint_mode = script->arg_defaults[i].sfa_brush.paint_mode =
get_c_long (car (brush_list)); sc->vptr->ivalue (sc->vptr->pair_car (brush_list));
script->arg_values[i].sfa_brush.paint_mode = script->arg_values[i].sfa_brush.paint_mode =
script->arg_defaults[i].sfa_brush.paint_mode; script->arg_defaults[i].sfa_brush.paint_mode;
@ -516,11 +531,11 @@ script_fu_add_script (LISP a)
break; break;
case SF_GRADIENT: case SF_GRADIENT:
if (!TYPEP (car (a), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (a)))
return my_err ("script-fu-register: gradient defaults must be string values", NIL); return my_err (sc, "script-fu-register: gradient defaults must be string values");
script->arg_defaults[i].sfa_gradient = script->arg_defaults[i].sfa_gradient =
g_strdup (get_c_string (car (a))); g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
script->arg_values[i].sfa_gradient = script->arg_values[i].sfa_gradient =
g_strdup (script->arg_defaults[i].sfa_gradient); g_strdup (script->arg_defaults[i].sfa_gradient);
@ -530,16 +545,17 @@ script_fu_add_script (LISP a)
break; break;
case SF_OPTION: case SF_OPTION:
if (!TYPEP (car (a), tc_cons)) if (!sc->vptr->is_list (sc, a))
return my_err ("script-fu-register: option defaults must be a list", NIL); return my_err (sc, "script-fu-register: option defaults must be a list");
for (option_list = car (a); for (option_list = sc->vptr->pair_car (a);
option_list; option_list != sc->NIL;
option_list = cdr (option_list)) option_list = sc->vptr->pair_cdr (option_list))
{ {
script->arg_defaults[i].sfa_option.list = script->arg_defaults[i].sfa_option.list =
g_slist_append (script->arg_defaults[i].sfa_option.list, g_slist_append (script->arg_defaults[i].sfa_option.list,
g_strdup (get_c_string (car (option_list)))); g_strdup (sc->vptr->string_value
(sc->vptr->pair_car (option_list))));
} }
script->arg_defaults[i].sfa_option.history = 0; script->arg_defaults[i].sfa_option.history = 0;
@ -551,14 +567,15 @@ script_fu_add_script (LISP a)
break; break;
case SF_ENUM: case SF_ENUM:
if (!TYPEP (car (a), tc_cons)) if (!sc->vptr->is_list (sc, a))
return my_err ("script-fu-register: enum defaults must be a list", NIL); return my_err (sc, "script-fu-register: enum defaults must be a list");
option_list = car (a); option_list = sc->vptr->pair_car (a);
if (!TYPEP (car (option_list), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (option_list)))
return my_err ("script-fu-register: first element in enum defaults must be a type-name", NIL); return my_err (sc, "script-fu-register: first element in enum defaults must be a type-name");
val = get_c_string (car (option_list)); val =
sc->vptr->string_value (sc->vptr->pair_car (option_list));
if (g_str_has_prefix (val, "Gimp")) if (g_str_has_prefix (val, "Gimp"))
val = g_strdup (val); val = g_strdup (val);
else else
@ -568,18 +585,18 @@ script_fu_add_script (LISP a)
if (! G_TYPE_IS_ENUM (enum_type)) if (! G_TYPE_IS_ENUM (enum_type))
{ {
g_free (val); g_free (val);
return my_err ("script-fu-register: first element in enum defaults must be the name of a registered type", NIL); return my_err (sc, "script-fu-register: first element in enum defaults must be the name of a registered type");
} }
script->arg_defaults[i].sfa_enum.type_name = val; script->arg_defaults[i].sfa_enum.type_name = val;
option_list = cdr (option_list); option_list = sc->vptr->pair_cdr (option_list);
if (!TYPEP (car (option_list), tc_string)) if (!sc->vptr->is_string (sc->vptr->pair_car (option_list)))
return my_err ("script-fu-register: second element in enum defaults must be a string", NIL); return my_err (sc, "script-fu-register: second element in enum defaults must be a string");
enum_value = enum_value =
g_enum_get_value_by_nick (g_type_class_peek (enum_type), g_enum_get_value_by_nick (g_type_class_peek (enum_type),
get_c_string (car (option_list))); sc->vptr->string_value (sc->vptr->pair_car (option_list)));
if (enum_value) if (enum_value)
script->arg_defaults[i].sfa_enum.history = script->arg_defaults[i].sfa_enum.history =
script->arg_values[i].sfa_enum.history = enum_value->value; script->arg_values[i].sfa_enum.history = enum_value->value;
@ -593,12 +610,12 @@ script_fu_add_script (LISP a)
break; break;
} }
a = cdr (a); a = sc->vptr->pair_cdr (a);
} }
else else
{ {
return my_err ("script-fu-register: missing default argument", return my_err (sc,
NIL); "script-fu-register: missing default argument");
} }
} }
} }
@ -612,30 +629,31 @@ script_fu_add_script (LISP a)
g_tree_insert (script_tree, (gpointer) key, g_list_append (list, script)); g_tree_insert (script_tree, (gpointer) key, g_list_append (list, script));
} }
return NIL; return sc->NIL;
} }
LISP pointer
script_fu_add_menu (LISP a) script_fu_add_menu (scheme *sc, pointer a)
{ {
SFScript *script; SFScript *script;
SFMenu *menu; SFMenu *menu;
const gchar *name; const gchar *name;
/* Check the length of a */ /* Check the length of a */
if (nlength (a) != 2) if (sc->vptr->list_length (sc, a) != 2)
return my_err ("Incorrect number of arguments for script-fu-menu-register", return my_err (sc, "Incorrect number of arguments for script-fu-menu-register");
NIL);
/* Find the script PDB entry name */ /* Find the script PDB entry name */
name = get_c_string (car (a)); name = sc->vptr->string_value (sc->vptr->pair_car (a));
a = cdr (a); a = sc->vptr->pair_cdr (a);
script = script_fu_find_script (name); script = script_fu_find_script (name);
if (! script) if (! script)
return my_err ("Nonexisting procedure name in script-fu-menu-register", {
NIL); g_message ("Procedure %s in script-fu-menu-register does not exist", name);
return sc->NIL;
}
/* Create a new list of menus */ /* Create a new list of menus */
menu = g_new0 (SFMenu, 1); menu = g_new0 (SFMenu, 1);
@ -643,18 +661,18 @@ script_fu_add_menu (LISP a)
menu->script = script; menu->script = script;
/* Find the script menu path */ /* Find the script menu path */
menu->menu_path = g_strdup (get_c_string (car (a))); menu->menu_path = g_strdup (sc->vptr->string_value (sc->vptr->pair_car (a)));
script_menu_list = g_list_prepend (script_menu_list, menu); script_menu_list = g_list_prepend (script_menu_list, menu);
return NIL; return sc->NIL;
} }
void void
script_fu_error_msg (const gchar *command) script_fu_error_msg (const gchar *command)
{ {
g_message (_("Error while executing\n%s\n%s"), g_message (_("Error while executing\n%s\n\n%s"),
command, siod_get_error_msg ()); command, ts_get_error_msg ());
} }
@ -672,7 +690,7 @@ script_fu_load_script (const GimpDatafileData *file_data,
command = g_strdup_printf ("(load \"%s\")", escaped); command = g_strdup_printf ("(load \"%s\")", escaped);
g_free (escaped); g_free (escaped);
if (repl_c_string (command, 0, 0, 1) != 0) if (ts_interpret_string (command))
script_fu_error_msg (command); script_fu_error_msg (command);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
@ -900,7 +918,7 @@ script_fu_script_proc (const gchar *name,
command = g_string_free (s, FALSE); command = g_string_free (s, FALSE);
/* run the command through the interpreter */ /* run the command through the interpreter */
if (repl_c_string (command, 0, 0, 1) != 0) if (ts_interpret_string (command))
script_fu_error_msg (command); script_fu_error_msg (command);
g_free (command); g_free (command);

View File

@ -19,11 +19,9 @@
#ifndef __SCRIPT_FU_SCRIPTS_H__ #ifndef __SCRIPT_FU_SCRIPTS_H__
#define __SCRIPT_FU_SCRIPTS_H__ #define __SCRIPT_FU_SCRIPTS_H__
void script_fu_find_scripts (void);
void script_fu_find_scripts (void); pointer script_fu_add_script (scheme *sc, pointer a);
LISP script_fu_add_script (LISP a); pointer script_fu_add_menu (scheme *sc, pointer a);
LISP script_fu_add_menu (LISP a); void script_fu_error_msg (const gchar *command);
void script_fu_error_msg (const gchar *command);
#endif /* __SCRIPT_FU_SCRIPTS__ */ #endif /* __SCRIPT_FU_SCRIPTS__ */

View File

@ -20,6 +20,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <time.h> #include <time.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
@ -36,6 +37,7 @@
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
#include <winsock2.h> #include <winsock2.h>
#include <libgimpbase/gimpwin32-io.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
@ -44,7 +46,6 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <errno.h>
#endif #endif
#include <glib/gstdio.h> #include <glib/gstdio.h>
@ -54,7 +55,7 @@
#include "script-fu-intl.h" #include "script-fu-intl.h"
#include "siod-wrapper.h" #include "scheme-wrapper.h"
#include "script-fu-server.h" #include "script-fu-server.h"
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
@ -133,18 +134,18 @@ typedef struct
*/ */
static void server_start (gint port, static void server_start (gint port,
const gchar *logfile); const gchar *logfile);
static gboolean execute_command (SFCommand *cmd); static gboolean execute_command (SFCommand *cmd);
static gint read_from_client (gint filedes); static gint read_from_client (gint filedes);
static gint make_socket (guint port); static gint make_socket (guint port);
static void server_log (const gchar *format, static void server_log (const gchar *format,
...) G_GNUC_PRINTF (1, 2); ...) G_GNUC_PRINTF (1, 2);
static void server_quit (void); static void server_quit (void);
static gboolean server_interface (void); static gboolean server_interface (void);
static void response_callback (GtkWidget *widget, static void response_callback (GtkWidget *widget,
gint response_id, gint response_id,
gpointer data); gpointer data);
static void print_socket_api_error (const gchar *api_name); static void print_socket_api_error (const gchar *api_name);
/* /*
@ -188,10 +189,10 @@ script_fu_server_get_mode (void)
void void
script_fu_server_run (const gchar *name, script_fu_server_run (const gchar *name,
gint nparams, gint nparams,
const GimpParam *params, const GimpParam *params,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
static GimpParam values[1]; static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
@ -203,12 +204,12 @@ script_fu_server_run (const gchar *name,
{ {
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_INTERACTIVE:
if (server_interface ()) if (server_interface ())
{ {
server_mode = TRUE; server_mode = TRUE;
/* Start the server */ /* Start the server */
server_start (sint.port, sint.logfile); server_start (sint.port, sint.logfile);
} }
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
@ -221,7 +222,7 @@ script_fu_server_run (const gchar *name,
case GIMP_RUN_WITH_LAST_VALS: case GIMP_RUN_WITH_LAST_VALS:
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
g_warning ("Script-Fu server does handle \"GIMP_RUN_WITH_LAST_VALS\""); g_warning ("Script-Fu server does not handle \"GIMP_RUN_WITH_LAST_VALS\"");
default: default:
break; break;
@ -387,7 +388,7 @@ server_progress_uninstall (const gchar *progress)
static void static void
server_start (gint port, server_start (gint port,
const gchar *logfile) const gchar *logfile)
{ {
const gchar *progress; const gchar *progress;
@ -416,7 +417,7 @@ server_start (gint port,
progress = server_progress_install (); progress = server_progress_install ();
server_log ("Script-fu server initialized and listening...\n"); server_log ("Script-Fu server initialized and listening...\n");
/* Loop until the server is finished */ /* Loop until the server is finished */
while (! script_fu_done) while (! script_fu_done)
@ -424,20 +425,20 @@ server_start (gint port,
script_fu_server_listen (0); script_fu_server_listen (0);
while (command_queue) while (command_queue)
{ {
SFCommand *cmd = (SFCommand *) command_queue->data; SFCommand *cmd = (SFCommand *) command_queue->data;
/* Process the command */ /* Process the command */
execute_command (cmd); execute_command (cmd);
/* Remove the command from the list */ /* Remove the command from the list */
command_queue = g_list_remove (command_queue, cmd); command_queue = g_list_remove (command_queue, cmd);
queue_length--; queue_length--;
/* Free the request */ /* Free the request */
g_free (cmd->command); g_free (cmd->command);
g_free (cmd); g_free (cmd);
} }
} }
server_progress_uninstall (progress); server_progress_uninstall (progress);
@ -460,10 +461,10 @@ execute_command (SFCommand *cmd)
time (&clock1); time (&clock1);
/* run the command */ /* run the command */
if (siod_interpret_string (cmd->command) != 0) if (ts_interpret_string (cmd->command) != 0)
{ {
error = TRUE; error = TRUE;
response = siod_get_error_msg (); response = ts_get_error_msg ();
response_len = strlen (response); response_len = strlen (response);
server_log ("%s\n", response); server_log ("%s\n", response);
@ -472,12 +473,12 @@ execute_command (SFCommand *cmd)
{ {
error = FALSE; error = FALSE;
response = siod_get_success_msg (); response = ts_get_success_msg ();
response_len = strlen (response); response_len = strlen (response);
time (&clock2); time (&clock2);
server_log ("Request #%d processed in %f seconds, finishing on %s", server_log ("Request #%d processed in %f seconds, finishing on %s",
cmd->request_no, difftime (clock2, clock1), ctime (&clock2)); cmd->request_no, difftime (clock2, clock1), ctime (&clock2));
} }
buffer[MAGIC_BYTE] = MAGIC; buffer[MAGIC_BYTE] = MAGIC;
@ -489,17 +490,17 @@ execute_command (SFCommand *cmd)
for (i = 0; i < RESPONSE_HEADER; i++) for (i = 0; i < RESPONSE_HEADER; i++)
if (cmd->filedes > 0 && send (cmd->filedes, buffer + i, 1, 0) < 0) if (cmd->filedes > 0 && send (cmd->filedes, buffer + i, 1, 0) < 0)
{ {
/* Write error */ /* Write error */
print_socket_api_error ("send"); print_socket_api_error ("send");
return FALSE; return FALSE;
} }
for (i = 0; i < response_len; i++) for (i = 0; i < response_len; i++)
if (cmd->filedes > 0 && send (cmd->filedes, response + i, 1, 0) < 0) if (cmd->filedes > 0 && send (cmd->filedes, response + i, 1, 0) < 0)
{ {
/* Write error */ /* Write error */
print_socket_api_error ("send"); print_socket_api_error ("send");
return FALSE; return FALSE;
} }
return FALSE; return FALSE;
@ -580,10 +581,10 @@ read_from_client (gint filedes)
clientaddr = g_hash_table_lookup (clients, GINT_TO_POINTER (cmd->filedes)); clientaddr = g_hash_table_lookup (clients, GINT_TO_POINTER (cmd->filedes));
time (&clock); time (&clock);
server_log ("Received request #%d from IP address %s: %s on %s," server_log ("Received request #%d from IP address %s: %s on %s,"
"[Request queue length: %d]", "[Request queue length: %d]",
cmd->request_no, cmd->request_no,
clientaddr ? clientaddr : "<invalid>", clientaddr ? clientaddr : "<invalid>",
cmd->command, ctime (&clock), queue_length); cmd->command, ctime (&clock), queue_length);
return 0; return 0;
} }
@ -709,12 +710,12 @@ server_interface (void)
dlg = gimp_dialog_new (_("Script-Fu Server Options"), "script-fu", dlg = gimp_dialog_new (_("Script-Fu Server Options"), "script-fu",
NULL, 0, NULL, 0,
gimp_standard_help_func, "plug-in-script-fu-server", gimp_standard_help_func, "plug-in-script-fu-server",
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Start Server"), GTK_RESPONSE_OK, _("_Start Server"), GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg), gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
GTK_RESPONSE_OK, GTK_RESPONSE_OK,
@ -740,14 +741,14 @@ server_interface (void)
sint.port_entry = gtk_entry_new (); sint.port_entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (sint.port_entry), "10008"); gtk_entry_set_text (GTK_ENTRY (sint.port_entry), "10008");
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Server port:"), 0.0, 0.5, _("Server port:"), 0.0, 0.5,
sint.port_entry, 1, FALSE); sint.port_entry, 1, FALSE);
/* The server logfile */ /* The server logfile */
sint.log_entry = gtk_entry_new (); sint.log_entry = gtk_entry_new ();
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Server logfile:"), 0.0, 0.5, _("Server logfile:"), 0.0, 0.5,
sint.log_entry, 1, FALSE); sint.log_entry, 1, FALSE);
gtk_widget_show (table); gtk_widget_show (table);
gtk_widget_show (dlg); gtk_widget_show (dlg);

View File

@ -27,7 +27,7 @@
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
#include "siod-wrapper.h" #include "scheme-wrapper.h"
#include "script-fu-intl.h" #include "script-fu-intl.h"
@ -37,17 +37,19 @@ static void script_fu_text_console_interface (void);
void void
script_fu_text_console_run (const gchar *name, script_fu_text_console_run (const gchar *name,
gint nparams, gint nparams,
const GimpParam *params, const GimpParam *params,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
static GimpParam values[1]; static GimpParam values[1];
siod_set_output_file (stdout); /* Enable Script-Fu output */
siod_set_verbose_level (2); ts_set_output_file (stdout);
siod_print_welcome (); ts_set_verbose_level (2);
ts_print_welcome ();
/* Run the interface */
script_fu_text_console_interface (); script_fu_text_console_interface ();
values[0].type = GIMP_PDB_STATUS; values[0].type = GIMP_PDB_STATUS;
@ -107,7 +109,7 @@ script_fu_text_console_interface (void)
while (read_command (command)) while (read_command (command))
{ {
if (command->len > 0) if (command->len > 0)
siod_interpret_string (command->str); ts_interpret_string (command->str);
} }
g_string_free (command, TRUE); g_string_free (command, TRUE);

View File

@ -23,7 +23,7 @@
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h> #include <libgimp/gimpui.h>
#include "siod/siod.h" #include "tinyscheme/scheme.h"
#include "script-fu-types.h" #include "script-fu-types.h"
@ -33,7 +33,7 @@
#include "script-fu-server.h" #include "script-fu-server.h"
#include "script-fu-text-console.h" #include "script-fu-text-console.h"
#include "siod-wrapper.h" #include "scheme-wrapper.h"
#include "script-fu-intl.h" #include "script-fu-intl.h"
@ -95,28 +95,28 @@ script_fu_query (void)
gimp_plugin_domain_register (GETTEXT_PACKAGE "-script-fu", NULL); gimp_plugin_domain_register (GETTEXT_PACKAGE "-script-fu", NULL);
gimp_install_procedure ("extension-script-fu", gimp_install_procedure ("extension-script-fu",
"A scheme interpreter for scripting GIMP operations", "A scheme interpreter for scripting GIMP operations",
"More help here later", "More help here later",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"1997", "1997",
NULL, NULL,
NULL, NULL,
GIMP_EXTENSION, GIMP_EXTENSION,
0, 0, NULL, NULL); 0, 0, NULL, NULL);
gimp_install_procedure ("plug-in-script-fu-console", gimp_install_procedure ("plug-in-script-fu-console",
N_("Interactive console for Script-Fu development"), N_("Interactive console for Script-Fu development"),
"Provides an interface which allows interactive " "Provides an interface which allows interactive "
"scheme development.", "scheme development.",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"1997", "1997",
N_("Script-Fu _Console"), N_("Script-Fu _Console"),
NULL, NULL,
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS (console_args), 0, G_N_ELEMENTS (console_args), 0,
console_args, NULL); console_args, NULL);
gimp_plugin_menu_register ("plug-in-script-fu-console", gimp_plugin_menu_register ("plug-in-script-fu-console",
N_("<Toolbox>/Xtns/Languages/Script-Fu")); N_("<Toolbox>/Xtns/Languages/Script-Fu"));
@ -129,52 +129,51 @@ script_fu_query (void)
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"1997", "1997",
NULL, NULL,
NULL, NULL,
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS (textconsole_args), 0, G_N_ELEMENTS (textconsole_args), 0,
textconsole_args, NULL); textconsole_args, NULL);
gimp_install_procedure ("plug-in-script-fu-server", gimp_install_procedure ("plug-in-script-fu-server",
N_("Server for remote Script-Fu operation"), N_("Server for remote Script-Fu operation"),
"Provides a server for remote script-fu operation", "Provides a server for remote script-fu operation",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"1997", "1997",
N_("_Start Server..."), N_("_Start Server..."),
NULL, NULL,
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS (server_args), 0, G_N_ELEMENTS (server_args), 0,
server_args, NULL); server_args, NULL);
gimp_plugin_menu_register ("plug-in-script-fu-server", gimp_plugin_menu_register ("plug-in-script-fu-server",
N_("<Toolbox>/Xtns/Languages/Script-Fu")); N_("<Toolbox>/Xtns/Languages/Script-Fu"));
gimp_install_procedure ("plug-in-script-fu-eval", gimp_install_procedure ("plug-in-script-fu-eval",
"Evaluate scheme code", "Evaluate scheme code",
"Evaluate the code under the scheme interpreter " "Evaluate the code under the scheme interpreter "
"(primarily for batch mode)", "(primarily for batch mode)",
"Manish Singh", "Manish Singh",
"Manish Singh", "Manish Singh",
"1998", "1998",
NULL, NULL,
NULL, NULL,
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS (eval_args), 0, G_N_ELEMENTS (eval_args), 0,
eval_args, NULL); eval_args, NULL);
} }
static void static void
script_fu_run (const gchar *name, script_fu_run (const gchar *name,
gint nparams, gint nparams,
const GimpParam *param, const GimpParam *param,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
INIT_I18N(); INIT_I18N();
siod_set_console_mode (0); ts_set_console_mode (0);
siod_set_output_file (stdout);
/* Determine before we allow scripts to register themselves /* Determine before we allow scripts to register themselves
* whether this is the base, automatically installed script-fu extension * whether this is the base, automatically installed script-fu extension
@ -184,13 +183,13 @@ script_fu_run (const gchar *name,
/* Setup auxillary temporary procedures for the base extension */ /* Setup auxillary temporary procedures for the base extension */
script_fu_extension_init (); script_fu_extension_init ();
/* Init the interpreter */ /* Init the interpreter and register scripts */
siod_init (TRUE); tinyscheme_init (TRUE);
} }
else else
{ {
/* Init the interpreter */ /* Init the interpreter */
siod_init (FALSE); tinyscheme_init (FALSE);
} }
/* Load all of the available scripts */ /* Load all of the available scripts */
@ -209,7 +208,7 @@ script_fu_run (const gchar *name,
/* Go into an endless loop */ /* Go into an endless loop */
while (TRUE) while (TRUE)
gimp_extension_process (0); gimp_extension_process (0);
/* Set return values; pointless because we never get out of the loop */ /* Set return values; pointless because we never get out of the loop */
*nreturn_vals = 1; *nreturn_vals = 1;
@ -221,20 +220,20 @@ script_fu_run (const gchar *name,
else if (strcmp (name, "plug-in-script-fu-text-console") == 0) else if (strcmp (name, "plug-in-script-fu-text-console") == 0)
{ {
/* /*
* The script-fu text console for interactive SIOD development * The script-fu text console for interactive Scheme development
*/ */
script_fu_text_console_run (name, nparams, param, script_fu_text_console_run (name, nparams, param,
nreturn_vals, return_vals); nreturn_vals, return_vals);
} }
else if (strcmp (name, "plug-in-script-fu-console") == 0) else if (strcmp (name, "plug-in-script-fu-console") == 0)
{ {
/* /*
* The script-fu console for interactive SIOD development * The script-fu console for interactive Scheme development
*/ */
script_fu_console_run (name, nparams, param, script_fu_console_run (name, nparams, param,
nreturn_vals, return_vals); nreturn_vals, return_vals);
} }
else if (strcmp (name, "plug-in-script-fu-server") == 0) else if (strcmp (name, "plug-in-script-fu-server") == 0)
{ {
@ -243,7 +242,7 @@ script_fu_run (const gchar *name,
*/ */
script_fu_server_run (name, nparams, param, script_fu_server_run (name, nparams, param,
nreturn_vals, return_vals); nreturn_vals, return_vals);
} }
else if (strcmp (name, "plug-in-script-fu-eval") == 0) else if (strcmp (name, "plug-in-script-fu-eval") == 0)
{ {
@ -252,10 +251,11 @@ script_fu_run (const gchar *name,
*/ */
script_fu_eval_run (name, nparams, param, script_fu_eval_run (name, nparams, param,
nreturn_vals, return_vals); nreturn_vals, return_vals);
} }
} }
static void static void
script_fu_extension_init (void) script_fu_extension_init (void)
{ {
@ -292,23 +292,41 @@ script_fu_extension_init (void)
gimp_plugin_menu_branch_register ("<Image>/Filters", gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("Alpha to _Logo")); N_("Alpha to _Logo"));
gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("An_imation"));
gimp_plugin_menu_branch_register ("<Image>/Filters/Animation",
N_("_Animators"));
gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("_Artistic"));
gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("_Blur"));
gimp_plugin_menu_branch_register ("<Image>/Filters", gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("_Decor")); N_("_Decor"));
gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("_Effects"));
gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("En_hance"));
gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("_Light and Shadow"));
gimp_plugin_menu_branch_register ("<Image>/Filters/Light and Shadow",
N_("S_hadow"));
gimp_plugin_menu_branch_register ("<Image>/Filters", gimp_plugin_menu_branch_register ("<Image>/Filters",
N_("_Render")); N_("_Render"));
gimp_plugin_menu_branch_register ("<Image>/Filters/Effects",
N_("_Alchemy"));
gimp_install_temp_proc ("script-fu-refresh", gimp_install_temp_proc ("script-fu-refresh",
N_("Re-read all available Script-Fu scripts"), N_("Re-read all available Script-Fu scripts"),
"Re-read all available scripts", "Re-read all available Script-Fu scripts",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis",
"1997", "1997",
N_("_Refresh Scripts"), N_("_Refresh Scripts"),
NULL, NULL,
GIMP_TEMPORARY, GIMP_TEMPORARY,
G_N_ELEMENTS (args), 0, G_N_ELEMENTS (args), 0,
args, NULL, args, NULL,
script_fu_refresh_proc); script_fu_refresh_proc);
gimp_plugin_menu_register ("script-fu-refresh", gimp_plugin_menu_register ("script-fu-refresh",
N_("<Toolbox>/Xtns/Languages/Script-Fu")); N_("<Toolbox>/Xtns/Languages/Script-Fu"));
@ -316,10 +334,10 @@ script_fu_extension_init (void)
static void static void
script_fu_refresh_proc (const gchar *name, script_fu_refresh_proc (const gchar *name,
gint nparams, gint nparams,
const GimpParam *params, const GimpParam *params,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
static GimpParam values[1]; static GimpParam values[1];
GimpPDBStatusType status; GimpPDBStatusType status;
@ -327,8 +345,8 @@ script_fu_refresh_proc (const gchar *name,
if (script_fu_interface_is_active ()) if (script_fu_interface_is_active ())
{ {
g_message (_("You can not use \"Refresh Scripts\" while a " g_message (_("You can not use \"Refresh Scripts\" while a "
"Script-Fu dialog box is open. Please close " "Script-Fu dialog box is open. Please close "
"all Script-Fu windows and try again.")); "all Script-Fu windows and try again."));
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
} }

View File

@ -22,27 +22,28 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (apply-3d-outline-logo-effect img (define (apply-3d-outline-logo-effect img
logo-layer logo-layer
text-pattern text-pattern
outline-blur-radius outline-blur-radius
shadow-blur-radius shadow-blur-radius
bump-map-blur-radius bump-map-blur-radius
noninteractive noninteractive
s-offset-x s-offset-x
s-offset-y) s-offset-y)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* (
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(bg-layer (car (gimp-layer-new img width height (height (car (gimp-drawable-height logo-layer)))
RGB-IMAGE "Background" 100 NORMAL-MODE))) (bg-layer (car (gimp-layer-new img width height
(pattern (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
RGBA-IMAGE "Pattern" 100 NORMAL-MODE))) (pattern (car (gimp-layer-new img width height
(layer2) RGBA-IMAGE "Pattern" 100 NORMAL-MODE)))
(layer3) (layer2)
(pattern-mask) (layer3)
(floating-sel)) (pattern-mask)
(floating-sel)
)
(gimp-context-push) (gimp-context-push)
(gimp-selection-none img) (gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer) (script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img pattern 1) (gimp-image-add-layer img pattern 1)
@ -65,10 +66,10 @@
(gimp-selection-all img) (gimp-selection-all img)
(gimp-context-set-pattern text-pattern) (gimp-context-set-pattern text-pattern)
(gimp-edit-bucket-fill pattern (gimp-edit-bucket-fill pattern PATTERN-BUCKET-FILL
PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) NORMAL-MODE 100 0 FALSE 0 0)
(plug-in-bump-map noninteractive img pattern layer2 (plug-in-bump-map noninteractive img pattern layer2
110.0 45.0 4 0 0 0 0 TRUE FALSE 0) 110.0 45.0 4 0 0 0 0 TRUE FALSE 0)
(set! pattern-mask (car (gimp-layer-create-mask pattern ADD-ALPHA-MASK))) (set! pattern-mask (car (gimp-layer-create-mask pattern ADD-ALPHA-MASK)))
(gimp-layer-add-mask pattern pattern-mask) (gimp-layer-add-mask pattern pattern-mask)
@ -87,85 +88,93 @@
(gimp-drawable-set-visible layer2 FALSE) (gimp-drawable-set-visible layer2 FALSE)
(gimp-drawable-set-visible pattern TRUE) (gimp-drawable-set-visible pattern TRUE)
;;(set! final (car (gimp-image-flatten img))) ;;(set! final (car (gimp-image-flatten img)))
(gimp-context-pop)
(gimp-context-pop))) )
)
(define (script-fu-3d-outline-logo-alpha img (define (script-fu-3d-outline-logo-alpha img
logo-layer logo-layer
text-pattern text-pattern
outline-blur-radius outline-blur-radius
shadow-blur-radius shadow-blur-radius
bump-map-blur-radius bump-map-blur-radius
noninteractive noninteractive
s-offset-x s-offset-x
s-offset-y) s-offset-y)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-3d-outline-logo-effect img logo-layer text-pattern (apply-3d-outline-logo-effect img logo-layer text-pattern
outline-blur-radius shadow-blur-radius outline-blur-radius shadow-blur-radius
bump-map-blur-radius noninteractive bump-map-blur-radius noninteractive
s-offset-x s-offset-y) s-offset-x s-offset-y)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-3d-outline-logo-alpha" (script-fu-register "script-fu-3d-outline-logo-alpha"
_"3D _Outline..." _"3D _Outline..."
_"Outline the selected region (or alpha) with a pattern and add a drop shadow" _"Outline the selected region (or alpha) with a pattern and add a drop shadow"
"Hrvoje Horvat (hhorvat@open.hr)" "Hrvoje Horvat (hhorvat@open.hr)"
"Hrvoje Horvat" "Hrvoje Horvat"
"07 April, 1998" "07 April, 1998"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-PATTERN _"Pattern" "Parque #1" SF-PATTERN "Pattern" "Parque #1"
SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1) SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1)
SF-ADJUSTMENT _"Shadow blur radius" '(10 1 200 1 10 0 1) SF-ADJUSTMENT _"Shadow blur radius" '(10 1 200 1 10 0 1)
SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1) SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1)
SF-TOGGLE _"Default bumpmap settings" TRUE SF-TOGGLE _"Default bumpmap settings" TRUE
SF-ADJUSTMENT _"Shadow X offset" '(0 0 200 1 5 0 1) SF-ADJUSTMENT _"Shadow X offset" '(0 0 200 1 5 0 1)
SF-ADJUSTMENT _"Shadow Y offset" '(0 0 200 1 5 0 1)) SF-ADJUSTMENT _"Shadow Y offset" '(0 0 200 1 5 0 1)
)
(script-fu-menu-register "script-fu-3d-outline-logo-alpha" (script-fu-menu-register "script-fu-3d-outline-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-3d-outline-logo text-pattern (define (script-fu-3d-outline-logo text-pattern
text text
size size
font font
outline-blur-radius outline-blur-radius
shadow-blur-radius shadow-blur-radius
bump-map-blur-radius bump-map-blur-radius
noninteractive noninteractive
s-offset-x s-offset-x
s-offset-y) s-offset-y)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-3d-outline-logo-effect img text-layer text-pattern (apply-3d-outline-logo-effect img text-layer text-pattern
outline-blur-radius shadow-blur-radius outline-blur-radius shadow-blur-radius
bump-map-blur-radius noninteractive bump-map-blur-radius noninteractive
s-offset-x s-offset-y) s-offset-x s-offset-y)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-3d-outline-logo" (script-fu-register "script-fu-3d-outline-logo"
_"3D _Outline..." _"3D _Outline..."
_"Create a logo with outlined text and a drop shadow" _"Create a logo with outlined text and a drop shadow"
"Hrvoje Horvat (hhorvat@open.hr)" "Hrvoje Horvat (hhorvat@open.hr)"
"Hrvoje Horvat" "Hrvoje Horvat"
"07 April, 1998" "07 April, 1998"
"" ""
SF-PATTERN _"Pattern" "Parque #1" SF-PATTERN "Pattern" "Parque #1"
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The Gimp"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "RoostHeavy" SF-FONT _"Font" "RoostHeavy"
SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1) SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1)
SF-ADJUSTMENT _"Shadow blur radius" '(10 1 200 1 10 0 1) SF-ADJUSTMENT _"Shadow blur radius" '(10 1 200 1 10 0 1)
SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1) SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1)
SF-TOGGLE _"Default bumpmap settings" TRUE SF-TOGGLE _"Default bumpmap settings" TRUE
SF-ADJUSTMENT _"Shadow X offset" '(0 0 200 1 5 0 1) SF-ADJUSTMENT _"Shadow X offset" '(0 0 200 1 5 0 1)
SF-ADJUSTMENT _"Shadow Y offset" '(0 0 200 1 5 0 1)) SF-ADJUSTMENT _"Shadow Y offset" '(0 0 200 1 5 0 1)
)
(script-fu-menu-register "script-fu-3d-outline-logo" (script-fu-menu-register "script-fu-3d-outline-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -5,17 +5,17 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; ;
; 3dTruchet - a script to create Truchet patterns ; 3dTruchet - a script to create Truchet patterns
; by Adrian Likins <aklikins@eos.ncsu.edu> ; by Adrian Likins <aklikins@eos.ncsu.edu>
; http://www4.ncsu.edu/~aklikins/ ; http://www4.ncsu.edu/~aklikins/
; version about .8 give or take ; version about .8 give or take
@ -26,59 +26,63 @@
; The utility of this script is left as an exercise for the reader. ; The utility of this script is left as an exercise for the reader.
(define (center-ellipse img (define (center-ellipse img
cx cx
cy cy
rx rx
ry ry
op op
aa aa
feather feather
frad) frad)
(gimp-ellipse-select img (- cx rx) (- cy ry) (+ rx rx) (+ ry ry) (gimp-ellipse-select img (- cx rx) (- cy ry) (+ rx rx) (+ ry ry)
op aa feather frad)) op aa feather frad)
)
(define (use-tile img (define (use-tile img
drawable drawable
height height
width width
img2 img2
drawable2 drawable2
xoffset xoffset
yoffset) yoffset)
(gimp-edit-copy drawable2) (gimp-edit-copy drawable2)
(let ((floating-sel (car (gimp-edit-paste drawable FALSE)))) (let (
(floating-sel (car (gimp-edit-paste drawable FALSE)))
)
(gimp-layer-set-offsets floating-sel xoffset yoffset) (gimp-layer-set-offsets floating-sel xoffset yoffset)
(gimp-floating-sel-anchor floating-sel) (gimp-floating-sel-anchor floating-sel)
)
) )
)
(define (create-tile img (define (create-tile img
drawable1 drawable1
drawable2 drawable2
size size
thickness thickness
backcolor backcolor
begincolor begincolor
endcolor endcolor
supersample) supersample)
(let* ( (let* (
(half-thickness (/ thickness 2)) (half-thickness (/ thickness 2))
(outer-radius (+ (/ size 2) half-thickness)) (outer-radius (+ (/ size 2) half-thickness))
(inner-radius (- (/ size 2) half-thickness)) (inner-radius (- (/ size 2) half-thickness))
) )
(gimp-selection-all img) (gimp-selection-all img)
(gimp-context-set-background backcolor) (gimp-context-set-background backcolor)
(gimp-edit-fill drawable1 BACKGROUND-FILL) (gimp-edit-fill drawable1 BACKGROUND-FILL)
(let* ( (let* (
(tempSize (* size 3)) (tempSize (* size 3))
(temp-img (car (gimp-image-new tempSize tempSize RGB))) (temp-img (car (gimp-image-new tempSize tempSize RGB)))
(temp-draw (car (gimp-layer-new temp-img tempSize tempSize (temp-draw (car (gimp-layer-new temp-img tempSize tempSize
RGB-IMAGE "Jabar" 100 NORMAL-MODE))) RGB-IMAGE "Jabar" 100 NORMAL-MODE)))
(temp-draw2 (car (gimp-layer-new temp-img tempSize tempSize (temp-draw2 (car (gimp-layer-new temp-img tempSize tempSize
RGB-IMAGE "Jabar" 100 NORMAL-MODE)))) RGB-IMAGE "Jabar" 100 NORMAL-MODE)))
)
(gimp-image-undo-disable temp-img) (gimp-image-undo-disable temp-img)
(gimp-image-add-layer temp-img temp-draw 0) (gimp-image-add-layer temp-img temp-draw 0)
@ -92,36 +96,36 @@
(gimp-context-set-foreground endcolor) (gimp-context-set-foreground endcolor)
(center-ellipse temp-img size size outer-radius outer-radius (center-ellipse temp-img size size outer-radius outer-radius
CHANNEL-OP-REPLACE TRUE FALSE 0) CHANNEL-OP-REPLACE TRUE FALSE 0)
(center-ellipse temp-img size size inner-radius inner-radius (center-ellipse temp-img size size inner-radius inner-radius
CHANNEL-OP-SUBTRACT TRUE FALSE 0) CHANNEL-OP-SUBTRACT TRUE FALSE 0)
(center-ellipse temp-img (* size 2) (* size 2) outer-radius outer-radius (center-ellipse temp-img (* size 2) (* size 2) outer-radius outer-radius
CHANNEL-OP-ADD TRUE FALSE 0) CHANNEL-OP-ADD TRUE FALSE 0)
(center-ellipse temp-img (* size 2) (* size 2) inner-radius inner-radius (center-ellipse temp-img (* size 2) (* size 2) inner-radius inner-radius
CHANNEL-OP-SUBTRACT TRUE FALSE 0) CHANNEL-OP-SUBTRACT TRUE FALSE 0)
(gimp-edit-blend temp-draw FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend temp-draw FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
supersample 3 .2 TRUE supersample 3 .2 TRUE
size size (* size 2) (/ size 2)) size size (* size 2) (/ size 2))
(center-ellipse temp-img size (* size 2) outer-radius outer-radius (center-ellipse temp-img size (* size 2) outer-radius outer-radius
CHANNEL-OP-REPLACE TRUE FALSE 0) CHANNEL-OP-REPLACE TRUE FALSE 0)
(center-ellipse temp-img size (* size 2) inner-radius inner-radius (center-ellipse temp-img size (* size 2) inner-radius inner-radius
CHANNEL-OP-SUBTRACT TRUE FALSE 0) CHANNEL-OP-SUBTRACT TRUE FALSE 0)
(center-ellipse temp-img (* size 2) size outer-radius outer-radius (center-ellipse temp-img (* size 2) size outer-radius outer-radius
CHANNEL-OP-ADD TRUE FALSE 0) CHANNEL-OP-ADD TRUE FALSE 0)
(center-ellipse temp-img (* size 2) size inner-radius inner-radius (center-ellipse temp-img (* size 2) size inner-radius inner-radius
CHANNEL-OP-SUBTRACT TRUE FALSE 0) CHANNEL-OP-SUBTRACT TRUE FALSE 0)
;(gimp-edit-fill temp-img temp-draw2 BACKGROUND-FILL) ;(gimp-edit-fill temp-img temp-draw2 BACKGROUND-FILL)
(gimp-edit-blend temp-draw2 FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend temp-draw2 FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
supersample 3 .2 TRUE supersample 3 .2 TRUE
size size (* size 2) (* size 2)) size size (* size 2) (* size 2))
(gimp-selection-none temp-img) (gimp-selection-none temp-img)
@ -132,55 +136,55 @@
(gimp-selection-all temp-img) (gimp-selection-all temp-img)
(gimp-edit-copy temp-draw) (gimp-edit-copy temp-draw)
(let ((floating-sel (car (gimp-edit-paste drawable2 FALSE)))) (let ((floating-sel (car (gimp-edit-paste drawable2 FALSE))))
(gimp-floating-sel-anchor floating-sel)) (gimp-floating-sel-anchor floating-sel))
(gimp-edit-copy temp-draw2) (gimp-edit-copy temp-draw2)
(let ((floating-sel (car (gimp-edit-paste drawable1 FALSE)))) (let ((floating-sel (car (gimp-edit-paste drawable1 FALSE))))
(gimp-floating-sel-anchor floating-sel)) (gimp-floating-sel-anchor floating-sel))
;(let ((drawble (car (gimp-drawable-transform-flip-simple img drawable1 ;(let ((drawble (car (gimp-drawable-transform-flip-simple img drawable1
; ORIENTATION-HORIZONTAL ; ORIENTATION-HORIZONTAL
; TRUE 0 TRUE))))) ; TRUE 0 TRUE)))))
;(gimp-display-new temp-img) ;(gimp-display-new temp-img)
(gimp-image-delete temp-img) (gimp-image-delete temp-img)
)
) )
) )
)
(define (script-fu-3dtruchet size (define (script-fu-3dtruchet size
thickness thickness
backcolor backcolor
begincolor begincolor
endcolor endcolor
supersample supersample
xtiles xtiles
ytiles) ytiles)
(let* ( (let* (
(width (* size xtiles)) (width (* size xtiles))
(height (* size ytiles)) (height (* size ytiles))
(img (car (gimp-image-new width height RGB))) (img (car (gimp-image-new width height RGB)))
(tile (car (gimp-image-new size size RGB))) (tile (car (gimp-image-new size size RGB)))
(layer-one (car (gimp-layer-new img width height (layer-one (car (gimp-layer-new img width height
RGB-IMAGE "Rambis" 100 NORMAL-MODE))) RGB-IMAGE "Rambis" 100 NORMAL-MODE)))
(tiledraw1 (car (gimp-layer-new tile size size (tiledraw1 (car (gimp-layer-new tile size size
RGB-IMAGE "Johnson" 100 NORMAL-MODE))) RGB-IMAGE "Johnson" 100 NORMAL-MODE)))
(tiledraw2 (car (gimp-layer-new tile size size (tiledraw2 (car (gimp-layer-new tile size size
RGB-IMAGE "Cooper" 100 NORMAL-MODE))) RGB-IMAGE "Cooper" 100 NORMAL-MODE)))
(Xindex 0) (Xindex 0)
(Yindex 0)) (Yindex 0)
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-undo-disable tile) (gimp-image-undo-disable tile)
(gimp-image-add-layer img layer-one 0) (gimp-image-add-layer img layer-one 0)
(gimp-image-add-layer tile tiledraw1 0) (gimp-image-add-layer tile tiledraw1 0)
(gimp-image-add-layer tile tiledraw2 0) (gimp-image-add-layer tile tiledraw2 0)
;just to look a little better ;just to look a little better
(gimp-selection-all img) (gimp-selection-all img)
(gimp-context-set-background backcolor) (gimp-context-set-background backcolor)
@ -188,44 +192,45 @@
(gimp-selection-none img) (gimp-selection-none img)
(create-tile tile tiledraw1 tiledraw2 size thickness (create-tile tile tiledraw1 tiledraw2 size thickness
backcolor begincolor endcolor supersample) backcolor begincolor endcolor supersample)
(while (<= Xindex xtiles) (while (<= Xindex xtiles)
(while (<= Yindex ytiles) (while (<= Yindex ytiles)
(if (= (rand 2) 0) (if (= (rand 2) 0)
(use-tile img layer-one height width tile (use-tile img layer-one height width tile
tiledraw1 (* Xindex size) (* Yindex size)) tiledraw1 (* Xindex size) (* Yindex size))
(use-tile img layer-one height width tile (use-tile img layer-one height width tile
tiledraw2 (* Xindex size) (* Yindex size)) tiledraw2 (* Xindex size) (* Yindex size))
) )
(set! Yindex (+ Yindex 1)) (set! Yindex (+ Yindex 1))
) )
(set! Yindex 0) (set! Yindex 0)
(set! Xindex (+ Xindex 1)) (set! Xindex (+ Xindex 1))
) )
(gimp-image-delete tile) (gimp-image-delete tile)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-context-pop)
(gimp-display-new img) (gimp-display-new img)
)
(gimp-context-pop))) )
(script-fu-register "script-fu-3dtruchet" (script-fu-register "script-fu-3dtruchet"
_"3_D Truchet..." _"3_D Truchet..."
_"Create an image filled with a 3D Truchet pattern" _"Create an image filled with a 3D Truchet pattern"
"Adrian Likins <aklikins@eos.ncsu.edu>" "Adrian Likins <aklikins@eos.ncsu.edu>"
"Adrian Likins" "Adrian Likins"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Block size" '(64 5 1000 1 10 0 1) SF-ADJUSTMENT _"Block size" '(64 5 1000 1 10 0 1)
SF-ADJUSTMENT _"Thickness" '(12 2 100 1 10 0 1) SF-ADJUSTMENT _"Thickness" '(12 2 100 1 10 0 1)
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" "white"
SF-COLOR _"Start blend" "black" SF-COLOR _"Start blend" "black"
SF-COLOR _"End blend" "white" SF-COLOR _"End blend" "white"
SF-TOGGLE _"Supersample" TRUE SF-TOGGLE _"Supersample" TRUE
SF-ADJUSTMENT _"Number of X tiles" '(5 1 1000 1 10 0 1) SF-ADJUSTMENT _"Number of X tiles" '(5 1 1000 1 10 0 1)
SF-ADJUSTMENT _"Number of Y tiles" '(5 1 1000 1 10 0 1)) SF-ADJUSTMENT _"Number of Y tiles" '(5 1 1000 1 10 0 1)
)
(script-fu-menu-register "script-fu-3dtruchet" (script-fu-menu-register "script-fu-3dtruchet"
"<Toolbox>/Xtns/Patterns") "<Toolbox>/Xtns/Patterns")

View File

@ -5,6 +5,8 @@ SUBDIRS = images
scriptdatadir = $(gimpdatadir)/scripts scriptdatadir = $(gimpdatadir)/scripts
scripts = \ scripts = \
script-fu.init \
script-fu-compat.init \
3d-outline.scm \ 3d-outline.scm \
3dTruchet.scm \ 3dTruchet.scm \
add-bevel.scm \ add-bevel.scm \
@ -38,6 +40,7 @@ scripts = \
clothify.scm \ clothify.scm \
coffee.scm \ coffee.scm \
comic-logo.scm \ comic-logo.scm \
contactsheet.scm \
coolmetal-logo.scm \ coolmetal-logo.scm \
copy-visible.scm \ copy-visible.scm \
crystal-logo.scm \ crystal-logo.scm \
@ -78,6 +81,7 @@ scripts = \
reverse-layers.scm \ reverse-layers.scm \
ripply-anim.scm \ ripply-anim.scm \
round-corners.scm \ round-corners.scm \
script-fu-set-cmap.scm \
script-fu-util.scm \ script-fu-util.scm \
select-to-brush.scm \ select-to-brush.scm \
select-to-image.scm \ select-to-image.scm \
@ -106,7 +110,8 @@ scripts = \
xach-effect.scm xach-effect.scm
test_scripts = \ test_scripts = \
test-sphere.scm test-sphere.scm \
ts-helloworld.scm
if GIMP_UNSTABLE if GIMP_UNSTABLE

View File

@ -54,27 +54,28 @@
work-on-copy work-on-copy
keep-bump-layer) keep-bump-layer)
(let* ((index 0) (let* (
(bevelling-whole-image FALSE) (index 1)
(greyness 0) (bevelling-whole-image FALSE)
(thickness (abs thickness)) (greyness 0)
(type (car (gimp-drawable-type-with-alpha drawable))) (thickness (abs thickness))
(image (if (= work-on-copy TRUE) (car (gimp-image-duplicate img)) img)) (type (car (gimp-drawable-type-with-alpha drawable)))
(pic-layer (car (gimp-image-get-active-drawable image))) (image (if (= work-on-copy TRUE) (car (gimp-image-duplicate img)) img))
(offsets (gimp-drawable-offsets pic-layer)) (pic-layer (car (gimp-image-get-active-drawable image)))
(width (car (gimp-drawable-width pic-layer))) (offsets (gimp-drawable-offsets pic-layer))
(height (car (gimp-drawable-height pic-layer))) (width (car (gimp-drawable-width pic-layer)))
(height (car (gimp-drawable-height pic-layer)))
; Bumpmap has a one pixel border on each side ; Bumpmap has a one pixel border on each side
(bump-layer (car (gimp-layer-new image (bump-layer (car (gimp-layer-new image
(+ width 2) (+ width 2)
(+ height 2) (+ height 2)
GRAY GRAY
"Bumpmap" "Bumpmap"
100 100
NORMAL-MODE))) NORMAL-MODE)))
(bevelling-whole-image TRUE) (select)
(select)) (bevelling-whole-image)
)
(gimp-context-push) (gimp-context-push)
@ -117,7 +118,6 @@
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-drawable-fill bump-layer BACKGROUND-FILL) (gimp-drawable-fill bump-layer BACKGROUND-FILL)
(set! index 1)
(while (< index thickness) (while (< index thickness)
(set! greyness (/ (* index 255) thickness)) (set! greyness (/ (* index 255) thickness))
(gimp-context-set-background (list greyness greyness greyness)) (gimp-context-set-background (list greyness greyness greyness))
@ -161,34 +161,39 @@
; clean up ; clean up
(gimp-image-remove-channel image select) (gimp-image-remove-channel image select)
(if (= keep-bump-layer TRUE) (if (= keep-bump-layer TRUE)
(gimp-drawable-set-visible bump-layer 0) (gimp-drawable-set-visible bump-layer 0)
(gimp-image-remove-layer image bump-layer)) (gimp-image-remove-layer image bump-layer)
)
(gimp-image-set-active-layer image pic-layer) (gimp-image-set-active-layer image pic-layer)
; enable undo / end undo group ; enable undo / end undo group
(if (= work-on-copy TRUE) (if (= work-on-copy TRUE)
(begin (begin
(gimp-display-new image) (gimp-display-new image)
(gimp-image-undo-enable image)) (gimp-image-undo-enable image)
(gimp-image-undo-group-end image)) )
(gimp-image-undo-group-end image)
)
(gimp-context-pop)
(gimp-displays-flush) (gimp-displays-flush)
)
(gimp-context-pop))) )
(script-fu-register "script-fu-add-bevel" (script-fu-register "script-fu-add-bevel"
_"Add B_evel..." _"Add B_evel..."
_"Add a bevel border to an image" _"Add a bevelled border to an image"
"Andrew Donkin <ard@cs.waikato.ac.nz>" "Andrew Donkin <ard@cs.waikato.ac.nz>"
"Andrew Donkin" "Andrew Donkin"
"1997/11/06" "1997/11/06"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Thickness" '(5 0 30 1 2 0 0) SF-ADJUSTMENT _"Thickness" '(5 0 30 1 2 0 0)
SF-TOGGLE _"Work on copy" TRUE SF-TOGGLE _"Work on copy" TRUE
SF-TOGGLE _"Keep bump layer" FALSE) SF-TOGGLE _"Keep bump layer" FALSE
)
(script-fu-menu-register "script-fu-add-bevel" (script-fu-menu-register "script-fu-add-bevel"
_"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -20,7 +20,7 @@
; Version 0.2 10.6.97 Changed to new script-fu interface in 0.99.10 ; Version 0.2 10.6.97 Changed to new script-fu interface in 0.99.10
; Delta the colour by the given amount. Check for boundary conditions ; Delta the colour by the given amount. Check for boundary conditions
; If < 0 set to zero ; If < 0 set to zero
; If > 255 set to 255 ; If > 255 set to 255
; Return the new value ; Return the new value
@ -28,8 +28,9 @@
(let* ((newcol (+ col delta))) (let* ((newcol (+ col delta)))
(if (< newcol 0) (set! newcol 0)) (if (< newcol 0) (set! newcol 0))
(if (> newcol 255) (set! newcol 255)) (if (> newcol 255) (set! newcol 255))
newcol) newcol
) )
)
(define (adjcolour col delta) (define (adjcolour col delta)
(mapcar (lambda (x) (deltacolour x delta)) col) (mapcar (lambda (x) (deltacolour x delta)) col)
@ -101,13 +102,10 @@
(oheight (car (gimp-image-height img))) (oheight (car (gimp-image-height img)))
(width (+ owidth (* 2 xsize))) (width (+ owidth (* 2 xsize)))
(height (+ oheight (* 2 ysize))) (height (+ oheight (* 2 ysize)))
(layer (car (gimp-layer-new img (layer (car (gimp-layer-new img width height
width height
(car (gimp-drawable-type-with-alpha adraw)) (car (gimp-drawable-type-with-alpha adraw))
"Border-Layer" 100 NORMAL-MODE)))) "Border-Layer" 100 NORMAL-MODE))))
;Add this for debugging (verbose 4)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
@ -163,21 +161,24 @@
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-addborder" (script-fu-register "script-fu-addborder"
_"Add _Border..." _"Add _Border..."
_"Add a border around an image" "Add a border around an image"
"Andy Thomas <alt@picnic.demon.co.uk>" "Andy Thomas <alt@picnic.demon.co.uk>"
"Andy Thomas" "Andy Thomas"
"6/10/97" "6/10/97"
"*" "*"
SF-IMAGE "Input image" 0 SF-IMAGE "Input image" 0
SF-DRAWABLE "Input drawable" 0 SF-DRAWABLE "Input drawable" 0
SF-ADJUSTMENT _"Border X size" '(12 1 250 1 10 0 1) SF-ADJUSTMENT _"Border X size" '(12 1 250 1 10 0 1)
SF-ADJUSTMENT _"Border Y size" '(12 1 250 1 10 0 1) SF-ADJUSTMENT _"Border Y size" '(12 1 250 1 10 0 1)
SF-COLOR _"Border color" '(38 31 207) SF-COLOR _"Border color" '(38 31 207)
SF-ADJUSTMENT _"Delta value on color" '(25 1 255 1 10 0 1)) SF-ADJUSTMENT _"Delta value on color" '(25 1 255 1 10 0 1)
)
(script-fu-menu-register "script-fu-addborder" (script-fu-menu-register "script-fu-addborder"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Alien Glow themed arrows for web pages ; Alien Glow themed arrows for web pages
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
@ -9,17 +9,17 @@
; Based on code from ; Based on code from
; Federico Mena Quintero ; Federico Mena Quintero
; federico@nuclecu.unam.mx ; federico@nuclecu.unam.mx
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -36,22 +36,31 @@
(if (null? seq) (if (null? seq)
'() '()
(cons (proc (car seq)) (cons (proc (car seq))
(map proc (cdr seq))))) (map proc (cdr seq))
)
)
)
(define (for-each proc seq) (define (for-each proc seq)
(if (not (null? seq)) (if (not (null? seq))
(begin (begin
(proc (car seq)) (proc (car seq))
(for-each proc (cdr seq))))) (for-each proc (cdr seq))
)
)
)
(define (make-point x y) (define (make-point x y)
(cons x y)) (cons x y)
)
(define (point-x p) (define (point-x p)
(car p)) (car p)
)
(define (point-y p) (define (point-y p)
(cdr p)) (cdr p)
)
(define (point-list->double-array point-list) (define (point-list->double-array point-list)
(define (convert points array pos) (define (convert points array pos)
@ -59,18 +68,27 @@
(begin (begin
(aset array (* 2 pos) (point-x (car points))) (aset array (* 2 pos) (point-x (car points)))
(aset array (+ 1 (* 2 pos)) (point-y (car points))) (aset array (+ 1 (* 2 pos)) (point-y (car points)))
(convert (cdr points) array (+ pos 1))))) (convert (cdr points) array (+ pos 1))
)
)
)
(let* ((how-many (length point-list)) (let* (
(a (cons-array (* 2 how-many) 'double))) (how-many (length point-list))
(a (cons-array (* 2 how-many) 'double))
)
(convert point-list a 0) (convert point-list a 0)
a)) a
)
)
(define (make-arrow size (define (make-arrow size
offset) offset)
(list (make-point offset offset) (list (make-point offset offset)
(make-point (- size offset) (/ size 2)) (make-point (- size offset) (/ size 2))
(make-point offset (- size offset)))) (make-point offset (- size offset))
)
)
(define (rotate-points points size orientation) (define (rotate-points points size orientation)
@ -80,37 +98,43 @@
(cond ((= orientation 0) (make-point px py)) ; right (cond ((= orientation 0) (make-point px py)) ; right
((= orientation 1) (make-point (- size px) py)) ; left ((= orientation 1) (make-point (- size px) py)) ; left
((= orientation 2) (make-point py (- size px))) ; up ((= orientation 2) (make-point py (- size px))) ; up
((= orientation 3) (make-point py px))))) ; down ((= orientation 3) (make-point py px)) ; down
points)) )
)
)
points
)
)
; the main function ; the main function
(let* ((img (car (gimp-image-new size size RGB))) (let* (
(grow-amount (/ size 12)) (img (car (gimp-image-new size size RGB)))
(blur-radius (/ size 3)) (grow-amount (/ size 12))
(offset (/ size 6)) (blur-radius (/ size 3))
(ruler-layer (car (gimp-layer-new img (offset (/ size 6))
size size RGBA-IMAGE (ruler-layer (car (gimp-layer-new img
"Ruler" 100 NORMAL-MODE)))
(glow-layer (car (gimp-layer-new img
size size RGBA-IMAGE size size RGBA-IMAGE
"Alien Glow" 100 NORMAL-MODE))) "Ruler" 100 NORMAL-MODE)))
(bg-layer (car (gimp-layer-new img (glow-layer (car (gimp-layer-new img
size size RGB-IMAGE size size RGBA-IMAGE
"Background" 100 NORMAL-MODE))) "Alien Glow" 100 NORMAL-MODE)))
(big-arrow (point-list->double-array (bg-layer (car (gimp-layer-new img
(rotate-points (make-arrow size offset) size size RGB-IMAGE
size orientation)))) "Background" 100 NORMAL-MODE)))
(big-arrow (point-list->double-array
(rotate-points (make-arrow size offset)
size orientation)))
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
;(gimp-image-resize img (+ length height) (+ height height) 0 0) ;(gimp-image-resize img (+ length height) (+ height height) 0 0)
(gimp-image-add-layer img bg-layer 1) (gimp-image-add-layer img bg-layer 1)
(gimp-image-add-layer img glow-layer -1) (gimp-image-add-layer img glow-layer -1)
(gimp-image-add-layer img ruler-layer -1) (gimp-image-add-layer img ruler-layer -1)
(gimp-edit-clear glow-layer) (gimp-edit-clear glow-layer)
(gimp-edit-clear ruler-layer) (gimp-edit-clear ruler-layer)
@ -123,7 +147,7 @@
GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 size size) 0 0 size size)
(gimp-selection-grow img grow-amount) (gimp-selection-grow img grow-amount)
(gimp-context-set-foreground glow-color) (gimp-context-set-foreground glow-color)
(gimp-edit-fill glow-layer FOREGROUND-FILL) (gimp-edit-fill glow-layer FOREGROUND-FILL)
@ -137,27 +161,28 @@
(gimp-edit-fill bg-layer BACKGROUND-FILL) (gimp-edit-fill bg-layer BACKGROUND-FILL)
(if (= flatten TRUE) (if (= flatten TRUE)
(gimp-image-flatten img)) (gimp-image-flatten img)
)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-alien-glow-right-arrow" (script-fu-register "script-fu-alien-glow-right-arrow"
_"_Arrow..." _"_Arrow..."
_"Create an arrow graphic with an eerie glow theme for web pages" _"Create an arrow graphic with an eerie glow for web pages"
"Adrian Likins" "Adrian Likins"
"Adrian Likins" "Adrian Likins"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Size" '(32 5 150 1 10 0 1) SF-ADJUSTMENT _"Size" '(32 5 150 1 10 0 1)
SF-OPTION _"Orientation" '(_"Right" SF-OPTION _"Orientation" '(_"Right" _"Left" _"Up" _"Down")
_"Left" SF-COLOR _"Glow color" '(63 252 0)
_"Up" SF-COLOR _"Background color" "black"
_"Down") SF-TOGGLE _"Flatten image" TRUE
SF-COLOR _"Glow color" '(63 252 0) )
SF-COLOR _"Background color" "black"
SF-TOGGLE _"Flatten image" TRUE)
(script-fu-menu-register "script-fu-alien-glow-right-arrow" (script-fu-menu-register "script-fu-alien-glow-right-arrow"
"<Toolbox>/Xtns/Web Page Themes/Alien Glow") "<Toolbox>/Xtns/Web Page Themes/Alien Glow")

View File

@ -1,69 +1,65 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Alien Glow themed hrule for web pages ; Alien Glow themed hrule for web pages
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
; ;
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-alien-glow-horizontal-ruler length (define (script-fu-alien-glow-horizontal-ruler length
height height
glow-color glow-color
bg-color bg-color
flatten) flatten)
(let* ((img (car (gimp-image-new height length RGB))) (let* (
(border (/ height 4)) (img (car (gimp-image-new height length RGB)))
(ruler-layer (car (gimp-layer-new img (border (/ height 4))
(+ length height) (+ height height) (ruler-layer (car (gimp-layer-new img
RGBA-IMAGE "Ruler" (+ length height) (+ height height)
100 NORMAL-MODE))) RGBA-IMAGE "Ruler" 100 NORMAL-MODE)))
(glow-layer (car (gimp-layer-new img (glow-layer (car (gimp-layer-new img
(+ length height) (+ height height) (+ length height) (+ height height)
RGBA-IMAGE "ALien Glow" RGBA-IMAGE "ALien Glow" 100 NORMAL-MODE)))
100 NORMAL-MODE))) (bg-layer (car (gimp-layer-new img
(bg-layer (car (gimp-layer-new img (+ length height) (+ height height)
(+ length height) (+ height height) RGB-IMAGE "Backround" 100 NORMAL-MODE)))
RGB-IMAGE "Backround" )
100 NORMAL-MODE))))
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-resize img (+ length height) (+ height height) 0 0) (gimp-image-resize img (+ length height) (+ height height) 0 0)
(gimp-image-add-layer img bg-layer 1) (gimp-image-add-layer img bg-layer 1)
(gimp-image-add-layer img glow-layer -1) (gimp-image-add-layer img glow-layer -1)
(gimp-image-add-layer img ruler-layer -1) (gimp-image-add-layer img ruler-layer -1)
; (gimp-layer-set-lock-alpha ruler-layer TRUE) ; (gimp-layer-set-lock-alpha ruler-layer TRUE)
(gimp-context-set-background bg-color) (gimp-context-set-background bg-color)
(gimp-edit-fill bg-layer BACKGROUND-FILL) (gimp-edit-fill bg-layer BACKGROUND-FILL)
(gimp-edit-clear glow-layer) (gimp-edit-clear glow-layer)
(gimp-edit-clear ruler-layer) (gimp-edit-clear ruler-layer)
(gimp-rect-select img (gimp-rect-select img (/ height 2) (/ height 2) length height CHANNEL-OP-REPLACE FALSE 0)
(/ height 2) (/ height 2)
length height CHANNEL-OP-REPLACE FALSE 0)
(gimp-context-set-foreground '(79 79 79)) (gimp-context-set-foreground '(79 79 79))
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-blend ruler-layer FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend ruler-layer FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 height height) 0 0 height height)
(gimp-context-set-foreground glow-color) (gimp-context-set-foreground glow-color)
(gimp-selection-grow img border) (gimp-selection-grow img border)
@ -74,25 +70,27 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(if (= flatten TRUE) (if (= flatten TRUE)
(gimp-image-flatten img)) (gimp-image-flatten img))
(gimp-context-pop)
(gimp-display-new img) (gimp-display-new img)
)
(gimp-context-pop))) )
(script-fu-register "script-fu-alien-glow-horizontal-ruler" (script-fu-register "script-fu-alien-glow-horizontal-ruler"
_"_Hrule..." _"_Hrule..."
_"Create an Hrule graphic with an eerie glow theme for web pages" _"Create an Hrule graphic with an eerie glow for web pages"
"Adrian Likins" "Adrian Likins"
"Adrian Likins" "Adrian Likins"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Bar length" '(480 5 1500 1 10 0 1) SF-ADJUSTMENT _"Bar length" '(480 5 1500 1 10 0 1)
SF-ADJUSTMENT _"Bar height" '(16 1 100 1 10 0 1) SF-ADJUSTMENT _"Bar height" '(16 1 100 1 10 0 1)
SF-COLOR _"Glow color" '(63 252 0) SF-COLOR _"Glow color" '(63 252 0)
SF-COLOR _"Background color" "black" SF-COLOR _"Background color" "black"
SF-TOGGLE _"Flatten image" TRUE) SF-TOGGLE _"Flatten image" TRUE
)
(script-fu-menu-register "script-fu-alien-glow-horizontal-ruler" (script-fu-menu-register "script-fu-alien-glow-horizontal-ruler"
"<Toolbox>/Xtns/Web Page Themes/Alien Glow") "<Toolbox>/Xtns/Web Page Themes/Alien Glow")

View File

@ -1,56 +1,51 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Alien Glow themed bullets for web pages ; Alien Glow themed bullets for web pages
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (center-ellipse img
cx
cy
rx
ry
op
aa
feather
frad)
(gimp-ellipse-select img (- cx rx) (- cy ry) (+ rx rx) (+ ry ry)
op aa feather frad))
(define (script-fu-alien-glow-bullet radius (define (script-fu-alien-glow-bullet radius
glow-color glow-color
bg-color bg-color
flatten) flatten)
(let* ((img (car (gimp-image-new radius radius RGB)))
(border (/ radius 4)) (define (center-ellipse img cx cy rx ry op aa feather frad)
(diameter (* radius 2)) (gimp-ellipse-select img (- cx rx) (- cy ry) (+ rx rx) (+ ry ry)
(half-radius (/ radius 2)) op aa feather frad)
(blend-start (+ half-radius (/ half-radius 2))) )
(bullet-layer (car (gimp-layer-new img
diameter diameter RGBA-IMAGE
"Ruler" 100 NORMAL-MODE))) (let* (
(glow-layer (car (gimp-layer-new img diameter diameter RGBA-IMAGE (img (car (gimp-image-new radius radius RGB)))
"ALien Glow" 100 NORMAL-MODE))) (border (/ radius 4))
(bg-layer (car (gimp-layer-new img diameter diameter RGB-IMAGE (diameter (* radius 2))
"Background" 100 NORMAL-MODE)))) (half-radius (/ radius 2))
(blend-start (+ half-radius (/ half-radius 2)))
(bullet-layer (car (gimp-layer-new img
diameter diameter RGBA-IMAGE
"Ruler" 100 NORMAL-MODE)))
(glow-layer (car (gimp-layer-new img diameter diameter RGBA-IMAGE
"ALien Glow" 100 NORMAL-MODE)))
(bg-layer (car (gimp-layer-new img diameter diameter RGB-IMAGE
"Background" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-resize img diameter diameter 0 0) (gimp-image-resize img diameter diameter 0 0)
(gimp-image-add-layer img bg-layer 1) (gimp-image-add-layer img bg-layer 1)
@ -64,17 +59,17 @@
(gimp-edit-clear bullet-layer) (gimp-edit-clear bullet-layer)
(center-ellipse img radius radius half-radius half-radius (center-ellipse img radius radius half-radius half-radius
CHANNEL-OP-REPLACE TRUE FALSE 0) CHANNEL-OP-REPLACE TRUE FALSE 0)
; (gimp-rect-select img (/ height 2) (/ height 2) length height CHANNEL-OP-REPLACE FALSE 0) ; (gimp-rect-select img (/ height 2) (/ height 2) length height CHANNEL-OP-REPLACE FALSE 0)
(gimp-context-set-foreground '(90 90 90)) (gimp-context-set-foreground '(90 90 90))
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-blend bullet-layer FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend bullet-layer FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-RADIAL 100 0 REPEAT-NONE FALSE GRADIENT-RADIAL 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
blend-start blend-start blend-start blend-start
(+ half-radius radius) (+ half-radius radius)) (+ half-radius radius) (+ half-radius radius))
(gimp-context-set-foreground glow-color) (gimp-context-set-foreground glow-color)
(gimp-selection-grow img border) (gimp-selection-grow img border)
@ -82,27 +77,32 @@
(gimp-edit-fill glow-layer FOREGROUND-FILL) (gimp-edit-fill glow-layer FOREGROUND-FILL)
(gimp-selection-none img) (gimp-selection-none img)
(if (>= radius 16) (if (>= radius 16)
(plug-in-gauss-rle 1 img glow-layer 25 TRUE TRUE) (plug-in-gauss-rle 1 img glow-layer 25 TRUE TRUE)
(plug-in-gauss-rle 1 img glow-layer 12 TRUE TRUE)) (plug-in-gauss-rle 1 img glow-layer 12 TRUE TRUE)
)
(if (= flatten TRUE) (if (= flatten TRUE)
(gimp-image-flatten img)) (gimp-image-flatten img)
)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-alien-glow-bullet" (script-fu-register "script-fu-alien-glow-bullet"
_"_Bullet..." _"_Bullet..."
_"Create a bullet graphic with an eerie glow theme for web pages" _"Create a bullet graphic with an eerie glow for web pages"
"Adrian Likins" "Adrian Likins"
"Adrian Likins" "Adrian Likins"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Radius" '(16 1 100 1 10 0 1) SF-ADJUSTMENT _"Radius" '(16 1 100 1 10 0 1)
SF-COLOR _"Glow color" '(63 252 0) SF-COLOR _"Glow color" '(63 252 0)
SF-COLOR _"Background color" "black" SF-COLOR _"Background color" '(0 0 0)
SF-TOGGLE _"Flatten image" TRUE) SF-TOGGLE _"Flatten image" TRUE
)
(script-fu-menu-register "script-fu-alien-glow-bullet" (script-fu-menu-register "script-fu-alien-glow-bullet"
"<Toolbox>/Xtns/Web Page Themes/Alien Glow") "<Toolbox>/Xtns/Web Page Themes/Alien Glow")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Alien Glow themed button ; Alien Glow themed button
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
@ -12,81 +12,84 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (text-width extents)
(car extents))
(define (text-height extents)
(cadr extents))
(define (text-ascent extents)
(caddr extents))
(define (text-descent extents)
(cadr (cddr extents)))
(define (blend-bumpmap img
drawable
x1
y1
x2
y2)
(gimp-edit-blend drawable FG-BG-RGB-MODE DARKEN-ONLY-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
x1 y1 x2 y2))
(define (script-fu-alien-glow-button text (define (script-fu-alien-glow-button text
font font
size size
text-color text-color
glow-color glow-color
bg-color bg-color
padding padding
glow-radius glow-radius
flatten) flatten)
(let* ((text-extents (gimp-text-get-extents-fontname text
size (define (text-width extents)
PIXELS (car extents))
font))
(ascent (text-ascent text-extents)) (define (text-height extents)
(descent (text-descent text-extents)) (cadr extents))
(img-width (+ (* 2 padding) (define (text-ascent extents)
(text-width text-extents))) (caddr extents))
(img-height (+ (* 2 padding)
(+ ascent descent))) (define (text-descent extents)
(layer-height img-height) (cadr (cddr extents)))
(layer-width img-width)
(img-width (+ img-width glow-radius)) (define (blend-bumpmap img
(img-height (+ img-height glow-radius)) drawable
(img (car (gimp-image-new img-width img-height RGB))) x1
(bg-layer (car (gimp-layer-new img y1
img-width img-height RGBA-IMAGE x2
"Background" 100 NORMAL-MODE))) y2)
(glow-layer (car (gimp-layer-new img (gimp-edit-blend drawable FG-BG-RGB-MODE DARKEN-ONLY-MODE
img-width img-height RGBA-IMAGE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
"Glow" 100 NORMAL-MODE))) FALSE 0 0 TRUE
(button-layer (car (gimp-layer-new img x1 y1 x2 y2)
layer-width layer-height RGBA-IMAGE )
"Button" 100 NORMAL-MODE))))
(let* (
(text-extents (gimp-text-get-extents-fontname text
size
PIXELS
font))
(ascent (text-ascent text-extents))
(descent (text-descent text-extents))
(img-width (+ (* 2 padding)
(text-width text-extents)))
(img-height (+ (* 2 padding)
(+ ascent descent)))
(layer-height img-height)
(layer-width img-width)
(img-width (+ img-width glow-radius))
(img-height (+ img-height glow-radius))
(img (car (gimp-image-new img-width img-height RGB)))
(bg-layer (car (gimp-layer-new img
img-width img-height RGBA-IMAGE
"Background" 100 NORMAL-MODE)))
(glow-layer (car (gimp-layer-new img
img-width img-height RGBA-IMAGE
"Glow" 100 NORMAL-MODE)))
(button-layer (car (gimp-layer-new img
layer-width layer-height RGBA-IMAGE
"Button" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
; Create bumpmap layer ; Create bumpmap layer
(gimp-image-add-layer img bg-layer -1) (gimp-image-add-layer img bg-layer -1)
(gimp-context-set-foreground '(0 0 0)) (gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background bg-color) (gimp-context-set-background bg-color)
@ -103,55 +106,62 @@
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-blend button-layer FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend button-layer FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 img-height img-width) 0 0 img-height img-width)
(gimp-edit-clear glow-layer) (gimp-edit-clear glow-layer)
(gimp-rect-select img (gimp-rect-select img
(/ glow-radius 4) (/ glow-radius 4)
(/ glow-radius 4) (/ glow-radius 4)
(- img-width (/ glow-radius 2)) (- img-width (/ glow-radius 2))
(- img-height (/ glow-radius 2)) (- img-height (/ glow-radius 2))
CHANNEL-OP-REPLACE FALSE 0 ) CHANNEL-OP-REPLACE FALSE 0 )
(gimp-context-set-foreground glow-color) (gimp-context-set-foreground glow-color)
(gimp-edit-fill glow-layer FOREGROUND-FILL) (gimp-edit-fill glow-layer FOREGROUND-FILL)
(gimp-selection-none img) (gimp-selection-none img)
(plug-in-gauss-rle 1 img glow-layer glow-radius TRUE TRUE) (plug-in-gauss-rle 1 img glow-layer glow-radius TRUE TRUE)
(gimp-context-set-foreground text-color) (gimp-context-set-foreground text-color)
(let ((textl (car (gimp-text-fontname (let (
img -1 0 0 text 0 TRUE size PIXELS font)))) (textl (car (gimp-text-fontname
img -1 0 0 text 0 TRUE size PIXELS font)))
)
(gimp-layer-set-offsets textl (gimp-layer-set-offsets textl
(+ padding (/ glow-radius 2)) (+ padding (/ glow-radius 2))
(+ (+ padding descent) (/ glow-radius 2)))) (+ (+ padding descent) (/ glow-radius 2)))
)
; Done ; Done
(gimp-selection-none img) (gimp-selection-none img)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(if (= flatten TRUE) (if (= flatten TRUE)
(gimp-image-flatten img)) (gimp-image-flatten img)
)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-alien-glow-button" (script-fu-register "script-fu-alien-glow-button"
_"B_utton..." _"B_utton..."
_"Create a button graphic with an eerie glow theme for web pages" _"Create a button graphic with an eerie glow for web pages"
"Adrian Likins" "Adrian Likins"
"Adrian Likins" "Adrian Likins"
"July 1997" "July 1997"
"" ""
SF-STRING _"Text" "Hello world!" SF-STRING _"Text" "Hello world!"
SF-FONT _"Font" "Sans Bold" SF-FONT _"Font" "Sans Bold"
SF-ADJUSTMENT _"Font size (pixels)" '(22 2 100 1 1 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(22 2 100 1 1 0 1)
SF-COLOR _"Text color" "black" SF-COLOR _"Text color" '(0 0 0)
SF-COLOR _"Glow color" '(63 252 0) SF-COLOR _"Glow color" '(63 252 0)
SF-COLOR _"Background color" "black" SF-COLOR _"Background color" '(0 0 0)
SF-ADJUSTMENT _"Padding" '(6 1 100 1 10 0 1) SF-ADJUSTMENT _"Padding" '(6 1 100 1 10 0 1)
SF-ADJUSTMENT _"Glow radius" '(10 1 200 1 10 0 1) SF-ADJUSTMENT _"Glow radius" '(10 1 200 1 10 0 1)
SF-TOGGLE _"Flatten image" TRUE) SF-TOGGLE _"Flatten image" TRUE
)
(script-fu-menu-register "script-fu-alien-glow-button" (script-fu-menu-register "script-fu-alien-glow-button"
"<Toolbox>/Xtns/Web Page Themes/Alien Glow") "<Toolbox>/Xtns/Web Page Themes/Alien Glow")

View File

@ -2,23 +2,24 @@
; Create a text effect that simulates an eerie alien glow around text ; Create a text effect that simulates an eerie alien glow around text
(define (apply-alien-glow-logo-effect img (define (apply-alien-glow-logo-effect img
logo-layer logo-layer
size size
glow-color) glow-color)
(let* ((border (/ size 4)) (let* (
(grow (/ size 30)) (border (/ size 4))
(feather (/ size 4)) (grow (/ size 30))
(width (car (gimp-drawable-width logo-layer))) (feather (/ size 4))
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(bg-layer (car (gimp-layer-new img (height (car (gimp-drawable-height logo-layer)))
width height RGB-IMAGE (bg-layer (car (gimp-layer-new img
"Background" 100 NORMAL-MODE))) width height RGB-IMAGE
(glow-layer (car (gimp-layer-new img "Background" 100 NORMAL-MODE)))
width height RGBA-IMAGE (glow-layer (car (gimp-layer-new img
"Alien Glow" 100 NORMAL-MODE)))) width height RGBA-IMAGE
"Alien Glow" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-selection-none img) (gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer) (script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1) (gimp-image-add-layer img bg-layer 1)
@ -38,68 +39,72 @@
(gimp-context-set-foreground '(79 79 79)) (gimp-context-set-foreground '(79 79 79))
(gimp-edit-blend logo-layer FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend logo-layer FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 1 1) 0 0 1 1)
(gimp-context-pop)
(gimp-context-pop))) )
)
(define (script-fu-alien-glow-logo-alpha img (define (script-fu-alien-glow-logo-alpha img
logo-layer logo-layer
size size
glow-color) glow-color)
(begin (gimp-image-undo-group-start img)
(gimp-image-undo-group-start img) (apply-alien-glow-logo-effect img logo-layer size glow-color)
(apply-alien-glow-logo-effect img logo-layer size glow-color) (gimp-image-undo-group-end img)
(gimp-image-undo-group-end img) (gimp-displays-flush)
(gimp-displays-flush))) )
(script-fu-register "script-fu-alien-glow-logo-alpha" (script-fu-register "script-fu-alien-glow-logo-alpha"
_"Alien _Glow..." _"Alien _Glow..."
_"Add an eerie glow around the selected region (or alpha)" _"Add an eerie glow around the selected region (or alpha)"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Glow size (pixels * 4)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Glow size (pixels * 4)" '(150 2 1000 1 10 0 1)
SF-COLOR _"Glow color" '(63 252 0)) SF-COLOR _"Glow color" '(63 252 0)
)
(script-fu-menu-register "script-fu-alien-glow-logo-alpha" (script-fu-menu-register "script-fu-alien-glow-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-alien-glow-logo text (define (script-fu-alien-glow-logo text
size size
font font
glow-color) glow-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(border (/ size 4)) (img (car (gimp-image-new 256 256 RGB)))
(grow (/ size 30)) (border (/ size 4))
(feather (/ size 4)) (grow (/ size 30))
(text-layer (car (gimp-text-fontname img (feather (/ size 4))
-1 0 0 text border TRUE (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
size PIXELS font))) (width (car (gimp-drawable-width text-layer)))
(width (car (gimp-drawable-width text-layer))) (height (car (gimp-drawable-height text-layer)))
(height (car (gimp-drawable-height text-layer)))) )
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-alien-glow-logo-effect img text-layer size glow-color) (apply-alien-glow-logo-effect img text-layer size glow-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-alien-glow-logo" (script-fu-register "script-fu-alien-glow-logo"
_"Alien _Glow..." _"Alien _Glow..."
_"Create a logo with an alien glow around the text" _"Create a logo with an alien glow around the text"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"" ""
SF-STRING _"Text" "ALIEN" SF-STRING _"Text" "ALIEN"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Sans Bold" SF-FONT _"Font" "Sans Bold"
SF-COLOR _"Glow color" '(63 252 0)) SF-COLOR _"Glow color" '(63 252 0)
)
(script-fu-menu-register "script-fu-alien-glow-logo" (script-fu-menu-register "script-fu-alien-glow-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; alien-neon-logo.scm - creates multiple outlines around the letters ; alien-neon-logo.scm - creates multiple outlines around the letters
; Copyright (C) 1999-2000 Raphael Quinet <quinet@gamers.org> ; Copyright (C) 1999-2000 Raphael Quinet <quinet@gamers.org>
; ;
@ -8,12 +8,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -27,24 +27,25 @@
; To do: use a channel mask for creating the bands, instead of working in the ; To do: use a channel mask for creating the bands, instead of working in the
; image. gimp-invert would then work on one grayscale channel instead of ; image. gimp-invert would then work on one grayscale channel instead of
; wasting CPU cycles on three identical R, G, B channels. ; wasting CPU cycles on three identical R, G, B channels.
; ;
(define (apply-alien-neon-logo-effect img (define (apply-alien-neon-logo-effect img
logo-layer logo-layer
fg-color fg-color
bg-color bg-color
band-size band-size
gap-size gap-size
num-bands num-bands
do-fade) do-fade)
(let* ((fade-size (- (* (+ band-size gap-size) num-bands) 1)) (let* (
(width (car (gimp-drawable-width logo-layer))) (fade-size (- (* (+ band-size gap-size) num-bands) 1))
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (height (car (gimp-drawable-height logo-layer)))
(bands-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bands" 100 NORMAL-MODE)))) (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(bands-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bands" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
(script-fu-util-image-resize-from-layer img logo-layer) (script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1) (gimp-image-add-layer img bg-layer 1)
(gimp-image-add-layer img bands-layer 1) (gimp-image-add-layer img bands-layer 1)
@ -61,31 +62,32 @@
; Create multiple outlines by growing and inverting the selection ; Create multiple outlines by growing and inverting the selection
; The bands are black and white because they will be used as a mask. ; The bands are black and white because they will be used as a mask.
(while (> num-bands 0) (while (> num-bands 0)
(gimp-selection-grow img band-size) (gimp-selection-grow img band-size)
(gimp-invert bands-layer) (gimp-invert bands-layer)
(gimp-selection-grow img gap-size) (gimp-selection-grow img gap-size)
(gimp-invert bands-layer) (gimp-invert bands-layer)
(set! num-bands (- num-bands 1))) (set! num-bands (- num-bands 1))
)
; The fading effect is obtained by masking the image with a gradient. ; The fading effect is obtained by masking the image with a gradient.
; The gradient is created by filling a bordered selection (white->black). ; The gradient is created by filling a bordered selection (white->black).
(if (= do-fade TRUE) (if (= do-fade TRUE)
(let ((bands-layer-mask (car (gimp-layer-create-mask bands-layer (let ((bands-layer-mask (car (gimp-layer-create-mask bands-layer
ADD-BLACK-MASK)))) ADD-BLACK-MASK))))
(gimp-layer-add-mask bands-layer bands-layer-mask) (gimp-layer-add-mask bands-layer bands-layer-mask)
(gimp-selection-layer-alpha logo-layer) (gimp-selection-layer-alpha logo-layer)
(gimp-selection-border img fade-size) (gimp-selection-border img fade-size)
(gimp-edit-fill bands-layer-mask FOREGROUND-FILL) (gimp-edit-fill bands-layer-mask FOREGROUND-FILL)
(gimp-layer-remove-mask bands-layer MASK-APPLY))) (gimp-layer-remove-mask bands-layer MASK-APPLY)))
; Transfer the resulting grayscale bands into the layer mask. ; Transfer the resulting grayscale bands into the layer mask.
(let ((bands-layer-mask (car (gimp-layer-create-mask bands-layer (let ((bands-layer-mask (car (gimp-layer-create-mask bands-layer
ADD-BLACK-MASK)))) ADD-BLACK-MASK))))
(gimp-layer-add-mask bands-layer bands-layer-mask) (gimp-layer-add-mask bands-layer bands-layer-mask)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-edit-copy bands-layer) (gimp-edit-copy bands-layer)
(gimp-floating-sel-anchor (car (gimp-edit-paste bands-layer-mask (gimp-floating-sel-anchor (car (gimp-edit-paste bands-layer-mask
FALSE)))) FALSE))))
; Fill the layer with the foreground color. The areas that are not ; Fill the layer with the foreground color. The areas that are not
; masked become visible. ; masked become visible.
@ -97,78 +99,87 @@
(gimp-drawable-set-visible logo-layer 0) (gimp-drawable-set-visible logo-layer 0)
(gimp-image-set-active-layer img bands-layer) (gimp-image-set-active-layer img bands-layer)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-alien-neon-logo-alpha img (define (script-fu-alien-neon-logo-alpha img
logo-layer logo-layer
fg-color fg-color
bg-color bg-color
band-size band-size
gap-size gap-size
num-bands num-bands
do-fade) do-fade)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-alien-neon-logo-effect img logo-layer fg-color bg-color (apply-alien-neon-logo-effect img logo-layer fg-color bg-color
band-size gap-size num-bands do-fade) band-size gap-size num-bands do-fade)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)))
(script-fu-register "script-fu-alien-neon-logo-alpha" (script-fu-register "script-fu-alien-neon-logo-alpha"
_"Alien _Neon..." _"Alien _Neon..."
_"Add psychedelic outlines to the selected region (or alpha)" _"Add psychedelic outlines to the selected region (or alpha)"
"Raphael Quinet (quinet@gamers.org)" "Raphael Quinet (quinet@gamers.org)"
"Raphael Quinet" "Raphael Quinet"
"1999-2000" "1999-2000"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-COLOR _"Glow color" '(0 255 0) SF-COLOR _"Glow color" '(0 255 0)
SF-COLOR _"Background color" '(0 0 0) SF-COLOR _"Background color" '(0 0 0)
SF-ADJUSTMENT _"Width of bands" '(2 1 60 1 10 0 0) SF-ADJUSTMENT _"Width of bands" '(2 1 60 1 10 0 0)
SF-ADJUSTMENT _"Width of gaps" '(2 1 60 1 10 0 0) SF-ADJUSTMENT _"Width of gaps" '(2 1 60 1 10 0 0)
SF-ADJUSTMENT _"Number of bands" '(7 1 100 1 10 0 1) SF-ADJUSTMENT _"Number of bands" '(7 1 100 1 10 0 1)
SF-TOGGLE _"Fade away" TRUE) SF-TOGGLE _"Fade away" TRUE
)
(script-fu-menu-register "script-fu-alien-neon-logo-alpha" (script-fu-menu-register "script-fu-alien-neon-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-alien-neon-logo text
(define (script-fu-alien-neon-logo text size
size fontname
fontname fg-color
fg-color bg-color
bg-color band-size
band-size gap-size
gap-size num-bands
num-bands do-fade)
do-fade) (let* (
(let* ((img (car (gimp-image-new 256 256 RGB))) (img (car (gimp-image-new 256 256 RGB)))
(fade-size (- (* (+ band-size gap-size) num-bands) 1)) (fade-size (- (* (+ band-size gap-size) num-bands) 1))
(text-layer (car (gimp-text-fontname img -1 0 0 text (+ fade-size 10) TRUE size PIXELS fontname)))) (text-layer (car (gimp-text-fontname img -1 0 0 text (+ fade-size 10) TRUE size PIXELS fontname)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-alien-neon-logo-effect img text-layer fg-color bg-color (apply-alien-neon-logo-effect img text-layer fg-color bg-color
band-size gap-size num-bands do-fade) band-size gap-size num-bands do-fade)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-alien-neon-logo" (script-fu-register "script-fu-alien-neon-logo"
_"Alien _Neon..." _"Alien _Neon..."
_"Create a logo with psychedelic outlines around the text" _"Create a logo with psychedelic outlines around the text"
"Raphael Quinet (quinet@gamers.org)" "Raphael Quinet (quinet@gamers.org)"
"Raphael Quinet" "Raphael Quinet"
"1999-2000" "1999-2000"
"" ""
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Blippo" SF-FONT _"Font" "Blippo"
SF-COLOR _"Glow color" '(0 255 0) SF-COLOR _"Glow color" '(0 255 0)
SF-COLOR _"Background color" '(0 0 0) SF-COLOR _"Background color" '(0 0 0)
SF-ADJUSTMENT _"Width of bands" '(2 1 60 1 10 0 0) SF-ADJUSTMENT _"Width of bands" '(2 1 60 1 10 0 0)
SF-ADJUSTMENT _"Width of gaps" '(2 1 60 1 10 0 0) SF-ADJUSTMENT _"Width of gaps" '(2 1 60 1 10 0 0)
SF-ADJUSTMENT _"Number of bands" '(7 1 100 1 10 0 1) SF-ADJUSTMENT _"Number of bands" '(7 1 100 1 10 0 1)
SF-TOGGLE _"Fade away" TRUE) SF-TOGGLE _"Fade away" TRUE
)
(script-fu-menu-register "script-fu-alien-neon-logo" (script-fu-menu-register "script-fu-alien-neon-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")
; end

View File

@ -2,16 +2,17 @@
; draw the specified text over a background with a drop shadow ; draw the specified text over a background with a drop shadow
(define (apply-basic1-logo-effect img (define (apply-basic1-logo-effect img
logo-layer logo-layer
bg-color bg-color
text-color) text-color)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* (
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE))) (height (car (gimp-drawable-height logo-layer)))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))) (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-selection-none img) (gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer) (script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img shadow-layer 1) (gimp-image-add-layer img shadow-layer 1)
@ -30,65 +31,73 @@
(gimp-context-set-foreground '(255 255 255)) (gimp-context-set-foreground '(255 255 255))
(gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE (gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE
GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 width height) 0 0 width height)
(gimp-layer-translate shadow-layer 3 3) (gimp-layer-translate shadow-layer 3 3)
(gimp-context-pop)
(gimp-context-pop))) )
)
(define (script-fu-basic1-logo-alpha img (define (script-fu-basic1-logo-alpha img
logo-layer logo-layer
bg-color bg-color
text-color) text-color)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-basic1-logo-effect img logo-layer bg-color text-color) (apply-basic1-logo-effect img logo-layer bg-color text-color)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-basic1-logo-alpha" (script-fu-register "script-fu-basic1-logo-alpha"
_"_Basic I..." _"_Basic I..."
_"Add a gradient effect, a drop shadow, and a background to the selected region (or alpha)" _"Add a gradient effect, a drop shadow, and a background to the selected region (or alpha)"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1996" "1996"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-COLOR _"Background color" '(255 255 255) SF-COLOR _"Background color" '(255 255 255)
SF-COLOR _"Text color" '(6 6 206)) SF-COLOR _"Text color" '(6 6 206)
)
(script-fu-menu-register "script-fu-basic1-logo-alpha" (script-fu-menu-register "script-fu-basic1-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-basic1-logo text (define (script-fu-basic1-logo text
size size
font font
bg-color bg-color
text-color) text-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-basic1-logo-effect img text-layer bg-color text-color) (apply-basic1-logo-effect img text-layer bg-color text-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-basic1-logo" (script-fu-register "script-fu-basic1-logo"
_"_Basic I..." _"_Basic I..."
_"Create a plain text logo and add a drop shadow" _"Create a plain text logo with a gradient effect, a drop shadow, and a background"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1996" "1996"
"" ""
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The Gimp"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Dragonwick" SF-FONT _"Font" "Dragonwick"
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-COLOR _"Text color" '(6 6 206)) SF-COLOR _"Text color" '(6 6 206)
)
(script-fu-menu-register "script-fu-basic1-logo" (script-fu-menu-register "script-fu-basic1-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,27 +1,34 @@
; HIGHLIGHT-DROP-SHADOW-LOGO ; HIGHLIGHT-DROP-SHADOW-LOGO
; draw the specified text over a background with a drop shadow and a highlight ; draw the specified text over a background with a drop shadow and a highlight
(define (color-highlight color)
(let ((r (car color))
(g (cadr color))
(b (caddr color)))
(set! r (+ r (* (- 255 r) 0.75)))
(set! g (+ g (* (- 255 g) 0.75)))
(set! b (+ b (* (- 255 b) 0.75)))
(list r g b)))
(define (apply-basic2-logo-effect img (define (apply-basic2-logo-effect img
logo-layer logo-layer
bg-color bg-color
text-color) text-color)
(let* ((width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer))) (define (color-highlight color)
(posx (- (car (gimp-drawable-offsets logo-layer)))) (let (
(posy (- (cadr (gimp-drawable-offsets logo-layer)))) (r (car color))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (g (cadr color))
(highlight-layer (car (gimp-layer-copy logo-layer TRUE))) (b (caddr color))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))) )
(set! r (+ r (* (- 255 r) 0.75)))
(set! g (+ g (* (- 255 g) 0.75)))
(set! b (+ b (* (- 255 b) 0.75)))
(list r g b)
)
)
(let* (
(width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(posx (- (car (gimp-drawable-offsets logo-layer))))
(posy (- (cadr (gimp-drawable-offsets logo-layer))))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))
)
(gimp-context-push) (gimp-context-push)
@ -47,67 +54,74 @@
(gimp-context-set-foreground '(255 255 255)) (gimp-context-set-foreground '(255 255 255))
(gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE (gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE
GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 width height) 0 0 width height)
(gimp-layer-translate shadow-layer 3 3) (gimp-layer-translate shadow-layer 3 3)
(gimp-layer-translate highlight-layer (- posx 2) (- posy 2)) (gimp-layer-translate highlight-layer (- posx 2) (- posy 2))
(gimp-drawable-set-name highlight-layer "Highlight") (gimp-drawable-set-name highlight-layer "Highlight")
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-basic2-logo-alpha img (define (script-fu-basic2-logo-alpha img
logo-layer logo-layer
bg-color bg-color
text-color) text-color)
(begin (gimp-image-undo-group-start img)
(gimp-image-undo-group-start img) (apply-basic2-logo-effect img logo-layer bg-color text-color)
(apply-basic2-logo-effect img logo-layer bg-color text-color) (gimp-image-undo-group-end img)
(gimp-image-undo-group-end img) (gimp-displays-flush)
(gimp-displays-flush))) )
(script-fu-register "script-fu-basic2-logo-alpha" (script-fu-register "script-fu-basic2-logo-alpha"
_"B_asic II..." _"B_asic II..."
_"Add a shadow and a highlight to the selected region (or alpha)" _"Add a shadow and a highlight to the selected region (or alpha)"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1996" "1996"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-COLOR _"Background color" '(255 255 255) SF-COLOR _"Background color" '(255 255 255)
SF-COLOR _"Text color" '(206 6 50)) SF-COLOR _"Text color" '(206 6 50)
)
(script-fu-menu-register "script-fu-basic2-logo-alpha"
"<Image>/Filters/Alpha to Logo")
(define (script-fu-basic2-logo text (define (script-fu-basic2-logo text
size size
font font
bg-color bg-color
text-color) text-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-basic2-logo-effect img text-layer bg-color text-color) (apply-basic2-logo-effect img text-layer bg-color text-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-menu-register "script-fu-basic2-logo-alpha"
"<Image>/Filters/Alpha to Logo")
(script-fu-register "script-fu-basic2-logo" (script-fu-register "script-fu-basic2-logo"
_"B_asic II..." _"B_asic II..."
_"Create a simple logo with a shadow and a highlight" _"Create a simple logo with a shadow and a highlight"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1996" "1996"
"" ""
SF-STRING _"Text" "SCRIPT-FU" SF-STRING _"Text" "TINY-FU"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Sans Bold" SF-FONT _"Font" "Sans Bold"
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-COLOR _"Text color" '(206 6 50)) SF-COLOR _"Text color" '(206 6 50)
)
(script-fu-menu-register "script-fu-basic2-logo" (script-fu-menu-register "script-fu-basic2-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,20 +1,20 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Button00 --- create a simple beveled Web button ; Button00 --- create a simple beveled Web button
; Copyright (C) 1997 Federico Mena Quintero ; Copyright (C) 1997 Federico Mena Quintero
; federico@nuclecu.unam.mx ; federico@nuclecu.unam.mx
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -39,52 +39,54 @@
(cadr (cddr extents))) (cadr (cddr extents)))
(define (blend-bumpmap img (define (blend-bumpmap img
drawable drawable
x1 x1
y1 y1
x2 x2
y2) y2)
(gimp-edit-blend drawable FG-BG-RGB-MODE DARKEN-ONLY-MODE (gimp-edit-blend drawable FG-BG-RGB-MODE DARKEN-ONLY-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
x1 y1 x2 y2)) x1 y1 x2 y2))
(define (script-fu-button00 text (define (script-fu-button00 text
size size
font font
ul-color ul-color
lr-color lr-color
text-color text-color
padding padding
bevel-width bevel-width
pressed) pressed)
(let* ((text-extents (gimp-text-get-extents-fontname text (let* (
size (text-extents (gimp-text-get-extents-fontname text
PIXELS size
font)) PIXELS
(ascent (text-ascent text-extents)) font))
(descent (text-descent text-extents)) (ascent (text-ascent text-extents))
(descent (text-descent text-extents))
(img-width (+ (* 2 (+ padding bevel-width)) (img-width (+ (* 2 (+ padding bevel-width))
(text-width text-extents))) (text-width text-extents)))
(img-height (+ (* 2 (+ padding bevel-width)) (img-height (+ (* 2 (+ padding bevel-width))
(+ ascent descent))) (+ ascent descent)))
(img (car (gimp-image-new img-width img-height RGB))) (img (car (gimp-image-new img-width img-height RGB)))
(bumpmap (car (gimp-layer-new img (bumpmap (car (gimp-layer-new img
img-width img-height RGBA-IMAGE img-width img-height RGBA-IMAGE
"Bumpmap" 100 NORMAL-MODE))) "Bumpmap" 100 NORMAL-MODE)))
(gradient (car (gimp-layer-new img (gradient (car (gimp-layer-new img
img-width img-height RGBA-IMAGE img-width img-height RGBA-IMAGE
"Gradient" 100 NORMAL-MODE)))) "Gradient" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
; Create bumpmap layer ; Create bumpmap layer
(gimp-image-add-layer img bumpmap -1) (gimp-image-add-layer img bumpmap -1)
(gimp-context-set-foreground '(0 0 0)) (gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
@ -111,21 +113,21 @@
(gimp-context-set-background lr-color) (gimp-context-set-background lr-color)
(gimp-edit-blend gradient FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend gradient FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 (- img-width 1) (- img-height 1)) 0 0 (- img-width 1) (- img-height 1))
(plug-in-bump-map 1 img gradient bumpmap (plug-in-bump-map 1 img gradient bumpmap
135 45 bevel-width 0 0 0 0 TRUE pressed 0) 135 45 bevel-width 0 0 0 0 TRUE pressed 0)
; Create text layer ; Create text layer
(gimp-context-set-foreground text-color) (gimp-context-set-foreground text-color)
(let ((textl (car (gimp-text-fontname (let ((textl (car (gimp-text-fontname
img -1 0 0 text 0 TRUE size PIXELS font)))) img -1 0 0 text 0 TRUE size PIXELS font))))
(gimp-layer-set-offsets textl (gimp-layer-set-offsets textl
(+ bevel-width padding) (+ bevel-width padding)
(+ bevel-width padding descent))) (+ bevel-width padding descent)))
; Done ; Done
@ -133,24 +135,26 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-button00" (script-fu-register "script-fu-button00"
_"Simple _Beveled Button..." _"Simple _Beveled Button..."
_"Create a simple, beveled button graphic for webpages" _"Create a simple, beveled button graphic for webpages"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"June 1997" "June 1997"
"" ""
SF-STRING _"Text" "Hello world!" SF-STRING _"Text" "Hello world!"
SF-ADJUSTMENT _"Font size (pixels)" '(16 2 100 1 1 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(16 2 100 1 1 0 1)
SF-FONT _"Font" "Sans" SF-FONT _"Font" "Sans"
SF-COLOR _"Upper-left color" '(0 255 127) SF-COLOR _"Upper-left color" '(0 255 127)
SF-COLOR _"Lower-right color" '(0 127 255) SF-COLOR _"Lower-right color" '(0 127 255)
SF-COLOR _"Text color" "black" SF-COLOR _"Text color" '(0 0 0)
SF-ADJUSTMENT _"Padding" '(2 1 100 1 10 0 1) SF-ADJUSTMENT _"Padding" '(2 1 100 1 10 0 1)
SF-ADJUSTMENT _"Bevel width" '(4 1 100 1 10 0 1) SF-ADJUSTMENT _"Bevel width" '(4 1 100 1 10 0 1)
SF-TOGGLE _"Pressed" FALSE) SF-TOGGLE _"Pressed" FALSE)
(script-fu-menu-register "script-fu-button00" (script-fu-menu-register "script-fu-button00"
"<Toolbox>/Xtns/Buttons") "<Toolbox>/Xtns/Buttons")

View File

@ -22,38 +22,35 @@
(define (script-fu-beveled-pattern-arrow size orientation pattern) (define (script-fu-beveled-pattern-arrow size orientation pattern)
; define some local helper functions
(define (map proc seq)
(if (null? seq)
'()
(cons (proc (car seq))
(map proc (cdr seq)))))
(define (for-each proc seq)
(if (not (null? seq))
(begin
(proc (car seq))
(for-each proc (cdr seq)))))
(define (make-point x y) (define (make-point x y)
(cons x y)) (cons x y)
)
(define (point-x p) (define (point-x p)
(car p)) (car p)
)
(define (point-y p) (define (point-y p)
(cdr p)) (cdr p)
)
(define (point-list->double-array point-list) (define (point-list->double-array point-list)
(let* ((how-many (length point-list)) (let* (
(a (cons-array (* 2 how-many) 'double)) (how-many (length point-list))
(count 0)) (a (cons-array (* 2 how-many) 'double))
(for-each (lambda (p) (count 0)
(aset a (* count 2) (point-x p)) (point)
(aset a (+ 1 (* count 2)) (point-y p)) )
(set! count (+ count 1))) (while (< count how-many)
point-list) (set! point (car point-list))
a)) (set! point-list (cdr point-list))
(aset a (* count 2) (point-x point))
(aset a (+ 1 (* count 2)) (point-y point))
(set! count (+ 1 count))
)
a
)
)
(define (rotate-points points size orientation) (define (rotate-points points size orientation)
(map (lambda (p) (map (lambda (p)
@ -62,22 +59,31 @@
(cond ((= orientation 0) (make-point px py)) ; right (cond ((= orientation 0) (make-point px py)) ; right
((= orientation 1) (make-point (- size px) py)) ; left ((= orientation 1) (make-point (- size px) py)) ; left
((= orientation 2) (make-point py (- size px))) ; up ((= orientation 2) (make-point py (- size px))) ; up
((= orientation 3) (make-point py px))))) ; down ((= orientation 3) (make-point py px)) ; down
points)) )
)
)
points
)
)
(define (make-arrow size offset) (define (make-arrow size offset)
(list (make-point offset offset) (list (make-point offset offset)
(make-point (- size offset) (/ size 2)) (make-point (- size offset) (/ size 2))
(make-point offset (- size offset)))) (make-point offset (- size offset)))
)
; the main function ; the main function
(let* ((img (car (gimp-image-new size size RGB))) (let* (
(background (car (gimp-layer-new img size size RGB-IMAGE "Arrow" 100 NORMAL-MODE))) (img (car (gimp-image-new size size RGB)))
(bumpmap (car (gimp-layer-new img size size RGB-IMAGE "Bumpmap" 100 NORMAL-MODE))) (background (car (gimp-layer-new img size size RGB-IMAGE "Arrow" 100 NORMAL-MODE)))
(big-arrow (point-list->double-array (rotate-points (make-arrow size 6) size orientation))) (bumpmap (car (gimp-layer-new img size size RGB-IMAGE "Bumpmap" 100 NORMAL-MODE)))
(med-arrow (point-list->double-array (rotate-points (make-arrow size 7) size orientation))) (big-arrow (point-list->double-array (rotate-points (make-arrow size 6) size orientation)))
(small-arrow (point-list->double-array (rotate-points (make-arrow size 8) size orientation)))) (med-arrow (point-list->double-array (rotate-points (make-arrow size 7) size orientation)))
(display big-arrow)
(small-arrow (point-list->double-array (rotate-points (make-arrow size 8) size orientation)))
)
(gimp-context-push) (gimp-context-push)
@ -136,22 +142,22 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-beveled-pattern-arrow" (script-fu-register "script-fu-beveled-pattern-arrow"
_"_Arrow..." _"_Arrow..."
_"Create a beveled pattern arrow for webpages" _"Create a beveled pattern arrow for webpages"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"July 1997" "July 1997"
"" ""
SF-ADJUSTMENT _"Size" '(32 5 150 1 10 0 1) SF-ADJUSTMENT _"Size" '(32 5 150 1 10 0 1)
SF-OPTION _"Orientation" '(_"Right" SF-OPTION _"Orientation" '(_"Right" _"Left" _"Up" _"Down")
_"Left" SF-PATTERN _"Pattern" "Wood"
_"Up" )
_"Down")
SF-PATTERN _"Pattern" "Wood")
(script-fu-menu-register "script-fu-beveled-pattern-arrow" (script-fu-menu-register "script-fu-beveled-pattern-arrow"
"<Toolbox>/Xtns/Web Page Themes/Beveled Pattern") "<Toolbox>/Xtns/Web Page Themes/Beveled Pattern")

View File

@ -21,9 +21,11 @@
(define (script-fu-beveled-pattern-bullet diameter pattern transparent) (define (script-fu-beveled-pattern-bullet diameter pattern transparent)
(let* ((img (car (gimp-image-new diameter diameter RGB))) (let* (
(background (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bullet" 100 NORMAL-MODE))) (img (car (gimp-image-new diameter diameter RGB)))
(bumpmap (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))) (background (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bullet" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
@ -68,24 +70,27 @@
(gimp-image-remove-layer img bumpmap) (gimp-image-remove-layer img bumpmap)
(if (= transparent FALSE) (if (= transparent FALSE)
(gimp-image-flatten img)) (gimp-image-flatten img))
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-beveled-pattern-bullet" (script-fu-register "script-fu-beveled-pattern-bullet"
_"_Bullet..." _"_Bullet..."
_"Create a beveled pattern bullet for webpages" _"Create a beveled pattern bullet for webpages"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"July 1997" "July 1997"
"" ""
SF-ADJUSTMENT _"Diameter" '(16 1 150 1 10 0 1) SF-ADJUSTMENT _"Diameter" '(16 1 150 1 10 0 1)
SF-PATTERN _"Pattern" "Wood" SF-PATTERN _"Pattern" "Wood"
SF-TOGGLE _"Transparent background" FALSE) SF-TOGGLE _"Transparent background" FALSE
)
(script-fu-menu-register "script-fu-beveled-pattern-bullet" (script-fu-menu-register "script-fu-beveled-pattern-bullet"
"<Toolbox>/Xtns/Web Page Themes/Beveled Pattern") "<Toolbox>/Xtns/Web Page Themes/Beveled Pattern")

View File

@ -38,26 +38,28 @@
(cadr (cddr extents))) (cadr (cddr extents)))
(define (script-fu-beveled-pattern-button (define (script-fu-beveled-pattern-button
text text-size font text-color pattern pressed) text text-size font text-color pattern pressed)
(let* ((text-extents (gimp-text-get-extents-fontname (let* (
text text-size PIXELS font)) (text-extents (gimp-text-get-extents-fontname
(ascent (text-ascent text-extents)) text text-size PIXELS font))
(descent (text-descent text-extents)) (ascent (text-ascent text-extents))
(descent (text-descent text-extents))
(xpadding 8) (xpadding 8)
(ypadding 6) (ypadding 6)
(width (+ (* 2 xpadding) (width (+ (* 2 xpadding)
(text-width text-extents))) (text-width text-extents)))
(height (+ (* 2 ypadding) (height (+ (* 2 ypadding)
(+ ascent descent))) (+ ascent descent)))
(img (car (gimp-image-new width height RGB))) (img (car (gimp-image-new width height RGB)))
(background (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE))) (background (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))) (bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))
(textl (car (textl (car
(gimp-text-fontname (gimp-text-fontname
img -1 0 0 text 0 TRUE text-size PIXELS font)))) img -1 0 0 text 0 TRUE text-size PIXELS font)))
)
(gimp-context-push) (gimp-context-push)
@ -97,8 +99,8 @@
(gimp-edit-fill textl BACKGROUND-FILL) (gimp-edit-fill textl BACKGROUND-FILL)
(gimp-layer-set-offsets textl (gimp-layer-set-offsets textl
xpadding xpadding
(+ ypadding descent)) (+ ypadding descent))
; Clean up ; Clean up
@ -109,22 +111,25 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-beveled-pattern-button" (script-fu-register "script-fu-beveled-pattern-button"
_"B_utton..." _"B_utton..."
_"Create a beveled pattern button for webpages" _"Create a beveled pattern button for webpages"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"July 1997" "July 1997"
"" ""
SF-STRING _"Text" "Hello world!" SF-STRING _"Text" "Hello world!"
SF-ADJUSTMENT _"Font size (pixels)" '(32 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(32 2 1000 1 10 0 1)
SF-FONT _"Font" "Sans" SF-FONT _"Font" "Sans"
SF-COLOR _"Text color" "black" SF-COLOR _"Text color" '(0 0 0)
SF-PATTERN _"Pattern" "Wood" SF-PATTERN _"Pattern" "Wood"
SF-TOGGLE _"Pressed" FALSE) SF-TOGGLE _"Pressed" FALSE
)
(script-fu-menu-register "script-fu-beveled-pattern-button" (script-fu-menu-register "script-fu-beveled-pattern-button"
"<Toolbox>/Xtns/Web Page Themes/Beveled Pattern") "<Toolbox>/Xtns/Web Page Themes/Beveled Pattern")

View File

@ -27,21 +27,19 @@
(define (script-fu-beveled-pattern-heading (define (script-fu-beveled-pattern-heading
text text-size font pattern transparent) text text-size font pattern transparent)
(let* ((img (car (gimp-image-new 10 10 RGB))) (let* (
(textl (img (car (gimp-image-new 10 10 RGB)))
(car (textl
(gimp-text-fontname img -1 0 0 text 0 TRUE text-size PIXELS font))) (car
(gimp-text-fontname img -1 0 0 text 0 TRUE text-size PIXELS font)))
(width (car (gimp-drawable-width textl))) (width (car (gimp-drawable-width textl)))
(height (car (gimp-drawable-height textl))) (height (car (gimp-drawable-height textl)))
(background (car (gimp-layer-new img (background (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
width height RGBA-IMAGE (bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))
"Background" 100 NORMAL-MODE))) )
(bumpmap (car (gimp-layer-new img
width height RGBA-IMAGE
"Bumpmap" 100 NORMAL-MODE))))
(gimp-context-push) (gimp-context-push)
@ -56,7 +54,7 @@
(gimp-edit-fill background BACKGROUND-FILL) (gimp-edit-fill background BACKGROUND-FILL)
(gimp-context-set-pattern pattern) (gimp-context-set-pattern pattern)
(gimp-edit-bucket-fill background (gimp-edit-bucket-fill background
PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
; Create bumpmap layer ; Create bumpmap layer
@ -91,26 +89,29 @@
(gimp-image-remove-layer img textl) (gimp-image-remove-layer img textl)
(if (= transparent FALSE) (if (= transparent FALSE)
(gimp-image-flatten img)) (gimp-image-flatten img))
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-beveled-pattern-heading" (script-fu-register "script-fu-beveled-pattern-heading"
_"H_eading..." _"H_eading..."
_"Create a beveled pattern heading for webpages" _"Create a beveled pattern heading for webpages"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"July 1997" "July 1997"
"" ""
SF-STRING _"Text" "Hello world!" SF-STRING _"Text" "Hello world!"
SF-ADJUSTMENT _"Font size (pixels)" '(72 2 200 1 1 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(72 2 200 1 1 0 1)
SF-FONT _"Font" "Sans" SF-FONT _"Font" "Sans"
SF-PATTERN _"Pattern" "Wood" SF-PATTERN _"Pattern" "Wood"
SF-TOGGLE _"Transparent background" FALSE) SF-TOGGLE _"Transparent background" FALSE
)
(script-fu-menu-register "script-fu-beveled-pattern-heading" (script-fu-menu-register "script-fu-beveled-pattern-heading"
"<Toolbox>/Xtns/Web Page Themes/Beveled Pattern") "<Toolbox>/Xtns/Web Page Themes/Beveled Pattern")

View File

@ -21,13 +21,11 @@
(define (script-fu-beveled-pattern-hrule width height pattern) (define (script-fu-beveled-pattern-hrule width height pattern)
(let* ((img (car (gimp-image-new width height RGB))) (let* (
(background (car (gimp-layer-new img (img (car (gimp-image-new width height RGB)))
width height RGB-IMAGE (background (car (gimp-layer-new img width height RGB-IMAGE "Hrule" 100 NORMAL-MODE)))
"Hrule" 100 NORMAL-MODE))) (bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img )
width height RGBA-IMAGE
"Bumpmap" 100 NORMAL-MODE))))
(gimp-context-push) (gimp-context-push)
@ -66,19 +64,22 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-beveled-pattern-hrule" (script-fu-register "script-fu-beveled-pattern-hrule"
_"_Hrule..." _"_Hrule..."
_"Create a beveled pattern hrule for webpages" _"Create a beveled pattern hrule for webpages"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"July 1997" "July 1997"
"" ""
SF-ADJUSTMENT _"Width" '(480 5 1500 1 10 0 1) SF-ADJUSTMENT _"Width" '(480 5 1500 1 10 0 1)
SF-ADJUSTMENT _"Height" '(16 1 100 1 10 0 1) SF-ADJUSTMENT _"Height" '(16 1 100 1 10 0 1)
SF-PATTERN _"Pattern" "Wood") SF-PATTERN _"Pattern" "Wood"
)
(script-fu-menu-register "script-fu-beveled-pattern-hrule" (script-fu-menu-register "script-fu-beveled-pattern-hrule"
"<Toolbox>/Xtns/Web Page Themes/Beveled Pattern") "<Toolbox>/Xtns/Web Page Themes/Beveled Pattern")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -26,208 +26,217 @@
; 1.03 - only call blur plugin when blut-radius >= 1.0 ; 1.03 - only call blur plugin when blut-radius >= 1.0
; ;
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org> ; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
; ;
; ;
; Blends two or more layers over a backgound, so that an animation can ; Blends two or more layers over a backgound, so that an animation can
; be saved. A minimum of three layers is required. ; be saved. A minimum of three layers is required.
(define (multi-raise-layer image layer times)
(while (> times 0)
(gimp-image-raise-layer image layer)
(set! times (- times 1))))
(define (script-fu-blend-anim img (define (script-fu-blend-anim img
drawable drawable
frames frames
max-blur max-blur
looped) looped)
(let* ((max-blur (max max-blur 0))
(frames (max frames 0))
(image (car (gimp-image-duplicate img)))
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(layers (gimp-image-get-layers image))
(num-layers (car layers))
(layer-array (cadr layers))
(slots (- num-layers 2))
(bg-layer (aref layer-array (- num-layers 1)))
(max-width 0)
(max-height 0)
(offset-x 0)
(offset-y 0))
(if (> num-layers 2)
(begin
(gimp-image-undo-disable image) (define (multi-raise-layer image layer times)
(while (> times 0)
(gimp-image-raise-layer image layer)
(set! times (- times 1))
)
)
(if (= looped TRUE) (let* (
; add a copy of the lowest blend layer on top (max-blur (max max-blur 0))
(let* ((copy (car (gimp-layer-copy (frames (max frames 0))
(aref layer-array (- num-layers 2)) TRUE)))) (image (car (gimp-image-duplicate img)))
(gimp-image-add-layer image copy 0) (width (car (gimp-image-width image)))
(set! layers (gimp-image-get-layers image)) (height (car (gimp-image-height image)))
(set! num-layers (car layers)) (layers (gimp-image-get-layers image))
(set! layer-array (cadr layers)) (num-layers (car layers))
(set! slots (- num-layers 2)) (layer-array (cadr layers))
(set! bg-layer (aref layer-array (- num-layers 1))))) (slots (- num-layers 2))
(bg-layer (aref layer-array (- num-layers 1)))
(max-width 0)
(max-height 0)
(offset-x 0)
(offset-y 0)
)
; make all layers invisible and check for sizes (if (> num-layers 2)
(let* ((min-offset-x width) (begin
(min-offset-y height) (gimp-image-undo-disable image)
(layer-count slots))
(gimp-drawable-set-visible bg-layer FALSE) (if (= looped TRUE)
(while (> layer-count -1) ; add a copy of the lowest blend layer on top
(let* ((layer (aref layer-array layer-count)) (let* ((copy (car (gimp-layer-copy
(layer-width (+ (car (gimp-drawable-width layer)) (aref layer-array (- num-layers 2)) TRUE))))
(* max-blur 2))) (gimp-image-add-layer image copy 0)
(layer-height (+ (car (gimp-drawable-height layer)) (set! layers (gimp-image-get-layers image))
(* max-blur 2))) (set! num-layers (car layers))
(layer-offsets (gimp-drawable-offsets layer)) (set! layer-array (cadr layers))
(layer-offset-x (- (car layer-offsets) max-blur)) (set! slots (- num-layers 2))
(layer-offset-y (- (cadr layer-offsets) max-blur))) (set! bg-layer (aref layer-array (- num-layers 1)))))
(gimp-drawable-set-visible layer FALSE)
(set! max-width (max max-width layer-width)) ; make all layers invisible and check for sizes
(set! max-height (max max-height layer-height)) (let* ((min-offset-x width)
(set! min-offset-x (min min-offset-x layer-offset-x)) (min-offset-y height)
(set! min-offset-y (min min-offset-y layer-offset-y)) (layer-count slots))
(set! layer-count (- layer-count 1)))) (gimp-drawable-set-visible bg-layer FALSE)
(set! offset-x (- (car (gimp-drawable-offsets bg-layer)) (while (> layer-count -1)
min-offset-x)) (let* ((layer (aref layer-array layer-count))
(set! offset-y (- (cadr (gimp-drawable-offsets bg-layer)) (layer-width (+ (car (gimp-drawable-width layer))
min-offset-y))) (* max-blur 2)))
(layer-height (+ (car (gimp-drawable-height layer))
; create intermediate frames by merging copies of adjascent layers (* max-blur 2)))
; with the background layer (layer-offsets (gimp-drawable-offsets layer))
(let* ((layer-count slots)) (layer-offset-x (- (car layer-offsets) max-blur))
(while (> layer-count 0) (layer-offset-y (- (cadr layer-offsets) max-blur)))
(let* ((frame-count frames) (gimp-drawable-set-visible layer FALSE)
(lower-layer (aref layer-array layer-count)) (set! max-width (max max-width layer-width))
(upper-layer (aref layer-array (- layer-count 1)))) (set! max-height (max max-height layer-height))
(while (> frame-count 0) (set! min-offset-x (min min-offset-x layer-offset-x))
(let* ((opacity (* (/ frame-count (+ frames 1)) 100)) (set! min-offset-y (min min-offset-y layer-offset-y))
(blur (/ (* opacity max-blur) 100)) (set! layer-count (- layer-count 1))))
(upper-copy (car (gimp-layer-copy upper-layer TRUE))) (set! offset-x (- (car (gimp-drawable-offsets bg-layer))
(lower-copy (car (gimp-layer-copy lower-layer TRUE))) min-offset-x))
(bg-copy (car (gimp-layer-copy bg-layer TRUE)))) (set! offset-y (- (cadr (gimp-drawable-offsets bg-layer))
(gimp-image-add-layer image bg-copy 0) min-offset-y)))
(gimp-image-add-layer image lower-copy 0)
(gimp-image-add-layer image upper-copy 0) ; create intermediate frames by merging copies of adjascent layers
(gimp-drawable-set-visible upper-copy TRUE) ; with the background layer
(gimp-drawable-set-visible lower-copy TRUE) (let* ((layer-count slots))
(gimp-drawable-set-visible bg-copy TRUE) (while (> layer-count 0)
(gimp-layer-set-opacity upper-copy (- 100 opacity)) (let* ((frame-count frames)
(gimp-layer-set-opacity lower-copy opacity) (lower-layer (aref layer-array layer-count))
(gimp-layer-set-opacity bg-copy 100) (upper-layer (aref layer-array (- layer-count 1))))
(if (> max-blur 0) (while (> frame-count 0)
(let* ((layer-width (car (gimp-drawable-width upper-copy))) (let* ((opacity (* (/ frame-count (+ frames 1)) 100))
(layer-height (car (gimp-drawable-height upper-copy)))) (blur (/ (* opacity max-blur) 100))
(gimp-layer-set-lock-alpha upper-copy FALSE) (upper-copy (car (gimp-layer-copy upper-layer TRUE)))
(gimp-layer-resize upper-copy (lower-copy (car (gimp-layer-copy lower-layer TRUE)))
(+ layer-width (* blur 2)) (bg-copy (car (gimp-layer-copy bg-layer TRUE))))
(+ layer-height (* blur 2)) (gimp-image-add-layer image bg-copy 0)
blur (gimp-image-add-layer image lower-copy 0)
blur) (gimp-image-add-layer image upper-copy 0)
(if (>= blur 1.0) (gimp-drawable-set-visible upper-copy TRUE)
(plug-in-gauss-rle 1 (gimp-drawable-set-visible lower-copy TRUE)
image (gimp-drawable-set-visible bg-copy TRUE)
upper-copy (gimp-layer-set-opacity upper-copy (- 100 opacity))
blur (gimp-layer-set-opacity lower-copy opacity)
TRUE TRUE)) (gimp-layer-set-opacity bg-copy 100)
(set! blur (- max-blur blur)) (if (> max-blur 0)
(gimp-layer-set-lock-alpha lower-copy FALSE) (let* ((layer-width (car (gimp-drawable-width upper-copy)))
(set! layer-width (car (gimp-drawable-width (layer-height (car (gimp-drawable-height upper-copy))))
lower-copy))) (gimp-layer-set-lock-alpha upper-copy FALSE)
(set! layer-height (car (gimp-drawable-height (gimp-layer-resize upper-copy
lower-copy))) (+ layer-width (* blur 2))
(gimp-layer-resize lower-copy (+ layer-height (* blur 2))
(+ layer-width (* blur 2)) blur
(+ layer-height (* blur 2)) blur)
blur (if (>= blur 1.0)
blur) (plug-in-gauss-rle 1
(if (>= blur 1.0) image
(plug-in-gauss-rle 1 upper-copy
image blur
lower-copy TRUE TRUE))
blur (set! blur (- max-blur blur))
TRUE TRUE)))) (gimp-layer-set-lock-alpha lower-copy FALSE)
(gimp-layer-resize bg-copy (set! layer-width (car (gimp-drawable-width
max-width lower-copy)))
max-height (set! layer-height (car (gimp-drawable-height
offset-x lower-copy)))
offset-y) (gimp-layer-resize lower-copy
(let* ((merged-layer (car (gimp-image-merge-visible-layers (+ layer-width (* blur 2))
image CLIP-TO-IMAGE)))) (+ layer-height (* blur 2))
(gimp-drawable-set-visible merged-layer FALSE)) blur
(set! frame-count (- frame-count 1)))) blur)
(set! layer-count (- layer-count 1))))) (if (>= blur 1.0)
(plug-in-gauss-rle 1
; merge all original blend layers but the lowest one image
; with copies of the background layer lower-copy
(let* ((layer-count 0)) blur
(while (< layer-count slots) TRUE TRUE))))
(let* ((orig-layer (aref layer-array layer-count)) (gimp-layer-resize bg-copy
(bg-copy (car (gimp-layer-copy bg-layer TRUE)))) max-width
(gimp-image-add-layer image max-height
bg-copy offset-x
(* layer-count (+ frames 1))) offset-y)
(multi-raise-layer image (let* ((merged-layer (car (gimp-image-merge-visible-layers
orig-layer image CLIP-TO-IMAGE))))
(+ (* (- slots layer-count) frames) 1)) (gimp-drawable-set-visible merged-layer FALSE))
(gimp-drawable-set-visible orig-layer TRUE) (set! frame-count (- frame-count 1))))
(gimp-drawable-set-visible bg-copy TRUE) (set! layer-count (- layer-count 1)))))
(gimp-layer-resize bg-copy
max-width ; merge all original blend layers but the lowest one
max-height ; with copies of the background layer
offset-x (let* ((layer-count 0))
offset-y) (while (< layer-count slots)
(let* ((merged-layer (car (gimp-image-merge-visible-layers (let* ((orig-layer (aref layer-array layer-count))
image CLIP-TO-IMAGE)))) (bg-copy (car (gimp-layer-copy bg-layer TRUE))))
(gimp-drawable-set-visible merged-layer FALSE)) (gimp-image-add-layer image
(set! layer-count (+ layer-count 1))))) bg-copy
(* layer-count (+ frames 1)))
; merge the lowest blend layer with the background layer (multi-raise-layer image
(let* ((orig-layer (aref layer-array (- num-layers 2)))) orig-layer
(gimp-drawable-set-visible bg-layer TRUE) (+ (* (- slots layer-count) frames) 1))
(gimp-drawable-set-visible orig-layer TRUE) (gimp-drawable-set-visible orig-layer TRUE)
(gimp-image-merge-visible-layers image CLIP-TO-IMAGE)) (gimp-drawable-set-visible bg-copy TRUE)
(gimp-layer-resize bg-copy
; make all layers visible again max-width
(let* ((result-layers (gimp-image-get-layers image)) max-height
(num-result-layers (car result-layers)) offset-x
(result-layer-array (cadr result-layers)) offset-y)
(layer-count (- num-result-layers 1))) (let* ((merged-layer (car (gimp-image-merge-visible-layers
(while (> layer-count -1) image CLIP-TO-IMAGE))))
(let* ((layer (aref result-layer-array layer-count)) (gimp-drawable-set-visible merged-layer FALSE))
(name (string-append "Frame " (set! layer-count (+ layer-count 1)))))
(number->string
(- num-result-layers layer-count) 10)))) ; merge the lowest blend layer with the background layer
(gimp-drawable-set-visible layer TRUE) (let* ((orig-layer (aref layer-array (- num-layers 2))))
(gimp-drawable-set-name layer name) (gimp-drawable-set-visible bg-layer TRUE)
(set! layer-count (- layer-count 1)))) (gimp-drawable-set-visible orig-layer TRUE)
(gimp-image-merge-visible-layers image CLIP-TO-IMAGE))
(if (= looped TRUE)
; remove the topmost layer ; make all layers visible again
(gimp-image-remove-layer image (aref result-layer-array 0)))) (let* ((result-layers (gimp-image-get-layers image))
(num-result-layers (car result-layers))
(gimp-image-undo-enable image) (result-layer-array (cadr result-layers))
(gimp-display-new image) (layer-count (- num-result-layers 1)))
(gimp-displays-flush)) (while (> layer-count -1)
(gimp-message "Blend Animation needs at least three source layers")))) (let* ((layer (aref result-layer-array layer-count))
(name (string-append "Frame "
(number->string
(- num-result-layers layer-count) 10))))
(gimp-drawable-set-visible layer TRUE)
(gimp-drawable-set-name layer name)
(set! layer-count (- layer-count 1))))
(if (= looped TRUE)
; remove the topmost layer
(gimp-image-remove-layer image (aref result-layer-array 0))))
(gimp-image-undo-enable image)
(gimp-display-new image)
(gimp-displays-flush)
)
(gimp-message _"Blend Animation needs at least three source layers")
)
)
)
(script-fu-register "script-fu-blend-anim" (script-fu-register "script-fu-blend-anim"
_"_Blend..." _"_Blend..."
_"Create intermediate layers to blend two or more layers over a background as an animation" _"Create intermediate layers to blend two or more layers over a background as an animation"
"Sven Neumann <sven@gimp.org>" "Sven Neumann <sven@gimp.org>"
"Sven Neumann" "Sven Neumann"
"1999/12/21" "1999/12/21"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Intermediate frames" '(3 1 1024 1 10 0 1) SF-ADJUSTMENT _"Intermediate frames" '(3 1 1024 1 10 0 1)
SF-ADJUSTMENT _"Max. blur radius" '(0 0 1024 1 10 0 1) SF-ADJUSTMENT _"Max. blur radius" '(0 0 1024 1 10 0 1)
SF-TOGGLE _"Looped" TRUE) SF-TOGGLE _"Looped" TRUE
)
(script-fu-menu-register "script-fu-blend-anim" (script-fu-menu-register "script-fu-blend-anim"
"<Image>/Filters/Animation/Animators") "<Image>/Filters/Animation/Animators")

View File

@ -5,41 +5,43 @@
; if the blend colors are specified as high intensity, the sharp option ; if the blend colors are specified as high intensity, the sharp option
; should be enabled or the logo will come out blurry ; should be enabled or the logo will come out blurry
(define (scale size (define (blended-logo-scale size percent)
percent) (* size percent)
(* size percent)) )
(define (apply-blended-logo-effect img (define (apply-blended-logo-effect img
logo-layer logo-layer
b-size b-size
bg-color bg-color
blend-mode blend-mode
blend-fg blend-fg
blend-bg blend-bg
blend-gradient blend-gradient
blend-gradient-reverse) blend-gradient-reverse)
(let* ((b-size-2 (scale b-size 0.5)) (let* (
(f-size (scale b-size 0.75)) (b-size-2 (blended-logo-scale b-size 0.5))
(ds-size (scale b-size 0.5)) (f-size (blended-logo-scale b-size 0.75))
(ts-size (- b-size-2 3)) (ds-size (blended-logo-scale b-size 0.5))
(width (car (gimp-drawable-width logo-layer))) (ts-size (- b-size-2 3))
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(blend-layer (car (gimp-layer-new img (height (car (gimp-drawable-height logo-layer)))
width height RGBA-IMAGE (blend-layer (car (gimp-layer-new img
"Blend" 100 NORMAL-MODE))) width height RGBA-IMAGE
(shadow-layer (car (gimp-layer-new img "Blend" 100 NORMAL-MODE)))
width height RGBA-IMAGE (shadow-layer (car (gimp-layer-new img
"Shadow" 100 NORMAL-MODE))) width height RGBA-IMAGE
(text-shadow-layer (car (gimp-layer-new img "Shadow" 100 NORMAL-MODE)))
width height RGBA-IMAGE (text-shadow-layer (car (gimp-layer-new img
"Text Shadow" 100 MULTIPLY-MODE))) width height RGBA-IMAGE
(tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer "Text Shadow" 100 MULTIPLY-MODE)))
ADD-BLACK-MASK))) (tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer
(drop-shadow-layer (car (gimp-layer-new img ADD-BLACK-MASK)))
width height RGBA-IMAGE (drop-shadow-layer (car (gimp-layer-new img
"Drop Shadow" 100 MULTIPLY-MODE))) width height RGBA-IMAGE
(dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer "Drop Shadow" 100 MULTIPLY-MODE)))
ADD-BLACK-MASK)))) (dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer
ADD-BLACK-MASK)))
)
(script-fu-util-image-resize-from-layer img logo-layer) (script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img shadow-layer 1) (gimp-image-add-layer img shadow-layer 1)
@ -67,9 +69,9 @@
(gimp-context-set-foreground '(255 255 255)) (gimp-context-set-foreground '(255 255 255))
(gimp-edit-blend text-shadow-layer FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend text-shadow-layer FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 1 1) 0 0 1 1)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-context-set-foreground blend-fg) (gimp-context-set-foreground blend-fg)
@ -77,9 +79,9 @@
(gimp-context-set-gradient blend-gradient) (gimp-context-set-gradient blend-gradient)
(gimp-edit-blend blend-layer blend-mode NORMAL-MODE (gimp-edit-blend blend-layer blend-mode NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE blend-gradient-reverse GRADIENT-LINEAR 100 0 REPEAT-NONE blend-gradient-reverse
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 width 0) 0 0 width 0)
(gimp-layer-translate logo-layer (- b-size-2) (- b-size-2)) (gimp-layer-translate logo-layer (- b-size-2) (- b-size-2))
(gimp-layer-translate blend-layer (- b-size) (- b-size)) (gimp-layer-translate blend-layer (- b-size) (- b-size))
@ -90,69 +92,73 @@
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-edit-fill dsl-layer-mask BACKGROUND-FILL) (gimp-edit-fill dsl-layer-mask BACKGROUND-FILL)
(gimp-layer-remove-mask drop-shadow-layer MASK-APPLY) (gimp-layer-remove-mask drop-shadow-layer MASK-APPLY)
(gimp-selection-none img))) (gimp-selection-none img)
)
)
(define (script-fu-blended-logo-alpha img (define (script-fu-blended-logo-alpha img
logo-layer logo-layer
b-size b-size
bg-color bg-color
blend-mode blend-mode
blend-fg blend-fg
blend-bg blend-bg
blend-gradient blend-gradient
blend-gradient-reverse) blend-gradient-reverse)
(begin (begin
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-blended-logo-effect img logo-layer b-size bg-color (apply-blended-logo-effect img logo-layer b-size bg-color
blend-mode blend-fg blend-bg blend-mode blend-fg blend-bg
blend-gradient blend-gradient-reverse) blend-gradient blend-gradient-reverse)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-blended-logo-alpha" (script-fu-register "script-fu-blended-logo-alpha"
_"Blen_ded..." _"Blen_ded..."
_"Add blended backgrounds, highlights, and shadows to the selected region (or alpha)" _"Add blended backgrounds, highlights, and shadows to the selected region (or alpha)"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1996" "1996"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Offset (pixels)" '(15 1 100 1 10 0 1) SF-ADJUSTMENT _"Offset (pixels)" '(15 1 100 1 10 0 1)
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-OPTION _"Blend mode" '(_"FG-BG-RGB" SF-OPTION _"Blend mode" '(_"FG-BG-RGB"
_"FG-BG-HSV" _"FG-BG-HSV"
_"FG-Transparent" _"FG-Transparent"
_"Custom Gradient") _"Custom Gradient")
SF-COLOR _"Start blend" '(22 9 129) SF-COLOR _"Start blend" '(22 9 129)
SF-COLOR _"End blend" '(129 9 82) SF-COLOR _"End blend" '(129 9 82)
SF-GRADIENT _"Gradient" "Golden" SF-GRADIENT _"Gradient" "Golden"
SF-TOGGLE _"Gradient reverse" FALSE) SF-TOGGLE _"Gradient reverse" FALSE
)
(script-fu-menu-register "script-fu-blended-logo-alpha" (script-fu-menu-register "script-fu-blended-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-blended-logo text (define (script-fu-blended-logo text
size size
font font
text-color text-color
bg-color bg-color
blend-mode blend-mode
blend-fg blend-fg
blend-bg blend-bg
blend-gradient blend-gradient
blend-gradient-reverse) blend-gradient-reverse)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(b-size (scale size 0.1)) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img (b-size (blended-logo-scale size 0.1))
-1 0 0 text b-size TRUE (text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
size PIXELS font)))) )
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
@ -160,33 +166,36 @@
(gimp-layer-set-lock-alpha text-layer TRUE) (gimp-layer-set-lock-alpha text-layer TRUE)
(gimp-edit-fill text-layer FOREGROUND-FILL) (gimp-edit-fill text-layer FOREGROUND-FILL)
(apply-blended-logo-effect img text-layer b-size bg-color (apply-blended-logo-effect img text-layer b-size bg-color
blend-mode blend-fg blend-bg blend-mode blend-fg blend-bg
blend-gradient blend-gradient-reverse) blend-gradient blend-gradient-reverse)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-blended-logo" (script-fu-register "script-fu-blended-logo"
_"Blen_ded..." _"Blen_ded..."
_"Create a logo with blended backgrounds, highlights, and shadows" _"Create a logo with blended backgrounds, highlights, and shadows"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1996" "1996"
"" ""
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Crillee" SF-FONT _"Font" "Crillee"
SF-COLOR _"Text color" '(124 174 255) SF-COLOR _"Text color" '(124 174 255)
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-OPTION _"Blend mode" '(_"FG-BG-RGB" SF-OPTION _"Blend mode" '(_"FG-BG-RGB"
_"FG-BG-HSV" _"FG-BG-HSV"
_"FG-Transparent" _"FG-Transparent"
_"Custom Gradient") _"Custom Gradient")
SF-COLOR _"Start blend" '(22 9 129) SF-COLOR _"Start blend" '(22 9 129)
SF-COLOR _"End blend" '(129 9 82) SF-COLOR _"End blend" '(129 9 82)
SF-GRADIENT _"Gradient" "Golden" SF-GRADIENT _"Gradient" "Golden"
SF-TOGGLE _"Gradient reverse" FALSE) SF-TOGGLE _"Gradient reverse" FALSE
)
(script-fu-menu-register "script-fu-blended-logo" (script-fu-menu-register "script-fu-blended-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -20,19 +20,14 @@
; Creates Cow-spotted logs.. what else? ; Creates Cow-spotted logs.. what else?
(define (apply-bovinated-logo-effect img (define (apply-bovinated-logo-effect img
logo-layer logo-layer
spots-x spots-x
spots-y spots-y
bg-color) bg-color)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* ((width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer))) (height (car (gimp-drawable-height logo-layer)))
(bg-layer (car (gimp-layer-new img (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
width height RGBA-IMAGE (blur-layer (car (gimp-layer-new img width height RGBA-IMAGE "Blur" 100 NORMAL-MODE))))
"Background" 100 NORMAL-MODE)))
(blur-layer (car (gimp-layer-new img
width height RGBA-IMAGE
"Blur" 100 NORMAL-MODE))))
(gimp-context-push) (gimp-context-push)
(script-fu-util-image-resize-from-layer img logo-layer) (script-fu-util-image-resize-from-layer img logo-layer)
@ -63,69 +58,75 @@
(gimp-selection-none img) (gimp-selection-none img)
(gimp-layer-set-lock-alpha logo-layer FALSE) (gimp-layer-set-lock-alpha logo-layer FALSE)
(plug-in-bump-map 1 img logo-layer blur-layer (plug-in-bump-map 1 img logo-layer blur-layer
135 50 10 0 0 0 30 TRUE FALSE 0) 135 50 10 0 0 0 30 TRUE FALSE 0)
(gimp-layer-set-offsets blur-layer 5 5) (gimp-layer-set-offsets blur-layer 5 5)
(gimp-invert blur-layer) (gimp-invert blur-layer)
(gimp-layer-set-opacity blur-layer 50.0) (gimp-layer-set-opacity blur-layer 50.0)
(gimp-image-set-active-layer img logo-layer) (gimp-image-set-active-layer img logo-layer)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-bovinated-logo-alpha img (define (script-fu-bovinated-logo-alpha img
logo-layer logo-layer
spots-x spots-x
spots-y spots-y
bg-color) bg-color)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-bovinated-logo-effect img logo-layer spots-x spots-y bg-color) (apply-bovinated-logo-effect img logo-layer spots-x spots-y bg-color)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-bovinated-logo-alpha" (script-fu-register "script-fu-bovinated-logo-alpha"
_"Bo_vination..." _"Bo_vination..."
_"Add 'cow spots' to the selected region (or alpha)" _"Add 'cow spots' to the selected region (or alpha)"
"Brian McFee <keebler@wco.com>" "Brian McFee <keebler@wco.com>"
"Brian McFee" "Brian McFee"
"April 1998" "April 1998"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Spots density X" '(16 1 16 1 10 0 1) SF-ADJUSTMENT _"Spots density X" '(16 1 16 1 10 0 1)
SF-ADJUSTMENT _"Spots density Y" '(4 1 16 1 10 0 1) SF-ADJUSTMENT _"Spots density Y" '(4 1 16 1 10 0 1)
SF-COLOR _"Background color" "white") SF-COLOR _"Background Color" '(255 255 255)
)
(script-fu-menu-register "script-fu-bovinated-logo-alpha"
"<Image>/Filters/Alpha to Logo")
(define (script-fu-bovinated-logo text (define (script-fu-bovinated-logo text
size size
font font
spots-x spots-x
spots-y spots-y
bg-color) bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4)) (border (/ size 4))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))) (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-bovinated-logo-effect img text-layer spots-x spots-y bg-color) (apply-bovinated-logo-effect img text-layer spots-x spots-y bg-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img))
)
(script-fu-menu-register "script-fu-bovinated-logo-alpha"
"<Image>/Filters/Alpha to Logo")
(script-fu-register "script-fu-bovinated-logo" (script-fu-register "script-fu-bovinated-logo"
_"Bo_vination..." _"Bo_vination..."
_"Create a logo with text in the style of 'cow spots'" _"Create a logo with text in the style of 'cow spots'"
"Brian McFee <keebler@wco.com>" "Brian McFee <keebler@wco.com>"
"Brian McFee" "Brian McFee"
"April 1998" "April 1998"
"" ""
SF-STRING _"Text" "Fear the Cow" SF-STRING _"Text" "Fear the Cow"
SF-ADJUSTMENT _"Font size (pixels)" '(80 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(80 2 1000 1 10 0 1)
SF-FONT _"Font" "RoostHeavy" SF-FONT _"Font" "RoostHeavy"
SF-ADJUSTMENT _"Spots density X" '(16 1 16 1 10 0 1) SF-ADJUSTMENT _"Spots density X" '(16 1 16 1 10 0 1)
SF-ADJUSTMENT _"Spots density Y" '(4 1 16 1 10 0 1) SF-ADJUSTMENT _"Spots density Y" '(4 1 16 1 10 0 1)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-bovinated-logo" (script-fu-menu-register "script-fu-bovinated-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -12,193 +12,225 @@
; ;
(define (script-fu-burn-in-anim org-img (define (script-fu-burn-in-anim org-img
org-layer org-layer
glow-color glow-color
fadeout fadeout
bl-width bl-width
corona-width corona-width
after-glow after-glow
show-glow show-glow
optimize optimize
speed) speed)
(let* ( (let* (
;--- main variable: "bl-x" runs from 0 to layer-width ;--- main variable: "bl-x" runs from 0 to layer-width
(bl-x 0) (bl-x 0)
(frame-nr 0)) (frame-nr 0)
(img)
(source-layer)
(bg-source-layer)
(source-layer-width)
(bg-layer)
(bg-layer-name)
(bl-layer)
(bl-layer-name)
(bl-mask)
(bl-layer-width)
(bl-height)
(bl-x-off)
(bl-y-off)
(nofadeout-bl-x-off)
(nofadeout-bl-width)
(blended-layer)
(img-display)
)
(if (< speed 1) (if (< speed 1)
(set! speed (* -1 speed)) ) (set! speed (* -1 speed)) )
;--- check image and work on a copy ;--- check image and work on a copy
(if (= (car (gimp-image-get-layers org-img)) 2) (if (= (car (gimp-image-get-layers org-img)) 2)
;--- main program structure starts here, begin of "if-1" ;--- main program structure starts here, begin of "if-1"
(begin (begin
(gimp-context-push) (gimp-context-push)
(set! img (car (gimp-image-duplicate org-img))) (set! img (car (gimp-image-duplicate org-img)))
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(if (> (car (gimp-drawable-type org-layer)) 1 ) (if (> (car (gimp-drawable-type org-layer)) 1 )
(gimp-image-convert-rgb img)) (gimp-image-convert-rgb img))
(set! source-layer (aref (cadr (gimp-image-get-layers img)) 0 )) (set! source-layer (aref (cadr (gimp-image-get-layers img)) 0 ))
(set! bg-source-layer (aref (cadr (gimp-image-get-layers img)) 1 )) (set! bg-source-layer (aref (cadr (gimp-image-get-layers img)) 1 ))
(set! source-layer-width (car (gimp-drawable-width source-layer))) (set! source-layer-width (car (gimp-drawable-width source-layer)))
;--- hide layers, cause we want to "merge visible layers" later ;--- hide layers, cause we want to "merge visible layers" later
(gimp-drawable-set-visible source-layer FALSE) (gimp-drawable-set-visible source-layer FALSE)
(gimp-drawable-set-visible bg-source-layer FALSE) (gimp-drawable-set-visible bg-source-layer FALSE)
;--- process image horizontal with pixel-speed ;--- process image horizontal with pixel-speed
(while (< bl-x (+ source-layer-width bl-width)) (while (< bl-x (+ source-layer-width bl-width))
(set! bl-layer (car (gimp-layer-copy source-layer TRUE))) (set! bl-layer (car (gimp-layer-copy source-layer TRUE)))
(set! bl-layer-name (string-append "fr-nr" (set! bl-layer-name (string-append "fr-nr"
(number->string frame-nr 10) ) ) (number->string frame-nr 10) ) )
(gimp-image-add-layer img bl-layer -2) (gimp-image-add-layer img bl-layer -2)
(gimp-drawable-set-name bl-layer bl-layer-name) (gimp-drawable-set-name bl-layer bl-layer-name)
(gimp-drawable-set-visible bl-layer TRUE) (gimp-drawable-set-visible bl-layer TRUE)
(gimp-layer-set-lock-alpha bl-layer TRUE) (gimp-layer-set-lock-alpha bl-layer TRUE)
(gimp-layer-add-alpha bl-layer) (gimp-layer-add-alpha bl-layer)
;--- add an alpha mask for blending and select it ;--- add an alpha mask for blending and select it
(gimp-selection-layer-alpha bl-layer) (gimp-selection-layer-alpha bl-layer)
(set! bl-mask (car (gimp-layer-create-mask bl-layer ADD-BLACK-MASK))) (set! bl-mask (car (gimp-layer-create-mask bl-layer ADD-BLACK-MASK)))
(gimp-layer-add-mask bl-layer bl-mask) (gimp-layer-add-mask bl-layer bl-mask)
;--- handle layer geometry ;--- handle layer geometry
(set! bl-layer-width source-layer-width) (set! bl-layer-width source-layer-width)
(set! bl-height (car (gimp-drawable-height bl-layer))) (set! bl-height (car (gimp-drawable-height bl-layer)))
(set! bl-x-off (- bl-x bl-width)) (set! bl-x-off (- bl-x bl-width))
(set! bl-x-off (+ bl-x-off (car (gimp-drawable-offsets bl-layer)))) (set! bl-x-off (+ bl-x-off (car (gimp-drawable-offsets bl-layer))))
(set! bl-y-off (cadr (gimp-drawable-offsets bl-layer))) (set! bl-y-off (cadr (gimp-drawable-offsets bl-layer)))
;--- select a rectangular area to blend ;--- select a rectangular area to blend
(gimp-rect-select img bl-x-off bl-y-off bl-width bl-height CHANNEL-OP-REPLACE 0 0) (gimp-rect-select img bl-x-off bl-y-off bl-width bl-height CHANNEL-OP-REPLACE 0 0)
;--- select at least 1 pixel! ;--- select at least 1 pixel!
(gimp-rect-select img bl-x-off bl-y-off (+ bl-width 1) bl-height CHANNEL-OP-ADD 0 0) (gimp-rect-select img bl-x-off bl-y-off (+ bl-width 1) bl-height CHANNEL-OP-ADD 0 0)
(if (= fadeout FALSE) (if (= fadeout FALSE)
(begin (begin
(set! nofadeout-bl-x-off (car (gimp-drawable-offsets bl-layer))) (set! nofadeout-bl-x-off (car (gimp-drawable-offsets bl-layer)))
(set! nofadeout-bl-width (+ nofadeout-bl-x-off bl-x)) (set! nofadeout-bl-width (+ nofadeout-bl-x-off bl-x))
(set! nofadeout-bl-width (max nofadeout-bl-width 1)) (set! nofadeout-bl-width (max nofadeout-bl-width 1))
(gimp-rect-select img nofadeout-bl-x-off bl-y-off (gimp-rect-select img nofadeout-bl-x-off bl-y-off
nofadeout-bl-width bl-height nofadeout-bl-width bl-height
CHANNEL-OP-REPLACE 0 0))) CHANNEL-OP-REPLACE 0 0)
)
)
;--- alpha blending text to trans (fadeout) ;--- alpha blending text to trans (fadeout)
(gimp-context-set-foreground '(255 255 255)) (gimp-context-set-foreground '(255 255 255))
(gimp-context-set-background '( 0 0 0)) (gimp-context-set-background '( 0 0 0))
(if (= fadeout TRUE) (if (= fadeout TRUE)
(begin (begin
; blend with 20% offset to get less transparency in the front ; blend with 20% offset to get less transparency in the front
(gimp-edit-blend bl-mask FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend bl-mask FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-LINEAR 100 20 REPEAT-NONE FALSE GRADIENT-LINEAR 100 20 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
(+ bl-x-off bl-width) 0 bl-x-off 0))) (+ bl-x-off bl-width) 0 bl-x-off 0)
)
)
(if (= fadeout FALSE) (if (= fadeout FALSE)
(begin (begin
(gimp-context-set-foreground '(255 255 255)) (gimp-context-set-foreground '(255 255 255))
(gimp-edit-bucket-fill bl-mask FG-BUCKET-FILL NORMAL-MODE (gimp-edit-bucket-fill bl-mask FG-BUCKET-FILL NORMAL-MODE
100 255 0 0 0))) 100 255 0 0 0)
)
)
(gimp-layer-remove-mask bl-layer MASK-APPLY) (gimp-layer-remove-mask bl-layer MASK-APPLY)
;--- add bright glow in front ;--- add bright glow in front
(if (= show-glow TRUE) (if (= show-glow TRUE)
(begin (begin
;--- add some brightness to whole text ;--- add some brightness to whole text
(if (= fadeout TRUE) (if (= fadeout TRUE)
(gimp-brightness-contrast bl-layer 100 0)) (gimp-brightness-contrast bl-layer 100 0)
)
;--- blend glow color inside the letters ;--- blend glow color inside the letters
(gimp-context-set-foreground glow-color) (gimp-context-set-foreground glow-color)
(gimp-edit-blend bl-layer FG-TRANSPARENT-MODE NORMAL-MODE (gimp-edit-blend bl-layer FG-TRANSPARENT-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
(+ bl-x-off bl-width) 0 (+ bl-x-off bl-width) 0
(- (+ bl-x-off bl-width) after-glow) 0) (- (+ bl-x-off bl-width) after-glow) 0)
;--- add corona effect ;--- add corona effect
(gimp-selection-layer-alpha bl-layer) (gimp-selection-layer-alpha bl-layer)
(gimp-selection-sharpen img) (gimp-selection-sharpen img)
(gimp-selection-grow img corona-width) (gimp-selection-grow img corona-width)
(gimp-layer-set-lock-alpha bl-layer FALSE) (gimp-layer-set-lock-alpha bl-layer FALSE)
(gimp-selection-feather img corona-width) (gimp-selection-feather img corona-width)
(gimp-context-set-foreground glow-color) (gimp-context-set-foreground glow-color)
(gimp-edit-blend bl-layer FG-TRANSPARENT-MODE NORMAL-MODE (gimp-edit-blend bl-layer FG-TRANSPARENT-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
(- (+ bl-x-off bl-width) corona-width) 0 (- (+ bl-x-off bl-width) corona-width) 0
(- (+ bl-x-off bl-width) after-glow) 0)) (- (+ bl-x-off bl-width) after-glow) 0)
) )
)
;--- merge with bg layer ;--- merge with bg layer
(set! bg-layer (car (gimp-layer-copy bg-source-layer FALSE))) (set! bg-layer (car (gimp-layer-copy bg-source-layer FALSE)))
(gimp-image-add-layer img bg-layer -1) (gimp-image-add-layer img bg-layer -1)
(gimp-image-lower-layer img bg-layer) (gimp-image-lower-layer img bg-layer)
(set! bg-layer-name (string-append "bg-" (set! bg-layer-name (string-append "bg-"
(number->string frame-nr 10))) (number->string frame-nr 10)))
(gimp-drawable-set-name bg-layer bg-layer-name) (gimp-drawable-set-name bg-layer bg-layer-name)
(gimp-drawable-set-visible bg-layer TRUE) (gimp-drawable-set-visible bg-layer TRUE)
(set! blended-layer (car (gimp-image-merge-visible-layers img (set! blended-layer (car (gimp-image-merge-visible-layers img
CLIP-TO-IMAGE))) CLIP-TO-IMAGE)))
;(set! blended-layer bl-layer) ;(set! blended-layer bl-layer)
(gimp-drawable-set-visible blended-layer FALSE) (gimp-drawable-set-visible blended-layer FALSE)
;--- end of "while" loop ;--- end of "while" loop
(set! frame-nr (+ frame-nr 1)) (set! frame-nr (+ frame-nr 1))
(set! bl-x (+ bl-x speed))) (set! bl-x (+ bl-x speed))
)
;--- finalize the job ;--- finalize the job
(gimp-selection-none img) (gimp-selection-none img)
(gimp-image-remove-layer img source-layer) (gimp-image-remove-layer img source-layer)
(gimp-image-remove-layer img bg-source-layer) (gimp-image-remove-layer img bg-source-layer)
(gimp-image-set-filename img "burn-in") (gimp-image-set-filename img "burn-in")
(if (= optimize TRUE) (if (= optimize TRUE)
(begin (begin
(gimp-image-convert-indexed img 1 WEB-PALETTE 250 FALSE TRUE "") (gimp-image-convert-indexed img 1 WEB-PALETTE 250 FALSE TRUE "")
(set! img-out (car (plug-in-animationoptimize 0 (set! img-out (car (plug-in-animationoptimize 0
img img
bl-layer))))) bl-layer)))
)
)
(gimp-drawable-set-visible (aref (cadr (gimp-image-get-layers img)) 0) (gimp-drawable-set-visible (aref (cadr (gimp-image-get-layers img)) 0)
TRUE) TRUE)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-image-clean-all img) (gimp-image-clean-all img)
(set! img-display (car (gimp-display-new img))) (set! img-display (car (gimp-display-new img)))
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop)) (gimp-context-pop)
)
;--- false form of "if-1" ;--- false form of "if-1"
(gimp-message _"Burn-In: Need two layers in total!" (gimp-message _"Burn-In: Needs two layers in total!\nA foreground text layer with transparency and a background layer.")
"A foreground text layer with transparency" )
"and a background layer.")))) )
)
(script-fu-register "script-fu-burn-in-anim" (script-fu-register "script-fu-burn-in-anim"
_"B_urn-In..." _"B_urn-In..."
_"Create intermediate layers to produce an animated 'burn-in' transition between two layers" _"Create intermediate layers to produce an animated 'burn-in' transition between two layers"
"Roland Berger roland@fuchur.leute.server.de" "Roland Berger roland@fuchur.leute.server.de"
"Roland Berger" "Roland Berger"
"January 2001" "January 2001"
"RGBA GRAYA INDEXEDA" "RGBA GRAYA INDEXEDA"
SF-IMAGE "The image" 0 SF-IMAGE "The image" 0
SF-DRAWABLE "Layer to animate" 0 SF-DRAWABLE "Layer to animate" 0
SF-COLOR _"Glow color" "white" SF-COLOR _"Glow color" '(255 255 255)
SF-TOGGLE _"Fadeout" FALSE SF-TOGGLE _"Fadeout" FALSE
SF-VALUE _"Fadeout width" "100" SF-VALUE _"Fadeout width" "100"
SF-VALUE _"Corona width" "7" SF-VALUE _"Corona width" "7"
SF-VALUE _"After glow" "50" SF-VALUE _"After glow" "50"
SF-TOGGLE _"Add glowing" TRUE SF-TOGGLE _"Add glowing" TRUE
SF-TOGGLE _"Prepare for GIF" FALSE SF-TOGGLE _"Prepare for GIF" FALSE
SF-VALUE _"Speed (pixels/frame)" "50") SF-VALUE _"Speed (pixels/frame)" "50"
)
(script-fu-menu-register "script-fu-burn-in-anim" (script-fu-menu-register "script-fu-burn-in-anim"
"<Image>/Filters/Animation/Animators") "<Image>/Filters/Animation/Animators")

View File

@ -8,12 +8,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -31,75 +31,78 @@
(theBlur) (theBlur)
) )
(gimp-image-add-layer theImage baseLayer 0) (gimp-context-push)
(set! thickLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thick Layer" 100 NORMAL-MODE))) (gimp-image-add-layer theImage baseLayer 0)
(gimp-image-add-layer theImage thickLayer 0)
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thin Layer" 100 NORMAL-MODE))) (set! thickLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thick Layer" 100 NORMAL-MODE)))
(gimp-image-add-layer theImage thinLayer 0) (gimp-image-add-layer theImage thickLayer 0)
(gimp-context-push) (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thin Layer" 100 NORMAL-MODE)))
(gimp-image-add-layer theImage thinLayer 0)
(gimp-selection-all theImage) (gimp-selection-all theImage)
(gimp-context-set-background inColor1) (gimp-context-set-background inColor1)
(gimp-drawable-fill baseLayer BACKGROUND-FILL) (gimp-drawable-fill baseLayer BACKGROUND-FILL)
(plug-in-solid-noise TRUE theImage thickLayer 1 0 (rand 65536) 1 inGrain inGrain) (plug-in-solid-noise TRUE theImage thickLayer 1 0 (rand 65536) 1 inGrain inGrain)
(plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536) 1 inGrain inGrain) (plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536) 1 inGrain inGrain)
(gimp-threshold thickLayer 127 255) (gimp-threshold thickLayer 127 255)
(gimp-threshold thinLayer 145 255) (gimp-threshold thinLayer 145 255)
(set! theBlur (- 16 inGrain)) (set! theBlur (- 16 inGrain))
(gimp-context-set-background inColor2) (gimp-context-set-background inColor2)
(gimp-by-color-select thickLayer '(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE) (gimp-by-color-select thickLayer '(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
(gimp-edit-clear thickLayer) (gimp-edit-clear thickLayer)
(gimp-selection-invert theImage) (gimp-selection-invert theImage)
(gimp-edit-fill thickLayer BACKGROUND-FILL) (gimp-edit-fill thickLayer BACKGROUND-FILL)
(gimp-selection-none theImage) (gimp-selection-none theImage)
(if (= inSmooth TRUE) (if (= inSmooth TRUE)
(script-fu-tile-blur theImage thickLayer theBlur TRUE TRUE FALSE) (script-fu-tile-blur theImage thickLayer theBlur TRUE TRUE FALSE)
() )
)
(gimp-context-set-background inColor3) (gimp-context-set-background inColor3)
(gimp-by-color-select thinLayer '(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE) (gimp-by-color-select thinLayer '(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
(gimp-edit-clear thinLayer) (gimp-edit-clear thinLayer)
(gimp-selection-invert theImage) (gimp-selection-invert theImage)
(gimp-edit-fill thinLayer BACKGROUND-FILL) (gimp-edit-fill thinLayer BACKGROUND-FILL)
(gimp-selection-none theImage) (gimp-selection-none theImage)
(if (= inSmooth TRUE) (if (= inSmooth TRUE)
(script-fu-tile-blur theImage thinLayer (/ theBlur 2) TRUE TRUE FALSE) (script-fu-tile-blur theImage thinLayer (/ theBlur 2) TRUE TRUE FALSE)
() )
)
(if (= inFlatten TRUE) (if (= inFlatten TRUE)
(gimp-image-flatten theImage) (gimp-image-flatten theImage)
() )
) (gimp-display-new theImage)
(gimp-display-new theImage) (gimp-context-pop)
)
(gimp-context-pop))) )
(script-fu-register "script-fu-camo-pattern" ; Register the function with the GIMP:
_"_Camouflage..."
_"Create an image filled with a camouflage pattern" (script-fu-register
"Chris Gutteridge: cjg@ecs.soton.ac.uk" "script-fu-camo-pattern"
"28th April 1998" _"_Camouflage..."
"Chris Gutteridge / ECS @ University of Southampton, England" _"Create an image filled with a camouflage pattern"
"" "Chris Gutteridge: cjg@ecs.soton.ac.uk"
SF-ADJUSTMENT _"Image size" '(256 10 1000 1 10 0 1) "28th April 1998"
SF-ADJUSTMENT _"Granularity" '(7 0 15 1 1 0 0) "Chris Gutteridge / ECS @ University of Southampton, England"
SF-COLOR _"Color 1" '(33 100 58) ""
SF-COLOR _"Color 2" '(170 170 60) SF-ADJUSTMENT _"Image size" '(256 10 1000 1 10 0 1)
SF-COLOR _"Color 3" '(150 115 100) SF-ADJUSTMENT _"Granularity" '(7 0 15 1 1 0 0)
SF-TOGGLE _"Smooth" FALSE SF-COLOR _"Color 1" '(33 100 58)
SF-TOGGLE _"Flatten image" TRUE) SF-COLOR _"Color 2" '(170 170 60)
SF-COLOR _"Color 3" '(150 115 100)
SF-TOGGLE _"Smooth" FALSE
SF-TOGGLE _"Flatten image" TRUE
)
(script-fu-menu-register "script-fu-camo-pattern" (script-fu-menu-register "script-fu-camo-pattern"
"<Toolbox>/Xtns/Patterns") "<Toolbox>/Xtns/Patterns")

View File

@ -11,22 +11,22 @@
(define (carve-brush brush-size) (define (carve-brush brush-size)
(cond ((<= brush-size 5) "Circle (05)") (cond ((<= brush-size 5) "Circle (05)")
((<= brush-size 7) "Circle (07)") ((<= brush-size 7) "Circle (07)")
((<= brush-size 9) "Circle (09)") ((<= brush-size 9) "Circle (09)")
((<= brush-size 11) "Circle (11)") ((<= brush-size 11) "Circle (11)")
((<= brush-size 13) "Circle (13)") ((<= brush-size 13) "Circle (13)")
((<= brush-size 15) "Circle (15)") ((<= brush-size 15) "Circle (15)")
((<= brush-size 17) "Circle (17)") ((<= brush-size 17) "Circle (17)")
(else "Circle (19)"))) (else "Circle (19)")))
(define (carve-scale val scale) (define (carve-scale val scale)
(* (sqrt val) scale)) (* (sqrt val) scale))
(define (calculate-inset-gamma img layer) (define (calculate-inset-gamma img layer)
(let* ((stats (gimp-histogram layer 0 0 255)) (let* ((stats (gimp-histogram layer 0 0 255))
(mean (car stats))) (mean (car stats)))
(cond ((< mean 127) (+ 1.0 (* 0.5 (/ (- 127 mean) 127.0)))) (cond ((< mean 127) (+ 1.0 (* 0.5 (/ (- 127 mean) 127.0))))
((>= mean 127) (- 1.0 (* 0.5 (/ (- mean 127) 127.0))))))) ((>= mean 127) (- 1.0 (* 0.5 (/ (- mean 127) 127.0)))))))
(define (copy-layer-carve-it dest-image dest-drawable source-image source-drawable) (define (copy-layer-carve-it dest-image dest-drawable source-image source-drawable)
@ -36,43 +36,45 @@
(gimp-selection-all source-image) (gimp-selection-all source-image)
(gimp-edit-copy source-drawable) (gimp-edit-copy source-drawable)
(let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE)))) (let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel))) (gimp-floating-sel-anchor floating-sel)))
(define (script-fu-carve-it mask-img mask-drawable bg-layer carve-white) (define (script-fu-carve-it mask-img mask-drawable bg-layer carve-white)
(let* ((width (car (gimp-drawable-width mask-drawable))) (let* (
(height (car (gimp-drawable-height mask-drawable))) (width (car (gimp-drawable-width mask-drawable)))
(type (car (gimp-drawable-type bg-layer))) (height (car (gimp-drawable-height mask-drawable)))
(img (car (gimp-image-new width height (cond ((= type RGB-IMAGE) RGB) (type (car (gimp-drawable-type bg-layer)))
((= type RGBA-IMAGE) RGB) (img (car (gimp-image-new width height (cond ((= type RGB-IMAGE) RGB)
((= type GRAY-IMAGE) GRAY) ((= type RGBA-IMAGE) RGB)
((= type GRAYA-IMAGE) GRAY) ((= type GRAY-IMAGE) GRAY)
((= type INDEXED-IMAGE) INDEXED) ((= type GRAYA-IMAGE) GRAY)
((= type INDEXEDA-IMAGE) INDEXED))))) ((= type INDEXED-IMAGE) INDEXED)
(size (min width height)) ((= type INDEXEDA-IMAGE) INDEXED)))))
(offx (carve-scale size 0.33)) (size (min width height))
(offy (carve-scale size 0.25)) (offx (carve-scale size 0.33))
(feather (carve-scale size 0.3)) (offy (carve-scale size 0.25))
(brush-size (carve-scale size 0.3)) (feather (carve-scale size 0.3))
(mask-fs 0) (brush-size (carve-scale size 0.3))
(mask (car (gimp-channel-new img width height "Engraving Mask" 50 '(0 0 0)))) (mask-fs 0)
(inset-gamma (calculate-inset-gamma (car (gimp-drawable-get-image bg-layer)) bg-layer)) (mask (car (gimp-channel-new img width height "Engraving Mask" 50 '(0 0 0))))
(mask-fat 0) (inset-gamma (calculate-inset-gamma (car (gimp-drawable-get-image bg-layer)) bg-layer))
(mask-emboss 0) (mask-fat 0)
(mask-highlight 0) (mask-emboss 0)
(mask-shadow 0) (mask-highlight 0)
(shadow-layer 0) (mask-shadow 0)
(highlight-layer 0) (shadow-layer 0)
(cast-shadow-layer 0) (highlight-layer 0)
(csl-mask 0) (cast-shadow-layer 0)
(inset-layer 0) (csl-mask 0)
(il-mask 0) (inset-layer 0)
(bg-width (car (gimp-drawable-width bg-layer))) (il-mask 0)
(bg-height (car (gimp-drawable-height bg-layer))) (bg-width (car (gimp-drawable-width bg-layer)))
(bg-type (car (gimp-drawable-type bg-layer))) (bg-height (car (gimp-drawable-height bg-layer)))
(bg-image (car (gimp-drawable-get-image bg-layer))) (bg-type (car (gimp-drawable-type bg-layer)))
(layer1 (car (gimp-layer-new img bg-width bg-height bg-type "Layer1" 100 NORMAL-MODE)))) (bg-image (car (gimp-drawable-get-image bg-layer)))
(layer1 (car (gimp-layer-new img bg-width bg-height bg-type "Layer1" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
@ -92,7 +94,7 @@
(set! mask-fs (car (gimp-edit-paste mask FALSE))) (set! mask-fs (car (gimp-edit-paste mask FALSE)))
(gimp-floating-sel-anchor mask-fs) (gimp-floating-sel-anchor mask-fs)
(if (= carve-white FALSE) (if (= carve-white FALSE)
(gimp-invert mask)) (gimp-invert mask))
(set! mask-fat (car (gimp-channel-copy mask))) (set! mask-fat (car (gimp-channel-copy mask)))
(gimp-image-add-channel img mask-fat 0) (gimp-image-add-channel img mask-fat 0)
@ -171,19 +173,22 @@
(gimp-display-new img) (gimp-display-new img)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-carve-it" (script-fu-register "script-fu-carve-it"
_"Stencil C_arve..." _"Stencil C_arve..."
_"Create an image with a carved effect using the active (grayscale) drawable as a mask" "Use the specified [GRAY] drawable as a stencil to carve from the specified image. The specified image must be either RGB colour or grayscale, not indexed."
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"GRAY" "GRAY"
SF-IMAGE "Mask image" 0 SF-IMAGE "Mask image" 0
SF-DRAWABLE "Mask drawable" 0 SF-DRAWABLE "Mask drawable" 0
SF-DRAWABLE _"Image to carve" 0 SF-DRAWABLE _"Image to carve" 0
SF-TOGGLE _"Carve white areas" TRUE) SF-TOGGLE _"Carve white areas" TRUE
)
(script-fu-menu-register "script-fu-carve-it" (script-fu-menu-register "script-fu-carve-it"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -6,47 +6,49 @@
(define (carve-brush brush-size) (define (carve-brush brush-size)
(cond ((<= brush-size 5) "Circle (05)") (cond ((<= brush-size 5) "Circle (05)")
((<= brush-size 7) "Circle (07)") ((<= brush-size 7) "Circle (07)")
((<= brush-size 9) "Circle (09)") ((<= brush-size 9) "Circle (09)")
((<= brush-size 11) "Circle (11)") ((<= brush-size 11) "Circle (11)")
((<= brush-size 13) "Circle (13)") ((<= brush-size 13) "Circle (13)")
((<= brush-size 15) "Circle (15)") ((<= brush-size 15) "Circle (15)")
((<= brush-size 17) "Circle (17)") ((<= brush-size 17) "Circle (17)")
((> brush-size 17) "Circle (19)"))) ((> brush-size 17) "Circle (19)")))
(define (carve-scale val scale) (define (carve-scale val scale)
(* (sqrt val) scale)) (* (sqrt val) scale))
(define (calculate-inset-gamma img layer) (define (calculate-inset-gamma img layer)
(let* ((stats (gimp-histogram layer 0 0 255)) (let* ((stats (gimp-histogram layer 0 0 255))
(mean (car stats))) (mean (car stats)))
(cond ((< mean 127) (+ 1.0 (* 0.5 (/ (- 127 mean) 127.0)))) (cond ((< mean 127) (+ 1.0 (* 0.5 (/ (- 127 mean) 127.0))))
((>= mean 127) (- 1.0 (* 0.5 (/ (- mean 127) 127.0))))))) ((>= mean 127) (- 1.0 (* 0.5 (/ (- mean 127) 127.0)))))))
(define (script-fu-carved-logo text size font bg-img carve-raised padding) (define (script-fu-carved-logo text size font bg-img carve-raised padding)
(let* ((img (car (gimp-file-load 1 bg-img bg-img))) (let* (
(offx (carve-scale size 0.33)) (img (car (gimp-file-load 1 bg-img bg-img)))
(offy (carve-scale size 0.25)) (offx (carve-scale size 0.33))
(feather (carve-scale size 0.3)) (offy (carve-scale size 0.25))
(brush-size (carve-scale size 0.3)) (feather (carve-scale size 0.3))
(b-size (+ (carve-scale size 0.5) padding)) (brush-size (carve-scale size 0.3))
(layer1 (car (gimp-image-get-active-drawable img))) (b-size (+ (carve-scale size 0.5) padding))
(mask-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font))) (layer1 (car (gimp-image-get-active-drawable img)))
(width (car (gimp-drawable-width mask-layer))) (mask-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(height (car (gimp-drawable-height mask-layer))) (width (car (gimp-drawable-width mask-layer)))
(mask-fs 0) (height (car (gimp-drawable-height mask-layer)))
(mask (car (gimp-channel-new img width height "Engraving Mask" 50 '(0 0 0)))) (mask-fs 0)
(inset-gamma (calculate-inset-gamma img layer1)) (mask (car (gimp-channel-new img width height "Engraving Mask" 50 '(0 0 0))))
(mask-fat 0) (inset-gamma (calculate-inset-gamma img layer1))
(mask-emboss 0) (mask-fat 0)
(mask-highlight 0) (mask-emboss 0)
(mask-shadow 0) (mask-highlight 0)
(shadow-layer 0) (mask-shadow 0)
(highlight-layer 0) (shadow-layer 0)
(cast-shadow-layer 0) (highlight-layer 0)
(csl-mask 0) (cast-shadow-layer 0)
(inset-layer 0) (csl-mask 0)
(il-mask 0)) (inset-layer 0)
(il-mask 0)
)
(gimp-context-push) (gimp-context-push)
@ -68,7 +70,8 @@
(set! mask-fs (car (gimp-edit-paste mask FALSE))) (set! mask-fs (car (gimp-edit-paste mask FALSE)))
(gimp-floating-sel-anchor mask-fs) (gimp-floating-sel-anchor mask-fs)
(if (= carve-raised TRUE) (if (= carve-raised TRUE)
(gimp-invert mask)) (gimp-invert mask)
)
(gimp-image-remove-layer img mask-layer) (gimp-image-remove-layer img mask-layer)
@ -150,24 +153,28 @@
(gimp-display-new img) (gimp-display-new img)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-carved-logo" (script-fu-register "script-fu-carved-logo"
_"Carved..." _"Carved..."
_"Create a logo with carved text raised above the specified background image" _"Create a logo with text raised above or carved in to the specified background image"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"" ""
SF-STRING _"Text" "Marble" SF-STRING _"Text" "Marble"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Engraver" SF-FONT _"Font" "Engraver"
SF-FILENAME _"Background image" SF-FILENAME _"Background Image"
(string-append "" (string-append gimp-data-directory DIR-SEPARATOR
gimp-data-directory "scripts" DIR-SEPARATOR
"/scripts/images/texture3.jpg") "images" DIR-SEPARATOR
SF-TOGGLE _"Carve raised text" FALSE "texture3.jpg")
SF-ADJUSTMENT _"Padding around text" '(10 0 1000 1 10 0 1)) SF-TOGGLE _"Carve raised text" FALSE
SF-ADJUSTMENT _"Padding around text" '(10 0 1000 1 10 0 1)
)
(script-fu-menu-register "script-fu-carved-logo" (script-fu-menu-register "script-fu-carved-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -18,17 +18,17 @@
; chalk.scm version 0.11 10/10/97 ; chalk.scm version 0.11 10/10/97
; ;
; Copyright (C) 1997 Manish Singh <msingh@uclink4.berkeley.edu> ; Copyright (C) 1997 Manish Singh <msingh@uclink4.berkeley.edu>
; ;
; Makes a logo with a chalk-like text effect. ; Makes a logo with a chalk-like text effect.
(define (apply-chalk-logo-effect img (define (apply-chalk-logo-effect img
logo-layer logo-layer
bg-color) bg-color)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* (
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(bg-layer (car (gimp-layer-new img (height (car (gimp-drawable-height logo-layer)))
width height RGB-IMAGE (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
"Background" 100 NORMAL-MODE)))) )
(gimp-context-push) (gimp-context-push)
@ -53,41 +53,48 @@
(gimp-edit-clear logo-layer) (gimp-edit-clear logo-layer)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-chalk-logo-alpha img (define (script-fu-chalk-logo-alpha img
logo-layer logo-layer
bg-color) bg-color)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-chalk-logo-effect img logo-layer bg-color) (apply-chalk-logo-effect img logo-layer bg-color)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-chalk-logo-alpha" (script-fu-register "script-fu-chalk-logo-alpha"
_"_Chalk..." _"_Chalk..."
_"Create a chalk drawing effect for the selected region (or alpha)" _"Create a chalk drawing effect for the selected region (or alpha)"
"Manish Singh <msingh@uclink4.berkeley.edu>" "Manish Singh <msingh@uclink4.berkeley.edu>"
"Manish Singh" "Manish Singh"
"October 1997" "October 1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-COLOR _"Background color" '(0 0 0)) SF-COLOR _"Background color" '(0 0 0)
)
(script-fu-menu-register "script-fu-chalk-logo-alpha" (script-fu-menu-register "script-fu-chalk-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-chalk-logo text (define (script-fu-chalk-logo text
size size
font font
bg-color bg-color
chalk-color) chalk-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(border (/ size 4)) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))) (border (/ size 4))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
)
(gimp-context-push) (gimp-context-push)
@ -99,20 +106,23 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-chalk-logo" (script-fu-register "script-fu-chalk-logo"
_"_Chalk..." _"_Chalk..."
_"Create a logo resembling chalk scribbled on a blackboard" _"Create a logo resembling chalk scribbled on a blackboard"
"Manish Singh <msingh@uclink4.berkeley.edu>" "Manish Singh <msingh@uclink4.berkeley.edu>"
"Manish Singh" "Manish Singh"
"October 1997" "October 1997"
"" ""
SF-STRING _"Text" "CHALK" SF-STRING _"Text" "CHALK"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Cooper" SF-FONT _"Font" "Cooper"
SF-COLOR _"Background color" "black" SF-COLOR _"Background color" '(0 0 0)
SF-COLOR _"Chalk color" "white") SF-COLOR _"Chalk color" '(255 255 255)
)
(script-fu-menu-register "script-fu-chalk-logo" (script-fu-menu-register "script-fu-chalk-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -3,16 +3,16 @@
; ;
; Supposed to look vaguely like roughly carved wood. Chipped away if you will. ; Supposed to look vaguely like roughly carved wood. Chipped away if you will.
; ;
; Options: Text String - the string to make the logo from ; Options: Text String - the string to make the logo from
; Font - which font to use ; Font - which font to use
; Font Size - how big ; Font Size - how big
; Chip Amount - how rought he chipping is (how spread the bump map is) ; Chip Amount - how rought he chipping is (how spread the bump map is)
; Blur Amount - the bump layer is blurred slighty by this amount ; Blur Amount - the bump layer is blurred slighty by this amount
; Invert - whether or not to invert the bumpmap (gives a carved in feel) ; Invert - whether or not to invert the bumpmap (gives a carved in feel)
; Drop Shadow - whether or not to draw a drop shadow ; Drop Shadow - whether or not to draw a drop shadow
; Keep bump layer? - whether to keep the layer used as the bump map ; Keep bump layer? - whether to keep the layer used as the bump map
; fill bg with pattern? - whether to fill the background with the pattern or leave it white ; fill bg with pattern? - whether to fill the background with the pattern or leave it white
; Keep Backgroun - whether or not to remove the background layer ; Keep Background - whether or not to remove the background layer
; ;
; Adrian Likins (Adrian@gimp.org) ; Adrian Likins (Adrian@gimp.org)
; Jan 11, 1998 v1 ; Jan 11, 1998 v1
@ -37,19 +37,21 @@
; ;
(define (apply-chip-away-logo-effect img (define (apply-chip-away-logo-effect img
logo-layer logo-layer
spread-amount spread-amount
blur-amount blur-amount
invert invert
drop-shadow drop-shadow
keep-bump keep-bump
bg-fill bg-fill
keep-back keep-back
pattern) pattern)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* (
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (height (car (gimp-drawable-height logo-layer)))
(bump-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bump Layer" 100 NORMAL-MODE)))) (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(bump-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bump Layer" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
@ -62,8 +64,11 @@
(gimp-selection-all img) (gimp-selection-all img)
(if (= bg-fill TRUE) (if (= bg-fill TRUE)
(gimp-edit-bucket-fill bg-layer 2 NORMAL-MODE 100 255 FALSE 1 1) (gimp-edit-bucket-fill bg-layer
(gimp-edit-fill bg-layer BACKGROUND-FILL)) PATTERN-BUCKET-FILL NORMAL-MODE
100 255 FALSE 1 1)
(gimp-edit-fill bg-layer BACKGROUND-FILL)
)
(gimp-image-add-layer img bump-layer 1) (gimp-image-add-layer img bump-layer 1)
@ -72,7 +77,8 @@
(gimp-selection-none img) (gimp-selection-none img)
(gimp-selection-layer-alpha logo-layer) (gimp-selection-layer-alpha logo-layer)
(gimp-edit-fill bump-layer BACKGROUND-FILL) (gimp-edit-fill bump-layer BACKGROUND-FILL)
(gimp-edit-bucket-fill logo-layer 2 NORMAL-MODE 100 255 FALSE 1 1) (gimp-edit-bucket-fill logo-layer
PATTERN-BUCKET-FILL NORMAL-MODE 100 255 FALSE 1 1)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-layer-set-lock-alpha bump-layer FALSE) (gimp-layer-set-lock-alpha bump-layer FALSE)
@ -82,111 +88,120 @@
(gimp-selection-none img) (gimp-selection-none img)
(plug-in-bump-map 1 img logo-layer bump-layer 135.00 25.0 60 0 0 0 0 TRUE invert 1) (plug-in-bump-map 1 img logo-layer bump-layer
135.00 25.0 60 0 0 0 0 TRUE invert 1)
(gimp-drawable-set-visible bump-layer FALSE) (gimp-drawable-set-visible bump-layer FALSE)
(if (= drop-shadow TRUE) (if (= drop-shadow TRUE)
(begin (begin
(let* ((shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow layer" 100 NORMAL-MODE)))) (let* ((shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow layer" 100 NORMAL-MODE))))
(gimp-image-add-layer img shadow-layer 1) (gimp-image-add-layer img shadow-layer 1)
(gimp-selection-all img) (gimp-selection-all img)
(gimp-edit-clear shadow-layer) (gimp-edit-clear shadow-layer)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-selection-layer-alpha logo-layer) (gimp-selection-layer-alpha logo-layer)
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-fill shadow-layer BACKGROUND-FILL) (gimp-edit-fill shadow-layer BACKGROUND-FILL)
(gimp-selection-none img) (gimp-selection-none img)
(plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE) (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
(gimp-layer-translate shadow-layer 6 6)))) (gimp-layer-translate shadow-layer 6 6))))
(if (= keep-bump FALSE) (if (= keep-bump FALSE)
(gimp-image-remove-layer img bump-layer)) (gimp-image-remove-layer img bump-layer))
(if (= keep-back FALSE) (if (= keep-back FALSE)
(gimp-image-remove-layer img bg-layer)) (gimp-image-remove-layer img bg-layer))
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-chip-away-logo-alpha img (define (script-fu-chip-away-logo-alpha img
logo-layer logo-layer
spread-amount spread-amount
blur-amount blur-amount
invert invert
drop-shadow drop-shadow
keep-bump keep-bump
bg-fill bg-fill
keep-back keep-back
pattern) pattern)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-chip-away-logo-effect img logo-layer spread-amount blur-amount (apply-chip-away-logo-effect img logo-layer spread-amount blur-amount
invert drop-shadow keep-bump bg-fill invert drop-shadow keep-bump bg-fill
keep-back pattern) keep-back pattern)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-chip-away-logo-alpha" (script-fu-register "script-fu-chip-away-logo-alpha"
_"Chip Awa_y..." _"Chip Awa_y..."
_"Add a chipped woodcarving effect to the selected region (or alpha)" _"Add a chipped woodcarving effect to the selected region (or alpha)"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"1997" "1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Chip amount" '(30 0 250 1 10 0 1) SF-ADJUSTMENT _"Chip amount" '(30 0 250 1 10 0 1)
SF-ADJUSTMENT _"Blur amount" '(3 1 100 1 10 1 0) SF-ADJUSTMENT _"Blur amount" '(3 1 100 1 10 1 0)
SF-TOGGLE _"Invert" FALSE SF-TOGGLE _"Invert" FALSE
SF-TOGGLE _"Drop shadow" TRUE SF-TOGGLE _"Drop shadow" TRUE
SF-TOGGLE _"Keep bump layer" FALSE SF-TOGGLE _"Keep bump layer" FALSE
SF-TOGGLE _"Fill BG with pattern" TRUE SF-TOGGLE _"Fill BG with pattern" TRUE
SF-TOGGLE _"Keep background" TRUE SF-TOGGLE _"Keep background" TRUE
SF-PATTERN _"Pattern" "Burlwood") SF-PATTERN _"Pattern" "Burlwood"
)
(script-fu-menu-register "script-fu-chip-away-logo-alpha" (script-fu-menu-register "script-fu-chip-away-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-chip-away-logo text (define (script-fu-chip-away-logo text
font font
font-size font-size
spread-amount spread-amount
blur-amount blur-amount
invert invert
drop-shadow drop-shadow
keep-bump keep-bump
bg-fill bg-fill
keep-back keep-back
pattern) pattern)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 (text-layer (car (gimp-text-fontname img -1 0 0
text 30 TRUE font-size PIXELS font)))) text 30 TRUE font-size PIXELS font))))
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-chip-away-logo-effect img text-layer spread-amount blur-amount (apply-chip-away-logo-effect img text-layer spread-amount blur-amount
invert drop-shadow keep-bump bg-fill invert drop-shadow keep-bump bg-fill
keep-back pattern) keep-back pattern)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-chip-away-logo" (script-fu-register "script-fu-chip-away-logo"
_"Chip Awa_y..." _"Chip Awa_y..."
_"Create a logo resembling a chipped wood carving" _"Create a logo resembling a chipped wood carving"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"1997" "1997"
"" ""
SF-STRING _"Text" "Sloth" SF-STRING _"Text" "Sloth"
SF-FONT _"Font" "RoostHeavy" SF-FONT _"Font" "RoostHeavy"
SF-ADJUSTMENT _"Font size (pixels)" '(200 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(200 2 1000 1 10 0 1)
SF-ADJUSTMENT _"Chip amount" '(30 0 250 1 10 0 1) SF-ADJUSTMENT _"Chip amount" '(30 0 250 1 10 0 1)
SF-ADJUSTMENT _"Blur amount" '(3 1 100 1 10 1 0) SF-ADJUSTMENT _"Blur amount" '(3 1 100 1 10 1 0)
SF-TOGGLE _"Invert" FALSE SF-TOGGLE _"Invert" FALSE
SF-TOGGLE _"Drop shadow" TRUE SF-TOGGLE _"Drop shadow" TRUE
SF-TOGGLE _"Keep bump layer" FALSE SF-TOGGLE _"Keep bump layer" FALSE
SF-TOGGLE _"Fill BG with pattern" TRUE SF-TOGGLE _"Fill BG with pattern" TRUE
SF-TOGGLE _"Keep background" TRUE SF-TOGGLE _"Keep background" TRUE
SF-PATTERN _"Pattern" "Burlwood") SF-PATTERN _"Pattern" "Burlwood"
)
(script-fu-menu-register "script-fu-chip-away-logo" (script-fu-menu-register "script-fu-chip-away-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -3,89 +3,109 @@
; This script requires a grayscale image containing a single layer. ; This script requires a grayscale image containing a single layer.
; This layer is used as the mask for the SOTA chrome effect ; This layer is used as the mask for the SOTA chrome effect
(define (set-pt a index x y)
(prog1
(aset a (* index 2) x)
(aset a (+ (* index 2) 1) y)))
(define (spline-chrome-it)
(let* ((a (cons-array 18 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 31 235)
(set-pt a 2 63 23)
(set-pt a 3 95 230)
(set-pt a 4 127 25)
(set-pt a 5 159 210)
(set-pt a 6 191 20)
(set-pt a 7 223 240)
(set-pt a 8 255 31)
a))
(define (brush brush-size)
(cond ((<= brush-size 5) "Circle Fuzzy (05)")
((<= brush-size 7) "Circle Fuzzy (07)")
((<= brush-size 9) "Circle Fuzzy (09)")
((<= brush-size 11) "Circle Fuzzy (11)")
((<= brush-size 13) "Circle Fuzzy (13)")
((<= brush-size 15) "Circle Fuzzy (15)")
((<= brush-size 17) "Circle Fuzzy (17)")
(else "Circle Fuzzy (19)")))
(define (shadows val)
(/ (* 0.96 val) 2.55))
(define (midtones val)
(/ val 2.55))
(define (highlights val)
(/ (* 1.108 val) 2.55))
(define (rval col)
(car col))
(define (gval col)
(cadr col))
(define (bval col)
(caddr col))
(define (sota-scale val scale chrome-factor)
(* (sqrt val) (* scale chrome-factor)))
(define (copy-layer-chrome-it dest-image dest-drawable source-image source-drawable)
(gimp-selection-all dest-image)
(gimp-edit-clear dest-drawable)
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-drawable)
(let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel)))
(define (script-fu-sota-chrome-it mask-img mask-drawable chrome-saturation (define (script-fu-sota-chrome-it mask-img mask-drawable chrome-saturation
chrome-lightness chrome-factor env-map hc cc carve-white) chrome-lightness chrome-factor env-map hc cc carve-white)
(let* ((banding-img (car (gimp-file-load 1 env-map env-map)))
(banding-layer (car (gimp-image-get-active-drawable banding-img))) (define (set-pt a index x y)
(banding-height (car (gimp-drawable-height banding-layer))) (begin
(banding-width (car (gimp-drawable-width banding-layer))) (aset a (* index 2) x)
(banding-type (car (gimp-drawable-type banding-layer))) (aset a (+ (* index 2) 1) y)
(width (car (gimp-drawable-width mask-drawable))) )
(height (car (gimp-drawable-height mask-drawable))) )
(img (car (gimp-image-new width height GRAY)))
(size (min width height)) (define (spline-chrome-it)
(offx1 (sota-scale size 0.33 chrome-factor)) (let* ((a (cons-array 18 'byte)))
(offy1 (sota-scale size 0.25 chrome-factor)) (set-pt a 0 0 0)
(offx2 (sota-scale size (- 0.33) chrome-factor)) (set-pt a 1 31 235)
(offy2 (sota-scale size (- 0.25) chrome-factor)) (set-pt a 2 63 23)
(feather (sota-scale size 0.5 chrome-factor)) (set-pt a 3 95 230)
(brush-size (sota-scale size 0.5 chrome-factor)) (set-pt a 4 127 25)
(mask (car (gimp-channel-new img width height "Chrome Stencil" 50 '(0 0 0)))) (set-pt a 5 159 210)
(bg-layer (car (gimp-layer-new img width height GRAY-IMAGE "Background" 100 NORMAL-MODE))) (set-pt a 6 191 20)
(layer1 (car (gimp-layer-new img banding-width banding-height banding-type "Layer1" 100 NORMAL-MODE))) (set-pt a 7 223 240)
(layer2 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 2" 100 DIFFERENCE-MODE))) (set-pt a 8 255 31)
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE))) a
(shadow (car (gimp-layer-new img width height GRAYA-IMAGE "Drop Shadow" 100 NORMAL-MODE))) )
(mask-fs 0) )
(layer-mask 0))
(define (brush brush-size)
(cond ((<= brush-size 5) "Circle Fuzzy (05)")
((<= brush-size 7) "Circle Fuzzy (07)")
((<= brush-size 9) "Circle Fuzzy (09)")
((<= brush-size 11) "Circle Fuzzy (11)")
((<= brush-size 13) "Circle Fuzzy (13)")
((<= brush-size 15) "Circle Fuzzy (15)")
((<= brush-size 17) "Circle Fuzzy (17)")
(else "Circle Fuzzy (19)")
)
)
(define (shadows val)
(/ (* 0.96 val) 2.55)
)
(define (midtones val)
(/ val 2.55)
)
(define (highlights val)
(/ (* 1.108 val) 2.55)
)
(define (rval col)
(car col)
)
(define (gval col)
(cadr col)
)
(define (bval col)
(caddr col)
)
(define (sota-scale val scale chrome-factor)
(* (sqrt val) (* scale chrome-factor))
)
(define (copy-layer-chrome-it dest-image dest-drawable source-image source-drawable)
(gimp-selection-all dest-image)
(gimp-edit-clear dest-drawable)
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-drawable)
(let (
(floating-sel (car (gimp-edit-paste dest-drawable FALSE)))
)
(gimp-floating-sel-anchor floating-sel)
)
)
(let* (
(banding-img (car (gimp-file-load 1 env-map env-map)))
(banding-layer (car (gimp-image-get-active-drawable banding-img)))
(banding-height (car (gimp-drawable-height banding-layer)))
(banding-width (car (gimp-drawable-width banding-layer)))
(banding-type (car (gimp-drawable-type banding-layer)))
(width (car (gimp-drawable-width mask-drawable)))
(height (car (gimp-drawable-height mask-drawable)))
(img (car (gimp-image-new width height GRAY)))
(size (min width height))
(offx1 (sota-scale size 0.33 chrome-factor))
(offy1 (sota-scale size 0.25 chrome-factor))
(offx2 (sota-scale size (- 0.33) chrome-factor))
(offy2 (sota-scale size (- 0.25) chrome-factor))
(feather (sota-scale size 0.5 chrome-factor))
(brush-size (sota-scale size 0.5 chrome-factor))
(mask (car (gimp-channel-new img width height "Chrome Stencil" 50 '(0 0 0))))
(bg-layer (car (gimp-layer-new img width height GRAY-IMAGE "Background" 100 NORMAL-MODE)))
(layer1 (car (gimp-layer-new img banding-width banding-height banding-type "Layer1" 100 NORMAL-MODE)))
(layer2 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 2" 100 DIFFERENCE-MODE)))
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(shadow (car (gimp-layer-new img width height GRAYA-IMAGE "Drop Shadow" 100 NORMAL-MODE)))
(mask-fs 0)
(layer-mask 0)
)
(gimp-context-push) (gimp-context-push)
@ -101,7 +121,8 @@
(set! mask-fs (car (gimp-edit-paste mask FALSE))) (set! mask-fs (car (gimp-edit-paste mask FALSE)))
(gimp-floating-sel-anchor mask-fs) (gimp-floating-sel-anchor mask-fs)
(if (= carve-white FALSE) (if (= carve-white FALSE)
(gimp-invert mask)) (gimp-invert mask)
)
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-selection-none img) (gimp-selection-none img)
@ -176,27 +197,31 @@
(gimp-display-new img) (gimp-display-new img)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-sota-chrome-it" (script-fu-register "script-fu-sota-chrome-it"
_"Stencil C_hrome..." _"Stencil C_hrome..."
_"Add a chrome effect to the selected region (or alpha) using a specified (grayscale) stencil" _"Add a chrome effect to the selected region (or alpha) using a specified (grayscale) stencil"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"GRAY" "GRAY*"
SF-IMAGE "Chrome image" 0 SF-IMAGE "Chrome image" 0
SF-DRAWABLE "Chrome mask" 0 SF-DRAWABLE "Chrome mask" 0
SF-ADJUSTMENT _"Chrome saturation" '(-80 -100 100 1 10 0 0) SF-ADJUSTMENT _"Chrome saturation" '(-80 -100 100 1 10 0 0)
SF-ADJUSTMENT _"Chrome lightness" '(-47 -100 100 1 10 0 0) SF-ADJUSTMENT _"Chrome lightness" '(-47 -100 100 1 10 0 0)
SF-ADJUSTMENT _"Chrome factor" '(.75 0 1 .1 .01 2 0) SF-ADJUSTMENT _"Chrome factor" '(.75 0 1 .1 .01 2 0)
SF-FILENAME _"Environment map" SF-FILENAME _"Environment map"
(string-append "" (string-append gimp-data-directory DIR-SEPARATOR
gimp-data-directory "scripts" DIR-SEPARATOR
"/scripts/images/beavis.jpg") "images" DIR-SEPARATOR
SF-COLOR _"Highlight balance" '(211 95 0) "beavis.jpg")
SF-COLOR _"Chrome balance" "black" SF-COLOR _"Highlight balance" '(211 95 0)
SF-TOGGLE _"Chrome white areas" TRUE) SF-COLOR _"Chrome balance" '(0 0 0)
SF-TOGGLE _"Chrome white areas" TRUE
)
(script-fu-menu-register "script-fu-sota-chrome-it" (script-fu-menu-register "script-fu-sota-chrome-it"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -1,22 +1,24 @@
; CHROME-LOGOS ; CHROME-LOGOS
(define (apply-chrome-logo-effect img (define (apply-chrome-logo-effect img
logo-layer logo-layer
offsets offsets
bg-color) bg-color)
(let* ((offx1 (* offsets 0.4)) (let* (
(offy1 (* offsets 0.3)) (offx1 (* offsets 0.4))
(offx2 (* offsets (- 0.4))) (offy1 (* offsets 0.3))
(offy2 (* offsets (- 0.3))) (offx2 (* offsets (- 0.4)))
(feather (* offsets 0.5)) (offy2 (* offsets (- 0.3)))
(width (car (gimp-drawable-width logo-layer))) (feather (* offsets 0.5))
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(layer1 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 1" 100 DIFFERENCE-MODE))) (height (car (gimp-drawable-height logo-layer)))
(layer2 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 2" 100 DIFFERENCE-MODE))) (layer1 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 1" 100 DIFFERENCE-MODE)))
(layer3 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 3" 100 NORMAL-MODE))) (layer2 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 2" 100 DIFFERENCE-MODE)))
(shadow (car (gimp-layer-new img width height RGBA-IMAGE "Drop Shadow" 100 NORMAL-MODE))) (layer3 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(background (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (shadow (car (gimp-layer-new img width height RGBA-IMAGE "Drop Shadow" 100 NORMAL-MODE)))
(layer-mask (car (gimp-layer-create-mask layer1 ADD-BLACK-MASK)))) (background (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(layer-mask (car (gimp-layer-create-mask layer1 ADD-BLACK-MASK)))
)
(gimp-context-push) (gimp-context-push)
@ -62,57 +64,66 @@
(gimp-drawable-set-name layer1 (car (gimp-drawable-get-name logo-layer))) (gimp-drawable-set-name layer1 (car (gimp-drawable-get-name logo-layer)))
(gimp-image-remove-layer img logo-layer) (gimp-image-remove-layer img logo-layer)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-chrome-logo-alpha img (define (script-fu-chrome-logo-alpha img
logo-layer logo-layer
offsets offsets
bg-color) bg-color)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-chrome-logo-effect img logo-layer offsets bg-color) (apply-chrome-logo-effect img logo-layer offsets bg-color)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-chrome-logo-alpha" (script-fu-register "script-fu-chrome-logo-alpha"
_"C_hrome..." _"C_hrome..."
_"Add a simple chrome effect to the selected region (or alpha)" _"Add a simple chrome effect to the selected region (or alpha)"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball & Peter Mattis" "Spencer Kimball & Peter Mattis"
"1997" "1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Offsets (pixels * 2)" '(10 2 100 1 10 0 1) SF-ADJUSTMENT _"Offsets (pixels * 2)" '(10 2 100 1 10 0 1)
SF-COLOR _"Background color" '(191 191 191)) SF-COLOR _"Background Color" '(191 191 191)
)
(script-fu-menu-register "script-fu-chrome-logo-alpha" (script-fu-menu-register "script-fu-chrome-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-chrome-logo text (define (script-fu-chrome-logo text
size size
font font
bg-color) bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(b-size (* size 0.2)) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))) (b-size (* size 0.2))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-chrome-logo-effect img text-layer (* size 0.1) bg-color) (apply-chrome-logo-effect img text-layer (* size 0.1) bg-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-chrome-logo" (script-fu-register "script-fu-chrome-logo"
_"C_hrome..." _"C_hrome..."
_"Create a simplistic, but cool, chromed logo" _"Create a simplistic, but cool, chromed logo"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball & Peter Mattis" "Spencer Kimball & Peter Mattis"
"1997" "1997"
"" ""
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Bodoni" SF-FONT _"Font" "Bodoni"
SF-COLOR _"Background color" "lightgrey") SF-COLOR _"Background color" '(191 191 191)
)
(script-fu-menu-register "script-fu-chrome-logo" (script-fu-menu-register "script-fu-chrome-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Circuit board effect ; Circuit board effect
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.ed ; aklikins@eos.ncsu.ed
@ -8,7 +8,7 @@
; Genrates what looks a little like the back of an old circuit board. ; Genrates what looks a little like the back of an old circuit board.
; Looks even better when gradmapped with a suitable gradient. ; Looks even better when gradmapped with a suitable gradient.
; ;
; This script doesnt handle or color combos well. ie, black/black ; This script doesnt handle or color combos well. ie, black/black
; doesnt work.. ; doesnt work..
; The effect seems to work best on odd shaped selections because of some ; The effect seems to work best on odd shaped selections because of some
; limitations in the maze codes selection handling ablity ; limitations in the maze codes selection handling ablity
@ -18,79 +18,88 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-circuit image (define (script-fu-circuit image
drawable drawable
mask-size mask-size
seed seed
remove-bg remove-bg
keep-selection keep-selection
separate-layer) separate-layer)
(let* ( (let* (
(type (car (gimp-drawable-type-with-alpha drawable))) (type (car (gimp-drawable-type-with-alpha drawable)))
(image-width (car (gimp-image-width image))) (image-width (car (gimp-image-width image)))
(image-height (car (gimp-image-height image))) (image-height (car (gimp-image-height image)))
) (active-selection)
(from-selection)
(gimp-context-push) (selection-bounds)
(select-offset-x)
(select-offset-y)
(select-width)
(select-height)
(effect-layer)
(active-layer)
)
(gimp-context-push)
(gimp-image-undo-group-start image) (gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable) (gimp-layer-add-alpha drawable)
(if (= (car (gimp-selection-is-empty image)) TRUE) (if (= (car (gimp-selection-is-empty image)) TRUE)
(begin (begin
(gimp-selection-layer-alpha drawable) (gimp-selection-layer-alpha drawable)
(set! active-selection (car (gimp-selection-save image))) (set! active-selection (car (gimp-selection-save image)))
(set! from-selection FALSE)) (set! from-selection FALSE))
(begin (begin
(set! from-selection TRUE) (set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image))))) (set! active-selection (car (gimp-selection-save image)))))
(set! selection-bounds (gimp-selection-bounds image)) (set! selection-bounds (gimp-selection-bounds image))
(set! select-offset-x (cadr selection-bounds)) (set! select-offset-x (cadr selection-bounds))
(set! select-offset-y (caddr selection-bounds)) (set! select-offset-y (caddr selection-bounds))
(set! select-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
(set! select-height (- (caddr (cddr selection-bounds)) select-offset-y)) (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
(if (= separate-layer TRUE) (if (= separate-layer TRUE)
(begin (begin
(set! effect-layer (car (gimp-layer-new image (set! effect-layer (car (gimp-layer-new image
select-width select-width
select-height select-height
type type
"effect layer" "effect layer"
100 100
NORMAL-MODE))) NORMAL-MODE)))
(gimp-image-add-layer image effect-layer -1) (gimp-image-add-layer image effect-layer -1)
(gimp-layer-set-offsets effect-layer select-offset-x select-offset-y) (gimp-layer-set-offsets effect-layer select-offset-x select-offset-y)
(gimp-selection-none image) (gimp-selection-none image)
(gimp-edit-clear effect-layer) (gimp-edit-clear effect-layer)
(gimp-selection-load active-selection) (gimp-selection-load active-selection)
(gimp-edit-copy drawable) (gimp-edit-copy drawable)
(let ((floating-sel (car (gimp-edit-paste effect-layer FALSE)))) (let ((floating-sel (car (gimp-edit-paste effect-layer FALSE))))
(gimp-floating-sel-anchor floating-sel) (gimp-floating-sel-anchor floating-sel)
) )
(gimp-image-set-active-layer image effect-layer )) (gimp-image-set-active-layer image effect-layer ))
(set! effect-layer drawable) (set! effect-layer drawable)
) )
(set! active-layer effect-layer) (set! active-layer effect-layer)
(if (= remove-bg TRUE) (if (= remove-bg TRUE)
(gimp-context-set-foreground '(0 0 0)) (gimp-context-set-foreground '(0 0 0))
(gimp-context-set-foreground '(14 14 14))) (gimp-context-set-foreground '(14 14 14))
)
(gimp-selection-load active-selection) (gimp-selection-load active-selection)
(plug-in-maze 1 image active-layer 5 5 TRUE 0 seed 57 1) (plug-in-maze 1 image active-layer 5 5 TRUE 0 seed 57 1)
@ -98,25 +107,25 @@
(plug-in-edge 1 image active-layer 2 1 0) (plug-in-edge 1 image active-layer 2 1 0)
(if (= type RGBA-IMAGE) (if (= type RGBA-IMAGE)
(gimp-desaturate active-layer)) (gimp-desaturate active-layer))
(if (and (if (and
(= remove-bg TRUE) (= remove-bg TRUE)
(= separate-layer TRUE)) (= separate-layer TRUE))
(begin (begin
(gimp-by-color-select (gimp-by-color-select
active-layer active-layer
'(0 0 0) '(0 0 0)
15 15
2 2
TRUE TRUE
FALSE FALSE
10 10
FALSE) FALSE)
(gimp-edit-clear active-layer))) (gimp-edit-clear active-layer)))
(if (= keep-selection FALSE) (if (= keep-selection FALSE)
(gimp-selection-none image)) (gimp-selection-none image))
(gimp-image-remove-channel image active-selection) (gimp-image-remove-channel image active-selection)
(gimp-image-set-active-layer image drawable) (gimp-image-set-active-layer image drawable)
@ -124,22 +133,25 @@
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-circuit" (script-fu-register "script-fu-circuit"
_"_Circuit..." _"_Circuit..."
_"Fill the selected region (or alpha) with traces like those on a circuit board" _"Fill the selected region (or alpha) with traces like those on a circuit board"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"Adrian Likins" "Adrian Likins"
"10/17/97" "10/17/97"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Oilify mask size" '(17 3 50 1 10 0 1) SF-ADJUSTMENT _"Oilify mask size" '(17 3 50 1 10 0 1)
SF-ADJUSTMENT _"Circuit seed" '(3 1 3000000 1 10 0 1) SF-ADJUSTMENT _"Circuit seed" '(3 1 3000000 1 10 0 1)
SF-TOGGLE _"No background (only for separate layer)" FALSE SF-TOGGLE _"No background (only for separate layer)" FALSE
SF-TOGGLE _"Keep selection" TRUE SF-TOGGLE _"Keep selection" TRUE
SF-TOGGLE _"Separate layer" TRUE) SF-TOGGLE _"Separate layer" TRUE
)
(script-fu-menu-register "script-fu-circuit" (script-fu-menu-register "script-fu-circuit"
"<Image>/Filters/Render") "<Image>/Filters/Render")

View File

@ -5,59 +5,63 @@
; Tim Newsome <drz@froody.bloke.com> 4/11/97 ; Tim Newsome <drz@froody.bloke.com> 4/11/97
(define (script-fu-clothify timg tdrawable bx by azimuth elevation depth) (define (script-fu-clothify timg tdrawable bx by azimuth elevation depth)
(let* (let* (
((width (car (gimp-drawable-width tdrawable))) (width (car (gimp-drawable-width tdrawable)))
(height (car (gimp-drawable-height tdrawable))) (height (car (gimp-drawable-height tdrawable)))
(img (car (gimp-image-new width height RGB))) (img (car (gimp-image-new width height RGB)))
; (layer-two (car (gimp-layer-new img width height RGB-IMAGE "Y Dots" 100 MULTIPLY-MODE))) ; (layer-two (car (gimp-layer-new img width height RGB-IMAGE "Y Dots" 100 MULTIPLY-MODE)))
(layer-one (car (gimp-layer-new img width height RGB-IMAGE "X Dots" 100 NORMAL-MODE))) (layer-one (car (gimp-layer-new img width height RGB-IMAGE "X Dots" 100 NORMAL-MODE)))
(layer-two) (layer-two)
(bump-layer)) (bump-layer)
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-add-layer img layer-one 0) (gimp-image-add-layer img layer-one 0)
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-edit-fill layer-one BACKGROUND-FILL) (gimp-edit-fill layer-one BACKGROUND-FILL)
(plug-in-noisify 1 img layer-one FALSE 0.7 0.7 0.7 0.7) (plug-in-noisify 1 img layer-one FALSE 0.7 0.7 0.7 0.7)
(set! layer-two (car (gimp-layer-copy layer-one 0))) (set! layer-two (car (gimp-layer-copy layer-one 0)))
(gimp-layer-set-mode layer-two MULTIPLY-MODE) (gimp-layer-set-mode layer-two MULTIPLY-MODE)
(gimp-image-add-layer img layer-two 0) (gimp-image-add-layer img layer-two 0)
(plug-in-gauss-rle 1 img layer-one bx TRUE FALSE) (plug-in-gauss-rle 1 img layer-one bx TRUE FALSE)
(plug-in-gauss-rle 1 img layer-two by FALSE TRUE) (plug-in-gauss-rle 1 img layer-two by FALSE TRUE)
(gimp-image-flatten img) (gimp-image-flatten img)
(set! bump-layer (car (gimp-image-get-active-layer img))) (set! bump-layer (car (gimp-image-get-active-layer img)))
(plug-in-c-astretch 1 img bump-layer) (plug-in-c-astretch 1 img bump-layer)
(plug-in-noisify 1 img bump-layer FALSE 0.2 0.2 0.2 0.2) (plug-in-noisify 1 img bump-layer FALSE 0.2 0.2 0.2 0.2)
(plug-in-bump-map 1 img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0) (plug-in-bump-map 1 img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0)
(gimp-image-delete img) (gimp-image-delete img)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-clothify" (script-fu-register "script-fu-clothify"
_"_Clothify..." _"_Clothify..."
_"Add a cloth-like texture to the selected region (or alpha)" _"Add a cloth-like texture to the selected region (or alpha)"
"Tim Newsome <drz@froody.bloke.com>" "Tim Newsome <drz@froody.bloke.com>"
"Tim Newsome" "Tim Newsome"
"4/11/97" "4/11/97"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Input image" 0 SF-IMAGE "Input image" 0
SF-DRAWABLE "Input drawable" 0 SF-DRAWABLE "Input drawable" 0
SF-ADJUSTMENT _"Blur X" '(9 3 100 1 10 0 1) SF-ADJUSTMENT _"Blur X" '(9 3 100 1 10 0 1)
SF-ADJUSTMENT _"Blur Y" '(9 3 100 1 10 0 1) SF-ADJUSTMENT _"Blur Y" '(9 3 100 1 10 0 1)
SF-ADJUSTMENT _"Azimuth" '(135 0 360 1 10 1 0) SF-ADJUSTMENT _"Azimuth" '(135 0 360 1 10 1 0)
SF-ADJUSTMENT _"Elevation" '(45 0 90 1 10 1 0) SF-ADJUSTMENT _"Elevation" '(45 0 90 1 10 1 0)
SF-ADJUSTMENT _"Depth" '(3 1 50 1 10 0 1)) SF-ADJUSTMENT _"Depth" '(3 1 50 1 10 0 1)
)
(script-fu-menu-register "script-fu-clothify" (script-fu-menu-register "script-fu-clothify"
"<Image>/Filters/Artistic") "<Image>/Filters/Artistic")

View File

@ -5,85 +5,91 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-coffee-stain inImage (define (script-fu-coffee-stain inImage inLayer inNumber inDark)
inLayer (let* (
inNumber (theImage inImage)
inDark) (theHeight (car (gimp-image-height theImage)))
(theWidth (car (gimp-image-width theImage)))
(theNumber inNumber)
(theSize (min theWidth theHeight))
(theStain)
)
(set! theImage inImage) (gimp-context-push)
(set! theHeight (car (gimp-image-height theImage)))
(set! theWidth (car (gimp-image-width theImage)))
(set! theNumber inNumber)
(set! theSize (min theWidth theHeight))
(gimp-context-push) (gimp-image-undo-group-start theImage)
(gimp-image-undo-group-start theImage) (while (> theNumber 0)
(set! theNumber (- theNumber 1))
(set! theStain (car (gimp-layer-new theImage theSize theSize
RGBA-IMAGE "Stain" 100
(if (= inDark TRUE)
DARKEN-ONLY-MODE
NORMAL-MODE
))))
(while (> theNumber 0) (gimp-image-add-layer theImage theStain 0)
(set! theNumber (- theNumber 1)) (gimp-selection-all theImage)
(set! theStain (car (gimp-layer-new theImage theSize theSize (gimp-edit-clear theStain)
RGBA-IMAGE "Stain" 100
(if (= inDark TRUE)
DARKEN-ONLY-MODE NORMAL-MODE))))
(gimp-image-add-layer theImage theStain 0) (let ((blobSize (/ (rand (- theSize 40)) (+ (rand 3) 1))))
(gimp-selection-all theImage) (gimp-ellipse-select theImage
(gimp-edit-clear theStain) (/ (- theSize blobSize) 2)
(/ (- theSize blobSize) 2)
blobSize blobSize CHANNEL-OP-REPLACE TRUE 0 FALSE)
)
(let ((blobSize (/ (rand (- theSize 40)) (+ (rand 3) 1)))) (script-fu-distress-selection theImage theStain
(gimp-ellipse-select theImage (* (+ (rand 15) 1) (+ (rand 15) 1))
(/ (- theSize blobSize) 2) (/ theSize 25) 4 2 TRUE TRUE)
(/ (- theSize blobSize) 2)
blobSize blobSize CHANNEL-OP-REPLACE TRUE 0 FALSE))
(script-fu-distress-selection theImage theStain (gimp-context-set-gradient "Coffee")
(* (+ (rand 15) 1) (+ (rand 15) 1))
(/ theSize 25) 4 2 TRUE TRUE)
(gimp-context-set-gradient "Coffee") (gimp-edit-blend theStain CUSTOM-MODE NORMAL-MODE
GRADIENT-SHAPEBURST-DIMPLED 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 0 0)
(gimp-edit-blend theStain CUSTOM-MODE NORMAL-MODE (gimp-layer-set-offsets theStain
GRADIENT-SHAPEBURST-DIMPLED 100 0 REPEAT-NONE FALSE (- (rand theWidth) (/ theSize 2))
FALSE 0 0 TRUE (- (rand theHeight) (/ theSize 2)))
0 0 0 0) )
(gimp-layer-set-offsets theStain (gimp-selection-none theImage)
(- (rand theWidth) (/ theSize 2))
(- (rand theHeight) (/ theSize 2)) theSize))
(gimp-selection-none theImage) (gimp-image-undo-group-end theImage)
(gimp-image-undo-group-end theImage) (gimp-displays-flush)
(gimp-displays-flush) (gimp-context-pop)
)
(gimp-context-pop)) )
; Register the function with the GIMP: ; Register the function with the GIMP:
(script-fu-register "script-fu-coffee-stain" (script-fu-register "script-fu-coffee-stain"
_"_Coffee Stain..." _"_Coffee Stain..."
_"Add realistic looking coffee stains to the image" _"Add realistic looking coffee stains to the image"
"Chris Gutteridge" "Chris Gutteridge"
"1998, Chris Gutteridge / ECS dept, University of Southampton, England." "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
"25th April 1998" "25th April 1998"
"RGB*" "RGB*"
SF-IMAGE "The image" 0 SF-IMAGE "The image" 0
SF-DRAWABLE "The layer" 0 SF-DRAWABLE "The layer" 0
SF-ADJUSTMENT _"Stains" '(3 1 10 1 1 0 0) SF-ADJUSTMENT _"Stains" '(3 1 10 1 1 0 0)
SF-TOGGLE _"Darken only\n(Better, but only for images with a lot of white)" TRUE) SF-TOGGLE _"Darken only\n(Better, but only for images with a lot of white)" TRUE
)
(script-fu-menu-register "script-fu-coffee-stain" (script-fu-menu-register "script-fu-coffee-stain"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -20,20 +20,22 @@
; Creates snazzy-looking text, inspired by watching a Maxx marathon :) ; Creates snazzy-looking text, inspired by watching a Maxx marathon :)
(define (apply-comic-logo-effect img (define (apply-comic-logo-effect img
logo-layer logo-layer
gradient gradient
gradient-reverse gradient-reverse
ol-width ol-width
ol-color ol-color
bg-color) bg-color)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* (
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(posx (- (car (gimp-drawable-offsets logo-layer)))) (height (car (gimp-drawable-height logo-layer)))
(posy (- (cadr (gimp-drawable-offsets logo-layer)))) (posx (- (car (gimp-drawable-offsets logo-layer))))
(bg-layer (car (gimp-layer-new img width height RGBA-IMAGE (posy (- (cadr (gimp-drawable-offsets logo-layer))))
"Background" 100 NORMAL-MODE))) (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE
(white-layer (car (gimp-layer-copy logo-layer 1))) "Background" 100 NORMAL-MODE)))
(black-layer (car (gimp-layer-copy logo-layer 1)))) (white-layer (car (gimp-layer-copy logo-layer 1)))
(black-layer (car (gimp-layer-copy logo-layer 1)))
)
(gimp-context-push) (gimp-context-push)
@ -45,7 +47,7 @@
(gimp-image-add-layer img black-layer 1) (gimp-image-add-layer img black-layer 1)
(gimp-layer-translate black-layer posx posy) (gimp-layer-translate black-layer posx posy)
(gimp-drawable-set-name black-layer "Black") (gimp-drawable-set-name black-layer "Black")
(gimp-selection-all img) (gimp-selection-all img)
(gimp-context-set-background bg-color) (gimp-context-set-background bg-color)
(gimp-edit-fill bg-layer BACKGROUND-FILL) (gimp-edit-fill bg-layer BACKGROUND-FILL)
@ -77,9 +79,9 @@
(gimp-selection-all img) (gimp-selection-all img)
(gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 (* height 0.3) 0 (* height 0.78)) 0 (* height 0.3) 0 (* height 0.78))
(plug-in-noisify 1 img logo-layer 0 0.20 0.20 0.20 0.20) (plug-in-noisify 1 img logo-layer 0 0.20 0.20 0.20 0.20)
(gimp-selection-none img) (gimp-selection-none img)
@ -88,75 +90,83 @@
(plug-in-threshold-alpha 1 img logo-layer 60) (plug-in-threshold-alpha 1 img logo-layer 60)
(gimp-image-set-active-layer img logo-layer) (gimp-image-set-active-layer img logo-layer)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-comic-logo-alpha img (define (script-fu-comic-logo-alpha img
logo-layer logo-layer
gradient gradient
gradient-reverse gradient-reverse
ol-width ol-width
ol-color ol-color
bg-color) bg-color)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-comic-logo-effect img logo-layer (apply-comic-logo-effect img logo-layer
gradient gradient-reverse gradient gradient-reverse
ol-width ol-color bg-color) ol-width ol-color bg-color)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-comic-logo-alpha" (script-fu-register "script-fu-comic-logo-alpha"
_"Comic Boo_k..." _"Comic Boo_k..."
_"Add a comic-book effect to the selected region (or alpha) by outlining and filling with a gradient" _"Add a comic-book effect to the selected region (or alpha) by outlining and filling with a gradient"
"Brian McFee <keebler@wco.com>" "Brian McFee <keebler@wco.com>"
"Brian McFee" "Brian McFee"
"April 1998" "April 1998"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-GRADIENT _"Gradient" "Incandescent" SF-GRADIENT _"Gradient" "Incandescent"
SF-TOGGLE _"Gradient reverse" FALSE SF-TOGGLE _"Gradient reverse" FALSE
SF-ADJUSTMENT _"Outline size" '(5 1 100 1 10 0 1) SF-ADJUSTMENT _"Outline size" '(5 1 100 1 10 0 1)
SF-COLOR _"Outline color" "white" SF-COLOR _"Outline color" '(255 255 255)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-comic-logo-alpha" (script-fu-menu-register "script-fu-comic-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-comic-logo text (define (script-fu-comic-logo text
size size
font font
gradient gradient
gradient-reverse gradient-reverse
ol-width ol-width
ol-color ol-color
bg-color) bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4)) (border (/ size 4))
(text-layer (car (gimp-text-fontname (text-layer (car (gimp-text-fontname
img -1 0 0 text border TRUE size PIXELS font)))) img -1 0 0 text border TRUE size PIXELS font))))
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-comic-logo-effect img text-layer gradient gradient-reverse (apply-comic-logo-effect img text-layer gradient gradient-reverse
ol-width ol-color bg-color) ol-width ol-color bg-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-comic-logo" (script-fu-register "script-fu-comic-logo"
_"Comic Boo_k..." _"Comic Boo_k..."
_"Create a comic-book style logo" _"Create a comic-book style logo by outlining and filling with a gradient"
"Brian McFee <keebler@wco.com>" "Brian McFee <keebler@wco.com>"
"Brian McFee" "Brian McFee"
"April 1998" "April 1998"
"" ""
SF-STRING _"Text" "Moo" SF-STRING _"Text" "Moo"
SF-ADJUSTMENT _"Font size (pixels)" '(85 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(85 2 1000 1 10 0 1)
SF-FONT _"Font" "Tribeca" SF-FONT _"Font" "Tribeca"
SF-GRADIENT _"Gradient" "Incandescent" SF-GRADIENT _"Gradient" "Incandescent"
SF-TOGGLE _"Gradient reverse" FALSE SF-TOGGLE _"Gradient reverse" FALSE
SF-ADJUSTMENT _"Outline size" '(5 1 100 1 10 0 1) SF-ADJUSTMENT _"Outline size" '(5 1 100 1 10 0 1)
SF-COLOR _"Outline color" "white" SF-COLOR _"Outline color" '(255 255 255)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-comic-logo" (script-fu-menu-register "script-fu-comic-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -5,29 +5,31 @@
; This script was inspired by Rob Malda's 'coolmetal.gif' graphic ; This script was inspired by Rob Malda's 'coolmetal.gif' graphic
(define (apply-cool-metal-logo-effect img (define (apply-cool-metal-logo-effect img
logo-layer logo-layer
size size
bg-color bg-color
gradient gradient
gradient-reverse) gradient-reverse)
(let* ((feather (/ size 5)) (let* (
(smear 7.5) (feather (/ size 5))
(period (/ size 3)) (smear 7.5)
(amplitude (/ size 40)) (period (/ size 3))
(shrink (+ 1 (/ size 30))) (amplitude (/ size 40))
(depth (/ size 20)) (shrink (+ 1 (/ size 30)))
(width (car (gimp-drawable-width logo-layer))) (depth (/ size 20))
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(posx (- (car (gimp-drawable-offsets logo-layer)))) (height (car (gimp-drawable-height logo-layer)))
(posy (- (cadr (gimp-drawable-offsets logo-layer)))) (posx (- (car (gimp-drawable-offsets logo-layer))))
(img-width (+ width (* 0.15 height) 10)) (posy (- (cadr (gimp-drawable-offsets logo-layer))))
(img-height (+ (* 1.85 height) 10)) (img-width (+ width (* 0.15 height) 10))
(bg-layer (car (gimp-layer-new img img-width img-height RGB-IMAGE "Background" 100 NORMAL-MODE))) (img-height (+ (* 1.85 height) 10))
(shadow-layer (car (gimp-layer-new img img-width img-height RGBA-IMAGE "Shadow" 100 NORMAL-MODE))) (bg-layer (car (gimp-layer-new img img-width img-height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(reflect-layer (car (gimp-layer-new img width height RGBA-IMAGE "Reflection" 100 NORMAL-MODE))) (shadow-layer (car (gimp-layer-new img img-width img-height RGBA-IMAGE "Shadow" 100 NORMAL-MODE)))
(channel 0) (reflect-layer (car (gimp-layer-new img width height RGBA-IMAGE "Reflection" 100 NORMAL-MODE)))
(fs 0) (channel 0)
(layer-mask 0)) (fs 0)
(layer-mask 0)
)
(gimp-context-push) (gimp-context-push)
@ -47,9 +49,9 @@
(gimp-context-set-gradient gradient) (gimp-context-set-gradient gradient)
(gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 0 (+ height 5)) 0 0 0 (+ height 5))
(gimp-rect-select img 0 (- (/ height 2) feather) img-width (* 2 feather) CHANNEL-OP-REPLACE 0 0) (gimp-rect-select img 0 (- (/ height 2) feather) img-width (* 2 feather) CHANNEL-OP-REPLACE 0 0)
(plug-in-gauss-iir 1 img logo-layer smear TRUE TRUE) (plug-in-gauss-iir 1 img logo-layer smear TRUE TRUE)
@ -75,11 +77,11 @@
(set! fs (car (gimp-selection-float shadow-layer 0 0))) (set! fs (car (gimp-selection-float shadow-layer 0 0)))
(gimp-edit-clear shadow-layer) (gimp-edit-clear shadow-layer)
(gimp-drawable-transform-perspective-default fs (gimp-drawable-transform-perspective-default fs
(+ 5 (* 0.15 height)) (- height (* 0.15 height)) (+ 5 (* 0.15 height)) (- height (* 0.15 height))
(+ 5 width (* 0.15 height)) (- height (* 0.15 height)) (+ 5 width (* 0.15 height)) (- height (* 0.15 height))
5 height 5 height
(+ 5 width) height (+ 5 width) height
FALSE FALSE) FALSE FALSE)
(gimp-floating-sel-anchor fs) (gimp-floating-sel-anchor fs)
(plug-in-gauss-rle 1 img shadow-layer smear TRUE TRUE) (plug-in-gauss-rle 1 img shadow-layer smear TRUE TRUE)
@ -88,10 +90,11 @@
(set! fs (car (gimp-edit-paste reflect-layer FALSE))) (set! fs (car (gimp-edit-paste reflect-layer FALSE)))
(gimp-floating-sel-anchor fs) (gimp-floating-sel-anchor fs)
(gimp-drawable-transform-scale-default reflect-layer (gimp-drawable-transform-scale-default reflect-layer
0 0 width (* 0.85 height) 0 0 width (* 0.85 height)
FALSE FALSE) FALSE FALSE)
(gimp-drawable-transform-flip-simple reflect-layer ORIENTATION-VERTICAL (gimp-drawable-transform-flip-simple reflect-layer
TRUE 0 TRUE) ORIENTATION-VERTICAL
TRUE 0 TRUE)
(gimp-layer-set-offsets reflect-layer 5 (+ 3 height)) (gimp-layer-set-offsets reflect-layer 5 (+ 3 height))
(set! layer-mask (car (gimp-layer-create-mask reflect-layer ADD-WHITE-MASK))) (set! layer-mask (car (gimp-layer-create-mask reflect-layer ADD-WHITE-MASK)))
@ -99,74 +102,84 @@
(gimp-context-set-foreground '(255 255 255)) (gimp-context-set-foreground '(255 255 255))
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-blend layer-mask FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend layer-mask FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 (- (/ height 2)) 0 height) 0 (- (/ height 2)) 0 height)
(gimp-image-remove-channel img channel) (gimp-image-remove-channel img channel)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-cool-metal-logo-alpha img (define (script-fu-cool-metal-logo-alpha img
logo-layer logo-layer
size size
bg-color bg-color
gradient gradient
gradient-reverse) gradient-reverse)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-cool-metal-logo-effect img logo-layer size bg-color (apply-cool-metal-logo-effect img logo-layer size bg-color
gradient gradient-reverse) gradient gradient-reverse)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-cool-metal-logo-alpha" (script-fu-register "script-fu-cool-metal-logo-alpha"
_"Cool _Metal..." _"Cool _Metal..."
_"Add a metallic logo effect to the selected region (or alpha) with reflections and perspective shadows" _"Add a metallic effect to the selected region (or alpha) with reflections and perspective shadows"
"Spencer Kimball & Rob Malda" "Spencer Kimball & Rob Malda"
"Spencer Kimball & Rob Malda" "Spencer Kimball & Rob Malda"
"1997" "1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Effect size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Effect size (pixels)" '(100 2 1000 1 10 0 1)
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-GRADIENT _"Gradient" "Horizon 1" SF-GRADIENT _"Gradient" "Horizon 1"
SF-TOGGLE _"Gradient reverse" FALSE) SF-TOGGLE _"Gradient reverse" FALSE
)
(script-fu-menu-register "script-fu-cool-metal-logo-alpha" (script-fu-menu-register "script-fu-cool-metal-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-cool-metal-logo text (define (script-fu-cool-metal-logo text
size size
font font
bg-color bg-color
gradient gradient
gradient-reverse) gradient-reverse)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE (img (car (gimp-image-new 256 256 RGB)))
size PIXELS font)))) (text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE
size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-cool-metal-logo-effect img text-layer size bg-color (apply-cool-metal-logo-effect img text-layer size bg-color
gradient gradient-reverse) gradient gradient-reverse)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-cool-metal-logo" (script-fu-register "script-fu-cool-metal-logo"
_"Cool _Metal..." _"Cool _Metal..."
_"Create a metallic logo with reflections and perspective shadows" _"Create a metallic logo with reflections and perspective shadows"
"Spencer Kimball & Rob Malda" "Spencer Kimball & Rob Malda"
"Spencer Kimball & Rob Malda" "Spencer Kimball & Rob Malda"
"1997" "1997"
"" ""
SF-STRING _"Text" "Cool Metal" SF-STRING _"Text" "Cool Metal"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Crillee" SF-FONT _"Font" "Crillee"
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-GRADIENT _"Gradient" "Horizon 1" SF-GRADIENT _"Gradient" "Horizon 1"
SF-TOGGLE _"Gradient reverse" FALSE) SF-TOGGLE _"Gradient reverse" FALSE
)
(script-fu-menu-register "script-fu-cool-metal-logo" (script-fu-menu-register "script-fu-cool-metal-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,38 +1,50 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; "Copy Visible" -- copy the visible selection so that it can be pasted easily ; "Copy Visible" -- copy the visible selection so that it can be pasted easily
; Copyright (C) 2004 Raphaël Quinet, Adrian Likins, Sven Neumann ; Copyright (C) 2004 Raphaël Quinet, Adrian Likins, Sven Neumann
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; ;
; 2004-04-14 This script was almost rewritten from scratch
; by Raphaël Quinet <raphael@gimp.org>
; see also http://bugzilla.gnome.org/show_bug.cgi?id=139989
;
; The code is new but the API is the same as in the previous version:
; "Copy Visible" version 0.11 01/24/98
; by Adrian Likins <adrian@gimp.org>
; _heavily_ based on:
; cyn-merge.scm version 0.02 10/10/97
; Copyright (C) 1997 Sven Neumann (neumanns@uni-duesseldorf.de)
;
; Removed all code and made it a backward-compat wrapper around ; Removed all code and made it a backward-compat wrapper around
; (gimp-edit-copy-visible) ; (gimp-edit-copy-visible)
; 2004-12-12 Michael Natterer <mitch@gimp.org> ; 2004-12-12 Michael Natterer <mitch@gimp.org>
; ;
(define (script-fu-copy-visible image (define (script-fu-copy-visible image drawable)
drawable) (gimp-edit-copy-visible image)
(gimp-edit-copy-visible image)) )
(script-fu-register "script-fu-copy-visible" (script-fu-register "script-fu-copy-visible"
"Copy Visible" "Copy Visible"
_"This procedure is deprecated! use \'gimp_edit_copy_visible\' instead." _"This procedure is deprecated! use \'gimp-edit-copy-visible\' instead."
"" ""
"" ""
"" ""
"RGB* INDEXED* GRAY*" "RGB* INDEXED* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0) SF-DRAWABLE "Drawable" 0
)

View File

@ -1,99 +1,116 @@
; CRYSTAL ; CRYSTAL
; Create a text effect that simulates crystal ; Create a text effect that simulates crystal
(define (set-pt a index x y)
(prog1
(aset a (* index 2) x)
(aset a (+ (* index 2) 1) y)))
(define (spline1)
(let* ((a (cons-array 18 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 31 235)
(set-pt a 2 63 23)
(set-pt a 3 95 230)
(set-pt a 4 127 25)
(set-pt a 5 159 210)
(set-pt a 6 191 20)
(set-pt a 7 223 240)
(set-pt a 8 255 31)
a))
(define (crystal-brush brush-size)
(cond ((<= brush-size 5) "Circle (05)")
((<= brush-size 7) "Circle (07)")
((<= brush-size 9) "Circle (09)")
((<= brush-size 11) "Circle (11)")
((<= brush-size 13) "Circle (13)")
((<= brush-size 15) "Circle (15)")
((<= brush-size 17) "Circle (17)")
((> brush-size 17) "Circle Fuzzy (19)")))
(define (shadows val)
(/ (* 0.96 val) 2.55))
(define (midtones val)
(/ val 2.55))
(define (highlights val)
(/ (* 1.108 val) 2.55))
(define (rval col)
(car col))
(define (gval col)
(cadr col))
(define (bval col)
(caddr col))
(define (sota-scale val scale chrome-factor)
(* (sqrt val) (* scale chrome-factor)))
(define (copy-layer-crystal dest-image dest-drawable source-image source-drawable)
(gimp-selection-all dest-image)
(gimp-edit-clear dest-drawable)
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-drawable)
(let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel)))
(define (script-fu-crystal-logo chrome-factor text size font bg-img env-map) (define (script-fu-crystal-logo chrome-factor text size font bg-img env-map)
(let* ((img (car (gimp-image-new 256 256 GRAY)))
(back-img (car (gimp-file-load 1 bg-img bg-img)))
(back-layer (car (gimp-image-get-active-drawable back-img)))
(banding-img (car (gimp-file-load 1 env-map env-map)))
(banding-layer (car (gimp-image-get-active-drawable banding-img)))
(banding-height (car (gimp-drawable-height banding-layer)))
(banding-width (car (gimp-drawable-width banding-layer)))
(banding-type (car (gimp-drawable-type banding-layer)))
(b-size (sota-scale size 2 chrome-factor))
(offx1 (sota-scale size 0.33 chrome-factor))
(offy1 (sota-scale size 0.25 chrome-factor))
(offx2 (sota-scale size (- 0.33) chrome-factor))
(offy2 (sota-scale size (- 0.25) chrome-factor))
(feather (sota-scale size 0.5 chrome-factor))
(blur (sota-scale size 0.5 chrome-factor))
(displace (sota-scale size 0.25 chrome-factor))
(brush-size (sota-scale size 0.5 chrome-factor))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(tile-ret (plug-in-tile 1 back-img back-layer width height TRUE))
(tile-img (car tile-ret))
(tile-layer (cadr tile-ret))
(tile-width (car (gimp-drawable-width tile-layer)))
(tile-height (car (gimp-drawable-height tile-layer)))
(tile-type (car (gimp-drawable-type tile-layer)))
(bg-layer (car (gimp-layer-new img tile-width tile-height tile-type "BG-Layer" 100 NORMAL-MODE)))
(layer1 (car (gimp-layer-new img banding-width banding-height banding-type "Layer1" 100 NORMAL-MODE)))
(layer2 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 2" 100 DIFFERENCE-MODE)))
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(layer-mask 0)
(layer-mask2 0)
(disp-map 0))
(define (set-pt a index x y)
(begin
(aset a (* index 2) x)
(aset a (+ (* index 2) 1) y)
)
)
(define (spline1)
(let* ((a (cons-array 18 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 31 235)
(set-pt a 2 63 23)
(set-pt a 3 95 230)
(set-pt a 4 127 25)
(set-pt a 5 159 210)
(set-pt a 6 191 20)
(set-pt a 7 223 240)
(set-pt a 8 255 31)
a
)
)
(define (crystal-brush brush-size)
(cond ((<= brush-size 5) "Circle (05)")
((<= brush-size 7) "Circle (07)")
((<= brush-size 9) "Circle (09)")
((<= brush-size 11) "Circle (11)")
((<= brush-size 13) "Circle (13)")
((<= brush-size 15) "Circle (15)")
((<= brush-size 17) "Circle (17)")
((> brush-size 17) "Circle Fuzzy (19)")
)
)
(define (shadows val)
(/ (* 0.96 val) 2.55)
)
(define (midtones val)
(/ val 2.55)
)
(define (highlights val)
(/ (* 1.108 val) 2.55)
)
(define (rval col)
(car col)
)
(define (gval col)
(cadr col)
)
(define (bval col)
(caddr col)
)
(define (sota-scale val scale chrome-factor)
(* (sqrt val) (* scale chrome-factor))
)
(define (copy-layer-crystal dest-image dest-drawable source-image source-drawable)
(gimp-selection-all dest-image)
(gimp-edit-clear dest-drawable)
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-drawable)
(let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel)
)
)
(let* (
(img (car (gimp-image-new 256 256 GRAY)))
(back-img (car (gimp-file-load 1 bg-img bg-img)))
(back-layer (car (gimp-image-get-active-drawable back-img)))
(banding-img (car (gimp-file-load 1 env-map env-map)))
(banding-layer (car (gimp-image-get-active-drawable banding-img)))
(banding-height (car (gimp-drawable-height banding-layer)))
(banding-width (car (gimp-drawable-width banding-layer)))
(banding-type (car (gimp-drawable-type banding-layer)))
(b-size (sota-scale size 2 chrome-factor))
(offx1 (sota-scale size 0.33 chrome-factor))
(offy1 (sota-scale size 0.25 chrome-factor))
(offx2 (sota-scale size (- 0.33) chrome-factor))
(offy2 (sota-scale size (- 0.25) chrome-factor))
(feather (sota-scale size 0.5 chrome-factor))
(blur (sota-scale size 0.5 chrome-factor))
(displace (sota-scale size 0.25 chrome-factor))
(brush-size (sota-scale size 0.5 chrome-factor))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(tile-ret (plug-in-tile 1 back-img back-layer width height TRUE))
(tile-img (car tile-ret))
(tile-layer (cadr tile-ret))
(tile-width (car (gimp-drawable-width tile-layer)))
(tile-height (car (gimp-drawable-height tile-layer)))
(tile-type (car (gimp-drawable-type tile-layer)))
(bg-layer (car (gimp-layer-new img tile-width tile-height tile-type "BG-Layer" 100 NORMAL-MODE)))
(layer1 (car (gimp-layer-new img banding-width banding-height banding-type "Layer1" 100 NORMAL-MODE)))
(layer2 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 2" 100 DIFFERENCE-MODE)))
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(layer-mask 0)
(layer-mask2 0)
(disp-map 0)
)
(gimp-context-push) (gimp-context-push)
(gimp-image-delete back-img) (gimp-image-delete back-img)
@ -143,9 +160,9 @@
(gimp-levels disp-map 0 0 255 1.0 96 255) (gimp-levels disp-map 0 0 255 1.0 96 255)
(if (= (car (gimp-drawable-is-rgb bg-layer)) 1) (if (= (car (gimp-drawable-is-rgb bg-layer)) 1)
(gimp-image-convert-rgb img)) (gimp-image-convert-rgb img))
(gimp-image-add-layer img bg-layer 2) (gimp-image-add-layer img bg-layer 2)
(copy-layer-crystal img bg-layer tile-img tile-layer) (copy-layer-crystal img bg-layer tile-img tile-layer)
@ -182,28 +199,33 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-crystal-logo" (script-fu-register "script-fu-crystal-logo"
_"Crystal..." _"Crystal..."
_"Create a logo with a crystal/gel effect displacing the image underneath" _"Create a logo with a crystal/gel effect displacing the image underneath"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Chrome factor" '(1.0 0.2 4 0.1 1 1 0) SF-ADJUSTMENT _"Chrome factor" '(1.0 0.2 4 0.1 1 1 0)
SF-STRING _"Text" "Crystal" SF-STRING _"Text" "Crystal"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Engraver" SF-FONT _"Font" "Engraver"
SF-FILENAME _"Background image" SF-FILENAME _"Background image"
(string-append "" (string-append gimp-data-directory DIR-SEPARATOR
gimp-data-directory "scripts" DIR-SEPARATOR
"/scripts/images/texture1.jpg") "images" DIR-SEPARATOR
SF-FILENAME _"Environment map" "texture1.jpg")
(string-append "" SF-FILENAME _"Environment map"
gimp-data-directory (string-append gimp-data-directory DIR-SEPARATOR
"/scripts/images/beavis.jpg")) "scripts" DIR-SEPARATOR
"images" DIR-SEPARATOR
"beavis.jpg")
)
(script-fu-menu-register "script-fu-crystal-logo" (script-fu-menu-register "script-fu-crystal-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -9,12 +9,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -22,53 +22,58 @@
; Define the function: ; Define the function:
(define (script-fu-distress-selection inImage (define (script-fu-distress-selection inImage
inLayer inLayer
inThreshold inThreshold
inSpread inSpread
inGranu inGranu
inSmooth inSmooth
inSmoothH inSmoothH
inSmoothV) inSmoothV)
(set! theImage inImage) (let (
(set! theWidth (car (gimp-image-width inImage))) (theImage inImage)
(set! theHeight (car (gimp-image-height inImage))) (theWidth (car (gimp-image-width inImage)))
(theHeight (car (gimp-image-height inImage)))
(theLayer)
)
(gimp-image-undo-group-start theImage) (gimp-image-undo-group-start theImage)
(set! theLayer (car (gimp-layer-new theImage (set! theLayer (car (gimp-layer-new theImage
theWidth theWidth
theHeight theHeight
RGBA-IMAGE RGBA-IMAGE
"Distress Scratch Layer" "Distress Scratch Layer"
100 100
NORMAL-MODE))) NORMAL-MODE)))
(gimp-image-add-layer theImage theLayer 0) (gimp-image-add-layer theImage theLayer 0)
(if (= TRUE (car (gimp-selection-is-empty theImage))) (if (= TRUE (car (gimp-selection-is-empty theImage)))
() ()
(gimp-edit-fill theLayer BACKGROUND-FILL)) (gimp-edit-fill theLayer BACKGROUND-FILL)
)
(gimp-selection-invert theImage) (gimp-selection-invert theImage)
(if (= TRUE (car (gimp-selection-is-empty theImage))) (if (= TRUE (car (gimp-selection-is-empty theImage)))
() ()
(gimp-edit-clear theLayer)) (gimp-edit-clear theLayer)
)
(gimp-selection-invert theImage) (gimp-selection-invert theImage)
(gimp-selection-none inImage) (gimp-selection-none inImage)
(gimp-layer-scale theLayer (gimp-layer-scale theLayer
(/ theWidth inGranu) (/ theWidth inGranu)
(/ theHeight inGranu) (/ theHeight inGranu)
TRUE) TRUE)
(plug-in-spread TRUE (plug-in-spread TRUE
theImage theImage
theLayer theLayer
inSpread inSpread
inSpread) inSpread)
(plug-in-gauss-iir TRUE theImage theLayer inSmooth inSmoothH inSmoothV) (plug-in-gauss-iir TRUE theImage theLayer inSmooth inSmoothH inSmoothV)
(gimp-layer-scale theLayer theWidth theHeight TRUE) (gimp-layer-scale theLayer theWidth theHeight TRUE)
@ -79,24 +84,29 @@
(gimp-image-undo-group-end theImage) (gimp-image-undo-group-end theImage)
(gimp-displays-flush)) (gimp-displays-flush)
)
)
; Register the function with the GIMP:
(script-fu-register "script-fu-distress-selection" (script-fu-register "script-fu-distress-selection"
_"_Distort..." _"_Disort..."
_"Distress the selection" _"Distress the selection"
"Chris Gutteridge" "Chris Gutteridge"
"1998, Chris Gutteridge / ECS dept, University of Southampton, England." "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
"23rd April 1998" "23rd April 1998"
"RGB*" "RGB*"
SF-IMAGE "The image" 0 SF-IMAGE "The image" 0
SF-DRAWABLE "The layer" 0 SF-DRAWABLE "The layer" 0
SF-ADJUSTMENT _"Threshold (bigger 1<-->255 smaller)" '(127 1 255 1 10 0 0) SF-ADJUSTMENT _"Threshold (bigger 1<-->255 smaller)" '(127 1 255 1 10 0 0)
SF-ADJUSTMENT _"Spread" '(8 0 1000 1 10 0 1) SF-ADJUSTMENT _"Spread" '(8 0 1000 1 10 0 1)
SF-ADJUSTMENT _"Granularity (1 is low)" '(4 1 25 1 10 0 1) SF-ADJUSTMENT _"Granularity (1 is low)" '(4 1 25 1 10 0 1)
SF-ADJUSTMENT _"Smooth" '(2 0 150 1 10 0 1) SF-ADJUSTMENT _"Smooth" '(2 0 150 1 10 0 1)
SF-TOGGLE _"Smooth horizontally" TRUE SF-TOGGLE _"Smooth horizontally" TRUE
SF-TOGGLE _"Smooth vertically" TRUE) SF-TOGGLE _"Smooth vertically" TRUE
)
(script-fu-menu-register "script-fu-distress-selection" (script-fu-menu-register "script-fu-distress-selection"
"<Image>/Select/Modify") "<Image>/Select/Modify")

View File

@ -1,22 +1,22 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; ;
; ;
; drop-shadow.scm version 1.04 1999/12/21 ; drop-shadow.scm version 1.04 1999/12/21
; ;
; CHANGE-LOG: ; CHANGE-LOG:
; 1.00 - initial release ; 1.00 - initial release
@ -26,153 +26,159 @@
; ;
; ;
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org> ; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
;
;
; Adds a drop-shadow of the current selection or alpha-channel.
; ;
; This script is derived from my script add-shadow, which has become ;
; obsolete now. Thanks to Andrew Donkin (ard@cs.waikato.ac.nz) for his ; Adds a drop-shadow of the current selection or alpha-channel.
;
; This script is derived from my script add-shadow, which has become
; obsolete now. Thanks to Andrew Donkin (ard@cs.waikato.ac.nz) for his
; idea to add alpha-support to add-shadow. ; idea to add alpha-support to add-shadow.
(define (script-fu-drop-shadow image (define (script-fu-drop-shadow image
drawable drawable
shadow-transl-x shadow-transl-x
shadow-transl-y shadow-transl-y
shadow-blur shadow-blur
shadow-color shadow-color
shadow-opacity shadow-opacity
allow-resize) allow-resize)
(let* ((shadow-blur (max shadow-blur 0)) (let* (
(shadow-opacity (min shadow-opacity 100)) (shadow-blur (max shadow-blur 0))
(shadow-opacity (max shadow-opacity 0)) (shadow-opacity (min shadow-opacity 100))
(type (car (gimp-drawable-type-with-alpha drawable))) (shadow-opacity (max shadow-opacity 0))
(image-width (car (gimp-image-width image))) (type (car (gimp-drawable-type-with-alpha drawable)))
(image-height (car (gimp-image-height image))) (image-width (car (gimp-image-width image)))
(from-selection 0) (image-height (car (gimp-image-height image)))
(active-selection 0) (from-selection 0)
(shadow-layer 0)) (active-selection 0)
(shadow-layer 0)
)
(gimp-context-push) (gimp-context-push)
(gimp-image-set-active-layer image drawable) (gimp-image-set-active-layer image drawable)
(gimp-image-undo-group-start image) (gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable)
(if (= (car (gimp-selection-is-empty image)) TRUE)
(begin
(gimp-selection-layer-alpha drawable)
(set! from-selection FALSE))
(begin
(set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image)))))
(let* ((selection-bounds (gimp-selection-bounds image)) (gimp-layer-add-alpha drawable)
(select-offset-x (cadr selection-bounds)) (if (= (car (gimp-selection-is-empty image)) TRUE)
(select-offset-y (caddr selection-bounds)) (begin
(select-width (- (cadr (cddr selection-bounds)) select-offset-x)) (gimp-selection-layer-alpha drawable)
(select-height (- (caddr (cddr selection-bounds)) select-offset-y)) (set! from-selection FALSE))
(begin
(shadow-width (+ select-width (* 2 shadow-blur))) (set! from-selection TRUE)
(shadow-height (+ select-height (* 2 shadow-blur))) (set! active-selection (car (gimp-selection-save image)))))
(shadow-offset-x (- select-offset-x shadow-blur))
(shadow-offset-y (- select-offset-y shadow-blur)))
(if (= allow-resize TRUE) (let* ((selection-bounds (gimp-selection-bounds image))
(let* ((new-image-width image-width) (select-offset-x (cadr selection-bounds))
(new-image-height image-height) (select-offset-y (caddr selection-bounds))
(image-offset-x 0) (select-width (- (cadr (cddr selection-bounds)) select-offset-x))
(image-offset-y 0)) (select-height (- (caddr (cddr selection-bounds)) select-offset-y))
(if (< (+ shadow-offset-x shadow-transl-x) 0) (shadow-width (+ select-width (* 2 shadow-blur)))
(begin (shadow-height (+ select-height (* 2 shadow-blur)))
(set! image-offset-x (- 0 (+ shadow-offset-x
shadow-transl-x)))
(set! shadow-offset-x (- 0 shadow-transl-x))
(set! new-image-width (- new-image-width image-offset-x))))
(if (< (+ shadow-offset-y shadow-transl-y) 0) (shadow-offset-x (- select-offset-x shadow-blur))
(begin (shadow-offset-y (- select-offset-y shadow-blur)))
(set! image-offset-y (- 0 (+ shadow-offset-y
shadow-transl-y)))
(set! shadow-offset-y (- 0 shadow-transl-y))
(set! new-image-height (- new-image-height image-offset-y))))
(if (> (+ (+ shadow-width shadow-offset-x) shadow-transl-x) (if (= allow-resize TRUE)
new-image-width) (let* ((new-image-width image-width)
(set! new-image-width (new-image-height image-height)
(+ (+ shadow-width shadow-offset-x) shadow-transl-x))) (image-offset-x 0)
(image-offset-y 0))
(if (> (+ (+ shadow-height shadow-offset-y) shadow-transl-y) (if (< (+ shadow-offset-x shadow-transl-x) 0)
new-image-height) (begin
(set! new-image-height (set! image-offset-x (- 0 (+ shadow-offset-x
(+ (+ shadow-height shadow-offset-y) shadow-transl-y))) shadow-transl-x)))
(set! shadow-offset-x (- 0 shadow-transl-x))
(set! new-image-width (- new-image-width image-offset-x))))
(gimp-image-resize image (if (< (+ shadow-offset-y shadow-transl-y) 0)
new-image-width (begin
new-image-height (set! image-offset-y (- 0 (+ shadow-offset-y
image-offset-x shadow-transl-y)))
image-offset-y))) (set! shadow-offset-y (- 0 shadow-transl-y))
(set! new-image-height (- new-image-height image-offset-y))))
(set! shadow-layer (car (gimp-layer-new image (if (> (+ (+ shadow-width shadow-offset-x) shadow-transl-x)
shadow-width new-image-width)
shadow-height (set! new-image-width
type (+ (+ shadow-width shadow-offset-x) shadow-transl-x)))
"Drop-Shadow"
shadow-opacity
NORMAL-MODE)))
(gimp-image-add-layer image shadow-layer -1)
(gimp-layer-set-offsets shadow-layer
shadow-offset-x
shadow-offset-y))
(gimp-drawable-fill shadow-layer TRANSPARENT-FILL) (if (> (+ (+ shadow-height shadow-offset-y) shadow-transl-y)
(gimp-context-set-background shadow-color) new-image-height)
(gimp-edit-fill shadow-layer BACKGROUND-FILL) (set! new-image-height
(gimp-selection-none image) (+ (+ shadow-height shadow-offset-y) shadow-transl-y)))
(gimp-layer-set-lock-alpha shadow-layer FALSE)
(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) (gimp-image-resize image
(begin new-image-width
(gimp-selection-load active-selection) new-image-height
(gimp-edit-clear shadow-layer) image-offset-x
(gimp-image-remove-channel image active-selection))) image-offset-y)))
(if (and
(= (car (gimp-layer-is-floating-sel drawable)) 0)
(= from-selection FALSE))
(gimp-image-raise-layer image drawable))
(gimp-image-set-active-layer image drawable) (set! shadow-layer (car (gimp-layer-new image
(gimp-image-undo-group-end image) shadow-width
(gimp-displays-flush) shadow-height
type
"Drop-Shadow"
shadow-opacity
NORMAL-MODE)))
(gimp-image-add-layer image shadow-layer -1)
(gimp-layer-set-offsets shadow-layer
shadow-offset-x
shadow-offset-y))
(gimp-context-pop))) (gimp-drawable-fill shadow-layer TRANSPARENT-FILL)
(gimp-context-set-background shadow-color)
(gimp-edit-fill shadow-layer BACKGROUND-FILL)
(gimp-selection-none image)
(gimp-layer-set-lock-alpha shadow-layer FALSE)
(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)
(begin
(gimp-selection-load active-selection)
(gimp-edit-clear shadow-layer)
(gimp-image-remove-channel image active-selection)))
(if (and
(= (car (gimp-layer-is-floating-sel drawable)) 0)
(= from-selection FALSE))
(gimp-image-raise-layer image drawable))
(gimp-image-set-active-layer image drawable)
(gimp-image-undo-group-end image)
(gimp-displays-flush)
(gimp-context-pop)
)
)
(script-fu-register "script-fu-drop-shadow" (script-fu-register "script-fu-drop-shadow"
_"_Drop-Shadow..." _"_Drop-Shadow..."
_"Add a drop-shadow to the selected region (or alpha)" _"Add a drop-shadow to the selected region (or alpha)"
"Sven Neumann <sven@gimp.org>" "Sven Neumann <sven@gimp.org>"
"Sven Neumann" "Sven Neumann"
"1999/12/21" "1999/12/21"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Offset X" '(8 -4096 4096 1 10 0 1) SF-ADJUSTMENT _"Offset X" '(8 -4096 4096 1 10 0 1)
SF-ADJUSTMENT _"Offset Y" '(8 -4096 4096 1 10 0 1) SF-ADJUSTMENT _"Offset Y" '(8 -4096 4096 1 10 0 1)
SF-ADJUSTMENT _"Blur radius" '(15 0 1024 1 10 0 1) SF-ADJUSTMENT _"Blur radius" '(15 0 1024 1 10 0 1)
SF-COLOR _"Color" "black" SF-COLOR _"Color" '(0 0 0)
SF-ADJUSTMENT _"Opacity" '(80 0 100 1 10 0 0) SF-ADJUSTMENT _"Opacity" '(80 0 100 1 10 0 0)
SF-TOGGLE _"Allow resizing" TRUE) SF-TOGGLE _"Allow resizing" TRUE
)
(script-fu-menu-register "script-fu-drop-shadow" (script-fu-menu-register "script-fu-drop-shadow"
"<Image>/Filters/Light and Shadow/Shadow") "<Image>/Filters/Light and Shadow/Shadow")

View File

@ -1,41 +1,49 @@
(define (script-fu-erase-rows img drawable orientation which type) (define (script-fu-erase-rows img drawable orientation which type)
(let* ((width (car (gimp-drawable-width drawable))) (let* (
(height (car (gimp-drawable-height drawable))) (width (car (gimp-drawable-width drawable)))
(position-x (car (gimp-drawable-offsets drawable))) (height (car (gimp-drawable-height drawable)))
(position-y (cadr (gimp-drawable-offsets drawable)))) (x (car (gimp-drawable-offsets drawable)))
(y (cadr (gimp-drawable-offsets drawable)))
)
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(letrec ((loop (lambda (i max) (letrec ((loop (lambda (i max)
(if (< i max) (if (< i max)
(begin (begin
(if (= orientation 0) (if (= orientation 0)
(gimp-rect-select img position-x (+ i position-y) width 1 CHANNEL-OP-REPLACE FALSE 0) (gimp-rect-select img x (+ i y) width 1 CHANNEL-OP-REPLACE FALSE 0)
(gimp-rect-select img (+ i position-x) position-y 1 height CHANNEL-OP-REPLACE FALSE 0)) (gimp-rect-select img (+ i x) y 1 height CHANNEL-OP-REPLACE FALSE 0))
(if (= type 0) (if (= type 0)
(gimp-edit-clear drawable) (gimp-edit-clear drawable)
(gimp-edit-fill drawable BACKGROUND-FILL)) (gimp-edit-fill drawable BACKGROUND-FILL))
(loop (+ i 2) max)))))) (loop (+ i 2) max))))))
(loop (if (= which 0) (loop (if (= which 0)
0 0
1) 1)
(if (= orientation 0) (if (= orientation 0)
height height
width))) width)
)
)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-erase-rows" (script-fu-register "script-fu-erase-rows"
_"_Erase Every Other Row..." _"_Erase every other Row..."
_"Erase every other row/column of pixels of the active drawable" _"Erase every other row/column of pixels of the active drawable"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"June 1997" "June 1997"
"RGB* GRAY* INDEXED*" "RGB* GRAY* INDEXED*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-OPTION _"Rows/cols" '(_"Rows" _"Columns") SF-OPTION _"Rows/cols" '(_"Rows" _"Columns")
SF-OPTION _"Even/odd" '(_"Even" _"Odd") SF-OPTION _"Even/odd" '(_"Even" _"Odd")
SF-OPTION _"Erase/fill" '(_"Erase" _"Fill with BG")) SF-OPTION _"Erase/fill" '(_"Erase" _"Fill with BG")
)
(script-fu-menu-register "script-fu-erase-rows" (script-fu-menu-register "script-fu-erase-rows"
"<Image>/Filters/Distorts") "<Image>/Filters/Distorts")

View File

@ -14,22 +14,22 @@
; or from the layers alpha channel if no selection is active. ; or from the layers alpha channel if no selection is active.
; ;
; Optional you may keep the generated layermask or apply ; Optional you may keep the generated layermask or apply
; it to the layer ; it to the layer
; ;
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -37,25 +37,34 @@
; Define the main function: ; Define the main function:
(define (script-fu-fade-outline inImage (define (script-fu-fade-outline inImage
inLayer inLayer
inBorderSize inBorderSize
inFadeFrom inFadeFrom
inFadeTo inFadeTo
inGrowingSelection inGrowingSelection
inApplyMask inApplyMask
inClearUnselected) inClearUnselected)
(let* ((l-idx 0)
(l-has-selection TRUE)) (let* (
(l-idx)
(l-has-selection TRUE)
(l-from-gray)
(l-to-gray)
(l-step)
(l-gray)
(l-mask)
(l-orig-selection)
)
(gimp-context-push) (gimp-context-push)
; check Fade from and To Values (and force values from 0% to 100%) ; check Fade from and To Values (and force values from 0% to 100%)
(if (> inFadeFrom 100) (begin (set! inFadeFrom 100 )) ) (if (> inFadeFrom 100) (set! inFadeFrom 100) )
(if (< inFadeFrom 0) (begin (set! inFadeFrom 0 )) ) (if (< inFadeFrom 0) (set! inFadeFrom 0) )
(if (> inFadeTo 100) (begin (set! inFadeTo 100 )) ) (if (> inFadeTo 100) (set! inFadeTo 100) )
(if (< inFadeTo 0) (begin (set! inFadeTo 0 )) ) (if (< inFadeTo 0) (set! inFadeTo 0) )
(set! l-from-gray (* inFadeFrom 255)) (set! l-from-gray (* inFadeFrom 255))
(set! l-to-gray (* inFadeTo 255)) (set! l-to-gray (* inFadeTo 255))
(set! l-step (/ (- l-from-gray l-to-gray) (+ inBorderSize 1))) (set! l-step (/ (- l-from-gray l-to-gray) (+ inBorderSize 1)))
@ -63,111 +72,121 @@
; do nothing if the layer is a layer mask ; do nothing if the layer is a layer mask
(if (= (car (gimp-drawable-is-layer-mask inLayer)) 0) (if (= (car (gimp-drawable-is-layer-mask inLayer)) 0)
(begin (begin
(gimp-image-undo-group-start inImage)
(gimp-image-undo-group-start inImage) ; if the layer has no alpha add alpha channel
(if (= (car (gimp-drawable-has-alpha inLayer)) FALSE)
; if the layer has no alpha add alpha channel (gimp-layer-add-alpha inLayer)
(if (= (car (gimp-drawable-has-alpha inLayer)) FALSE) )
(begin
(gimp-layer-add-alpha inLayer)))
; if the layer is the floating selection convert to normal layer ; if the layer is the floating selection convert to normal layer
; because floating selection cant have a layer mask ; because floating selection cant have a layer mask
(if (> (car (gimp-layer-is-floating-sel inLayer)) 0) (if (> (car (gimp-layer-is-floating-sel inLayer)) 0)
(begin (gimp-floating-sel-to-layer inLayer)
(gimp-floating-sel-to-layer inLayer))) )
; if there is no selection we use the layers alpha channel ; if there is no selection we use the layers alpha channel
(if (= (car (gimp-selection-is-empty inImage)) TRUE) (if (= (car (gimp-selection-is-empty inImage)) TRUE)
(begin (begin
(set! l-has-selection FALSE) (set! l-has-selection FALSE)
(gimp-selection-layer-alpha inLayer))) (gimp-selection-layer-alpha inLayer)
)
)
(gimp-selection-sharpen inImage) ;
(gimp-selection-sharpen inImage)
; apply the existing mask before creating a new one ; apply the existing mask before creating a new one
(gimp-layer-remove-mask inLayer 0) (gimp-layer-remove-mask inLayer 0)
(if (= inClearUnselected TRUE) (if (= inClearUnselected TRUE)
(begin (set! l-mask (car (gimp-layer-create-mask inLayer ADD-BLACK-MASK)))
(set! l-mask (car (gimp-layer-create-mask inLayer ADD-BLACK-MASK)))) (set! l-mask (car (gimp-layer-create-mask inLayer ADD-WHITE-MASK)))
(begin )
(set! l-mask (car (gimp-layer-create-mask inLayer ADD-WHITE-MASK)))))
(gimp-layer-add-mask inLayer l-mask) (gimp-layer-add-mask inLayer l-mask)
(if (= inGrowingSelection TRUE) (if (= inGrowingSelection TRUE)
(begin (begin
(set! l-gray l-from-gray) (set! l-gray l-from-gray)
(set! l-from-gray l-to-gray) (set! l-from-gray l-to-gray)
(set! l-to-gray l-gray) (set! l-to-gray l-gray)
(set! l-step (/ (- l-from-gray l-to-gray) (+ inBorderSize 1))) (set! l-step (/ (- l-from-gray l-to-gray) (+ inBorderSize 1)))
(set! l-orig-selection (car (gimp-selection-save inImage))) (set! l-orig-selection (car (gimp-selection-save inImage)))
(gimp-selection-invert inImage))) (gimp-selection-invert inImage)
)
(while (<= l-idx inBorderSize) )
(if (= l-idx inBorderSize)
(begin
(set! l-gray l-from-gray)))
(gimp-context-set-background (list (/ l-gray 100) (/ l-gray 100) (/ l-gray 100))) (while (<= l-idx inBorderSize)
(gimp-edit-fill l-mask BACKGROUND-FILL) (if (= l-idx inBorderSize)
(set! l-idx (+ l-idx 1)) (set! l-gray l-from-gray)
(set! l-gray (+ l-gray l-step)) )
(gimp-selection-shrink inImage 1) (gimp-context-set-background (list (/ l-gray 100) (/ l-gray 100) (/ l-gray 100)))
; check if selection has shrinked to none (gimp-edit-fill l-mask BACKGROUND-FILL)
(if (= (car (gimp-selection-is-empty inImage)) TRUE) (set! l-idx (+ l-idx 1))
(begin (set! l-gray (+ l-gray l-step))
(set! l-idx (+ inBorderSize 100)) ; break the while loop (gimp-selection-shrink inImage 1)
))) ; check if selection has shrinked to none
(if (= (car (gimp-selection-is-empty inImage)) TRUE)
(if (= inGrowingSelection TRUE) (set! l-idx (+ inBorderSize 100)) ; break the while loop
(begin )
(gimp-selection-load l-orig-selection) )
(gimp-context-set-background (list (/ l-to-gray 100) (/ l-to-gray 100) (/ l-to-gray 100)))
(gimp-edit-fill l-mask BACKGROUND-FILL)
(gimp-selection-grow inImage inBorderSize)
(gimp-selection-invert inImage)
(if (= inClearUnselected TRUE)
(begin
;(gimp-context-set-background (list (/ l-from-gray 100) (/ l-from-gray 100) (/ l-from-gray 100)))
(gimp-context-set-background (list 0 0 0)))
(begin (if (= inGrowingSelection TRUE)
(gimp-context-set-background (list 255 255 255)))) (begin
(gimp-selection-load l-orig-selection)
(gimp-context-set-background (list (/ l-to-gray 100) (/ l-to-gray 100) (/ l-to-gray 100)))
(gimp-edit-fill l-mask BACKGROUND-FILL)
(gimp-selection-grow inImage inBorderSize)
(gimp-selection-invert inImage)
(if (= inClearUnselected TRUE)
(begin
;(gimp-context-set-background (list (/ l-from-gray 100) (/ l-from-gray 100) (/ l-from-gray 100)))
(gimp-context-set-background (list 0 0 0))
)
(gimp-context-set-background (list 255 255 255))
)
(gimp-edit-fill l-mask BACKGROUND-FILL)
(gimp-image-remove-channel inImage l-orig-selection)
)
)
(gimp-edit-fill l-mask BACKGROUND-FILL) (if (= inApplyMask TRUE)
(gimp-image-remove-channel inImage l-orig-selection))) (gimp-layer-remove-mask inLayer 0)
)
(if (= inApplyMask TRUE) (if (= l-has-selection FALSE)
(begin (gimp-selection-none inImage)
(gimp-layer-remove-mask inLayer 0))) )
(if (= l-has-selection FALSE) (gimp-image-undo-group-end inImage)
(gimp-selection-none inImage)) (gimp-displays-flush)
)
)
(gimp-image-undo-group-end inImage) (gimp-context-pop)
(gimp-displays-flush))) )
)
(gimp-context-pop)))
(script-fu-register "script-fu-fade-outline" (script-fu-register
_"_Fade to Layer Mask..." "script-fu-fade-outline"
_"Create a layermask that fades the edges of the selected region (or alpha)" _"_Fade to Layer Mask..."
"Wolfgang Hofer <hof@hotbot.com>" _"Create a layermask that fades the edges of the selected region (or alpha)"
"Wolfgang Hofer" "Wolfgang Hofer <hof@hotbot.com>"
"10 Nov 1999" "Wolfgang Hofer"
"RGB* GRAY*" "10 Nov 1999"
SF-IMAGE "The image" 0 "RGB* GRAY*"
SF-DRAWABLE "The layer" 0 SF-IMAGE "The image" 0
SF-ADJUSTMENT _"Border size" '(10 1 300 1 10 0 1) SF-DRAWABLE "The layer" 0
SF-ADJUSTMENT _"Fade from %" '(100 0 100 1 10 0 0) SF-ADJUSTMENT _"Border size" '(10 1 300 1 10 0 1)
SF-ADJUSTMENT _"Fade to %" '(0 0 100 1 10 0 0) SF-ADJUSTMENT _"Fade from %" '(100 0 100 1 10 0 0)
SF-TOGGLE _"Use growing selection" FALSE SF-ADJUSTMENT _"Fade to %" '(0 0 100 1 10 0 0)
SF-TOGGLE _"Apply generated layermask" FALSE SF-TOGGLE _"Use growing selection" FALSE
SF-TOGGLE _"Clear unselected maskarea" TRUE) SF-TOGGLE _"Apply generated layermask" FALSE
SF-TOGGLE _"Clear unselected maskarea" TRUE
)
(script-fu-menu-register "script-fu-fade-outline" (script-fu-menu-register "script-fu-fade-outline"
"<Image>/Select") "<Image>/Filters/Selection")

View File

@ -1,29 +1,29 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; FlatLand - creates a tileable pattern that looks like a map ; FlatLand - creates a tileable pattern that looks like a map
; Copyright (C) 1997 Adrian Likins ; Copyright (C) 1997 Adrian Likins
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; ;
; FlatLand ; FlatLand
; ;
; When used with the Land gradient It produces a tileble pattern that ; When used with the Land gradient It produces a tileble pattern that
; looks a lot like a map. ; looks a lot like a map.
; ;
; Should be really cool once map-sphere starts working again. ; Should be really cool once map-sphere starts working again.
; ;
@ -35,40 +35,42 @@
(define (script-fu-flatland width height seed detail xscale yscale) (define (script-fu-flatland width height seed detail xscale yscale)
(let* ( (let* (
(img (car (gimp-image-new width height RGB))) (img (car (gimp-image-new width height RGB)))
(layer-one (car (gimp-layer-new img width height (layer-one (car (gimp-layer-new img width height
RGB-IMAGE "bottom" 100 NORMAL-MODE))) RGB-IMAGE "bottom" 100 NORMAL-MODE)))
(layer-two) (layer-two)
) )
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-add-layer img layer-one 0) (gimp-image-add-layer img layer-one 0)
; (gimp-img-add-layer img layer-two 1) ; (gimp-img-add-layer img layer-two 1)
(plug-in-solid-noise 1 img layer-one 1 0 seed detail xscale yscale ) (plug-in-solid-noise 1 img layer-one 1 0 seed detail xscale yscale )
(plug-in-c-astretch 1 img layer-one) (plug-in-c-astretch 1 img layer-one)
(set! layer-two (car (gimp-layer-copy layer-one TRUE))) (set! layer-two (car (gimp-layer-copy layer-one TRUE)))
(gimp-image-add-layer img layer-two -1) (gimp-image-add-layer img layer-two -1)
(gimp-image-set-active-layer img layer-two) (gimp-image-set-active-layer img layer-two)
(plug-in-gradmap 1 img layer-two) (plug-in-gradmap 1 img layer-two)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
)) )
)
(script-fu-register "script-fu-flatland" (script-fu-register "script-fu-flatland"
_"_Flatland..." _"_Flatland..."
_"Create an image filled with a Land Pattern" _"Create an image filled with a Land Pattern"
"Adrian Likins <aklikins@eos.ncsu.edu>" "Adrian Likins <aklikins@eos.ncsu.edu>"
"Adrian Likins" "Adrian Likins"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Image width" '(256 10 2000 1 10 0 1) SF-ADJUSTMENT _"Image width" '(256 10 2000 1 10 0 1)
SF-ADJUSTMENT _"Image height" '(256 10 2000 1 10 0 1) SF-ADJUSTMENT _"Image height" '(256 10 2000 1 10 0 1)
SF-ADJUSTMENT _"Random seed" '(80 1 2000000 1 10 0 1) SF-ADJUSTMENT _"Random seed" '(80 1 2000000 1 10 0 1)
SF-ADJUSTMENT _"Detail level" '(3 1 15 1 10 1 0) SF-ADJUSTMENT _"Detail level" '(3 1 15 1 10 1 0)
SF-ADJUSTMENT _"Scale X" '(4 0.1 16 0.1 2 1 1) SF-ADJUSTMENT _"Scale X" '(4 0.1 16 0.1 2 1 1)
SF-ADJUSTMENT _"Scale Y" '(4 0.1 16 0.1 2 1 1)) SF-ADJUSTMENT _"Scale Y" '(4 0.1 16 0.1 2 1 1)
)
(script-fu-menu-register "script-fu-flatland" (script-fu-menu-register "script-fu-flatland"
"<Toolbox>/Xtns/Patterns") "<Toolbox>/Xtns/Patterns")

View File

@ -1,146 +1,170 @@
;; font-select ;; font-select
;; Spencer Kimball ;; Spencer Kimball
(define (max-font-width text use-name font-list font-size)
(let* ((list font-list)
(width 0)
(maxwidth 0)
(font "")
(extents '()))
(while list
(set! font (car list))
(set! list (cdr list))
(if (= use-name TRUE)
(set! text font))
(set! extents (gimp-text-get-extents-fontname text
font-size PIXELS
font))
(set! width (nth 0 extents))
(if (> width maxwidth)
(set! maxwidth width)))
maxwidth))
(define (max-font-height text use-name font-list font-size)
(let* ((list font-list)
(height 0)
(maxheight 0)
(font "")
(extents '()))
(while list
(set! font (car list))
(set! list (cdr list))
(if (= use-name TRUE)
(set! text font))
(set! extents (gimp-text-get-extents-fontname text
font-size PIXELS
font))
(set! height (nth 1 extents))
(if (> height maxheight)
(set! maxheight height)))
maxheight))
(define (script-fu-font-map text (define (script-fu-font-map text
use-name use-name
labels labels
font-filter font-filter
font-size font-size
border border
colors) colors)
(let* ((font "")
(count 0) (define (max-font-width text use-name font-list font-size)
(font-list (cadr (gimp-fonts-get-list font-filter))) (let* ((list (cadr font-list))
(num-fonts (length font-list)) (list-cnt (car font-list))
(label-size (/ font-size 2)) (count 0)
(border (+ border (* labels (/ label-size 2)))) (width 0)
(y border) (maxwidth 0)
(maxheight (max-font-height text use-name font-list font-size)) (font "")
(maxwidth (max-font-width text use-name font-list font-size)) (extents '()))
(width (+ maxwidth (* 2 border))) (while (< count list-cnt)
(height (+ (+ (* maxheight num-fonts) (* 2 border)) (set! font (aref list count))
(* labels (* label-size num-fonts))))
(img (car (gimp-image-new width height (if (= colors 0) (if (= use-name TRUE)
GRAY RGB)))) (set! text font))
(drawable (car (gimp-layer-new img width height (if (= colors 0) (set! extents (gimp-text-get-extents-fontname text
GRAY-IMAGE RGB-IMAGE) font-size PIXELS
"Background" 100 NORMAL-MODE)))) font))
(set! width (car extents))
(if (> width maxwidth)
(set! maxwidth width))
(set! count (+ count 1))
)
maxwidth
)
)
(define (max-font-height text use-name font-list font-size)
(let* ((list (cadr font-list))
(list-cnt (car font-list))
(count 0)
(height 0)
(maxheight 0)
(font "")
(extents '()))
(while (< count list-cnt)
(set! font (aref list count))
(if (= use-name TRUE)
(set! text font)
)
(set! extents (gimp-text-get-extents-fontname text
font-size PIXELS
font))
(set! height (cadr extents))
(if (> height maxheight)
(set! maxheight height)
)
(set! count (+ count 1))
)
maxheight
)
)
(let* (
(font "")
(count 0)
(font-list (gimp-fonts-get-list font-filter))
(num-fonts (car font-list))
(label-size (/ font-size 2))
(border (+ border (* labels (/ label-size 2))))
(y border)
(maxheight (max-font-height text use-name font-list font-size))
(maxwidth (max-font-width text use-name font-list font-size))
(width (+ maxwidth (* 2 border)))
(height (+ (+ (* maxheight num-fonts) (* 2 border))
(* labels (* label-size num-fonts))))
(img (car (gimp-image-new width height (if (= colors 0)
GRAY RGB))))
(drawable (car (gimp-layer-new img width height (if (= colors 0)
GRAY-IMAGE RGB-IMAGE)
"Background" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(set! font-list (cadr font-list))
(if (= colors 0) (if (= colors 0)
(begin (begin
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-context-set-foreground '(0 0 0)))) (gimp-context-set-foreground '(0 0 0))))
(gimp-image-add-layer img drawable 0) (gimp-image-add-layer img drawable 0)
(gimp-edit-clear drawable) (gimp-edit-clear drawable)
(if (= labels TRUE) (if (= labels TRUE)
(begin (begin
(set! drawable (car (gimp-layer-new img width height (set! drawable (car (gimp-layer-new img width height
(if (= colors 0) (if (= colors 0)
GRAYA-IMAGE RGBA-IMAGE) GRAYA-IMAGE RGBA-IMAGE)
"Labels" 100 NORMAL-MODE))) "Labels" 100 NORMAL-MODE)))
(gimp-image-add-layer img drawable -1))) (gimp-image-add-layer img drawable -1)))
(gimp-edit-clear drawable) (gimp-edit-clear drawable)
(while font-list (while (< count num-fonts)
(set! font (car font-list)) (set! font (aref font-list count))
(set! font-list (cdr font-list))
(if (= use-name TRUE) (if (= use-name TRUE)
(set! text font)) (set! text font))
(gimp-text-fontname img -1 (gimp-text-fontname img -1
border border
y y
text text
0 TRUE font-size PIXELS 0 TRUE font-size PIXELS
font) font)
(set! y (+ y maxheight)) (set! y (+ y maxheight))
(if (= labels TRUE) (if (= labels TRUE)
(begin (begin
(gimp-floating-sel-anchor (car (gimp-text-fontname img drawable (gimp-floating-sel-anchor (car (gimp-text-fontname img drawable
(- border (- border
(/ label-size 2)) (/ label-size 2))
(- y (- y
(/ label-size 2)) (/ label-size 2))
font font
0 TRUE 0 TRUE
label-size PIXELS label-size PIXELS
"Sans"))) "Sans")))
(set! y (+ y label-size)))) (set! y (+ y label-size))
)
)
(set! count (+ count 1))
(set! count (+ count 1))) )
(gimp-image-set-active-layer img drawable) (gimp-image-set-active-layer img drawable)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-font-map" (script-fu-register "script-fu-font-map"
_"Render _Font Map..." _"Render _Font Map..."
_"Create an image filled with previews of fonts matching a fontname filter" _"Create an image filled with previews of fonts matching a fontname filter"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"" ""
SF-STRING _"_Text" "How quickly daft jumping zebras vex." SF-STRING _"_Text" "How quickly daft jumping zebras vex."
SF-TOGGLE _"Use font _name as text" FALSE SF-TOGGLE _"Use font _name as text" FALSE
SF-TOGGLE _"_Labels" TRUE SF-TOGGLE _"_Labels" TRUE
SF-STRING _"_Filter (regexp)" "Sans" SF-STRING _"_Filter (regexp)" "Sans"
SF-ADJUSTMENT _"Font _size (pixels)" '(32 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font _size (pixels)" '(32 2 1000 1 10 0 1)
SF-ADJUSTMENT _"_Border (pixels)" '(10 0 200 1 10 0 1) SF-ADJUSTMENT _"_Border (pixels)" '(10 0 200 1 10 0 1)
SF-OPTION _"_Color scheme" '(_"Black on white" SF-OPTION _"_Color scheme" '(_"Black on white" _"Active colors")
_"Active colors")) )
(script-fu-menu-register "script-fu-font-map" (script-fu-menu-register "script-fu-font-map"
"<Fonts>") "<Fonts>")

View File

@ -3,24 +3,24 @@
; Written by Spencer Kimball ; Written by Spencer Kimball
(define (apply-frosty-logo-effect img (define (apply-frosty-logo-effect img
logo-layer logo-layer
size size
bg-color) bg-color)
(let* ((border (/ size 5)) (let* (
(width (+ (car (gimp-drawable-width logo-layer)) border)) (border (/ size 5))
(height (+ (car (gimp-drawable-height logo-layer)) border)) (width (+ (car (gimp-drawable-width logo-layer)) border))
(logo-layer-mask (car (gimp-layer-create-mask logo-layer ADD-BLACK-MASK))) (height (+ (car (gimp-drawable-height logo-layer)) border))
(sparkle-layer (car (gimp-layer-new img width height RGBA-IMAGE "Sparkle" 100 NORMAL-MODE))) (logo-layer-mask (car (gimp-layer-create-mask logo-layer ADD-BLACK-MASK)))
(matte-layer (car (gimp-layer-new img width height RGBA-IMAGE "Matte" 100 NORMAL-MODE))) (sparkle-layer (car (gimp-layer-new img width height RGBA-IMAGE
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 90 MULTIPLY-MODE))) "Sparkle" 100 NORMAL-MODE)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (matte-layer (car (gimp-layer-new img width height RGBA-IMAGE
(selection 0)) "Matte" 100 NORMAL-MODE)))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
(define (for-each proc seq) "Shadow" 90 MULTIPLY-MODE)))
(if (not (null? seq)) (bg-layer (car (gimp-layer-new img width height RGB-IMAGE
(begin "Background" 100 NORMAL-MODE)))
(proc (car seq)) (selection 0)
(for-each proc (cdr seq))))) )
(gimp-context-push) (gimp-context-push)
@ -43,7 +43,9 @@
(plug-in-noisify 1 img sparkle-layer FALSE 0.2 0.2 0.2 0.0) (plug-in-noisify 1 img sparkle-layer FALSE 0.2 0.2 0.2 0.0)
(plug-in-c-astretch 1 img sparkle-layer) (plug-in-c-astretch 1 img sparkle-layer)
(gimp-selection-none img) (gimp-selection-none img)
(plug-in-sparkle 1 img sparkle-layer 0.03 0.5 (/ (min width height) 2) 6 15 1.0 0.0 0.0 0.0 FALSE FALSE FALSE 0) (plug-in-sparkle 1 img sparkle-layer 0.03 0.5
(/ (min width height) 2)
6 15 1.0 0.0 0.0 0.0 FALSE FALSE FALSE 0)
(gimp-levels sparkle-layer 1 0 255 0.2 0 255) (gimp-levels sparkle-layer 1 0 255 0.2 0 255)
(gimp-levels sparkle-layer 2 0 255 0.7 0 255) (gimp-levels sparkle-layer 2 0 255 0.7 0 255)
(gimp-selection-layer-alpha sparkle-layer) (gimp-selection-layer-alpha sparkle-layer)
@ -72,65 +74,80 @@
(gimp-edit-stroke logo-layer) (gimp-edit-stroke logo-layer)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-image-remove-channel img selection) (gimp-image-remove-channel img selection)
(for-each (lambda (the-layer) (for-each (lambda (the-layer)
(gimp-layer-resize the-layer (- width border) (- height border) (- border) (- border)) (gimp-layer-resize the-layer (- width border) (- height border)
; (gimp-layer-translate the-layer border border) (- border) (- border))
) ; (gimp-layer-translate the-layer border border)
(list sparkle-layer matte-layer bg-layer)) )
(list sparkle-layer matte-layer bg-layer)
)
(gimp-layer-resize shadow-layer (- width border) (- height border) 0 0) (gimp-layer-resize shadow-layer (- width border) (- height border) 0 0)
(gimp-layer-translate shadow-layer border border) (gimp-layer-translate shadow-layer border border)
(script-fu-util-image-resize-from-layer img logo-layer) (script-fu-util-image-resize-from-layer img logo-layer)
(gimp-context-pop)))
(gimp-context-pop)
)
)
(define (script-fu-frosty-logo-alpha img (define (script-fu-frosty-logo-alpha img
logo-layer logo-layer
size size
bg-color) bg-color)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-frosty-logo-effect img logo-layer size bg-color) (apply-frosty-logo-effect img logo-layer size bg-color)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-frosty-logo-alpha" (script-fu-register "script-fu-frosty-logo-alpha"
_"_Frosty..." _"_Frosty..."
_"Add a frost effect to the selected region (or alpha)" _"Add a frost effect to the selected region (or alpha) with an added drop shadow"
"Spencer Kimball & Ed Mackey" "Spencer Kimball & Ed Mackey"
"Spencer Kimball & Ed Mackey" "Spencer Kimball & Ed Mackey"
"1997" "1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Effect size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Effect size (pixels)" '(100 2 1000 1 10 0 1)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-frosty-logo-alpha" (script-fu-menu-register "script-fu-frosty-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-frosty-logo text (define (script-fu-frosty-logo text
size size
font font
bg-color) bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(border (/ size 5)) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2) TRUE size PIXELS font)))) (border (/ size 5))
(text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2) TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-frosty-logo-effect img text-layer size bg-color) (apply-frosty-logo-effect img text-layer size bg-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-frosty-logo" (script-fu-register "script-fu-frosty-logo"
_"_Frosty..." _"_Frosty..."
_"Create frozen logo with an added drop shadow" _"Create frozen logo with an added drop shadow"
"Spencer Kimball & Ed Mackey" "Spencer Kimball & Ed Mackey"
"Spencer Kimball & Ed Mackey" "Spencer Kimball & Ed Mackey"
"1997" "1997"
"" ""
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Becker" SF-FONT _"Font" "Becker"
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-frosty-logo" (script-fu-menu-register "script-fu-frosty-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -11,156 +11,151 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; Define the function: ; Define the function:
(define (script-fu-fuzzy-border inImage (define (script-fu-fuzzy-border inImage
inLayer inLayer
inColor inColor
inSize inSize
inBlur inBlur
inGranu inGranu
inShadow inShadow
inShadWeight inShadWeight
inCopy inCopy
inFlatten inFlatten
)
(gimp-selection-all inImage)
(set! theImage (if (= inCopy TRUE)
(car (gimp-image-duplicate inImage))
inImage)
) )
(if (> (car (gimp-drawable-type inLayer))
1
)
(gimp-image-convert-rgb theImage)
)
(set! theWidth (car (gimp-image-width inImage)))
(set! theHeight (car (gimp-image-height inImage)))
(set! theLayer (car (gimp-layer-new theImage (let (
theWidth (theWidth (car (gimp-image-width inImage)))
theHeight (theHeight (car (gimp-image-height inImage)))
RGBA-IMAGE (theImage)
"layer 1" (theLayer)
100 )
NORMAL-MODE
) ) )
(gimp-image-add-layer theImage theLayer 0) (gimp-selection-all inImage)
(set! theImage (if (= inCopy TRUE)
(car (gimp-image-duplicate inImage)) inImage
))
(if (> (car (gimp-drawable-type inLayer)) 1)
(gimp-image-convert-rgb theImage)
)
(set! theLayer (car (gimp-layer-new theImage
theWidth
theHeight
RGBA-IMAGE
"layer 1"
100
NORMAL-MODE)))
(gimp-image-add-layer theImage theLayer 0)
(gimp-edit-clear theLayer) (gimp-edit-clear theLayer)
(chris-color-edge theImage theLayer inColor inSize) (chris-color-edge theImage theLayer inColor inSize)
(gimp-layer-scale theLayer (gimp-layer-scale theLayer
(/ theWidth inGranu) (/ theWidth inGranu)
(/ theHeight inGranu) (/ theHeight inGranu)
TRUE TRUE)
)
(plug-in-spread TRUE (plug-in-spread TRUE
theImage theImage
theLayer theLayer
(/ inSize inGranu) (/ inSize inGranu)
(/ inSize inGranu) (/ inSize inGranu))
) (chris-color-edge theImage theLayer inColor 1)
(chris-color-edge theImage theLayer inColor 1) (gimp-layer-scale theLayer theWidth theHeight TRUE)
(gimp-layer-scale theLayer theWidth theHeight TRUE)
(gimp-selection-layer-alpha theLayer)
(gimp-selection-layer-alpha theLayer) (gimp-selection-invert theImage)
(gimp-selection-invert theImage) (gimp-edit-clear theLayer)
(gimp-edit-clear theLayer) (gimp-selection-invert theImage)
(gimp-selection-invert theImage) (gimp-edit-clear theLayer)
(gimp-edit-clear theLayer) (gimp-context-set-background inColor)
(gimp-context-set-background inColor) (gimp-edit-fill theLayer BACKGROUND-FILL)
(gimp-edit-fill theLayer BACKGROUND-FILL) (gimp-selection-none inImage)
(gimp-selection-none inImage) (chris-color-edge theImage theLayer inColor 1)
(chris-color-edge theImage theLayer inColor 1)
(if (= inBlur TRUE)
(if (= inBlur TRUE) (plug-in-gauss-rle TRUE theImage theLayer inSize TRUE TRUE)
(plug-in-gauss-rle TRUE theImage theLayer inSize TRUE TRUE) )
() (if (= inShadow TRUE)
) (begin
(if (= inShadow FALSE) (gimp-selection-none inImage)
() (gimp-image-add-layer theImage
(begin (car (gimp-layer-copy theLayer FALSE)) 0)
(gimp-selection-none inImage) (gimp-layer-scale theLayer (- theWidth inSize) (- theHeight inSize) TRUE)
(gimp-image-add-layer theImage (gimp-desaturate theLayer)
(car (gimp-layer-copy theLayer (gimp-brightness-contrast theLayer 127 127)
FALSE (gimp-invert theLayer)
)) (gimp-layer-resize theLayer
0 theWidth
) theHeight
(gimp-layer-scale theLayer (- theWidth inSize) (- theHeight inSize) TRUE) (/ inSize 2)
(gimp-desaturate theLayer) (/ inSize 2))
(gimp-brightness-contrast theLayer 127 127) (plug-in-gauss-rle TRUE
(gimp-invert theLayer) theImage
(gimp-layer-resize theLayer theLayer
theWidth (/ inSize 2)
theHeight TRUE
(/ inSize 2) TRUE)
(/ inSize 2) (gimp-layer-set-opacity theLayer inShadWeight)
) )
(plug-in-gauss-rle TRUE )
theImage (if (= inFlatten TRUE)
theLayer (gimp-image-flatten theImage)
(/ inSize 2) )
TRUE (if (= inCopy TRUE)
TRUE (begin
) (gimp-image-clean-all theImage)
(gimp-layer-set-opacity theLayer inShadWeight) (gimp-display-new theImage)
) )
) )
(if (= inFlatten TRUE) (gimp-displays-flush)
(gimp-image-flatten theImage) )
()
)
(if (= inCopy TRUE)
(begin (gimp-image-clean-all theImage)
(gimp-display-new theImage)
)
()
)
(gimp-displays-flush)
) )
(define (chris-color-edge inImage inLayer inColor inSize) (define (chris-color-edge inImage inLayer inColor inSize)
(gimp-selection-all inImage) (gimp-selection-all inImage)
(gimp-selection-shrink inImage inSize) (gimp-selection-shrink inImage inSize)
(gimp-selection-invert inImage) (gimp-selection-invert inImage)
(gimp-context-set-background inColor) (gimp-context-set-background inColor)
(gimp-edit-fill theLayer BACKGROUND-FILL) (gimp-edit-fill inLayer BACKGROUND-FILL)
(gimp-selection-none inImage) (gimp-selection-none inImage)
) )
(script-fu-register "script-fu-fuzzy-border" ; Register the function with the GIMP:
_"_Fuzzy Border..."
_"Add a jagged, fuzzy border to an image" (script-fu-register
"Chris Gutteridge" "script-fu-fuzzy-border"
"1998, Chris Gutteridge / ECS dept, University of Southampton, England." _"_Fuzzy Border..."
"3rd April 1998" _"Add a jagged, fuzzy border to an image"
"RGB* GRAY*" "Chris Gutteridge"
SF-IMAGE "The image" 0 "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
SF-DRAWABLE "The layer" 0 "3rd April 1998"
SF-COLOR _"Color" '(255 255 255) "RGB* GRAY*"
SF-ADJUSTMENT _"Border size" '(16 1 300 1 10 0 1) SF-IMAGE "The image" 0
SF-TOGGLE _"Blur border" TRUE SF-DRAWABLE "The layer" 0
SF-ADJUSTMENT _"Granularity (1 is Low)" '(4 1 16 0.25 5 2 0) SF-COLOR _"Color" '(255 255 255)
SF-TOGGLE _"Add shadow" FALSE SF-ADJUSTMENT _"Border size" '(16 1 300 1 10 0 1)
SF-ADJUSTMENT _"Shadow weight (%)" '(100 0 100 1 10 0 0) SF-TOGGLE _"Blur border" TRUE
SF-TOGGLE _"Work on copy" TRUE SF-ADJUSTMENT _"Granularity (1 is Low)" '(4 1 16 0.25 5 2 0)
SF-TOGGLE _"Flatten image" TRUE) SF-TOGGLE _"Add shadow" FALSE
SF-ADJUSTMENT _"Shadow weight (%)" '(100 0 100 1 10 0 0)
SF-TOGGLE _"Work on copy" TRUE
SF-TOGGLE _"Flatten image" TRUE
)
(script-fu-menu-register "script-fu-fuzzy-border" (script-fu-menu-register "script-fu-fuzzy-border"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; www.gimp.org web headers ; www.gimp.org web headers
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
@ -12,12 +12,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -37,13 +37,15 @@
; ************************************************************************ ; ************************************************************************
(define (script-fu-headers-gimp-org text font font-size text-color high-color side-color shadow-color crop rm-bg index num-colors) (define (script-fu-headers-gimp-org text font font-size text-color high-color side-color shadow-color crop rm-bg index num-colors)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(text-layer (car (gimp-text-fontname img -1 0 0 (img (car (gimp-image-new 256 256 RGB)))
text 30 TRUE font-size PIXELS (text-layer (car (gimp-text-fontname img -1 0 0
font))) text 30 TRUE font-size PIXELS
(width (car (gimp-drawable-width text-layer))) font)))
(height (car (gimp-drawable-height text-layer))) (width (car (gimp-drawable-width text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))) (height (car (gimp-drawable-height text-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
@ -57,23 +59,25 @@
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-edit-fill bg-layer BACKGROUND-FILL) (gimp-edit-fill bg-layer BACKGROUND-FILL)
(let* ((highlight-layer (car (gimp-layer-copy text-layer TRUE))) (let* (
(side-layer (car (gimp-layer-copy text-layer TRUE))) (highlight-layer (car (gimp-layer-copy text-layer TRUE)))
(shadow-layer (car (gimp-layer-copy text-layer TRUE)))) (side-layer (car (gimp-layer-copy text-layer TRUE)))
(shadow-layer (car (gimp-layer-copy text-layer TRUE)))
)
(gimp-image-add-layer img highlight-layer 1) (gimp-image-add-layer img highlight-layer 1)
(gimp-layer-set-lock-alpha highlight-layer TRUE) (gimp-layer-set-lock-alpha highlight-layer TRUE)
(gimp-image-add-layer img side-layer 1) (gimp-image-add-layer img side-layer 1)
(gimp-layer-set-lock-alpha side-layer TRUE) (gimp-layer-set-lock-alpha side-layer TRUE)
(gimp-image-add-layer img shadow-layer 1) (gimp-image-add-layer img shadow-layer 1)
(gimp-layer-set-lock-alpha shadow-layer TRUE) (gimp-layer-set-lock-alpha shadow-layer TRUE)
(gimp-context-set-background high-color) (gimp-context-set-background high-color)
(gimp-edit-fill highlight-layer BACKGROUND-FILL) (gimp-edit-fill highlight-layer BACKGROUND-FILL)
(gimp-layer-translate highlight-layer -1 -1) (gimp-layer-translate highlight-layer -1 -1)
(gimp-context-set-background side-color) (gimp-context-set-background side-color)
(gimp-edit-fill side-layer BACKGROUND-FILL) (gimp-edit-fill side-layer BACKGROUND-FILL)
(gimp-layer-translate side-layer 1 1) (gimp-layer-translate side-layer 1 1)
@ -81,97 +85,109 @@
(gimp-context-set-background shadow-color) (gimp-context-set-background shadow-color)
(gimp-edit-fill shadow-layer BACKGROUND-FILL) (gimp-edit-fill shadow-layer BACKGROUND-FILL)
(gimp-layer-translate shadow-layer 5 5) (gimp-layer-translate shadow-layer 5 5)
(gimp-layer-set-lock-alpha shadow-layer FALSE) (gimp-layer-set-lock-alpha shadow-layer FALSE)
(plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE) (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
(gimp-layer-set-opacity shadow-layer 60) (gimp-layer-set-opacity shadow-layer 60)
(gimp-image-lower-layer img shadow-layer) (gimp-image-lower-layer img shadow-layer)
(gimp-image-lower-layer img shadow-layer)) (gimp-image-lower-layer img shadow-layer)
)
(set! text-layer (car (gimp-image-flatten img))) (set! text-layer (car (gimp-image-flatten img)))
(gimp-layer-add-alpha text-layer) (gimp-layer-add-alpha text-layer)
(if (= rm-bg TRUE) (if (= rm-bg TRUE)
(begin (begin
(gimp-by-color-select text-layer '(255 255 255) (gimp-by-color-select text-layer '(255 255 255)
1 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE) 1 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
(gimp-edit-clear text-layer) (gimp-edit-clear text-layer)
(gimp-selection-none img))) (gimp-selection-none img)
)
)
(if (= crop TRUE) (if (= crop TRUE)
(plug-in-autocrop 1 img text-layer)) (plug-in-autocrop 1 img text-layer)
)
(if (= index TRUE) (if (= index TRUE)
(gimp-image-convert-indexed img FS-DITHER MAKE-PALETTE num-colors (gimp-image-convert-indexed img FS-DITHER MAKE-PALETTE num-colors
FALSE FALSE "")) FALSE FALSE "")
)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-big-header-gimp-org text font font-size text-color (define (script-fu-big-header-gimp-org text font font-size text-color
high-color side-color shadow-color high-color side-color shadow-color
crop rm-bg index num-colors) crop rm-bg index num-colors)
(script-fu-headers-gimp-org (string-append " " text) (script-fu-headers-gimp-org (string-append " " text)
font font-size font font-size
text-color high-color side-color shadow-color text-color high-color side-color shadow-color
crop rm-bg index num-colors)) crop rm-bg index num-colors)
)
(define (script-fu-small-header-gimp-org text font font-size text-color (define (script-fu-small-header-gimp-org text font font-size text-color
high-color side-color shadow-color high-color side-color shadow-color
crop rm-bg index num-colors) crop rm-bg index num-colors)
(script-fu-headers-gimp-org text font (script-fu-headers-gimp-org text font
font-size text-color high-color font-size text-color high-color
side-color shadow-color side-color shadow-color
crop rm-bg index num-colors)) crop rm-bg index num-colors)
)
(script-fu-register "script-fu-big-header-gimp-org" (script-fu-register "script-fu-big-header-gimp-org"
_"_Big Header..." _"_Big Header..."
_"Create an image of a large header using the Gimp.org webpage theme" _"Create an image of a large header using the gimp.org webpage theme"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"1997" "1997"
"" ""
SF-STRING _"Text" "gimp.org" SF-STRING _"Text" "gimp.org"
SF-FONT _"Font" "Serif" SF-FONT _"Font" "Serif"
SF-ADJUSTMENT _"Font size (pixels)" '(50 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(50 2 1000 1 10 0 1)
SF-COLOR _"Text color" '(82 108 159) SF-COLOR _"Text color" '(82 108 159)
SF-COLOR _"Highlight color" '(190 220 250) SF-COLOR _"Highlight color" '(190 220 250)
SF-COLOR _"Dark color" '(46 74 92) SF-COLOR _"Dark color" '(46 74 92)
SF-COLOR _"Shadow color" "black" SF-COLOR _"Shadow color" '(0 0 0)
SF-TOGGLE _"Autocrop" TRUE SF-TOGGLE _"Autocrop" TRUE
SF-TOGGLE _"Remove background" TRUE SF-TOGGLE _"Remove background" TRUE
SF-TOGGLE _"Index image" TRUE SF-TOGGLE _"Index image" TRUE
SF-ADJUSTMENT _"Number of colors" '(15 2 255 1 10 0 1)) SF-ADJUSTMENT _"Number of colors" '(15 2 255 1 10 0 1)
)
(script-fu-menu-register "script-fu-big-header-gimp-org" (script-fu-menu-register "script-fu-big-header-gimp-org"
"<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org") "<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org")
(script-fu-register "script-fu-small-header-gimp-org" (script-fu-register "script-fu-small-header-gimp-org"
_"_Small Header..." _"_Small Header..."
_"Create an image of a small header using the Gimp.org webpage theme" _"Create an image of a small header using the gimp.org webpage theme"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"1997" "1997"
"" ""
SF-STRING _"Text" "gimp.org" SF-STRING _"Text" "gimp.org"
SF-FONT _"Font" "Sans" SF-FONT _"Font" "Sans"
SF-ADJUSTMENT _"Font size (pixels)" '(24 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(24 2 1000 1 10 0 1)
SF-COLOR _"Text color" '(135 220 220) SF-COLOR _"Text color" '(135 220 220)
SF-COLOR _"Highlight color" '(210 240 245) SF-COLOR _"Highlight color" '(210 240 245)
SF-COLOR _"Dark color" '(46 74 92) SF-COLOR _"Dark color" '(46 74 92)
SF-COLOR _"Shadow color" "black" SF-COLOR _"Shadow color" '(0 0 0)
SF-TOGGLE _"Autocrop" TRUE SF-TOGGLE _"Autocrop" TRUE
SF-TOGGLE _"Remove background" TRUE SF-TOGGLE _"Remove background" TRUE
SF-TOGGLE _"Index image" TRUE SF-TOGGLE _"Index image" TRUE
SF-ADJUSTMENT _"Number of colors" '(15 2 255 1 10 0 1) SF-ADJUSTMENT _"Number of colors" '(15 2 255 1 10 0 1)
SF-ADJUSTMENT _"Select-by-color threshold" '(1 1 256 1 10 0 1)) SF-ADJUSTMENT _"Select-by-color threshold" '(1 1 256 1 10 0 1)
)
(script-fu-menu-register "script-fu-small-header-gimp-org" (script-fu-menu-register "script-fu-small-header-gimp-org"
"<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org") "<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; www.gimp.org web labels ; www.gimp.org web labels
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
@ -12,12 +12,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -37,24 +37,28 @@
; ************************************************************************ ; ************************************************************************
(define (script-fu-labels-gimp-org text font font-size text-color shadow-color bg-color rm-bg index num-colors color-thresh yoff xoff height) (define (script-fu-labels-gimp-org text font font-size text-color
(let* ((img (car (gimp-image-new 125 height RGB))) shadow-color bg-color rm-bg index
(text-layer (car (gimp-text-fontname img -1 xoff yoff text 0 num-colors color-thresh yoff xoff height)
TRUE font-size PIXELS (let* (
font))) (img (car (gimp-image-new 125 height RGB)))
(bg-layer (car (gimp-layer-new img 125 height (text-layer (car (gimp-text-fontname img -1 xoff yoff text 0
RGB-IMAGE "Background" 100 NORMAL-MODE))) TRUE font-size PIXELS
(shadow-layer (car (gimp-layer-copy text-layer TRUE)))) font)))
(bg-layer (car (gimp-layer-new img 125 height
RGB-IMAGE "Background" 100 NORMAL-MODE)))
(shadow-layer (car (gimp-layer-copy text-layer TRUE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-add-layer img shadow-layer 1) (gimp-image-add-layer img shadow-layer 1)
(gimp-image-add-layer img bg-layer 2) (gimp-image-add-layer img bg-layer 2)
(gimp-layer-set-lock-alpha text-layer TRUE) (gimp-layer-set-lock-alpha text-layer TRUE)
(gimp-layer-set-lock-alpha shadow-layer TRUE) (gimp-layer-set-lock-alpha shadow-layer TRUE)
(gimp-context-set-background text-color) (gimp-context-set-background text-color)
(gimp-edit-fill text-layer BACKGROUND-FILL) (gimp-edit-fill text-layer BACKGROUND-FILL)
@ -69,19 +73,22 @@
(gimp-layer-add-alpha text-layer) (gimp-layer-add-alpha text-layer)
(if (= rm-bg TRUE) (if (= rm-bg TRUE)
(begin (begin
(gimp-by-color-select text-layer bg-color (gimp-by-color-select text-layer bg-color
color-thresh CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE) color-thresh CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
(gimp-edit-clear text-layer) (gimp-edit-clear text-layer)
(gimp-selection-none img))) (gimp-selection-none img)))
(if (= index TRUE) (if (= index TRUE)
(gimp-image-convert-indexed img FS-DITHER MAKE-PALETTE num-colors (gimp-image-convert-indexed img FS-DITHER MAKE-PALETTE num-colors
FALSE FALSE "")) FALSE FALSE ""))
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
;;;(define (script-fu-tube-button-label-gimp-org text rm-bg index) ;;;(define (script-fu-tube-button-label-gimp-org text rm-bg index)
@ -89,86 +96,90 @@
;;; ;;;
;;;(define (script-fu-tube-subbutton-label-gimp-org text rm-bg index) ;;;(define (script-fu-tube-subbutton-label-gimp-org text rm-bg index)
;;; (script-fu-labels-gimp-org text "nimbus sans" 12 "medium" "r" "normal" '(151 177 192) '(0 0 0) '(255 255 255) rm-bg index 15 1 7 0 24)) ;;; (script-fu-labels-gimp-org text "nimbus sans" 12 "medium" "r" "normal" '(151 177 192) '(0 0 0) '(255 255 255) rm-bg index 15 1 7 0 24))
;;; ;;;
;;;(define (script-fu-tube-subsubbutton-label-gimp-org text rm-bg index) ;;;(define (script-fu-tube-subsubbutton-label-gimp-org text rm-bg index)
;;; (script-fu-labels-gimp-org text "nimbus sans" 10 "medium" "r" "normal" '(151 177 192) '(0 0 0) '(255 255 255) rm-bg index 15 1 6 0 18)) ;;; (script-fu-labels-gimp-org text "nimbus sans" 10 "medium" "r" "normal" '(151 177 192) '(0 0 0) '(255 255 255) rm-bg index 15 1 6 0 18))
;;; ;;;
(define (script-fu-tube-button-label-gimp-org text rm-bg index) (define (script-fu-tube-button-label-gimp-org text rm-bg index)
(script-fu-labels-gimp-org text "helvetica" 14 '(86 114 172) '(255 255 255) '(255 255 255) rm-bg index 15 1 8 0 30)) (script-fu-labels-gimp-org text "helvetica" 14 '(86 114 172) '(255 255 255) '(255 255 255) rm-bg index 15 1 8 0 30)
)
(define (script-fu-tube-subbutton-label-gimp-org text rm-bg index) (define (script-fu-tube-subbutton-label-gimp-org text rm-bg index)
(script-fu-labels-gimp-org text "helvetica" 12 '(86 114 172) '(255 255 255) '(255 255 255) rm-bg index 15 1 7 10 24)) (script-fu-labels-gimp-org text "helvetica" 12 '(86 114 172) '(255 255 255) '(255 255 255) rm-bg index 15 1 7 10 24)
)
(define (script-fu-tube-subsubbutton-label-gimp-org text rm-bg index) (define (script-fu-tube-subsubbutton-label-gimp-org text rm-bg index)
(script-fu-labels-gimp-org text "helvetica" 10 '(86 114 172) '(255 255 255) '(255 255 255) rm-bg index 15 1 6 20 18)) (script-fu-labels-gimp-org text "helvetica" 10 '(86 114 172) '(255 255 255) '(255 255 255) rm-bg index 15 1 6 20 18)
)
(script-fu-register "script-fu-tube-button-label-gimp-org" (script-fu-register "script-fu-tube-button-label-gimp-org"
_"_Tube Button Label..." _"_Tube Button Label..."
_"Create an image of a Tube Button Label using the gimp.org webpage theme" _"Create an image of a Tube Button Label using the gimp.org webpage theme"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"1997" "1997"
"" ""
SF-STRING _"Text" "?" SF-STRING _"Text" "?"
SF-TOGGLE _"Remove background" TRUE SF-TOGGLE _"Remove background" TRUE
SF-TOGGLE _"Index image" TRUE) SF-TOGGLE _"Index image" TRUE
)
(script-fu-menu-register "script-fu-tube-button-label-gimp-org" (script-fu-menu-register "script-fu-tube-button-label-gimp-org"
"<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org") "<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org")
(script-fu-register "script-fu-tube-subbutton-label-gimp-org" (script-fu-register "script-fu-tube-subbutton-label-gimp-org"
_"T_ube Sub-Button Label..." _"T_ube Sub-Button Label..."
_"Create an image of a Tube Button Label using the gimp.org webpage theme" _"Create an image of a second level Tube Button Label using the gimp.org webpage theme"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"1997" "1997"
"" ""
SF-STRING _"Text" "?" SF-STRING _"Text" "?"
SF-TOGGLE _"Remove background" TRUE SF-TOGGLE _"Remove background" TRUE
SF-TOGGLE _"Index image" TRUE) SF-TOGGLE _"Index image" TRUE
)
(script-fu-menu-register "script-fu-tube-subbutton-label-gimp-org" (script-fu-menu-register "script-fu-tube-subbutton-label-gimp-org"
"<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org") "<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org")
(script-fu-register "script-fu-tube-subsubbutton-label-gimp-org" (script-fu-register "script-fu-tube-subsubbutton-label-gimp-org"
_"Tub_e Sub-Sub-Button Label..." _"Tub_e Sub-Sub-Button Label..."
_"Create an image of a Tube Button Label using the gimp.org webpage theme" _"Create an image of a third level Tube Button Label using the gimp.org webpage theme"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"1997" "1997"
"" ""
SF-STRING _"Text" "?" SF-STRING _"Text" "?"
SF-TOGGLE _"Remove background" TRUE SF-TOGGLE _"Remove background" TRUE
SF-TOGGLE _"Index image" TRUE) SF-TOGGLE _"Index image" TRUE
)
(script-fu-menu-register "script-fu-tube-subsubbutton-label-gimp-org" (script-fu-menu-register "script-fu-tube-subsubbutton-label-gimp-org"
"<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org") "<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org")
(script-fu-register "script-fu-labels-gimp-org" (script-fu-register "script-fu-labels-gimp-org"
_"_General Tube Labels..." _"_General Tube Labels..."
_"Create an image of a Tube Button Label Header using the gimp.org webpage theme" _"Create an image of a Tube Button Label Header using the gimp.org webpage theme"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"Adrian Likins & Jens Lautenbacher" "Adrian Likins & Jens Lautenbacher"
"1997" "1997"
"" ""
SF-STRING _"Text" "Gimp.Org" SF-STRING _"Text" " Gimp.Org"
SF-FONT _"Font" "Sans" SF-FONT _"Font" "Sans"
SF-ADJUSTMENT _"Font size (pixels)" '(18 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(18 2 1000 1 10 0 1)
SF-COLOR _"Text color" '(130 165 235) SF-COLOR _"Text color" '(130 165 235)
SF-COLOR _"Shadow color" "black" SF-COLOR _"Shadow color" '(0 0 0)
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-TOGGLE _"Remove background" TRUE SF-TOGGLE _"Remove background" TRUE
SF-TOGGLE _"Index image" TRUE SF-TOGGLE _"Index image" TRUE
SF-ADJUSTMENT _"Number of colors" '(15 2 255 1 10 0 1) SF-ADJUSTMENT _"Number of colors" '(15 2 255 1 10 0 1)
SF-ADJUSTMENT _"Select-by-color threshold" '(1 1 256 1 10 0 1) SF-ADJUSTMENT _"Select-by-color threshold" '(1 1 256 1 10 0 1)
SF-ADJUSTMENT _"Offset X" '(8 0 50 1 10 0 1) SF-ADJUSTMENT _"Offset X" '(8 0 50 1 10 0 1)
SF-ADJUSTMENT _"Offset Y" '(0 0 50 1 10 0 1) SF-ADJUSTMENT _"Offset Y" '(0 0 50 1 10 0 1)
SF-ADJUSTMENT _"Height" '(30 2 1000 1 10 0 1)) SF-ADJUSTMENT _"Height" '(30 2 1000 1 10 0 1)
)
(script-fu-menu-register "script-fu-labels-gimp-org" (script-fu-menu-register "script-fu-labels-gimp-org"
"<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org") "<Toolbox>/Xtns/Web Page Themes/Classic.Gimp.Org")

View File

@ -23,30 +23,32 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (apply-glossy-logo-effect img (define (apply-glossy-logo-effect img
logo-layer logo-layer
blend-gradient-text blend-gradient-text
blend-gradient-text-reverse blend-gradient-text-reverse
blend-gradient-outline blend-gradient-outline
blend-gradient-outline-reverse blend-gradient-outline-reverse
grow-size grow-size
bg-color bg-color
use-pattern-text use-pattern-text
pattern-text pattern-text
use-pattern-outline use-pattern-outline
pattern-outline pattern-outline
use-pattern-overlay use-pattern-overlay
pattern-overlay pattern-overlay
noninteractive noninteractive
shadow-toggle shadow-toggle
s-offset-x s-offset-x
s-offset-y) s-offset-y)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* (
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(posx (- (car (gimp-drawable-offsets logo-layer)))) (height (car (gimp-drawable-height logo-layer)))
(posy (- (cadr (gimp-drawable-offsets logo-layer)))) (posx (- (car (gimp-drawable-offsets logo-layer))))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (posy (- (cadr (gimp-drawable-offsets logo-layer))))
(grow-me (car (gimp-layer-copy logo-layer TRUE))) (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(dont-drop-me)) (grow-me (car (gimp-layer-copy logo-layer TRUE)))
(dont-drop-me)
)
(gimp-context-push) (gimp-context-push)
@ -70,18 +72,22 @@
(if (= use-pattern-text TRUE) (if (= use-pattern-text TRUE)
(begin (begin
(gimp-context-set-pattern pattern-text) (gimp-context-set-pattern pattern-text)
(gimp-edit-bucket-fill logo-layer (gimp-edit-bucket-fill logo-layer PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0))) (gimp-context-set-pattern old-patterns)
)
)
(if (= use-pattern-text FALSE) (if (= use-pattern-text FALSE)
(begin (begin
(gimp-context-set-gradient blend-gradient-text) (gimp-context-set-gradient blend-gradient-text)
(gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE GRADIENT-LINEAR 100 0 REPEAT-NONE
blend-gradient-text-reverse blend-gradient-text-reverse
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 0 (+ height 5)))) 0 0 0 (+ height 5))
)
)
(gimp-selection-none img) (gimp-selection-none img)
@ -96,174 +102,189 @@
(if (= use-pattern-outline TRUE) (if (= use-pattern-outline TRUE)
(begin (begin
(gimp-context-set-pattern pattern-outline) (gimp-context-set-pattern pattern-outline)
(gimp-edit-bucket-fill grow-me (gimp-edit-bucket-fill grow-me PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
PATTERN-BUCKET-FILL NORMAL-MODE 100 (gimp-context-set-pattern old-patterns)
0 FALSE 0 0))) )
)
(if (= use-pattern-outline FALSE) (if (= use-pattern-outline FALSE)
(begin (begin
(gimp-context-set-gradient blend-gradient-outline) (gimp-context-set-gradient blend-gradient-outline)
(gimp-edit-blend grow-me CUSTOM-MODE NORMAL-MODE (gimp-edit-blend grow-me CUSTOM-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE GRADIENT-LINEAR 100 0 REPEAT-NONE
blend-gradient-outline-reverse blend-gradient-outline-reverse
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 0 (+ height 5)))) 0 0 0 (+ height 5))
)
)
(gimp-selection-none img) (gimp-selection-none img)
(plug-in-bump-map noninteractive img grow-me logo-layer (plug-in-bump-map RUN-NONINTERACTIVE img grow-me logo-layer 110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
(gimp-layer-set-mode logo-layer SCREEN-MODE) (gimp-layer-set-mode logo-layer SCREEN-MODE)
(if (= use-pattern-overlay TRUE) (if (= use-pattern-overlay TRUE)
(begin (begin
(gimp-selection-layer-alpha grow-me) (gimp-selection-layer-alpha grow-me)
(gimp-context-set-pattern pattern-overlay) (gimp-context-set-pattern pattern-overlay)
(gimp-edit-bucket-fill grow-me PATTERN-BUCKET-FILL (gimp-edit-bucket-fill grow-me PATTERN-BUCKET-FILL OVERLAY-MODE 100 0 FALSE 0 0)
OVERLAY-MODE 100 0 FALSE 0 0) (gimp-context-set-pattern old-patterns)
(gimp-selection-none img))) (gimp-selection-none img)
)
)
(if (= shadow-toggle TRUE) (if (= shadow-toggle TRUE)
(begin (begin
(gimp-selection-layer-alpha logo-layer) (gimp-selection-layer-alpha logo-layer)
(set! dont-drop-me (car (script-fu-drop-shadow img logo-layer (set! dont-drop-me (car (script-fu-drop-shadow img logo-layer s-offset-x s-offset-y 15 '(0 0 0) 80 TRUE)))
s-offset-x s-offset-y
15 '(0 0 0) 80 TRUE)))
(set! width (car (gimp-image-width img))) (set! width (car (gimp-image-width img)))
(set! height (car (gimp-image-height img))) (set! height (car (gimp-image-height img)))
(gimp-selection-none img))) (gimp-selection-none img)
)
)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-glossy-logo-alpha img (define (script-fu-glossy-logo-alpha img
logo-layer logo-layer
blend-gradient-text blend-gradient-text
blend-gradient-text-reverse blend-gradient-text-reverse
blend-gradient-outline blend-gradient-outline
blend-gradient-outline-reverse blend-gradient-outline-reverse
grow-size grow-size
bg-color bg-color
use-pattern-text use-pattern-text
pattern-text pattern-text
use-pattern-outline use-pattern-outline
pattern-outline pattern-outline
use-pattern-overlay use-pattern-overlay
pattern-overlay pattern-overlay
noninteractive noninteractive
shadow-toggle shadow-toggle
s-offset-x s-offset-x
s-offset-y) s-offset-y)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-glossy-logo-effect img logo-layer (apply-glossy-logo-effect img logo-layer
blend-gradient-text blend-gradient-text
blend-gradient-text-reverse blend-gradient-text-reverse
blend-gradient-outline blend-gradient-outline
blend-gradient-outline-reverse blend-gradient-outline-reverse
grow-size bg-color grow-size bg-color
use-pattern-text pattern-text use-pattern-text pattern-text
use-pattern-outline pattern-outline use-pattern-outline pattern-outline
use-pattern-overlay pattern-overlay use-pattern-overlay pattern-overlay
noninteractive shadow-toggle noninteractive shadow-toggle
s-offset-x s-offset-y) s-offset-x s-offset-y)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-glossy-logo-alpha" (script-fu-register "script-fu-glossy-logo-alpha"
_"Glo_ssy..." _"Glo_ssy..."
_"Add gradients, patterns, shadows, and bump maps to the selected region (or alpha)" _"Add gradients, patterns, shadows, and bump maps to the selected region (or alpha)"
"Hrvoje Horvat (hhorvat@open.hr)" "Hrvoje Horvat (hhorvat@open.hr)"
"Hrvoje Horvat" "Hrvoje Horvat"
"14/04/1998" "14/04/1998"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-GRADIENT _"Blend gradient (text)" "Shadows 2" SF-GRADIENT _"Blend gradient (text)" "Shadows 2"
SF-TOGGLE _"Text gradient reverse" FALSE SF-TOGGLE _"Text gradient reverse" FALSE
SF-GRADIENT _"Blend gradient (outline)" "Shadows 2" SF-GRADIENT _"Blend gradient (outline)" "Shadows 2"
SF-TOGGLE _"Outline gradient reverse" FALSE SF-TOGGLE _"Outline gradient reverse" FALSE
SF-ADJUSTMENT _"Outline size" '(5 0 250 1 10 0 1) SF-ADJUSTMENT _"Outline size" '(5 0 250 1 10 0 1)
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-TOGGLE _"Use pattern for text instead of gradient" FALSE SF-TOGGLE _"Use pattern for text instead of gradient" FALSE
SF-PATTERN _"Pattern (text)" "Electric Blue" SF-PATTERN _"Pattern (text)" "Electric Blue"
SF-TOGGLE _"Use pattern for outline instead of gradient" FALSE SF-TOGGLE _"Use pattern for outline instead of gradient" FALSE
SF-PATTERN _"Pattern (outline)" "Electric Blue" SF-PATTERN _"Pattern (outline)" "Electric Blue"
SF-TOGGLE _"Use pattern overlay" FALSE SF-TOGGLE _"Use pattern overlay" FALSE
SF-PATTERN _"Pattern (overlay)" "Parque #1" SF-PATTERN _"Pattern (overlay)" "Parque #1"
SF-TOGGLE _"Default bumpmap settings" TRUE SF-TOGGLE _"Default bumpmap settings" TRUE
SF-TOGGLE _"Shadow" TRUE SF-TOGGLE _"Shadow" TRUE
SF-ADJUSTMENT _"Shadow X offset" '(8 0 100 1 10 0 1) SF-ADJUSTMENT _"Shadow X offset" '(8 0 100 1 10 0 1)
SF-ADJUSTMENT _"Shadow Y offset" '(8 0 100 1 10 0 1)) SF-ADJUSTMENT _"Shadow Y offset" '(8 0 100 1 10 0 1)
)
(script-fu-menu-register "script-fu-glossy-logo-alpha" (script-fu-menu-register "script-fu-glossy-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-glossy-logo text (define (script-fu-glossy-logo text
size size
font font
blend-gradient-text blend-gradient-text
blend-gradient-text-reverse blend-gradient-text-reverse
blend-gradient-outline blend-gradient-outline
blend-gradient-outline-reverse blend-gradient-outline-reverse
grow-size grow-size
bg-color bg-color
use-pattern-text use-pattern-text
pattern-text pattern-text
use-pattern-outline use-pattern-outline
pattern-outline pattern-outline
use-pattern-overlay use-pattern-overlay
pattern-overlay pattern-overlay
noninteractive noninteractive
shadow-toggle shadow-toggle
s-offset-x s-offset-x
s-offset-y) s-offset-y)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-glossy-logo-effect img text-layer (apply-glossy-logo-effect img text-layer
blend-gradient-text blend-gradient-text
blend-gradient-text-reverse blend-gradient-text-reverse
blend-gradient-outline blend-gradient-outline
blend-gradient-outline-reverse blend-gradient-outline-reverse
grow-size bg-color grow-size bg-color
use-pattern-text pattern-text use-pattern-text pattern-text
use-pattern-outline pattern-outline use-pattern-outline pattern-outline
use-pattern-overlay pattern-overlay use-pattern-overlay pattern-overlay
noninteractive shadow-toggle noninteractive shadow-toggle
s-offset-x s-offset-y) s-offset-x s-offset-y)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-glossy-logo" (script-fu-register "script-fu-glossy-logo"
_"Glo_ssy..." _"Glo_ssy..."
_"Create a logo with gradients, patterns, shadows, and bump maps" _"Create a logo with gradients, patterns, shadows, and bump maps"
"Hrvoje Horvat (hhorvat@open.hr)" "Hrvoje Horvat (hhorvat@open.hr)"
"Hrvoje Horvat" "Hrvoje Horvat"
"14/04/1998" "14/04/1998"
"" ""
SF-STRING _"Text" "Galaxy" SF-STRING _"Text" "Galaxy"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Eras" SF-FONT _"Font" "Eras"
SF-GRADIENT _"Blend gradient (text)" "Shadows 2" SF-GRADIENT _"Blend gradient (text)" "Shadows 2"
SF-TOGGLE _"Text gradient reverse" FALSE SF-TOGGLE _"Text gradient reverse" FALSE
SF-GRADIENT _"Blend gradient (outline)" "Shadows 2" SF-GRADIENT _"Blend gradient (outline)" "Shadows 2"
SF-TOGGLE _"Outline gradient reverse" FALSE SF-TOGGLE _"Outline gradient reverse" FALSE
SF-ADJUSTMENT _"Outline size" '(5 0 250 1 10 0 1) SF-ADJUSTMENT _"Outline size" '(5 0 250 1 10 0 1)
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-TOGGLE _"Use pattern for text instead of gradient" FALSE SF-TOGGLE _"Use pattern for text instead of gradient" FALSE
SF-PATTERN _"Pattern (text)" "Electric Blue" SF-PATTERN _"Pattern (text)" "Electric Blue"
SF-TOGGLE _"Use pattern for outline instead of gradient" FALSE SF-TOGGLE _"Use pattern for outline instead of gradient" FALSE
SF-PATTERN _"Pattern (outline)" "Electric Blue" SF-PATTERN _"Pattern (outline)" "Electric Blue"
SF-TOGGLE _"Use pattern overlay" FALSE SF-TOGGLE _"Use pattern overlay" FALSE
SF-PATTERN _"Pattern (overlay)" "Parque #1" SF-PATTERN _"Pattern (overlay)" "Parque #1"
SF-TOGGLE _"Default bumpmap settings" TRUE SF-TOGGLE _"Default bumpmap settings" TRUE
SF-TOGGLE _"Shadow" TRUE SF-TOGGLE _"Shadow" TRUE
SF-ADJUSTMENT _"Shadow X offset" '(8 0 100 1 10 0 1) SF-ADJUSTMENT _"Shadow X offset" '(8 0 100 1 10 0 1)
SF-ADJUSTMENT _"Shadow Y offset" '(8 0 100 1 10 0 1)) SF-ADJUSTMENT _"Shadow Y offset" '(8 0 100 1 10 0 1)
)
(script-fu-menu-register "script-fu-glossy-logo" (script-fu-menu-register "script-fu-glossy-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -2,19 +2,21 @@
; Create a text effect that simulates a glowing hot logo ; Create a text effect that simulates a glowing hot logo
(define (apply-glowing-logo-effect img (define (apply-glowing-logo-effect img
logo-layer logo-layer
size size
bg-color) bg-color)
(let* ((grow (/ size 4)) (let* (
(feather1 (/ size 3)) (grow (/ size 4))
(feather2 (/ size 7)) (feather1 (/ size 3))
(feather3 (/ size 10)) (feather2 (/ size 7))
(width (car (gimp-drawable-width logo-layer))) (feather3 (/ size 10))
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(posx (- (car (gimp-drawable-offsets logo-layer)))) (height (car (gimp-drawable-height logo-layer)))
(posy (- (cadr (gimp-drawable-offsets logo-layer)))) (posx (- (car (gimp-drawable-offsets logo-layer))))
(glow-layer (car (gimp-layer-copy logo-layer TRUE))) (posy (- (cadr (gimp-drawable-offsets logo-layer))))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))) (glow-layer (car (gimp-layer-copy logo-layer TRUE)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
@ -53,58 +55,67 @@
(gimp-layer-set-mode logo-layer OVERLAY-MODE) (gimp-layer-set-mode logo-layer OVERLAY-MODE)
(gimp-drawable-set-name glow-layer "Glow Layer") (gimp-drawable-set-name glow-layer "Glow Layer")
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-glowing-logo-alpha img (define (script-fu-glowing-logo-alpha img
logo-layer logo-layer
size size
bg-color) bg-color)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-glowing-logo-effect img logo-layer size bg-color) (apply-glowing-logo-effect img logo-layer size bg-color)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-glowing-logo-alpha" (script-fu-register "script-fu-glowing-logo-alpha"
_"Glo_wing Hot..." _"Glo_wing Hot..."
_"Add a glowing hot metal effect to the selected region (or alpha)" _"Add a glowing hot metal effect to the selected region (or alpha)"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Effect size (pixels * 3)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Effect size (pixels * 3)" '(150 2 1000 1 10 0 1)
SF-COLOR _"Background color" '(7 0 20)) SF-COLOR _"Background color" '(7 0 20)
)
(script-fu-menu-register "script-fu-glowing-logo-alpha" (script-fu-menu-register "script-fu-glowing-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-glowing-logo text (define (script-fu-glowing-logo text
size size
font font
bg-color) bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(border (/ size 4)) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))) (border (/ size 4))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-glowing-logo-effect img text-layer size bg-color) (apply-glowing-logo-effect img text-layer size bg-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-glowing-logo" (script-fu-register "script-fu-glowing-logo"
_"Glo_wing Hot..." _"Glo_wing Hot..."
_"Create a logo that looks like glowing hot metal" _"Create a logo that looks like glowing hot metal"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"" ""
SF-STRING _"Text" "GLOWING" SF-STRING _"Text" "GLOWING"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Slogan" SF-FONT _"Font" "Slogan"
SF-COLOR _"Background color" '(7 0 20)) SF-COLOR _"Background color" '(7 0 20)
)
(script-fu-menu-register "script-fu-glowing-logo" (script-fu-menu-register "script-fu-glowing-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -20,17 +20,19 @@
; Create cool glossy bevelly text ; Create cool glossy bevelly text
(define (apply-gradient-bevel-logo-effect img (define (apply-gradient-bevel-logo-effect img
logo-layer logo-layer
b-size b-size
bevel-height bevel-height
bevel-width bevel-width
bg-color) bg-color)
(let* ((width (car (gimp-drawable-width logo-layer))) (let* (
(height (car (gimp-drawable-height logo-layer))) (width (car (gimp-drawable-width logo-layer)))
(indentX (+ b-size 12)) (height (car (gimp-drawable-height logo-layer)))
(indentY (+ b-size (/ height 8))) (indentX (+ b-size 12))
(bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE))) (indentY (+ b-size (/ height 8)))
(blur-layer (car (gimp-layer-new img width height RGBA-IMAGE "Blur" 100 NORMAL-MODE)))) (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
(blur-layer (car (gimp-layer-new img width height RGBA-IMAGE "Blur" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
@ -60,9 +62,9 @@
(gimp-selection-all img) (gimp-selection-all img)
(gimp-edit-blend logo-layer FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend logo-layer FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-RADIAL 95 0 REPEAT-NONE FALSE GRADIENT-RADIAL 95 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
indentX indentY indentX (- height indentY)) indentX indentY indentX (- height indentY))
(gimp-selection-none img) (gimp-selection-none img)
(gimp-layer-set-lock-alpha logo-layer FALSE) (gimp-layer-set-lock-alpha logo-layer FALSE)
@ -72,68 +74,75 @@
(gimp-layer-set-opacity blur-layer 50.0) (gimp-layer-set-opacity blur-layer 50.0)
(gimp-image-set-active-layer img logo-layer) (gimp-image-set-active-layer img logo-layer)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-gradient-bevel-logo-alpha img (define (script-fu-gradient-bevel-logo-alpha img
logo-layer logo-layer
b-size b-size
bevel-height bevel-height
bevel-width bevel-width
bg-color) bg-color)
(begin (gimp-image-undo-group-start img)
(gimp-image-undo-group-start img) (apply-gradient-bevel-logo-effect img logo-layer b-size
(apply-gradient-bevel-logo-effect img logo-layer b-size bevel-height bevel-width bg-color)
bevel-height bevel-width bg-color) (gimp-image-undo-group-end img)
(gimp-image-undo-group-end img) (gimp-displays-flush)
(gimp-displays-flush))) )
(script-fu-register "script-fu-gradient-bevel-logo-alpha" (script-fu-register "script-fu-gradient-bevel-logo-alpha"
_"Gradient Beve_l..." _"Gradient Beve_l..."
_"Add a shiny look and bevel effect to the selected region (or alpha)" _"Add a shiny look and bevel effect to the selected region (or alpha)"
"Brian McFee <keebler@wco.com>" "Brian McFee <keebler@wco.com>"
"Brian McFee" "Brian McFee"
"April 1998" "April 1998"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Border size (pixels)" '(22 1 300 1 10 0 1) SF-ADJUSTMENT _"Border size (pixels)" '(22 1 300 1 10 0 1)
SF-ADJUSTMENT _"Bevel height (sharpness)" '(40 1 250 1 10 0 1) SF-ADJUSTMENT _"Bevel height (sharpness)" '(40 1 250 1 10 0 1)
SF-ADJUSTMENT _"Bevel width" '(2.5 1 200 1 10 1 1) SF-ADJUSTMENT _"Bevel width" '(2.5 1 200 1 10 1 1)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-gradient-bevel-logo-alpha" (script-fu-menu-register "script-fu-gradient-bevel-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-gradient-bevel-logo text (define (script-fu-gradient-bevel-logo text
size size
font font
bevel-height bevel-height
bevel-width bevel-width
bg-color) bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(border (/ size 4)) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text (border (/ size 4))
border TRUE size PIXELS font)))) (text-layer (car (gimp-text-fontname img -1 0 0 text
border TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-gradient-bevel-logo-effect img text-layer border (apply-gradient-bevel-logo-effect img text-layer border
bevel-height bevel-width bg-color) bevel-height bevel-width bg-color)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-gradient-bevel-logo" (script-fu-register "script-fu-gradient-bevel-logo"
_"Gradient Beve_l..." _"Gradient Beve_l..."
_"Create a logo with a shiny look and bevelled edges" _"Create a logo with a shiny look and beveled edges"
"Brian McFee <keebler@wco.com>" "Brian McFee <keebler@wco.com>"
"Brian McFee" "Brian McFee"
"April 1998" "April 1998"
"" ""
SF-STRING _"Text" "Moo" SF-STRING _"Text" "Moo"
SF-ADJUSTMENT _"Font size (pixels)" '(90 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(90 2 1000 1 10 0 1)
SF-FONT _"Font" "Sans Bold" SF-FONT _"Font" "Sans Bold"
SF-ADJUSTMENT _"Bevel height (sharpness)" '(40 1 250 1 10 0 1) SF-ADJUSTMENT _"Bevel height (sharpness)" '(40 1 250 1 10 0 1)
SF-ADJUSTMENT _"Bevel width" '(2.5 1 200 1 10 1 1) SF-ADJUSTMENT _"Bevel width" '(2.5 1 200 1 10 1 1)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-gradient-bevel-logo" (script-fu-menu-register "script-fu-gradient-bevel-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -20,16 +20,18 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-gradient-example width (define (script-fu-gradient-example width
height height
gradient-reverse) gradient-reverse)
(let* ((img (car (gimp-image-new width height RGB))) (let* (
(drawable (car (gimp-layer-new img width height RGB (img (car (gimp-image-new width height RGB)))
"Gradient example" 100 NORMAL-MODE))) (drawable (car (gimp-layer-new img width height RGB
"Gradient example" 100 NORMAL-MODE)))
; Calculate colors for checkerboard... just like in the gradient editor ; Calculate colors for checkerboard... just like in the gradient editor
(fg-color (* 255 (/ 2 3))) (fg-color (* 255 (/ 2 3)))
(bg-color (* 255 (/ 1 3)))) (bg-color (* 255 (/ 1 3)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-add-layer img drawable 0) (gimp-image-add-layer img drawable 0)
@ -47,24 +49,28 @@
; Render gradient ; Render gradient
(gimp-edit-blend drawable CUSTOM-MODE NORMAL-MODE (gimp-edit-blend drawable CUSTOM-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 (- width 1) 0) 0 0 (- width 1) 0)
; Terminate ; Terminate
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-gradient-example" (script-fu-register "script-fu-gradient-example"
_"Custom _Gradient..." _"Custom _Gradient..."
_"Create an image filled with an example of the current gradient" _"Create an image filled with an example of the current gradient"
"Federico Mena Quintero" "Federico Mena Quintero"
"Federico Mena Quintero" "Federico Mena Quintero"
"June 1997" "June 1997"
"" ""
SF-ADJUSTMENT _"Width" '(400 1 2000 1 10 0 1) SF-ADJUSTMENT _"Width" '(400 1 2000 1 10 0 1)
SF-ADJUSTMENT _"Height" '(30 1 2000 1 10 0 1) SF-ADJUSTMENT _"Height" '(30 1 2000 1 10 0 1)
SF-TOGGLE _"Gradient reverse" FALSE) SF-TOGGLE _"Gradient reverse" FALSE
)
(script-fu-menu-register "script-fu-gradient-example" (script-fu-menu-register "script-fu-gradient-example"
"<Gradients>") "<Gradients>")

View File

@ -6,9 +6,9 @@
;;; Version 0.6 ;;; Version 0.6
;;; Code: ;;; Code:
(if (not (symbol-bound? 'script-fu-grid-system-x-divides (the-environment))) (if (not (symbol-bound? 'script-fu-grid-system-x-divides (current-environment)))
(define script-fu-grid-system-x-divides "'(1 g 1)")) (define script-fu-grid-system-x-divides "'(1 g 1)"))
(if (not (symbol-bound? 'script-fu-grid-system-y-divides (the-environment))) (if (not (symbol-bound? 'script-fu-grid-system-y-divides (current-environment)))
(define script-fu-grid-system-y-divides "'(1 g 1)")) (define script-fu-grid-system-y-divides "'(1 g 1)"))
(define (script-fu-grid-system img drw x-divides-orig y-divides-orig) (define (script-fu-grid-system img drw x-divides-orig y-divides-orig)
@ -32,9 +32,7 @@
(cond ((number? obj) (string-append (number->string obj) " ")) (cond ((number? obj) (string-append (number->string obj) " "))
((eq? obj 'g) "g ") ((eq? obj 'g) "g ")
(eq? obj '1/g) "1/g ")) (eq? obj '1/g) "1/g "))
(string-append "'(" (string-append "'(" (apply string-append (map wrap-object l)) ")"))
(apply string-append (map wrap-object l))
")"))
(let* ((drw-width (car (gimp-drawable-width drw))) (let* ((drw-width (car (gimp-drawable-width drw)))
(drw-height (car (gimp-drawable-height drw))) (drw-height (car (gimp-drawable-height drw)))
(drw-offset-x (nth 0 (gimp-drawable-offsets drw))) (drw-offset-x (nth 0 (gimp-drawable-offsets drw)))
@ -45,12 +43,13 @@
(stepped-y 0) (stepped-y 0)
(temp 0) (temp 0)
(total-step-x 0) (total-step-x 0)
(total-step-y 0)) (total-step-y 0)
(set! x-divides (convert-g x-divides-orig)) (x-divides (convert-g x-divides-orig))
(set! y-divides (convert-g y-divides-orig)) (y-divides (convert-g y-divides-orig))
(set! total-step-x (apply + x-divides)) (total-step-x (apply + x-divides))
(set! total-step-y (apply + y-divides)) (total-step-y (apply + y-divides)))
(gimp-context-push)
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(set! grid-layer (car (gimp-layer-copy drw TRUE))) (set! grid-layer (car (gimp-layer-copy drw TRUE)))
@ -77,22 +76,23 @@
(gimp-pencil grid-layer 4 segment)) (gimp-pencil grid-layer 4 segment))
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-context-pop)
(set! script-fu-grid-system-x-divides (wrap-list x-divides-orig))
(set! script-fu-grid-system-y-divides (wrap-list y-divides-orig))
(gimp-displays-flush))) (gimp-displays-flush)))
(script-fu-register "script-fu-grid-system" (script-fu-register "script-fu-grid-system"
_"_Grid..." _"_Grid..."
_"Draw a grid as specified by the lists of X and Y locations using the current brush" _"Draw a grid as specified by the lists of X and Y locations using the current brush"
"Shuji Narazaki <narazaki@InetQ.or.jp>" "Shuji Narazaki <narazaki@InetQ.or.jp>"
"Shuji Narazaki" "Shuji Narazaki"
"1997" "1997"
"RGB*, INDEXED*, GRAY*" "RGB*, INDEXED*, GRAY*"
SF-IMAGE "Image to use" 0 SF-IMAGE "Image to use" 0
SF-DRAWABLE "Drawable to draw grid" 0 SF-DRAWABLE "Drawable to draw grid" 0
SF-VALUE _"X divisions" script-fu-grid-system-x-divides SF-VALUE _"X divisions" "'(1 g 1)"
SF-VALUE _"Y divisions" script-fu-grid-system-y-divides) SF-VALUE _"Y divisions" "'(1 g 1)"
)
;;; grid-system.scm ends here
(script-fu-menu-register "script-fu-grid-system" (script-fu-menu-register "script-fu-grid-system"
"<Image>/Filters/Render/Pattern") "<Image>/Filters/Render/Pattern")

View File

@ -1,37 +1,44 @@
;; -*-scheme-*- ;; -*-scheme-*-
(define (script-fu-guides-from-selection image (define (script-fu-guides-from-selection image
drawable) drawable)
(let* ((boundries (gimp-selection-bounds image)) (let* (
;; non-empty INT32 TRUE if there is a selection (boundries (gimp-selection-bounds image))
(selection (car boundries)) ;; non-empty INT32 TRUE if there is a selection
(x1 (cadr boundries)) (selection (car boundries))
(y1 (caddr boundries)) (x1 (cadr boundries))
(x2 (cadr (cddr boundries))) (y1 (caddr boundries))
(y2 (caddr (cddr boundries)))) (x2 (cadr (cddr boundries)))
(y2 (caddr (cddr boundries)))
;; need to check for a selection or we get guides right at edges of the image )
(if (= selection TRUE)
(begin ;; need to check for a selection or we get guides right at edges of the image
(gimp-image-undo-group-start image) (if (= selection TRUE)
(begin
(gimp-image-add-vguide image x1) (gimp-image-undo-group-start image)
(gimp-image-add-hguide image y1)
(gimp-image-add-vguide image x2) (gimp-image-add-vguide image x1)
(gimp-image-add-hguide image y2) (gimp-image-add-hguide image y1)
(gimp-image-add-vguide image x2)
(gimp-image-undo-group-end image) (gimp-image-add-hguide image y2)
(gimp-displays-flush)))))
(gimp-image-undo-group-end image)
(script-fu-register "script-fu-guides-from-selection" (gimp-displays-flush)
_"New Guides from _Selection" )
_"Create four guides around the bounding box of the current selection" )
"Alan Horkan" )
"Alan Horkan, 2004. Public Domain." )
"2004-08-13"
"" (script-fu-register "script-fu-guides-from-selection"
SF-IMAGE "Image" 0 _"New Guides from _Selection"
SF-DRAWABLE "Drawable" 0) _"Draw a grid as specified by the lists of X and Y locations using the current brush"
"Alan Horkan"
(script-fu-menu-register "script-fu-guides-from-selection" "Alan Horkan, 2004. Public Domain."
"<Image>/Image/Guides") "2004-08-13"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)
(script-fu-menu-register "script-fu-guides-from-selection"
"<Image>/Image/Guides")

View File

@ -1,38 +1,42 @@
;; -*-scheme-*- ;; -*-scheme-*-
;; Alan Horkan 2004. Copyright. ;; Alan Horkan 2004. Copyright.
;; I'll fix it and license it differntly later if anyone cares to ask ;; I'll fix it and license it differntly later if anyone cares to ask
(define (script-fu-guide-new-percent image (define (script-fu-guide-new-percent image drawable direction position)
drawable (let* (
direction (width (car (gimp-image-width image)))
position) (height (car (gimp-image-height image)))
(let* ((width (car (gimp-image-width image))) )
(height (car (gimp-image-height image))))
(if (= direction 0) (if (= direction 0)
(set! position (/ (* height position) 100)) (set! position (/ (* height position) 100))
(set! position (/ (* width position) 100))) (set! position (/ (* width position) 100))
)
(if (= direction 0) (if (= direction 0)
;; convert position to pixel ;; convert position to pixel
(if (<= position height) (gimp-image-add-hguide image position)) (if (<= position height) (gimp-image-add-hguide image position))
(if (<= position width) (gimp-image-add-vguide image position))) (if (<= position width) (gimp-image-add-vguide image position))
)
(gimp-displays-flush)
)
)
(gimp-displays-flush)))
(script-fu-register "script-fu-guide-new-percent" (script-fu-register "script-fu-guide-new-percent"
_"New Guide (by _Percent)..." _"New Guide (by _Percent)..."
_"Add a guide at the position specified as a percentage of the image size" _"Add a guide at the position specified as a percentage of the image size"
"Alan Horkan" "Alan Horkan"
"Alan Horkan, 2004" "Alan Horkan, 2004"
"April 2004" "April 2004"
"" ""
SF-IMAGE "Input Image" 0 SF-IMAGE "Input Image" 0
SF-DRAWABLE "Input Drawable" 0 SF-DRAWABLE "Input Drawable" 0
SF-OPTION _"Direction" '(_"Horizontal" SF-OPTION _"Direction" '(_"Horizontal"
_"Vertical") _"Vertical")
SF-ADJUSTMENT _"Position (in %)" '(50 0 100 1 10 0 1)) SF-ADJUSTMENT _"Position (in %)" '(50 0 100 1 10 0 1)
)
(script-fu-menu-register "script-fu-guide-new-percent" (script-fu-menu-register "script-fu-guide-new-percent"
"<Image>/Image/Guides") "<Image>/Image/Guides")

View File

@ -1,35 +1,40 @@
;; -*-scheme-*- ;; -*-scheme-*-
;; Alan Horkan 2004. Public Domain. ;; Alan Horkan 2004. Public Domain.
;; so long as remove this block of comments from your script ;; so long as remove this block of comments from your script
;; feel free to use it for whatever you like. ;; feel free to use it for whatever you like.
(define (script-fu-guide-new image (define (script-fu-guide-new image
drawable drawable
direction direction
position) position)
(let* ((width (car (gimp-image-width image))) (let* (
(height (car (gimp-image-height image)))) (width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(if (= direction 0) )
;; check position is inside the image boundaries
(if (<= position height) (gimp-image-add-hguide image position)) (if (= direction 0)
(if (<= position width) (gimp-image-add-vguide image position))) ;; check position is inside the image boundaries
(if (<= position height) (gimp-image-add-hguide image position))
(gimp-displays-flush))) (if (<= position width) (gimp-image-add-vguide image position))
)
(script-fu-register "script-fu-guide-new"
_"New _Guide..." (gimp-displays-flush)
_"Add a guide at the orientation and position specified (in pixels)" )
"Alan Horkan" )
"Alan Horkan, 2004. Public Domain."
"2004-04-02" (script-fu-register "script-fu-guide-new"
"" _"New _Guide..."
SF-IMAGE "Image" 0 _"Add a guide at the orientation and position specified (in pixels)"
SF-DRAWABLE "Drawable" 0 "Alan Horkan"
SF-OPTION _"Direction" '(_"Horizontal" "Alan Horkan, 2004. Public Domain."
_"Vertical") "2004-04-02"
SF-ADJUSTMENT _"Position" '(0 0 262144 1 10 0 1)) ""
SF-IMAGE "Image" 0
(script-fu-menu-register "script-fu-guide-new" SF-DRAWABLE "Drawable" 0
"<Image>/Image/Guides") SF-OPTION _"Direction" '(_"Horizontal" _"Vertical")
SF-ADJUSTMENT _"Position" '(0 0 MAX-IMAGE-SIZE 1 10 0 1)
)
(script-fu-menu-register "script-fu-guide-new"
"<Image>/Image/Guides")

View File

@ -1,27 +1,30 @@
;; -*-scheme-*- ;; -*-scheme-*-
(define (script-fu-guides-remove image (define (script-fu-guides-remove image drawable)
drawable) (let* ((guide-id 0))
(let* ((guide-id 0)) (gimp-image-undo-group-start image)
(gimp-image-undo-group-start image)
(set! guide-id (car (gimp-image-find-next-guide image 0)))
(set! guide-id (car (gimp-image-find-next-guide image 0))) (while (> guide-id 0)
(while (> guide-id 0) (gimp-image-delete-guide image guide-id)
(gimp-image-delete-guide image guide-id) (set! guide-id (car (gimp-image-find-next-guide image 0)))
(set! guide-id (car (gimp-image-find-next-guide image 0)))) )
(gimp-image-undo-group-end image) (gimp-image-undo-group-end image)
(gimp-displays-flush))) (gimp-displays-flush)
)
(script-fu-register "script-fu-guides-remove" )
_"_Remove all Guides"
_"Remove all horizontal and vertical guides" (script-fu-register "script-fu-guides-remove"
"Alan Horkan" _"_Remove all Guides"
"Alan Horkan, 2004. Public Domain." _"Remove all horizontal and vertical guides"
"April 2004" "Alan Horkan"
"" "Alan Horkan, 2004. Public Domain."
SF-IMAGE "Image" 0 "April 2004"
SF-DRAWABLE "Drawable" 0) ""
SF-IMAGE "Image" 0
(script-fu-menu-register "script-fu-guides-remove" SF-DRAWABLE "Drawable" 0
"<Image>/Image/Guides") )
(script-fu-menu-register "script-fu-guides-remove"
"<Image>/Image/Guides")

View File

@ -10,80 +10,89 @@
; ************************************************************************ ; ************************************************************************
;;; Code: ;;; Code:
(if (not (symbol-bound? 'script-fu-hsv-graph-scale (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-scale (current-environment)))
(define script-fu-hsv-graph-scale 1)) (define script-fu-hsv-graph-scale 1))
(if (not (symbol-bound? 'script-fu-hsv-graph-opacity (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-opacity (current-environment)))
(define script-fu-hsv-graph-opacity 100)) (define script-fu-hsv-graph-opacity 100))
(if (not (symbol-bound? 'script-fu-hsv-graph-bounds? (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-bounds? (current-environment)))
(define script-fu-hsv-graph-bounds? TRUE)) (define script-fu-hsv-graph-bounds? TRUE))
(if (not (symbol-bound? 'script-fu-hsv-graph-left2right? (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-left2right? (current-environment)))
(define script-fu-hsv-graph-left2right? FALSE)) (define script-fu-hsv-graph-left2right? FALSE))
(if (not (symbol-bound? 'script-fu-hsv-graph-beg-x (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-beg-x (current-environment)))
(define script-fu-hsv-graph-beg-x 0)) (define script-fu-hsv-graph-beg-x 0))
(if (not (symbol-bound? 'script-fu-hsv-graph-beg-y (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-beg-y (current-environment)))
(define script-fu-hsv-graph-beg-y 0)) (define script-fu-hsv-graph-beg-y 0))
(if (not (symbol-bound? 'script-fu-hsv-graph-end-x (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-end-x (current-environment)))
(define script-fu-hsv-graph-end-x 1)) (define script-fu-hsv-graph-end-x 1))
(if (not (symbol-bound? 'script-fu-hsv-graph-end-y (the-environment))) (if (not (symbol-bound? 'script-fu-hsv-graph-end-y (current-environment)))
(define script-fu-hsv-graph-end-y 1)) (define script-fu-hsv-graph-end-y 1))
(define (script-fu-hsv-graph img drawable scale opacity bounds? (define (script-fu-hsv-graph img drawable scale opacity bounds?
left2right? beg-x beg-y end-x end-y) left2right? beg-x beg-y end-x end-y)
(define (floor x) (- x (fmod x 1))) (define (floor x) (- x (fmod x 1)))
(define *pos* #f) (define *pos* #f)
(define (set-point! fvec index x y) (define (set-point! fvec index x y)
(aset fvec (* 2 index) x) (aset fvec (* 2 index) x)
(aset fvec (+ (* 2 index) 1) y) (aset fvec (+ (* 2 index) 1) y)
fvec) fvec
)
(define (plot-dot img drawable x y) (define (plot-dot img drawable x y)
(gimp-pencil drawable 1 (set-point! *pos* 0 x y))) (gimp-pencil drawable 1 (set-point! *pos* 0 x y))
)
(define (rgb-to-hsv rgb hsv) (define (rgb-to-hsv rgb hsv)
(let* ((red (floor (nth 0 rgb))) (let* (
(green (floor (nth 1 rgb))) (red (floor (nth 0 rgb)))
(blue (floor (nth 2 rgb))) (green (floor (nth 1 rgb)))
(h 0.0) (blue (floor (nth 2 rgb)))
(s 0.0) (h 0.0)
(minv (min red (min green blue))) (s 0.0)
(maxv (max red (max green blue))) (minv (min red (min green blue)))
(v maxv) (maxv (max red (max green blue)))
(delta 0)) (v maxv)
(delta 0)
)
(if (not (= 0 maxv)) (if (not (= 0 maxv))
(set! s (/ (* (- maxv minv) 255.0) maxv)) (set! s (/ (* (- maxv minv) 255.0) maxv))
(set! s 0.0)) (set! s 0.0)
)
(if (= 0.0 s) (if (= 0.0 s)
(set! h 0.0) (set! h 0.0)
(begin (begin
(set! delta (- maxv minv)) (set! delta (- maxv minv))
(cond ((= maxv red) (cond ((= maxv red)
(set! h (/ (- green blue) delta))) (set! h (/ (- green blue) delta)))
((= maxv green) ((= maxv green)
(set! h (+ 2.0 (/ (- blue red) delta)))) (set! h (+ 2.0 (/ (- blue red) delta))))
((= maxv blue) ((= maxv blue)
(set! h (+ 4.0 (/ (- red green) delta))))) (set! h (+ 4.0 (/ (- red green) delta)))))
(set! h (* 42.5 h)) (set! h (* 42.5 h))
(if (< h 0.0) (if (< h 0.0)
(set! h (+ h 255.0))) (set! h (+ h 255.0)))
(if (< 255 h) (if (< 255 h)
(set! h (- h 255.0))))) (set! h (- h 255.0))))
)
(set-car! hsv (floor h)) (set-car! hsv (floor h))
(set-car! (cdr hsv) (floor s)) (set-car! (cdr hsv) (floor s))
(set-car! (cddr hsv) (floor v)))) (set-car! (cddr hsv) (floor v))
)
)
;; segment is ;; segment is
;; filled-index (integer) ;; filled-index (integer)
;; size as number of points (integer) ;; size as number of points (integer)
;; vector (which size is 2 * size) ;; vector (which size is 2 * size)
(define (make-segment length x y) (define (make-segment length x y)
(if (< 64 length) (if (< 64 length) (set! length 64))
(set! length 64)) (if (< length 5) (set! length 5))
(if (< length 5) (let (
(set! length 5)) (vec (cons-array (* 2 length) 'double)))
(let ((vec (cons-array (* 2 length) 'double))) (aset vec 0 x)
(aset vec 0 x) (aset vec 1 y)
(aset vec 1 y) (list 1 length vec)
(list 1 length vec))) )
)
;; accessors ;; accessors
(define (segment-filled-size segment) (car segment)) (define (segment-filled-size segment) (car segment))
@ -91,43 +100,49 @@
(define (segment-strokes segment) (caddr segment)) (define (segment-strokes segment) (caddr segment))
(define (fill-segment! segment new-x new-y) (define (fill-segment! segment new-x new-y)
(define (shift-segment! segment) (define (shift-segment! segment)
(let ((base 0) (let ((base 0)
(size (cadr segment)) (size (cadr segment))
(vec (caddr segment)) (vec (caddr segment))
(offset 2)) (offset 2))
(while (< base offset) (while (< base offset)
(aset vec (* 2 base) (aset vec (* 2 base)
(aref vec (* 2 (- size (- offset base))))) (aref vec (* 2 (- size (- offset base)))))
(aset vec (+ (* 2 base) 1) (aset vec (+ (* 2 base) 1)
(aref vec (+ (* 2 (- size (- offset base))) 1))) (aref vec (+ (* 2 (- size (- offset base))) 1)))
(set! base (+ base 1))) (set! base (+ base 1)))
(set-car! segment base))) (set-car! segment base))
)
(let ((base (car segment)) (let ((base (car segment))
(size (cadr segment)) (size (cadr segment))
(vec (caddr segment))) (vec (caddr segment)))
(if (= base 0) (if (= base 0)
(begin (begin
(shift-segment! segment) (shift-segment! segment)
(set! base (segment-filled-size segment)))) (set! base (segment-filled-size segment))))
(if (and (= new-x (aref vec (* 2 (- base 1)))) (if (and (= new-x (aref vec (* 2 (- base 1))))
(= new-y (aref vec (+ (* 2 (- base 1)) 1)))) (= new-y (aref vec (+ (* 2 (- base 1)) 1))))
#f #f
(begin (begin
(aset vec (* 2 base) new-x) (aset vec (* 2 base) new-x)
(aset vec (+ (* 2 base) 1) new-y) (aset vec (+ (* 2 base) 1) new-y)
(set! base (+ base 1)) (set! base (+ base 1))
(if (= base size) (if (= base size)
(begin (begin
(set-car! segment 0) (set-car! segment 0)
#t) #t)
(begin (begin
(set-car! segment base) (set-car! segment base)
#f)))))) #f))))
)
)
(define (draw-segment img drawable segment limit rgb) (define (draw-segment img drawable segment limit rgb)
(gimp-context-set-foreground rgb) (gimp-context-set-foreground rgb)
(gimp-airbrush drawable 100 (* 2 limit) (segment-strokes segment))) (gimp-airbrush drawable 100 (* 2 limit) (segment-strokes segment))
)
(define red-color '(255 10 10)) (define red-color '(255 10 10))
(define green-color '(10 255 10)) (define green-color '(10 255 10))
@ -142,117 +157,121 @@
(define (fill-dot img drawable x y segment color) (define (fill-dot img drawable x y segment color)
(if (fill-segment! segment x y) (if (fill-segment! segment x y)
(begin (begin
(gimp-context-set-foreground color) (gimp-context-set-foreground color)
(draw-segment img drawable segment (segment-max-size segment) color) (draw-segment img drawable segment (segment-max-size segment) color)
#t) #t)
#f)) #f)
)
(define (fill-color-band img drawable x scale x-base y-base color) (define (fill-color-band img drawable x scale x-base y-base color)
(gimp-context-set-foreground color) (gimp-context-set-foreground color)
(gimp-rect-select img (+ x-base (* scale x)) 0 scale y-base CHANNEL-OP-REPLACE FALSE 0) (gimp-rect-select img (+ x-base (* scale x)) 0 scale y-base CHANNEL-OP-REPLACE FALSE 0)
(gimp-edit-bucket-fill drawable FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) (gimp-edit-bucket-fill drawable FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(gimp-selection-none img)) (gimp-selection-none img)
)
(define (plot-hsv img drawable x scale x-base y-base hsv) (define (plot-hsv img drawable x scale x-base y-base hsv)
(let ((real-x (* scale x)) (let ((real-x (* scale x))
(h (car hsv)) (h (car hsv))
(s (cadr hsv)) (s (cadr hsv))
(v (caddr hsv))) (v (caddr hsv)))
(fill-dot img drawable (+ x-base real-x) (- y-base h) (fill-dot img drawable (+ x-base real-x) (- y-base h)
hue-segment red-color) hue-segment red-color)
(fill-dot img drawable (+ x-base real-x) (- y-base s) (fill-dot img drawable (+ x-base real-x) (- y-base s)
saturation-segment green-color) saturation-segment green-color)
(if (fill-dot img drawable (+ x-base real-x) (- y-base v) (if (fill-dot img drawable (+ x-base real-x) (- y-base v)
value-segment blue-color) value-segment blue-color)
(gimp-displays-flush)))) (gimp-displays-flush)))
)
(define (plot-rgb img drawable x scale x-base y-base hsv) (define (plot-rgb img drawable x scale x-base y-base hsv)
(let ((real-x (* scale x)) (let ((real-x (* scale x))
(h (car hsv)) (h (car hsv))
(s (cadr hsv)) (s (cadr hsv))
(v (caddr hsv))) (v (caddr hsv)))
(fill-dot img drawable (+ x-base real-x) (- y-base h) (fill-dot img drawable (+ x-base real-x) (- y-base h)
red-segment red-color) red-segment red-color)
(fill-dot img drawable (+ x-base real-x) (- y-base s) (fill-dot img drawable (+ x-base real-x) (- y-base s)
green-segment green-color) green-segment green-color)
(if (fill-dot img drawable (+ x-base real-x) (- y-base v) (if (fill-dot img drawable (+ x-base real-x) (- y-base v)
blue-segment blue-color) blue-segment blue-color)
(gimp-displays-flush)))) (gimp-displays-flush)))
)
(define (clamp-value x minv maxv) (define (clamp-value x minv maxv)
(if (< x minv) (if (< x minv)
(set! x minv)) (set! x minv))
(if (< maxv x) (if (< maxv x)
(set! x maxv)) (set! x maxv))
x) x
)
;; start of script-fu-hsv-graph ;; start of script-fu-hsv-graph
(if (= TRUE bounds?) (if (= TRUE bounds?)
(if (= TRUE (car (gimp-selection-bounds img))) (if (= TRUE (car (gimp-selection-bounds img)))
(let ((results (gimp-selection-bounds img))) (let ((results (gimp-selection-bounds img)))
(set! beg-x (nth (if (= TRUE left2right?) 1 3) results)) (set! beg-x (nth (if (= TRUE left2right?) 1 3) results))
(set! beg-y (nth 2 results)) (set! beg-y (nth 2 results))
(set! end-x (nth (if (= TRUE left2right?) 3 1) results)) (set! end-x (nth (if (= TRUE left2right?) 3 1) results))
(set! end-y (nth 4 results))) (set! end-y (nth 4 results)))
(let ((offsets (gimp-drawable-offsets drawable))) (let ((offsets (gimp-drawable-offsets drawable)))
(set! beg-x (if (= TRUE left2right?) (set! beg-x (if (= TRUE left2right?)
(nth 0 offsets) (nth 0 offsets)
(- (+ (nth 0 offsets) (- (+ (nth 0 offsets)
(car (gimp-drawable-width drawable))) (car (gimp-drawable-width drawable)))
1))) 1)))
(set! beg-y (nth 1 offsets)) (set! beg-y (nth 1 offsets))
(set! end-x (if (= TRUE left2right?) (set! end-x (if (= TRUE left2right?)
(- (+ (nth 0 offsets) (- (+ (nth 0 offsets)
(car (gimp-drawable-width drawable))) (car (gimp-drawable-width drawable)))
1) 1)
(nth 0 offsets))) (nth 0 offsets)))
(set! end-y (- (+ (nth 1 offsets) (set! end-y (- (+ (nth 1 offsets)
(car (gimp-drawable-height drawable))) (car (gimp-drawable-height drawable)))
1)))) 1))))
(let ((offsets (gimp-drawable-offsets drawable))) (let ((offsets (gimp-drawable-offsets drawable)))
(set! beg-x (clamp-value beg-x 0 (set! beg-x (clamp-value beg-x 0
(+ (nth 0 offsets) (+ (nth 0 offsets)
(car (gimp-drawable-width drawable))))) (car (gimp-drawable-width drawable)))))
(set! end-x (clamp-value end-x 0 (set! end-x (clamp-value end-x 0
(+ (nth 0 offsets) (+ (nth 0 offsets)
(car (gimp-drawable-width drawable))))) (car (gimp-drawable-width drawable)))))
(set! beg-y (clamp-value beg-y 0 (set! beg-y (clamp-value beg-y 0
(+ (nth 1 offsets) (+ (nth 1 offsets)
(car (gimp-drawable-height drawable))))) (car (gimp-drawable-height drawable)))))
(set! end-y (clamp-value end-y 0 (set! end-y (clamp-value end-y 0
(+ (nth 1 offsets) (+ (nth 1 offsets)
(car (gimp-drawable-height drawable))))))) (car (gimp-drawable-height drawable)))))))
(set! opacity (clamp-value opacity 0 100)) (set! opacity (clamp-value opacity 0 100))
(let* ((x-len (- end-x beg-x)) (let* ((x-len (- end-x beg-x))
(y-len (- end-y beg-y)) (y-len (- end-y beg-y))
(limit (pow (+ (pow x-len 2) (pow y-len 2)) 0.5)) (limit (pow (+ (pow x-len 2) (pow y-len 2)) 0.5))
(gimg-width (* limit scale)) (gimg-width (* limit scale))
(gimg-height 256) (gimg-height 256)
(gimg (car (gimp-image-new (+ (* 2 border-size) gimg-width) (gimg (car (gimp-image-new (+ (* 2 border-size) gimg-width)
(+ (* 2 border-size) gimg-height) RGB))) (+ (* 2 border-size) gimg-height) RGB)))
(bglayer (car (gimp-layer-new gimg (bglayer (car (gimp-layer-new gimg
(+ (* 2 border-size) gimg-width) (+ (* 2 border-size) gimg-width)
(+ (* 2 border-size) gimg-height) (+ (* 2 border-size) gimg-height)
1 "Background" 100 NORMAL-MODE))) 1 "Background" 100 NORMAL-MODE)))
(hsv-layer (car (gimp-layer-new gimg (hsv-layer (car (gimp-layer-new gimg
(+ (* 2 border-size) gimg-width) (+ (* 2 border-size) gimg-width)
(+ (* 2 border-size) gimg-height) (+ (* 2 border-size) gimg-height)
RGBA-IMAGE "HSV Graph" 100 NORMAL-MODE))) RGBA-IMAGE "HSV Graph" 100 NORMAL-MODE)))
(rgb-layer (car (gimp-layer-new gimg (rgb-layer (car (gimp-layer-new gimg
(+ (* 2 border-size) gimg-width) (+ (* 2 border-size) gimg-width)
(+ (* 2 border-size) gimg-height) (+ (* 2 border-size) gimg-height)
RGBA-IMAGE "RGB Graph" 100 NORMAL-MODE))) RGBA-IMAGE "RGB Graph" 100 NORMAL-MODE)))
(clayer (car (gimp-layer-new gimg gimg-width 40 RGBA-IMAGE (clayer (car (gimp-layer-new gimg gimg-width 40 RGBA-IMAGE
"Color Sampled" opacity NORMAL-MODE))) "Color Sampled" opacity NORMAL-MODE)))
(rgb '(255 255 255)) (rgb '(255 255 255))
(hsv '(254 255 255)) (hsv '(254 255 255))
(x-base border-size) (x-base border-size)
(y-base (+ gimg-height border-size)) (y-base (+ gimg-height border-size))
(index 0)) (index 0))
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable gimg) (gimp-image-undo-disable gimg)
(gimp-image-add-layer gimg bglayer -1) (gimp-image-add-layer gimg bglayer -1)
(gimp-selection-all gimg) (gimp-selection-all gimg)
@ -279,9 +298,9 @@
(gimp-display-new gimg) (gimp-display-new gimg)
(while (< index limit) (while (< index limit)
(set! rgb (car (gimp-image-pick-color img drawable (set! rgb (car (gimp-image-pick-color img drawable
(+ beg-x (* x-len (/ index limit))) (+ beg-x (* x-len (/ index limit)))
(+ beg-y (* y-len (/ index limit))) (+ beg-y (* y-len (/ index limit)))
TRUE FALSE 0))) TRUE FALSE 0)))
(fill-color-band gimg clayer index scale x-base 40 rgb) (fill-color-band gimg clayer index scale x-base 40 rgb)
(rgb-to-hsv rgb hsv) (rgb-to-hsv rgb hsv)
(plot-hsv gimg hsv-layer index scale x-base y-base hsv) (plot-hsv gimg hsv-layer index scale x-base y-base hsv)
@ -290,32 +309,33 @@
(mapcar (mapcar
(lambda (segment color) (lambda (segment color)
(if (< 1 (segment-filled-size segment)) (if (< 1 (segment-filled-size segment))
(begin (begin
(gimp-context-set-foreground color) (gimp-context-set-foreground color)
(draw-segment gimg hsv-layer segment (segment-filled-size segment) (draw-segment gimg hsv-layer segment (segment-filled-size segment)
color)))) color))))
(list hue-segment saturation-segment value-segment) (list hue-segment saturation-segment value-segment)
(list red-color green-color blue-color)) (list red-color green-color blue-color))
(mapcar (mapcar
(lambda (segment color) (lambda (segment color)
(if (< 1 (segment-filled-size segment)) (if (< 1 (segment-filled-size segment))
(begin (begin
(gimp-context-set-foreground color) (gimp-context-set-foreground color)
(draw-segment gimg rgb-layer segment (segment-filled-size segment) (draw-segment gimg rgb-layer segment (segment-filled-size segment)
color)))) color))))
(list red-segment green-segment blue-segment) (list red-segment green-segment blue-segment)
(list red-color green-color blue-color)) (list red-color green-color blue-color))
(gimp-context-set-foreground '(255 255 255)) (gimp-context-set-foreground '(255 255 255))
(let ((text-layer (car (gimp-text-fontname gimg -1 0 0 (let ((text-layer (car (gimp-text-fontname gimg -1 0 0
"Red: Hue, Green: Sat, Blue: Val" "Red: Hue, Green: Sat, Blue: Val"
1 1 12 PIXELS 1 1 12 PIXELS
"Sans"))) "-*-helvetica-*-r-*-*-12-*-*-*-p-*-*-*")))
(offset-y (- y-base (car (gimp-drawable-height clayer))))) (offset-y (- y-base (car (gimp-drawable-height clayer)))))
(gimp-layer-set-mode text-layer DIFFERENCE-MODE) (gimp-layer-set-mode text-layer DIFFERENCE-MODE)
(gimp-layer-translate clayer 0 offset-y) (gimp-layer-translate clayer 0 offset-y)
(gimp-layer-translate text-layer border-size (+ offset-y 15))) (gimp-layer-translate text-layer border-size (+ offset-y 15)))
(gimp-image-set-active-layer gimg bglayer) (gimp-image-set-active-layer gimg bglayer)
(gimp-image-clean-all gimg) (gimp-image-clean-all gimg)
;; return back the state
(gimp-image-undo-enable gimg) (gimp-image-undo-enable gimg)
(set! script-fu-hsv-graph-scale scale) (set! script-fu-hsv-graph-scale scale)
@ -328,25 +348,30 @@
(set! script-fu-hsv-graph-end-y end-y) (set! script-fu-hsv-graph-end-y end-y)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-hsv-graph" (script-fu-register "script-fu-hsv-graph"
_"Draw _HSV Graph..." _"Draw _HSV Graph..."
_"Create a graph of the Hue, Saturation, and Value distributions of the current drawable" _"Create a graph of the Hue, Saturation, and Value distributions of the current drawable"
"Shuji Narazaki <narazaki@InetQ.or.jp>" "Shuji Narazaki <narazaki@InetQ.or.jp>"
"Shuji Narazaki" "Shuji Narazaki"
"1997" "1997"
"RGB*" "RGB*"
SF-IMAGE "Image to analyze" 0 SF-IMAGE "Image to analyze" 0
SF-DRAWABLE "Drawable to analyze" 0 SF-DRAWABLE "Drawable to analyze" 0
SF-ADJUSTMENT _"Graph scale" (cons script-fu-hsv-graph-scale '(0.1 5 0.1 1 1 1)) SF-ADJUSTMENT _"Graph scale" '(1 0.1 5 0.1 1 1 1)
SF-ADJUSTMENT _"BG opacity" (cons script-fu-hsv-graph-opacity '(0 100 1 10 0 1)) SF-ADJUSTMENT _"BG opacity" '(100 0 100 1 10 0 1)
SF-TOGGLE _"Use selection bounds instead of belows" script-fu-hsv-graph-bounds? SF-TOGGLE _"Use selection bounds instead of values below" TRUE
SF-TOGGLE _"From top-left to bottom-right" script-fu-hsv-graph-left2right? SF-TOGGLE _"From top-left to bottom-right" FALSE
SF-ADJUSTMENT _"Start X" (cons script-fu-hsv-graph-beg-x '(0 5000 1 10 0 1)) SF-ADJUSTMENT _"Start X" '(0 0 5000 1 10 0 1)
SF-ADJUSTMENT _"Start Y" (cons script-fu-hsv-graph-beg-y '(0 5000 1 10 0 1)) SF-ADJUSTMENT _"Start Y" '(0 0 5000 1 10 0 1)
SF-ADJUSTMENT _"End X" (cons script-fu-hsv-graph-end-x '(0 5000 1 10 0 1)) SF-ADJUSTMENT _"End X" '(1 0 5000 1 10 0 1)
SF-ADJUSTMENT _"End Y" (cons script-fu-hsv-graph-end-y '(0 5000 1 10 0 1))) SF-ADJUSTMENT _"End Y" '(1 0 5000 1 10 0 1)
)
;;; hsv-graph.scm ends here
(script-fu-menu-register "script-fu-hsv-graph" (script-fu-menu-register "script-fu-hsv-graph"
"<Image>/Colors/Info") "<Image>/Colors/Info")

View File

@ -13,21 +13,23 @@
;;; Code: ;;; Code:
(define (script-fu-i26-gunya2 text text-color frame-color font font-size frame-size) (define (script-fu-i26-gunya2 text text-color frame-color font font-size frame-size)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(border (/ font-size 10)) (img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2) (border (/ font-size 10))
TRUE font-size PIXELS font))) (text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2)
(width (car (gimp-drawable-width text-layer))) TRUE font-size PIXELS font)))
(height (car (gimp-drawable-height text-layer))) (width (car (gimp-drawable-width text-layer)))
(dist-text-layer (car (gimp-layer-new img width height RGBA-IMAGE (height (car (gimp-drawable-height text-layer)))
"Distorted text" 100 NORMAL-MODE))) (dist-text-layer (car (gimp-layer-new img width height RGBA-IMAGE
(dist-frame-layer (car (gimp-layer-new img width height RGBA-IMAGE "Distorted text" 100 NORMAL-MODE)))
"Distorted text" 100 NORMAL-MODE))) (dist-frame-layer (car (gimp-layer-new img width height RGBA-IMAGE
(distortion-img (car (gimp-image-new width height GRAY))) "Distorted text" 100 NORMAL-MODE)))
(distortion-layer (car (gimp-layer-new distortion-img width height (distortion-img (car (gimp-image-new width height GRAY)))
GRAY-IMAGE "temp" 100 NORMAL-MODE))) (distortion-layer (car (gimp-layer-new distortion-img width height
(radius (/ font-size 10)) GRAY-IMAGE "temp" 100 NORMAL-MODE)))
(prob 0.5)) (radius (/ font-size 10))
(prob 0.5)
)
(gimp-context-push) (gimp-context-push)
@ -59,7 +61,7 @@
(plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1) (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
;; OK, apply it to dist-text-layer ;; OK, apply it to dist-text-layer
(plug-in-displace 1 img dist-text-layer radius radius 1 1 (plug-in-displace 1 img dist-text-layer radius radius 1 1
distortion-layer distortion-layer 0) distortion-layer distortion-layer 0)
;; make the distortion data once again fro the frame ;; make the distortion data once again fro the frame
(gimp-edit-fill distortion-layer BACKGROUND-FILL) (gimp-edit-fill distortion-layer BACKGROUND-FILL)
(plug-in-noisify 1 distortion-img distortion-layer FALSE prob prob prob 0.0) (plug-in-noisify 1 distortion-img distortion-layer FALSE prob prob prob 0.0)
@ -68,7 +70,7 @@
(plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1) (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
;; then, apply it to dist-frame-layer ;; then, apply it to dist-frame-layer
(plug-in-displace 1 img dist-frame-layer radius radius 1 1 (plug-in-displace 1 img dist-frame-layer radius radius 1 1
distortion-layer distortion-layer 0) distortion-layer distortion-layer 0)
;; Finally, clear the bottom layer (text-layer) ;; Finally, clear the bottom layer (text-layer)
(gimp-selection-all img) (gimp-selection-all img)
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
@ -80,22 +82,27 @@
(gimp-image-delete distortion-img) (gimp-image-delete distortion-img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-i26-gunya2" (script-fu-register "script-fu-i26-gunya2"
_"Imigre-_26..." _"Imigre-_26..."
_"Create a logo in a two-color, scribbled text style" _"Create a logo in a two-color, scribbled text style"
"Shuji Narazaki" "Shuji Narazaki"
"Shuji Narazaki" "Shuji Narazaki"
"1997" "1997"
"" ""
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-COLOR _"Text color" "red" SF-COLOR _"Text color" '(255 0 0)
SF-COLOR _"Frame color" '(0 34 255) SF-COLOR _"Frame color" '(0 34 255)
SF-FONT _"Font" "Becker" SF-FONT _"Font" "Becker"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-ADJUSTMENT _"Frame size" '(2 1 20 1 5 0 1)) SF-ADJUSTMENT _"Frame size" '(2 1 20 1 5 0 1)
)
;;; i26-gunya2.scm ends here
(script-fu-menu-register "script-fu-i26-gunya2" (script-fu-menu-register "script-fu-i26-gunya2"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -1,29 +1,29 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Land --- create a pattern that resembles a Topographic map ; Land --- create a pattern that resembles a Topographic map
; Copyright (C) 1997 Adrian Karstan Likins ; Copyright (C) 1997 Adrian Karstan Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
;
; ;
; This script works on the current gradient you have loaded. ;
; Some suggested gradients: ; This script works on the current gradient you have loaded.
; Some suggested gradients:
; Land (produces a earthlike map) ; Land (produces a earthlike map)
; Brushed_aluminum (looks like the moon) ; Brushed_aluminum (looks like the moon)
;
; ;
; Thanks to Quartic for helping me debug this thing. ;
; Thanks to Quartic for helping me debug this thing.
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -32,11 +32,11 @@
(define (script-fu-land width height seed detail landheight seadepth xscale yscale gradient) (define (script-fu-land width height seed detail landheight seadepth xscale yscale gradient)
(let* ( (let* (
(img (car (gimp-image-new width height RGB))) (img (car (gimp-image-new width height RGB)))
(layer-one (car (gimp-layer-new img width height (layer-one (car (gimp-layer-new img width height
RGB-IMAGE "Bottom" 100 NORMAL-MODE))) RGB-IMAGE "Bottom" 100 NORMAL-MODE)))
(layer-two) (layer-two)
) )
(gimp-context-set-gradient gradient) (gimp-context-set-gradient gradient)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(gimp-image-add-layer img layer-one 0) (gimp-image-add-layer img layer-one 0)
@ -65,24 +65,26 @@
(gimp-display-new img) (gimp-display-new img)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
)) )
)
(script-fu-register "script-fu-land" (script-fu-register "script-fu-land"
_"_Land..." _"_Land..."
_"Create an image filled with a topographic map pattern" _"Create an image filled with a topographic map pattern"
"Adrian Likins <aklikins@eos.ncsu.edu>" "Adrian Likins <aklikins@eos.ncsu.edu>"
"Adrian Likins" "Adrian Likins"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Image width" '(256 10 1000 1 10 0 1) SF-ADJUSTMENT _"Image width" '(256 10 1000 1 10 0 1)
SF-ADJUSTMENT _"Image height" '(256 10 1000 1 10 0 1) SF-ADJUSTMENT _"Image height" '(256 10 1000 1 10 0 1)
SF-ADJUSTMENT _"Random seed" '(32 0 15000000 1 10 0 1) SF-ADJUSTMENT _"Random seed" '(32 0 15000000 1 10 0 1)
SF-ADJUSTMENT _"Detail level" '(4 1 15 1 5 0 0) SF-ADJUSTMENT _"Detail level" '(4 1 15 1 5 0 0)
SF-ADJUSTMENT _"Land height" '(60 1 65 1 10 0 1) SF-ADJUSTMENT _"Land height" '(60 1 65 1 10 0 1)
SF-ADJUSTMENT _"Sea depth" '(4 1 65 1 10 0 1) SF-ADJUSTMENT _"Sea depth" '(4 1 65 1 10 0 1)
SF-ADJUSTMENT _"Scale X" '(4 0.1 16 1 5 0.1 0) SF-ADJUSTMENT _"Scale X" '(4 0.1 16 1 5 0.1 0)
SF-ADJUSTMENT _"Scale Y" '(4 0.1 16 1 5 0.1 0) SF-ADJUSTMENT _"Scale Y" '(4 0.1 16 1 5 0.1 0)
SF-GRADIENT _"Gradient" "Land 1") SF-GRADIENT _"Gradient" "Land 1"
)
(script-fu-menu-register "script-fu-land" (script-fu-menu-register "script-fu-land"
"<Toolbox>/Xtns/Patterns") "<Toolbox>/Xtns/Patterns")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Lava effect ; Lava effect
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
@ -12,74 +12,84 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-lava image (define (script-fu-lava image
drawable drawable
seed seed
tile_size tile_size
mask_size mask_size
gradient gradient
keep-selection keep-selection
separate-layer separate-layer
current-grad) current-grad)
(let* ( (let* (
(type (car (gimp-drawable-type-with-alpha drawable))) (type (car (gimp-drawable-type-with-alpha drawable)))
(image-width (car (gimp-image-width image))) (image-width (car (gimp-image-width image)))
(image-height (car (gimp-image-height image)))) (image-height (car (gimp-image-height image)))
(active-selection)
(from-selection)
(selection-bounds)
(select-offset-x)
(select-offset-y)
(select-width)
(select-height)
(lava-layer)
(active-layer)
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-group-start image) (gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable) (gimp-layer-add-alpha drawable)
(if (= (car (gimp-selection-is-empty image)) TRUE) (if (= (car (gimp-selection-is-empty image)) TRUE)
(begin (begin
(gimp-selection-layer-alpha drawable) (gimp-selection-layer-alpha drawable)
(set! active-selection (car (gimp-selection-save image))) (set! active-selection (car (gimp-selection-save image)))
(set! from-selection FALSE)) (set! from-selection FALSE))
(begin (begin
(set! from-selection TRUE) (set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image))))) (set! active-selection (car (gimp-selection-save image)))))
(set! selection-bounds (gimp-selection-bounds image)) (set! selection-bounds (gimp-selection-bounds image))
(set! select-offset-x (cadr selection-bounds)) (set! select-offset-x (cadr selection-bounds))
(set! select-offset-y (caddr selection-bounds)) (set! select-offset-y (caddr selection-bounds))
(set! select-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
(set! select-height (- (caddr (cddr selection-bounds)) select-offset-y)) (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
(if (= separate-layer TRUE) (if (= separate-layer TRUE)
(begin (begin
(set! lava-layer (car (gimp-layer-new image (set! lava-layer (car (gimp-layer-new image
select-width select-width
select-height select-height
type type
"Lava Layer" "Lava Layer"
100 100
NORMAL-MODE))) NORMAL-MODE)))
(gimp-image-add-layer image lava-layer -1) (gimp-image-add-layer image lava-layer -1)
(gimp-layer-set-offsets lava-layer select-offset-x select-offset-y) (gimp-layer-set-offsets lava-layer select-offset-x select-offset-y)
(gimp-selection-none image) (gimp-selection-none image)
(gimp-edit-clear lava-layer) (gimp-edit-clear lava-layer)
(gimp-selection-load active-selection) (gimp-selection-load active-selection)
(gimp-image-set-active-layer image lava-layer))) (gimp-image-set-active-layer image lava-layer)))
(set! active-layer (car (gimp-image-get-active-layer image))) (set! active-layer (car (gimp-image-get-active-layer image)))
(if (= current-grad FALSE) (if (= current-grad FALSE)
(gimp-context-set-gradient gradient)) (gimp-context-set-gradient gradient))
(plug-in-solid-noise 1 image active-layer FALSE TRUE seed 2 2 2) (plug-in-solid-noise 1 image active-layer FALSE TRUE seed 2 2 2)
(plug-in-cubism 1 image active-layer tile_size 2.5 0) (plug-in-cubism 1 image active-layer tile_size 2.5 0)
(plug-in-oilify 1 image active-layer mask_size 0) (plug-in-oilify 1 image active-layer mask_size 0)
@ -88,31 +98,34 @@
(plug-in-gradmap 1 image active-layer) (plug-in-gradmap 1 image active-layer)
(if (= keep-selection FALSE) (if (= keep-selection FALSE)
(gimp-selection-none image)) (gimp-selection-none image))
(gimp-image-set-active-layer image drawable) (gimp-image-set-active-layer image drawable)
(gimp-image-remove-channel image active-selection) (gimp-image-remove-channel image active-selection)
(gimp-image-undo-group-end image) (gimp-image-undo-group-end image)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-lava" (script-fu-register "script-fu-lava"
_"_Lava..." _"_Lava..."
_"Fill the current selection with lava" _"Fill the current selection with lava"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"Adrian Likins" "Adrian Likins"
"10/12/97" "10/12/97"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Seed" '(10 1 30000 1 10 0 1) SF-ADJUSTMENT _"Seed" '(10 1 30000 1 10 0 1)
SF-ADJUSTMENT _"Size" '(10 0 100 1 10 0 1) SF-ADJUSTMENT _"Size" '(10 0 100 1 10 0 1)
SF-ADJUSTMENT _"Roughness" '(7 3 50 1 10 0 0) SF-ADJUSTMENT _"Roughness" '(7 3 50 1 10 0 0)
SF-GRADIENT _"Gradient" "German flag smooth" SF-GRADIENT _"Gradient" "German flag smooth"
SF-TOGGLE _"Keep selection" TRUE SF-TOGGLE _"Keep selection" TRUE
SF-TOGGLE _"Separate layer" TRUE SF-TOGGLE _"Separate layer" TRUE
SF-TOGGLE _"Use current gradient" FALSE) SF-TOGGLE _"Use current gradient" FALSE
)
(script-fu-menu-register "script-fu-lava" (script-fu-menu-register "script-fu-lava"
"<Image>/Filters/Render") "<Image>/Filters/Render")

View File

@ -4,84 +4,116 @@
;;; Version 0.7 ;;; Version 0.7
(define (script-fu-line-nova img drw num-of-lines corn-deg offset variation) (define (script-fu-line-nova img drw num-of-lines corn-deg offset variation)
(let* ((*points* (cons-array (* 3 2) 'double)) (let* (
(modulo fmod) ; in R4RS way (*points* (cons-array (* 3 2) 'double))
(pi/2 (/ *pi* 2)) (modulo fmod) ; in R4RS way
(pi/4 (/ *pi* 4)) (pi/2 (/ *pi* 2))
(pi3/4 (* 3 pi/4)) (pi/4 (/ *pi* 4))
(pi5/4 (* 5 pi/4)) (pi3/4 (* 3 pi/4))
(pi3/2 (* 3 pi/2)) (pi5/4 (* 5 pi/4))
(pi7/4 (* 7 pi/4)) (pi3/2 (* 3 pi/2))
(2pi (* 2 *pi*)) (pi7/4 (* 7 pi/4))
(rad/deg (/ 2pi 360)) (2pi (* 2 *pi*))
(variation/2 (/ variation 2)) (rad/deg (/ 2pi 360))
(drw-width (car (gimp-drawable-width drw))) (variation/2 (/ variation 2))
(drw-height (car (gimp-drawable-height drw))) (drw-width (car (gimp-drawable-width drw)))
(drw-offsets (gimp-drawable-offsets drw)) (drw-height (car (gimp-drawable-height drw)))
(old-selection (if (eq? (car (gimp-selection-is-empty img)) TRUE) (drw-offsets (gimp-drawable-offsets drw))
#f (old-selection
(car (gimp-selection-save img)))) (if (eq? (car (gimp-selection-is-empty img)) TRUE)
(radius (max drw-height drw-width)) #f
(index 0) (car (gimp-selection-save img))
(dir-deg/line (/ 360 num-of-lines))) )
)
(radius (max drw-height drw-width))
(index 0)
(dir-deg/line (/ 360 num-of-lines))
)
(define (draw-vector beg-x beg-y direction) (define (draw-vector beg-x beg-y direction)
(define (set-point! index x y) (define (set-point! index x y)
(aset *points* (* 2 index) x) (aset *points* (* 2 index) x)
(aset *points* (+ (* 2 index) 1) y)) (aset *points* (+ (* 2 index) 1) y)
)
(define (deg->rad rad) (define (deg->rad rad)
(* (modulo rad 360) rad/deg)) (* (modulo rad 360) rad/deg)
)
(define (set-marginal-point beg-x beg-y direction) (define (set-marginal-point beg-x beg-y direction)
(let ((dir1 (deg->rad (+ direction corn-deg))) (let (
(dir2 (deg->rad (- direction corn-deg)))) (dir1 (deg->rad (+ direction corn-deg)))
(define (aux dir index) (dir2 (deg->rad (- direction corn-deg)))
(set-point! index )
(+ beg-x (* (cos dir) radius))
(+ beg-y (* (sin dir) radius)))) (define (aux dir index)
(aux dir1 1) (set-point! index
(aux dir2 2))) (+ beg-x (* (cos dir) radius))
(let ((dir0 (deg->rad direction)) (+ beg-y (* (sin dir) radius)))
(off (+ offset (- (modulo (rand) variation) variation/2)))) )
(set-point! 0
(+ beg-x (* off (cos dir0))) (aux dir1 1)
(+ beg-y (* off (sin dir0)))) (aux dir2 2)
(set-marginal-point beg-x beg-y direction) )
(gimp-free-select img 6 *points* CHANNEL-OP-ADD )
TRUE ; antialias
FALSE ; feather (let (
0 ; feather radius (dir0 (deg->rad direction))
))) (off (+ offset (- (modulo (rand) variation) variation/2)))
)
(set-point! 0
(+ beg-x (* off (cos dir0)))
(+ beg-y (* off (sin dir0)))
)
(set-marginal-point beg-x beg-y direction)
(gimp-free-select img 6 *points* CHANNEL-OP-ADD
TRUE ; antialias
FALSE ; feather
0 ; feather radius
)
)
)
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(gimp-selection-none img) (gimp-selection-none img)
(srand (realtime)) (srand (realtime))
(while (< index num-of-lines) (while (< index num-of-lines)
(draw-vector (+ (nth 0 drw-offsets) (/ drw-width 2)) (draw-vector (+ (nth 0 drw-offsets) (/ drw-width 2))
(+ (nth 1 drw-offsets) (/ drw-height 2)) (+ (nth 1 drw-offsets) (/ drw-height 2))
(* index dir-deg/line)) (* index dir-deg/line)
(set! index (+ index 1))) )
(set! index (+ index 1))
)
(gimp-edit-bucket-fill drw FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) (gimp-edit-bucket-fill drw FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(if old-selection (if old-selection
(begin (begin
(gimp-selection-load old-selection) (gimp-selection-load old-selection)
;; (gimp-image-set-active-layer img drw) ;; (gimp-image-set-active-layer img drw)
;; delete extra channel by Sven Neumann <neumanns@uni-duesseldorf.de> ;; delete extra channel by Sven Neumann <neumanns@uni-duesseldorf.de>
(gimp-image-remove-channel img old-selection))) (gimp-image-remove-channel img old-selection)
)
)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-line-nova" (script-fu-register
_"Line _Nova..." "script-fu-line-nova"
_"Fill a layer with rays emanating outward from its center using the FG color" _"Line _Nova..."
"Shuji Narazaki <narazaki@gimp.org>" _"Fill a layer with rays emanating outward from its center using the FG color"
"Shuji Narazaki" "Shuji Narazaki <narazaki@gimp.org>"
"1997,1998" "Shuji Narazaki"
"" "1997,1998"
SF-IMAGE "Image" 0 ""
SF-DRAWABLE "Drawable" 0 SF-IMAGE "Image" 0
SF-ADJUSTMENT _"Number of lines" '(200 40 1000 1 1 0 1) SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Sharpness (degrees)" '(1.0 0.0 10.0 0.1 1 1 1) SF-ADJUSTMENT _"Number of lines" '(200 40 1000 1 1 0 1)
SF-ADJUSTMENT _"Offset radius" '(100 0 2000 1 1 0 1) SF-ADJUSTMENT _"Sharpness (degrees)" '(1.0 0.0 10.0 0.1 1 1 1)
SF-ADJUSTMENT _"Randomness" '(30 1 2000 1 1 0 1)) SF-ADJUSTMENT _"Offset radius" '(100 0 2000 1 1 0 1)
SF-ADJUSTMENT _"Randomness" '(30 1 2000 1 1 0 1)
)
;;; line-nova.scm ends here
(script-fu-menu-register "script-fu-line-nova" (script-fu-menu-register "script-fu-line-nova"
"<Image>/Filters/Render") "<Image>/Filters/Render")

View File

@ -22,18 +22,19 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-make-brush-rectangular name width height spacing ) (define (script-fu-make-brush-rectangular name width height spacing)
(let* ((img (car (gimp-image-new width height GRAY))) (let* (
(drawable (car (gimp-layer-new img (img (car (gimp-image-new width height GRAY)))
width height GRAY-IMAGE (drawable (car (gimp-layer-new img
"MakeBrush" 100 NORMAL-MODE))) width height GRAY-IMAGE
"MakeBrush" 100 NORMAL-MODE)))
(filename (string-append gimp-directory (filename (string-append gimp-directory
"/brushes/r" "/brushes/r"
(number->string width) (number->string width)
"x" "x"
(number->string height) (number->string height)
".gbr"))) ".gbr"))
)
(gimp-context-push) (gimp-context-push)
@ -44,7 +45,7 @@
(gimp-drawable-fill drawable BACKGROUND-FILL) (gimp-drawable-fill drawable BACKGROUND-FILL)
(gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0) (gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0)
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-fill drawable BACKGROUND-FILL) (gimp-edit-fill drawable BACKGROUND-FILL)
@ -54,41 +55,46 @@
(gimp-context-pop) (gimp-context-pop)
(gimp-brushes-refresh) (gimp-brushes-refresh)
(gimp-context-set-brush name))) (gimp-context-set-brush name)
)
)
(script-fu-register "script-fu-make-brush-rectangular" (script-fu-register "script-fu-make-brush-rectangular"
_"_Rectangular..." _"_Rectangular..."
_"Create a rectangular brush" _"Create a rectangular brush"
"Seth Burgess <sjburges@ou.edu>" "Seth Burgess <sjburges@ou.edu>"
"Seth Burgess" "Seth Burgess"
"1997" "1997"
"" ""
SF-STRING _"Name" "Rectangle" SF-STRING _"Name" "Rectangle"
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)) SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
)
(script-fu-menu-register "script-fu-make-brush-rectangular" (script-fu-menu-register "script-fu-make-brush-rectangular"
"<Brushes>") "<Brushes>")
(define (script-fu-make-brush-rectangular-feathered name width height (define (script-fu-make-brush-rectangular-feathered name
feathering spacing) width height
(let* ((widthplus (+ width feathering)) feathering spacing)
(heightplus (+ height feathering)) (let* (
(img (car (gimp-image-new widthplus heightplus GRAY))) (widthplus (+ width feathering))
(drawable (car (gimp-layer-new img (heightplus (+ height feathering))
widthplus heightplus GRAY-IMAGE (img (car (gimp-image-new widthplus heightplus GRAY)))
"MakeBrush" 100 NORMAL-MODE))) (drawable (car (gimp-layer-new img
widthplus heightplus GRAY-IMAGE
(filename (string-append gimp-directory "MakeBrush" 100 NORMAL-MODE)))
"/brushes/r" (filename (string-append gimp-directory
(number->string width) "/brushes/r"
"x" (number->string width)
(number->string height) "x"
"f" (number->string height)
(number->string feathering) "f"
".gbr"))) (number->string feathering)
".gbr"))
)
(gimp-context-push) (gimp-context-push)
@ -99,11 +105,11 @@
(gimp-drawable-fill drawable BACKGROUND-FILL) (gimp-drawable-fill drawable BACKGROUND-FILL)
(cond ((< 0 feathering) (cond ((< 0 feathering)
(gimp-rect-select img (gimp-rect-select img
(/ feathering 2) (/ feathering 2) (/ feathering 2) (/ feathering 2)
width height CHANNEL-OP-REPLACE TRUE feathering)) width height CHANNEL-OP-REPLACE TRUE feathering))
((>= 0 feathering) ((>= 0 feathering)
(gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0))) (gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0)))
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-fill drawable BACKGROUND-FILL) (gimp-edit-fill drawable BACKGROUND-FILL)
@ -114,37 +120,41 @@
(gimp-context-pop) (gimp-context-pop)
(gimp-brushes-refresh) (gimp-brushes-refresh)
(gimp-context-set-brush name))) (gimp-context-set-brush name)
)
)
(script-fu-register "script-fu-make-brush-rectangular-feathered" (script-fu-register "script-fu-make-brush-rectangular-feathered"
_"Re_ctangular, Feathered..." _"Re_ctangular, Feathered..."
_"Create a rectangular brush with feathered edges" _"Create a rectangular brush with feathered edges"
"Seth Burgess <sjburges@ou.edu>" "Seth Burgess <sjburges@ou.edu>"
"Seth Burgess" "Seth Burgess"
"1997" "1997"
"" ""
SF-STRING _"Name" "Rectangle" SF-STRING _"Name" "Rectangle"
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1) SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1)
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)) SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
)
(script-fu-menu-register "script-fu-make-brush-rectangular-feathered" (script-fu-menu-register "script-fu-make-brush-rectangular-feathered"
"<Brushes>") "<Brushes>")
(define (script-fu-make-brush-elliptical name width height spacing) (define (script-fu-make-brush-elliptical name width height spacing)
(let* ((img (car (gimp-image-new width height GRAY))) (let* (
(drawable (car (gimp-layer-new img (img (car (gimp-image-new width height GRAY)))
width height GRAY-IMAGE (drawable (car (gimp-layer-new img
"MakeBrush" 100 NORMAL-MODE))) width height GRAY-IMAGE
"MakeBrush" 100 NORMAL-MODE)))
(filename (string-append gimp-directory (filename (string-append gimp-directory
"/brushes/e" "/brushes/e"
(number->string width) (number->string width)
"x" "x"
(number->string height) (number->string height)
".gbr"))) ".gbr"))
)
(gimp-context-push) (gimp-context-push)
@ -155,7 +165,7 @@
(gimp-drawable-fill drawable BACKGROUND-FILL) (gimp-drawable-fill drawable BACKGROUND-FILL)
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-ellipse-select img 0 0 width height CHANNEL-OP-REPLACE TRUE FALSE 0) (gimp-ellipse-select img 0 0 width height CHANNEL-OP-REPLACE TRUE FALSE 0)
(gimp-edit-fill drawable BACKGROUND-FILL) (gimp-edit-fill drawable BACKGROUND-FILL)
(file-gbr-save 1 img drawable filename "" spacing name) (file-gbr-save 1 img drawable filename "" spacing name)
@ -164,41 +174,46 @@
(gimp-context-pop) (gimp-context-pop)
(gimp-brushes-refresh) (gimp-brushes-refresh)
(gimp-context-set-brush name))) (gimp-context-set-brush name)
)
)
(script-fu-register "script-fu-make-brush-elliptical" (script-fu-register "script-fu-make-brush-elliptical"
_"_Elliptical..." _"_Elliptical..."
_"Create an elliptical brush" _"Create an elliptical brush"
"Seth Burgess <sjburges@ou.edu>" "Seth Burgess <sjburges@ou.edu>"
"Seth Burgess" "Seth Burgess"
"1997" "1997"
"" ""
SF-STRING _"Name" "Ellipse" SF-STRING _"Name" "Ellipse"
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)) SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
)
(script-fu-menu-register "script-fu-make-brush-elliptical" (script-fu-menu-register "script-fu-make-brush-elliptical"
"<Brushes>") "<Brushes>")
(define (script-fu-make-brush-elliptical-feathered name width height (define (script-fu-make-brush-elliptical-feathered name
feathering spacing) width height
(let* ((widthplus (+ feathering width)) ; add 3 for blurring feathering spacing)
(heightplus (+ feathering height)) (let* (
(img (car (gimp-image-new widthplus heightplus GRAY))) (widthplus (+ feathering width)) ; add 3 for blurring
(drawable (car (gimp-layer-new img (heightplus (+ feathering height))
widthplus heightplus GRAY-IMAGE (img (car (gimp-image-new widthplus heightplus GRAY)))
"MakeBrush" 100 NORMAL-MODE))) (drawable (car (gimp-layer-new img
widthplus heightplus GRAY-IMAGE
(filename (string-append gimp-directory "MakeBrush" 100 NORMAL-MODE)))
"/brushes/e" (filename (string-append gimp-directory
(number->string width) "/brushes/e"
"x" (number->string width)
(number->string height) "x"
"f" (number->string height)
(number->string feathering) "f"
".gbr"))) (number->string feathering)
".gbr"))
)
(gimp-context-push) (gimp-context-push)
@ -208,14 +223,14 @@
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-drawable-fill drawable BACKGROUND-FILL) (gimp-drawable-fill drawable BACKGROUND-FILL)
(cond ((> feathering 0) ; keep from taking out gimp with stupid entry. (cond ((> feathering 0) ; keep from taking out gimp with stupid entry.
(gimp-ellipse-select img (gimp-ellipse-select img
(/ feathering 2) (/ feathering 2) (/ feathering 2) (/ feathering 2)
width height CHANNEL-OP-REPLACE width height CHANNEL-OP-REPLACE
TRUE TRUE feathering)) TRUE TRUE feathering))
((<= feathering 0) ((<= feathering 0)
(gimp-ellipse-select img 0 0 width height (gimp-ellipse-select img 0 0 width height
CHANNEL-OP-REPLACE TRUE FALSE 0))) CHANNEL-OP-REPLACE TRUE FALSE 0)))
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-fill drawable BACKGROUND-FILL) (gimp-edit-fill drawable BACKGROUND-FILL)
@ -224,22 +239,25 @@
(gimp-image-delete img) (gimp-image-delete img)
(gimp-context-pop) (gimp-context-pop)
(gimp-brushes-refresh) (gimp-brushes-refresh)
(gimp-context-set-brush name))) (gimp-context-set-brush name)
)
)
(script-fu-register "script-fu-make-brush-elliptical-feathered" (script-fu-register "script-fu-make-brush-elliptical-feathered"
_"Elli_ptical, Feathered..." _"Elli_ptical, Feathered..."
_"Create an elliptical brush with feathered edges" _"Create an elliptical brush with feathered edges"
"Seth Burgess <sjburges@ou.edu>" "Seth Burgess <sjburges@ou.edu>"
"Seth Burgess" "Seth Burgess"
"1997" "1997"
"" ""
SF-STRING _"Name" "Ellipse" SF-STRING _"Name" "Ellipse"
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1) SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1) SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1)
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)) SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
)
(script-fu-menu-register "script-fu-make-brush-elliptical-feathered" (script-fu-menu-register "script-fu-make-brush-elliptical-feathered"
"<Brushes>") "<Brushes>")

View File

@ -1,93 +1,105 @@
; NEON ; NEON
; Create a text effect that simulates neon lighting ; Create a text effect that simulates neon lighting
(define (set-pt a index x y)
(prog1
(aset a (* index 2) x)
(aset a (+ (* index 2) 1) y)))
(define (neon-spline1)
(let* ((a (cons-array 6 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 127 145)
(set-pt a 2 255 255)
a))
(define (neon-spline2)
(let* ((a (cons-array 6 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 110 150)
(set-pt a 2 255 255)
a))
(define (neon-spline3)
(let* ((a (cons-array 6 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 100 185)
(set-pt a 2 255 255)
a))
(define (neon-spline4)
(let* ((a (cons-array 8 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 64 64)
(set-pt a 2 127 192)
(set-pt a 3 255 255)
a))
(define (find-hue-offset color)
(let* ((R (car color))
(G (cadr color))
(B (caddr color))
(max-val (max R G B))
(min-val (min R G B))
(delta (- max-val min-val))
(hue 0))
(if (= delta 0) 0
(begin
(cond ((= max-val R) (set! hue (/ (- G B) (* 1.0 delta))))
((= max-val G) (set! hue (+ 2 (/ (- B R) (* 1.0 delta)))))
((= max-val B) (set! hue (+ 4 (/ (- R G) (* 1.0 delta))))))
(set! hue (* hue 60))
(if (< hue 0) (set! hue (+ hue 360)))
(if (> hue 360) (set! hue (- hue 360)))
(if (> hue 180) (set! hue (- hue 360)))
hue))))
(define (apply-neon-logo-effect img (define (apply-neon-logo-effect img
tube-layer tube-layer
size size
bg-color bg-color
glow-color glow-color
shadow) shadow)
(let* ((tube-hue (find-hue-offset glow-color))
(shrink (/ size 14)) (define (set-pt a index x y)
(grow (/ size 40)) (begin
(feather (/ size 5)) (aset a (* index 2) x)
(feather1 (/ size 25)) (aset a (+ (* index 2) 1) y)))
(feather2 (/ size 12))
(inc-shrink (/ size 100)) (define (neon-spline1)
(shadow-shrink (/ size 40)) (let* ((a (cons-array 6 'byte)))
(shadow-feather (/ size 20)) (set-pt a 0 0 0)
(shadow-offx (/ size 10)) (set-pt a 1 127 145)
(shadow-offy (/ size 10)) (set-pt a 2 255 255)
(width (car (gimp-drawable-width tube-layer))) a))
(height (car (gimp-drawable-height tube-layer)))
(glow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Neon Glow" 100 NORMAL-MODE))) (define (neon-spline2)
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (let* ((a (cons-array 6 'byte)))
(shadow-layer (if (= shadow TRUE) (set-pt a 0 0 0)
(car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 NORMAL-MODE)) (set-pt a 1 110 150)
0)) (set-pt a 2 255 255)
(selection 0)) a))
(define (neon-spline3)
(let* ((a (cons-array 6 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 100 185)
(set-pt a 2 255 255)
a))
(define (neon-spline4)
(let* ((a (cons-array 8 'byte)))
(set-pt a 0 0 0)
(set-pt a 1 64 64)
(set-pt a 2 127 192)
(set-pt a 3 255 255)
a))
(define (find-hue-offset color)
(let* (
(R (car color))
(G (cadr color))
(B (caddr color))
(max-val (max R G B))
(min-val (min R G B))
(delta (- max-val min-val))
(hue 0)
)
(if (= delta 0)
0
(begin
(cond
((= max-val R) (set! hue (/ (- G B) (* 1.0 delta))))
((= max-val G) (set! hue (+ 2 (/ (- B R) (* 1.0 delta)))))
((= max-val B) (set! hue (+ 4 (/ (- R G) (* 1.0 delta)))))
)
(set! hue (* hue 60))
(if (< hue 0) (set! hue (+ hue 360)))
(if (> hue 360) (set! hue (- hue 360)))
(if (> hue 180) (set! hue (- hue 360)))
hue
)
)
)
)
(let* (
(tube-hue (find-hue-offset glow-color))
(shrink (/ size 14))
(grow (/ size 40))
(feather (/ size 5))
(feather1 (/ size 25))
(feather2 (/ size 12))
(inc-shrink (/ size 100))
(shadow-shrink (/ size 40))
(shadow-feather (/ size 20))
(shadow-offx (/ size 10))
(shadow-offy (/ size 10))
(width (car (gimp-drawable-width tube-layer)))
(height (car (gimp-drawable-height tube-layer)))
(glow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Neon Glow" 100 NORMAL-MODE)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(shadow-layer (if (= shadow TRUE)
(car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 NORMAL-MODE))
0))
(selection 0)
)
(gimp-context-push) (gimp-context-push)
(script-fu-util-image-resize-from-layer img tube-layer) (script-fu-util-image-resize-from-layer img tube-layer)
(gimp-image-add-layer img bg-layer 1) (gimp-image-add-layer img bg-layer 1)
(if (not (= shadow 0)) (if (not (= shadow 0))
(begin (begin
(gimp-image-add-layer img shadow-layer 1) (gimp-image-add-layer img shadow-layer 1)
(gimp-edit-clear shadow-layer))) (gimp-edit-clear shadow-layer)))
(gimp-image-add-layer img glow-layer 1) (gimp-image-add-layer img glow-layer 1)
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
@ -148,78 +160,87 @@
(gimp-edit-fill glow-layer BACKGROUND-FILL) (gimp-edit-fill glow-layer BACKGROUND-FILL)
(if (not (= shadow 0)) (if (not (= shadow 0))
(begin (begin
(gimp-selection-load selection) (gimp-selection-load selection)
(gimp-selection-grow img grow) (gimp-selection-grow img grow)
(gimp-selection-shrink img shadow-shrink) (gimp-selection-shrink img shadow-shrink)
(gimp-selection-feather img shadow-feather) (gimp-selection-feather img shadow-feather)
(gimp-selection-translate img shadow-offx shadow-offy) (gimp-selection-translate img shadow-offx shadow-offy)
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-fill shadow-layer BACKGROUND-FILL))) (gimp-edit-fill shadow-layer BACKGROUND-FILL)))
(gimp-selection-none img) (gimp-selection-none img)
(gimp-drawable-set-name tube-layer "Neon Tubes") (gimp-drawable-set-name tube-layer "Neon Tubes")
(gimp-image-remove-channel img selection) (gimp-image-remove-channel img selection)
(gimp-context-pop))) (gimp-context-pop)
)
)
(define (script-fu-neon-logo-alpha img (define (script-fu-neon-logo-alpha img
tube-layer tube-layer
size size
bg-color bg-color
glow-color glow-color
shadow) shadow)
(begin (begin
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(apply-neon-logo-effect img tube-layer size bg-color glow-color shadow) (apply-neon-logo-effect img tube-layer size bg-color glow-color shadow)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-neon-logo-alpha" (script-fu-register "script-fu-neon-logo-alpha"
_"N_eon..." _"N_eon..."
_"Convert the selected region (or alpha) into a neon-sign like object" _"Convert the selected region (or alpha) into a neon-sign like object"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"RGBA" "RGBA"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Effect size (pixels * 5)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Effect size (pixels * 5)" '(150 2 1000 1 10 0 1)
SF-COLOR _"Background color" "black" SF-COLOR _"Background color" '(0 0 0)
SF-COLOR _"Glow color" '(38 211 255) SF-COLOR _"Glow color" '(38 211 255)
SF-TOGGLE _"Create shadow" FALSE) SF-TOGGLE _"Create shadow" FALSE
)
(script-fu-menu-register "script-fu-neon-logo-alpha" (script-fu-menu-register "script-fu-neon-logo-alpha"
"<Image>/Filters/Alpha to Logo") "<Image>/Filters/Alpha to Logo")
(define (script-fu-neon-logo text (define (script-fu-neon-logo text
size size
font font
bg-color bg-color
glow-color glow-color
shadow) shadow)
(let* ((img (car (gimp-image-new 256 256 RGB))) (let* (
(border (/ size 4)) (img (car (gimp-image-new 256 256 RGB)))
(tube-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))) (border (/ size 4))
(tube-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
(apply-neon-logo-effect img tube-layer size bg-color glow-color shadow) (apply-neon-logo-effect img tube-layer size bg-color glow-color shadow)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img))) (gimp-display-new img)
)
)
(script-fu-register "script-fu-neon-logo" (script-fu-register "script-fu-neon-logo"
_"N_eon..." _"N_eon..."
_"Create a logo in the style of a neon sign" _"Create a logo in the style of a neon sign"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"" ""
SF-STRING _"Text" "NEON" SF-STRING _"Text" "NEON"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Blippo" SF-FONT _"Font" "Blippo"
SF-COLOR _"Background color" "black" SF-COLOR _"Background color" '(0 0 0)
SF-COLOR _"Glow color" '(38 211 255) SF-COLOR _"Glow color" '(38 211 255)
SF-TOGGLE _"Create shadow" FALSE) SF-TOGGLE _"Create shadow" FALSE
)
(script-fu-menu-register "script-fu-neon-logo" (script-fu-menu-register "script-fu-neon-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -3,31 +3,34 @@
; ;
; ;
; Based on alien glow code from Adrian Likins ; Based on alien glow code from Adrian Likins
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-newsprint-text string font font-size cell-size density blur-radius text-color bg-color) (define (script-fu-newsprint-text string font font-size cell-size
(let* ((text-ext (gimp-text-get-extents-fontname string font-size PIXELS font)) density blur-radius text-color bg-color)
(width (+ (car text-ext) 20 blur-radius)) (let* (
(height (+ (nth 1 text-ext) 20 blur-radius)) (text-ext (gimp-text-get-extents-fontname string font-size PIXELS font))
(img (car (gimp-image-new width height RGB))) (width (+ (car text-ext) 20 blur-radius))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))) (height (+ (list-ref text-ext 1) 20 blur-radius))
(text-layer (car (gimp-layer-new img width height RGBA-IMAGE "Text layer" 100 NORMAL-MODE))) (img (car (gimp-image-new width height RGB)))
(text-mask 0) (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(grey (/ (* density 255) 100))) (text-layer (car (gimp-layer-new img width height RGBA-IMAGE "Text layer" 100 NORMAL-MODE)))
(text-mask 0)
(grey (/ (* density 255) 100))
)
(gimp-context-push) (gimp-context-push)
@ -40,7 +43,10 @@
(gimp-edit-clear text-layer) (gimp-edit-clear text-layer)
(gimp-context-set-foreground text-color) (gimp-context-set-foreground text-color)
(gimp-floating-sel-anchor (car (gimp-text-fontname img text-layer (/ (+ 20 blur-radius) 2) (/ (+ 20 blur-radius) 2) string 0 TRUE font-size PIXELS font))) (gimp-floating-sel-anchor
(car (gimp-text-fontname img text-layer
(/ (+ 20 blur-radius) 2) (/ (+ 20 blur-radius) 2)
string 0 TRUE font-size PIXELS font)))
(set! text-mask (car (gimp-layer-create-mask text-layer ADD-ALPHA-MASK))) (set! text-mask (car (gimp-layer-create-mask text-layer ADD-ALPHA-MASK)))
(gimp-layer-add-mask text-layer text-mask) (gimp-layer-add-mask text-layer text-mask)
@ -53,31 +59,36 @@
(plug-in-gauss-iir 1 img text-mask blur-radius 1 1) (plug-in-gauss-iir 1 img text-mask blur-radius 1 1)
) )
(plug-in-newsprint 1 img text-mask cell-size 0 0 45.0 3 45.0 0 45.0 0 45.0 0 3) (plug-in-newsprint 1 img text-mask cell-size
0 0 45.0 3 45.0 0 45.0 0 45.0 0 3)
(gimp-edit-fill text-layer FOREGROUND-FILL) (gimp-edit-fill text-layer FOREGROUND-FILL)
(gimp-layer-remove-mask text-layer MASK-APPLY) (gimp-layer-remove-mask text-layer MASK-APPLY)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-newsprint-text" (script-fu-register "script-fu-newsprint-text"
_"Newsprint Text..." _"Newsprint Te_xt..."
_"Create a logo in the style newpaper printing" _"Create a logo in the style newpaper printing"
"Austin Donnelly" "Austin Donnelly"
"Austin Donnelly" "Austin Donnelly"
"1998" "1998"
"" ""
SF-STRING _"Text" "Newsprint" SF-STRING _"Text" "Newsprint"
SF-FONT _"Font" "Sans" SF-FONT _"Font" "Sans"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-ADJUSTMENT _"Cell size (pixels)" '(7 1 100 1 10 0 1) SF-ADJUSTMENT _"Cell size (pixels)" '(7 1 100 1 10 0 1)
SF-ADJUSTMENT _"Density (%)" '(60 0 100 1 10 0 0) SF-ADJUSTMENT _"Density (%)" '(60 0 100 1 10 0 0)
SF-ADJUSTMENT _"Blur radius" '(0 0 100 1 5 0 0) SF-ADJUSTMENT _"Blur radius" '(0 0 100 1 5 0 0)
SF-COLOR _"Text color" "black" SF-COLOR _"Text color" '(0 0 0)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-newsprint-text" (script-fu-menu-register "script-fu-newsprint-text"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -9,12 +9,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -25,78 +25,85 @@
; Define the function: ; Define the function:
(define (script-fu-old-photo inImage inLayer inDefocus inBorderSize inSepia inMottle inCopy) (define (script-fu-old-photo inImage inLayer inDefocus inBorderSize inSepia inMottle inCopy)
(let (
(theImage)
(theLayer)
(theWidth)
(theHeight)
)
(gimp-image-undo-group-start inImage) (gimp-image-undo-group-start inImage)
(gimp-selection-all inImage) (gimp-selection-all inImage)
(set! theImage (if (= inCopy TRUE) (set! theImage (if (= inCopy TRUE)
(car (gimp-image-duplicate inImage)) (car (gimp-image-duplicate inImage))
inImage) inImage)
) )
(set! theLayer (car (gimp-image-flatten theImage))) (set! theLayer (car (gimp-image-flatten theImage)))
(if (= inDefocus TRUE) (if (= inDefocus TRUE)
(plug-in-gauss-rle TRUE theImage theLayer 1.5 TRUE TRUE) (plug-in-gauss-rle TRUE theImage theLayer 1.5 TRUE TRUE)
() )
)
(if (> inBorderSize 0) (if (> inBorderSize 0)
(script-fu-fuzzy-border theImage theLayer '(255 255 255) (script-fu-fuzzy-border theImage theLayer '(255 255 255)
inBorderSize TRUE 8 FALSE 100 FALSE TRUE ) inBorderSize TRUE 8 FALSE 100 FALSE TRUE )
() )
)
(set! theLayer (car (gimp-image-flatten theImage))) (set! theLayer (car (gimp-image-flatten theImage)))
(if (= inSepia TRUE) (if (= inSepia TRUE)
(begin (gimp-desaturate theLayer) (begin (gimp-desaturate theLayer)
(gimp-brightness-contrast theLayer -20 -40) (gimp-brightness-contrast theLayer -20 -40)
(gimp-color-balance theLayer 0 TRUE 30 0 -30) (gimp-color-balance theLayer 0 TRUE 30 0 -30)
)
()
) )
)
(set! theWidth (car (gimp-image-width theImage))) (set! theWidth (car (gimp-image-width theImage)))
(set! theHeight (car (gimp-image-height theImage))) (set! theHeight (car (gimp-image-height theImage)))
(if (= inMottle TRUE) (if (= inMottle TRUE)
(begin (set! mLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Mottle" 100 DARKEN-ONLY-MODE))) (begin (set! mLayer (car (gimp-layer-new theImage theWidth theHeight
RGBA-IMAGE "Mottle"
(gimp-image-add-layer theImage mLayer 0) 100 DARKEN-ONLY-MODE)))
(gimp-selection-all theImage)
(gimp-edit-clear mLayer) (gimp-image-add-layer theImage mLayer 0)
(gimp-selection-none theImage) (gimp-selection-all theImage)
(plug-in-noisify TRUE theImage mLayer TRUE 0 0 0 0.5) (gimp-edit-clear mLayer)
(plug-in-gauss-rle TRUE theImage mLayer 5 TRUE TRUE) (gimp-selection-none theImage)
(set! theLayer (car (gimp-image-flatten theImage))) (plug-in-noisify TRUE theImage mLayer TRUE 0 0 0 0.5)
) (plug-in-gauss-rle TRUE theImage mLayer 5 TRUE TRUE)
() (set! theLayer (car (gimp-image-flatten theImage)))
) )
)
(if (= inCopy TRUE)
(begin (gimp-image-clean-all theImage) (if (= inCopy TRUE)
(gimp-display-new theImage) (begin (gimp-image-clean-all theImage)
) (gimp-display-new theImage)
() )
) )
(gimp-selection-none inImage) (gimp-selection-none inImage)
(gimp-image-undo-group-end inImage) (gimp-image-undo-group-end inImage)
(gimp-displays-flush theImage) (gimp-displays-flush theImage)
) )
)
; Register the function with the GIMP:
(script-fu-register "script-fu-old-photo" (script-fu-register "script-fu-old-photo"
_"_Old Photo..." _"_Old Photo..."
_"Make an image look like an old photo" _"Make an image look like an old photo"
"Chris Gutteridge" "Chris Gutteridge"
"1998, Chris Gutteridge / ECS dept, University of Southampton, England." "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
"16th April 1998" "16th April 1998"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "The image" 0 SF-IMAGE "The image" 0
SF-DRAWABLE "The layer" 0 SF-DRAWABLE "The layer" 0
SF-TOGGLE _"Defocus" TRUE SF-TOGGLE _"Defocus" TRUE
SF-ADJUSTMENT _"Border size" '(20 0 300 1 10 0 1) SF-ADJUSTMENT _"Border size" '(20 0 300 1 10 0 1)
; since this plug-in uses the fuzzy-border plug-in, I used the ; since this plug-in uses the fuzzy-border plug-in, I used the
; values of the latter, with the exception of the initial value ; values of the latter, with the exception of the initial value
; and the 'minimum' value. ; and the 'minimum' value.
SF-TOGGLE _"Sepia" TRUE SF-TOGGLE _"Sepia" TRUE
SF-TOGGLE _"Mottle" FALSE SF-TOGGLE _"Mottle" FALSE
SF-TOGGLE _"Work on copy" TRUE) SF-TOGGLE _"Work on copy" TRUE
)
(script-fu-menu-register "script-fu-old-photo" (script-fu-menu-register "script-fu-old-photo"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; script-fu-paste-as-brush ; script-fu-paste-as-brush
; Based on select-to-brush by Copyright (c) 1997 Adrian Likins ; Based on select-to-brush by Copyright (c) 1997 Adrian Likins
; ;
@ -8,58 +8,62 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-paste-as-brush name (define (script-fu-paste-as-brush name filename spacing)
filename
spacing)
(set! brush-image (car (gimp-edit-paste-as-new))) (let* (
(set! brush-draw (car (gimp-image-get-active-drawable brush-image))) (brush-image (car (gimp-edit-paste-as-new)))
(set! type (car (gimp-drawable-type brush-draw))) (brush-draw (car (gimp-image-get-active-drawable brush-image)))
(type (car (gimp-drawable-type brush-draw)))
)
(if (= type GRAYA-IMAGE) (if (= type GRAYA-IMAGE)
(begin (begin
(gimp-context-push) (gimp-context-push)
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(set! brush-draw (car (gimp-image-flatten brush-image))) (set! brush-draw (car (gimp-image-flatten brush-image)))
(gimp-context-pop)) (gimp-context-pop)
()) )
)
(set! path (string-append gimp-directory (set! path (string-append gimp-directory
"/brushes/" "/brushes/"
filename filename
(number->string brush-image) (number->string brush-image)
".gbr")) ".gbr"))
(file-gbr-save RUN-NONINTERACTIVE (file-gbr-save RUN-NONINTERACTIVE
brush-image brush-draw path path brush-image brush-draw path path
spacing name) spacing name)
(gimp-image-delete brush-image) (gimp-image-delete brush-image)
(gimp-brushes-refresh) (gimp-brushes-refresh)
(gimp-context-set-brush name)) (gimp-context-set-brush name)
)
)
(script-fu-register "script-fu-paste-as-brush" (script-fu-register "script-fu-paste-as-brush"
_"New _Brush..." _"New _Brush..."
_"Paste the clipboard contents into a new brush" _"Paste the clipboard contents into a new brush"
"Michael Natterer <mitch@gimp.org>" "Michael Natterer <mitch@gimp.org>"
"Michael Natterer" "Michael Natterer"
"2005-09-25" "2005-09-25"
"" ""
SF-STRING _"Brush name" "My Brush" SF-STRING _"Brush name" "My Brush"
SF-STRING _"File name" "mybrush" SF-STRING _"File name" "mybrush"
SF-ADJUSTMENT _"Spacing" '(25 0 1000 1 1 1 0)) SF-ADJUSTMENT _"Spacing" '(25 0 1000 1 1 1 0)
)
(script-fu-menu-register "script-fu-paste-as-brush" (script-fu-menu-register "script-fu-paste-as-brush"
"<Image>/Edit/Paste as") "<Image>/Edit/Paste as")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; script-fu-paste-as-pattern ; script-fu-paste-as-pattern
; Based on select-to-pattern by Cameron Gregory, http://www.flamingtext.com/ ; Based on select-to-pattern by Cameron Gregory, http://www.flamingtext.com/
; ;
@ -8,48 +8,48 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-paste-as-pattern name (define (script-fu-paste-as-pattern name filename)
filename)
(set! pattern-image (car (gimp-edit-paste-as-new))) (set! pattern-image (car (gimp-edit-paste-as-new)))
(set! pattern-draw (car (gimp-image-get-active-drawable pattern-image))) (set! pattern-draw (car (gimp-image-get-active-drawable pattern-image)))
(set! path (string-append gimp-directory (set! path (string-append gimp-directory
"/patterns/" "/patterns/"
filename filename
(number->string pattern-image) (number->string pattern-image)
".pat")) ".pat"))
(file-pat-save RUN-NONINTERACTIVE (file-pat-save RUN-NONINTERACTIVE
pattern-image pattern-draw path path pattern-image pattern-draw path path
name) name)
(gimp-image-delete pattern-image) (gimp-image-delete pattern-image)
(gimp-patterns-refresh) (gimp-patterns-refresh)
(gimp-context-set-pattern name)) (gimp-context-set-pattern name)
)
(script-fu-register "script-fu-paste-as-pattern"
(script-fu-register "script-fu-paste-as-pattern" _"New _Pattern..."
_"New _Pattern..." _"Paste the clipboard contents into a new pattern"
_"Paste the clipboard contents into a new pattern" "Michael Natterer <mitch@gimp.org>"
"Michael Natterer <mitch@gimp.org>" "Michael Natterer"
"Michael Natterer" "2005-09-25"
"2005-09-25" ""
"" SF-STRING _"Pattern name" "My Pattern"
SF-STRING _"Pattern name" "My Pattern" SF-STRING _"File name" "mypattern"
SF-STRING _"File name" "mypattern") )
(script-fu-menu-register "script-fu-paste-as-pattern" (script-fu-menu-register "script-fu-paste-as-pattern"
"<Image>/Edit/Paste as") "<Image>/Edit/Paste as")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -19,85 +19,88 @@
; perspective-shadow.scm version 1.2 2000/11/08 ; perspective-shadow.scm version 1.2 2000/11/08
; ;
; Copyright (C) 1997-2000 Sven Neumann <sven@gimp.org> ; Copyright (C) 1997-2000 Sven Neumann <sven@gimp.org>
; ;
; ;
; Adds a perspective shadow of the current selection or alpha-channel ; Adds a perspective shadow of the current selection or alpha-channel
; as a layer below the active layer ; as a layer below the active layer
; ;
(define (script-fu-perspective-shadow image (define (script-fu-perspective-shadow image
drawable drawable
alpha alpha
rel-distance rel-distance
rel-length rel-length
shadow-blur shadow-blur
shadow-color shadow-color
shadow-opacity shadow-opacity
interpolation interpolation
allow-resize) allow-resize)
(let* ((shadow-blur (max shadow-blur 0)) (let* (
(shadow-opacity (min shadow-opacity 100)) (shadow-blur (max shadow-blur 0))
(shadow-opacity (max shadow-opacity 0)) (shadow-opacity (min shadow-opacity 100))
(rel-length (abs rel-length)) (shadow-opacity (max shadow-opacity 0))
(alpha (* (/ alpha 180) *pi*)) (rel-length (abs rel-length))
(type (car (gimp-drawable-type-with-alpha drawable))) (*pi* (* 4 (atan 1.0)))
(image-width (car (gimp-image-width image))) (alpha (* (/ alpha 180) *pi*))
(image-height (car (gimp-image-height image))) (type (car (gimp-drawable-type-with-alpha drawable)))
(from-selection 0) (image-width (car (gimp-image-width image)))
(active-selection 0) (image-height (car (gimp-image-height image)))
(shadow-layer 0)) (from-selection 0)
(active-selection 0)
(if (= rel-distance 0) (set! rel-distance 999999)) (shadow-layer 0)
)
(gimp-context-push) (gimp-context-push)
(if (= rel-distance 0) (set! rel-distance 999999))
(gimp-image-undo-group-start image) (gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable) (gimp-layer-add-alpha drawable)
(if (= (car (gimp-selection-is-empty image)) TRUE) (if (= (car (gimp-selection-is-empty image)) TRUE)
(begin (begin
(gimp-selection-layer-alpha drawable) (gimp-selection-layer-alpha drawable)
(set! from-selection FALSE)) (set! from-selection FALSE))
(begin (begin
(set! from-selection TRUE) (set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image))))) (set! active-selection (car (gimp-selection-save image)))))
(let* ((selection-bounds (gimp-selection-bounds image)) (let* ((selection-bounds (gimp-selection-bounds image))
(select-offset-x (cadr selection-bounds)) (select-offset-x (cadr selection-bounds))
(select-offset-y (caddr selection-bounds)) (select-offset-y (caddr selection-bounds))
(select-width (- (cadr (cddr selection-bounds)) select-offset-x)) (select-width (- (cadr (cddr selection-bounds)) select-offset-x))
(select-height (- (caddr (cddr selection-bounds)) select-offset-y)) (select-height (- (caddr (cddr selection-bounds)) select-offset-y))
(abs-length (* rel-length select-height)) (abs-length (* rel-length select-height))
(abs-distance (* rel-distance select-height)) (abs-distance (* rel-distance select-height))
(half-bottom-width (/ select-width 2)) (half-bottom-width (/ select-width 2))
(half-top-width (* half-bottom-width (half-top-width (* half-bottom-width
(/ (- rel-distance rel-length) rel-distance))) (/ (- rel-distance rel-length) rel-distance)))
(x0 (+ select-offset-x (+ (- half-bottom-width half-top-width) (x0 (+ select-offset-x (+ (- half-bottom-width half-top-width)
(* (cos alpha) abs-length)))) (* (cos alpha) abs-length))))
(y0 (+ select-offset-y (- select-height (y0 (+ select-offset-y (- select-height
(* (sin alpha) abs-length)))) (* (sin alpha) abs-length))))
(x1 (+ x0 (* 2 half-top-width))) (x1 (+ x0 (* 2 half-top-width)))
(y1 y0) (y1 y0)
(x2 select-offset-x) (x2 select-offset-x)
(y2 (+ select-offset-y select-height)) (y2 (+ select-offset-y select-height))
(x3 (+ x2 select-width)) (x3 (+ x2 select-width))
(y3 y2) (y3 y2)
(shadow-width (+ (- (max x1 x3) (min x0 x2)) (* 2 shadow-blur)))
(shadow-height (+ (- (max y1 y3) (min y0 y2)) (* 2 shadow-blur)))
(shadow-offset-x (- (min x0 x2) shadow-blur))
(shadow-offset-y (- (min y0 y2) shadow-blur)))
(shadow-width (+ (- (max x1 x3) (min x0 x2)) (* 2 shadow-blur)))
(shadow-height (+ (- (max y1 y3) (min y0 y2)) (* 2 shadow-blur)))
(shadow-offset-x (- (min x0 x2) shadow-blur))
(shadow-offset-y (- (min y0 y2) shadow-blur)))
(set! shadow-layer (car (gimp-layer-new image (set! shadow-layer (car (gimp-layer-new image
select-width select-width
select-height select-height
type type
"Perspective Shadow" "Perspective Shadow"
shadow-opacity shadow-opacity
NORMAL-MODE))) NORMAL-MODE)))
(gimp-image-add-layer image shadow-layer -1) (gimp-image-add-layer image shadow-layer -1)
@ -108,60 +111,61 @@
(gimp-selection-none image) (gimp-selection-none image)
(if (= allow-resize TRUE) (if (= allow-resize TRUE)
(let* ((new-image-width image-width) (let* ((new-image-width image-width)
(new-image-height image-height) (new-image-height image-height)
(image-offset-x 0) (image-offset-x 0)
(image-offset-y 0)) (image-offset-y 0))
(if (< shadow-offset-x 0) (if (< shadow-offset-x 0)
(begin (begin
(set! image-offset-x (- 0 shadow-offset-x)) (set! image-offset-x (- 0 shadow-offset-x))
(set! new-image-width (- new-image-width image-offset-x)))) (set! new-image-width (- new-image-width image-offset-x))))
(if (< shadow-offset-y 0)
(begin
(set! image-offset-y (- 0 shadow-offset-y))
(set! new-image-height (- new-image-height image-offset-y))))
(if (> (+ shadow-width shadow-offset-x) new-image-width)
(set! new-image-width (+ shadow-width shadow-offset-x)))
(if (> (+ shadow-height shadow-offset-y) new-image-height)
(set! new-image-height (+ shadow-height shadow-offset-y)))
(gimp-image-resize image
new-image-width
new-image-height
image-offset-x
image-offset-y)))
(if (< shadow-offset-y 0)
(begin
(set! image-offset-y (- 0 shadow-offset-y))
(set! new-image-height (- new-image-height image-offset-y))))
(if (> (+ shadow-width shadow-offset-x) new-image-width)
(set! new-image-width (+ shadow-width shadow-offset-x)))
(if (> (+ shadow-height shadow-offset-y) new-image-height)
(set! new-image-height (+ shadow-height shadow-offset-y)))
(gimp-image-resize image
new-image-width
new-image-height
image-offset-x
image-offset-y)))
(gimp-drawable-transform-perspective shadow-layer (gimp-drawable-transform-perspective shadow-layer
x0 y0 x0 y0
x1 y1 x1 y1
x2 y2 x2 y2
x3 y3 x3 y3
TRANSFORM-FORWARD interpolation TRANSFORM-FORWARD
TRUE 3 FALSE) interpolation
TRUE 3 FALSE)
(if (>= shadow-blur 1.0) (if (>= shadow-blur 1.0)
(begin (begin
(gimp-layer-set-lock-alpha shadow-layer FALSE) (gimp-layer-set-lock-alpha shadow-layer FALSE)
(gimp-layer-resize shadow-layer (gimp-layer-resize shadow-layer
shadow-width shadow-width
shadow-height shadow-height
shadow-blur shadow-blur
shadow-blur) shadow-blur)
(plug-in-gauss-rle 1 (plug-in-gauss-rle 1
image image
shadow-layer shadow-layer
shadow-blur shadow-blur
TRUE TRUE
TRUE)))) TRUE))))
(if (= from-selection TRUE) (if (= from-selection TRUE)
(begin (begin
(gimp-selection-load active-selection) (gimp-selection-load active-selection)
(gimp-edit-clear shadow-layer) (gimp-edit-clear shadow-layer)
(gimp-image-remove-channel image active-selection))) (gimp-image-remove-channel image active-selection)))
(if (and (if (and
(= (car (gimp-layer-is-floating-sel drawable)) 0) (= (car (gimp-layer-is-floating-sel drawable)) 0)
@ -172,25 +176,28 @@
(gimp-image-undo-group-end image) (gimp-image-undo-group-end image)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-perspective-shadow" (script-fu-register "script-fu-perspective-shadow"
_"_Perspective..." _"_Perspective..."
_"Add a perspective shadow to the selected region (or alpha)" _"Add a perspective shadow to the selected region (or alpha)"
"Sven Neumann <sven@gimp.org>" "Sven Neumann <sven@gimp.org>"
"Sven Neumann" "Sven Neumann"
"2000/11/08" "2000/11/08"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Angle" '(45 0 180 1 10 1 0) SF-ADJUSTMENT _"Angle" '(45 0 180 1 10 1 0)
SF-ADJUSTMENT _"Relative distance of horizon" '(5 0 24 .1 1 1 1) SF-ADJUSTMENT _"Relative distance of horizon" '(5 0 24 .1 1 1 1)
SF-ADJUSTMENT _"Relative length of shadow" '(1 0 24 .1 1 1 1) SF-ADJUSTMENT _"Relative length of shadow" '(1 0 24 .1 1 1 1)
SF-ADJUSTMENT _"Blur radius" '(3 0 1024 1 10 0 0) SF-ADJUSTMENT _"Blur radius" '(3 0 1024 1 10 0 0)
SF-COLOR _"Color" '(0 0 0) SF-COLOR _"Color" '(0 0 0)
SF-ADJUSTMENT _"Opacity" '(80 0 100 1 10 0 0) SF-ADJUSTMENT _"Opacity" '(80 0 100 1 10 0 0)
SF-ENUM _"Interpolation" '("InterpolationType" "linear") SF-ENUM _"Interpolation" '("InterpolationType" "linear")
SF-TOGGLE _"Allow resizing" FALSE) SF-TOGGLE _"Allow resizing" FALSE
)
(script-fu-menu-register "script-fu-perspective-shadow" (script-fu-menu-register "script-fu-perspective-shadow"
"<Image>/Filters/Light and Shadow/Shadow") "<Image>/Filters/Light and Shadow/Shadow")

View File

@ -1,11 +1,11 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Predator effect ; Predator effect
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.ed ; aklikins@eos.ncsu.ed
; ;
; The idea here is too make the image/selection look sort of like ; The idea here is too make the image/selection look sort of like
; the view the predator had in the movies. ie, kind of a thermogram ; the view the predator had in the movies. ie, kind of a thermogram
; type of thing. Works best on colorful rgb images. ; type of thing. Works best on colorful rgb images.
; ;
@ -13,113 +13,122 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-predator image (define (script-fu-predator image
drawable drawable
edge-amount edge-amount
pixelize pixelize
pixel-size pixel-size
keep-selection keep-selection
separate-layer) separate-layer)
(let* ( (let* (
(type (car (gimp-drawable-type-with-alpha drawable))) (type (car (gimp-drawable-type-with-alpha drawable)))
(image-width (car (gimp-image-width image))) (image-width (car (gimp-image-width image)))
(image-height (car (gimp-image-height image))) (image-height (car (gimp-image-height image)))
(active-selection) (active-selection)
(from-selection) (from-selection)
(selection-bounds) (selection-bounds)
(select-offset-x) (select-offset-x)
(select-offset-y) (select-offset-y)
(select-width) (select-width)
(select-height) (select-height)
(effect-layer) (effect-layer)
(active-layer)) (active-layer)
)
(gimp-image-undo-group-start image) (gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable) (gimp-layer-add-alpha drawable)
(if (= (car (gimp-selection-is-empty image)) TRUE) (if (= (car (gimp-selection-is-empty image)) TRUE)
(begin (begin
(gimp-selection-layer-alpha drawable) (gimp-selection-layer-alpha drawable)
(set! active-selection (car (gimp-selection-save image))) (set! active-selection (car (gimp-selection-save image)))
(set! from-selection FALSE)) (set! from-selection FALSE)
(begin )
(begin
(set! from-selection TRUE) (set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image))))) (set! active-selection (car (gimp-selection-save image)))
)
)
(set! selection-bounds (gimp-selection-bounds image)) (set! selection-bounds (gimp-selection-bounds image))
(set! select-offset-x (cadr selection-bounds)) (set! select-offset-x (cadr selection-bounds))
(set! select-offset-y (caddr selection-bounds)) (set! select-offset-y (caddr selection-bounds))
(set! select-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
(set! select-height (- (caddr (cddr selection-bounds)) select-offset-y)) (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
(if (= separate-layer TRUE) (if (= separate-layer TRUE)
(begin (begin
(set! effect-layer (car (gimp-layer-new image (set! effect-layer (car (gimp-layer-new image
select-width select-width
select-height select-height
type type
"glow layer" "glow layer"
100 100
NORMAL-MODE))) NORMAL-MODE))
)
(gimp-layer-set-offsets effect-layer select-offset-x select-offset-y)
(gimp-image-add-layer image effect-layer -1) (gimp-layer-set-offsets effect-layer select-offset-x select-offset-y)
(gimp-selection-none image) (gimp-image-add-layer image effect-layer -1)
(gimp-edit-clear effect-layer) (gimp-selection-none image)
(gimp-edit-clear effect-layer)
(gimp-selection-load active-selection)
(gimp-edit-copy drawable) (gimp-selection-load active-selection)
(let ((floating-sel (car (gimp-edit-paste effect-layer FALSE)))) (gimp-edit-copy drawable)
(gimp-floating-sel-anchor floating-sel) (let ((floating-sel (car (gimp-edit-paste effect-layer FALSE))))
) (gimp-floating-sel-anchor floating-sel)
(gimp-image-set-active-layer image effect-layer )) )
(set! effect-layer drawable) )
(set! effect-layer drawable)
) )
(set! active-layer effect-layer) (set! active-layer effect-layer)
; all the fun stuff goes here ; all the fun stuff goes here
(if (= pixelize TRUE) (if (= pixelize TRUE)
(plug-in-pixelize 1 image active-layer pixel-size)) (plug-in-pixelize 1 image active-layer pixel-size)
)
(plug-in-max-rgb 1 image active-layer 0) (plug-in-max-rgb 1 image active-layer 0)
(plug-in-edge 1 image active-layer edge-amount 1 0) (plug-in-edge 1 image active-layer edge-amount 1 0)
; clean up the selection copy ; clean up the selection copy
(gimp-selection-load active-selection) (gimp-selection-load active-selection)
(if (= keep-selection FALSE) (if (= keep-selection FALSE)
(gimp-selection-none image)) (gimp-selection-none image)
)
(gimp-image-set-active-layer image drawable) (gimp-image-set-active-layer image drawable)
(gimp-image-remove-channel image active-selection) (gimp-image-remove-channel image active-selection)
(gimp-image-undo-group-end image) (gimp-image-undo-group-end image)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-predator" (script-fu-register "script-fu-predator"
_"_Predator..." _"_Predator..."
_"Add a 'Predator' effect to the selected region (or alpha)" _"Add a 'Predator' effect to the selected region (or alpha)"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"Adrian Likins" "Adrian Likins"
"10/12/97" "10/12/97"
"RGB*" "RGB*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Edge amount" '(2 0 24 1 1 0 0) SF-ADJUSTMENT _"Edge amount" '(2 0 24 1 1 0 0)
SF-TOGGLE _"Pixelize" TRUE SF-TOGGLE _"Pixelize" TRUE
SF-ADJUSTMENT _"Pixel amount" '(3 1 16 1 1 0 0) SF-ADJUSTMENT _"Pixel amount" '(3 1 16 1 1 0 0)
SF-TOGGLE _"Keep selection" TRUE SF-TOGGLE _"Keep selection" TRUE
SF-TOGGLE _"Separate layer" TRUE) SF-TOGGLE _"Separate layer" TRUE
)
(script-fu-menu-register "script-fu-predator" (script-fu-menu-register "script-fu-predator"
"<Image>/Filters/Artistic") "<Image>/Filters/Artistic")

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Round Button --- create a round beveled Web button. ; Round Button --- create a round beveled Web button.
; Copyright (C) 1998 Federico Mena Quintero & Arturo Espinosa Aldama ; Copyright (C) 1998 Federico Mena Quintero & Arturo Espinosa Aldama
; federico@nuclecu.unam.mx arturo@nuclecu.unam.mx ; federico@nuclecu.unam.mx arturo@nuclecu.unam.mx
@ -10,121 +10,123 @@
; All calls to gimp-text-* have been converted to use the *-fontname form. ; All calls to gimp-text-* have been converted to use the *-fontname form.
; The corresponding parameters have been replaced by an SF-FONT parameter. ; The corresponding parameters have been replaced by an SF-FONT parameter.
; ************************************************************************ ; ************************************************************************
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (text-width extents)
(car extents))
(define (text-height extents)
(cadr extents))
(define (text-ascent extents)
(caddr extents))
(define (text-descent extents)
(cadr (cddr extents)))
(define (round-select img
x
y
width
height
ratio)
(let* ((diameter (* ratio height)))
(gimp-ellipse-select img x y diameter height CHANNEL-OP-ADD FALSE 0 0)
(gimp-ellipse-select img (+ x (- width diameter)) y
diameter height CHANNEL-OP-ADD FALSE 0 0)
(gimp-rect-select img (+ x (/ diameter 2)) y
(- width diameter) height CHANNEL-OP-ADD FALSE 0)))
(define (script-fu-round-button text (define (script-fu-round-button text
size size
font font
ul-color ul-color
lr-color lr-color
text-color text-color
ul-color-high ul-color-high
lr-color-high lr-color-high
hlight-color hlight-color
xpadding xpadding
ypadding ypadding
bevel bevel
ratio ratio
notpressed notpressed
notpressed-active notpressed-active
pressed) pressed)
(cond ((eqv? notpressed TRUE) (cond ((eqv? notpressed TRUE)
(do-pupibutton text size font ul-color lr-color (do-pupibutton text size font ul-color lr-color
text-color xpadding ypadding bevel ratio 0))) text-color xpadding ypadding bevel ratio 0)))
(cond ((eqv? notpressed-active TRUE) (cond ((eqv? notpressed-active TRUE)
(do-pupibutton text size font ul-color-high lr-color-high (do-pupibutton text size font ul-color-high lr-color-high
hlight-color xpadding ypadding bevel ratio 0))) hlight-color xpadding ypadding bevel ratio 0)))
(cond ((eqv? pressed TRUE) (cond ((eqv? pressed TRUE)
(do-pupibutton text size font ul-color-high lr-color-high (do-pupibutton text size font ul-color-high lr-color-high
hlight-color xpadding ypadding bevel ratio 1)))) hlight-color xpadding ypadding bevel ratio 1))))
(define (do-pupibutton text (define (do-pupibutton text
size size
font font
ul-color ul-color
lr-color lr-color
text-color text-color
xpadding xpadding
ypadding ypadding
bevel bevel
ratio ratio
pressed) pressed)
(let* ((text-extents (gimp-text-get-extents-fontname text (define (text-width extents)
size (car extents))
PIXELS
font))
(ascent (text-ascent text-extents))
(descent (text-descent text-extents))
(height (+ (* 2 (+ ypadding bevel)) (define (text-height extents)
(+ ascent descent))) (cadr extents))
(radius (/ (* ratio height) 4)) (define (text-ascent extents)
(caddr extents))
(width (+ (* 2 (+ radius xpadding)) (define (text-descent extents)
bevel (cadr (cddr extents)))
(text-width text-extents)))
(img (car (gimp-image-new width height RGB))) (define (round-select img
x
y
width
height
ratio)
(let* ((diameter (* ratio height)))
(gimp-ellipse-select img x y diameter height CHANNEL-OP-ADD FALSE 0 0)
(gimp-ellipse-select img (+ x (- width diameter)) y
diameter height CHANNEL-OP-ADD FALSE 0 0)
(gimp-rect-select img (+ x (/ diameter 2)) y
(- width diameter) height CHANNEL-OP-ADD FALSE 0)))
(bumpmap (car (gimp-layer-new img width height (let* (
RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))) (text-extents (gimp-text-get-extents-fontname text
(gradient (car (gimp-layer-new img width height size
RGBA-IMAGE "Button" 100 NORMAL-MODE)))) PIXELS
font))
(ascent (text-ascent text-extents))
(descent (text-descent text-extents))
(height (+ (* 2 (+ ypadding bevel))
(+ ascent descent)))
(radius (/ (* ratio height) 4))
(width (+ (* 2 (+ radius xpadding))
bevel
(text-width text-extents)))
(img (car (gimp-image-new width height RGB)))
(bumpmap (car (gimp-layer-new img width height
RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))
(gradient (car (gimp-layer-new img width height
RGBA-IMAGE "Button" 100 NORMAL-MODE)))
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable img) (gimp-image-undo-disable img)
; Create bumpmap layer ; Create bumpmap layer
(gimp-image-add-layer img bumpmap -1) (gimp-image-add-layer img bumpmap -1)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-edit-fill bumpmap BACKGROUND-FILL) (gimp-edit-fill bumpmap BACKGROUND-FILL)
(round-select img (/ bevel 2) (/ bevel 2) (round-select img (/ bevel 2) (/ bevel 2)
(- width bevel) (- height bevel) ratio) (- width bevel) (- height bevel) ratio)
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-edit-fill bumpmap BACKGROUND-FILL) (gimp-edit-fill bumpmap BACKGROUND-FILL)
@ -140,14 +142,14 @@
(gimp-context-set-background lr-color) (gimp-context-set-background lr-color)
(gimp-edit-blend gradient FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend gradient FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 0 (- height 1)) 0 0 0 (- height 1))
(gimp-selection-none img) (gimp-selection-none img)
(plug-in-bump-map 1 img gradient bumpmap (plug-in-bump-map 1 img gradient bumpmap
135 45 bevel 0 0 0 0 TRUE pressed 0) 135 45 bevel 0 0 0 0 TRUE pressed 0)
; Create text layer ; Create text layer
@ -155,11 +157,11 @@
(gimp-context-set-foreground text-color) (gimp-context-set-foreground text-color)
(let ((textl (car (gimp-text-fontname (let ((textl (car (gimp-text-fontname
img -1 0 0 text 0 TRUE size PIXELS img -1 0 0 text 0 TRUE size PIXELS
font)))) font))))
(gimp-layer-set-offsets textl (gimp-layer-set-offsets textl
(+ xpadding radius bevel) (+ xpadding radius bevel)
(+ ypadding descent bevel))) (+ ypadding descent bevel)))
; Delete some fucked-up pixels. ; Delete some fucked-up pixels.
@ -177,31 +179,34 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-round-button" (script-fu-register "script-fu-round-button"
_"_Round Button..." _"_Round Button..."
_"Create images, each containing an oval button graphic" _"Create images, each containing an oval button graphic"
"Arturo Espinosa (stolen from quartic's beveled button)" "Arturo Espinosa (stolen from quartic's beveled button)"
"Arturo Espinosa & Federico Mena Quintero" "Arturo Espinosa & Federico Mena Quintero"
"June 1998" "June 1998"
"" ""
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-ADJUSTMENT _"Font size (pixels)" '(16 2 100 1 1 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(16 2 100 1 1 0 1)
SF-FONT _"Font" "Sans" SF-FONT _"Font" "Sans"
SF-COLOR _"Upper color" '(192 192 0) SF-COLOR _"Upper color" '(192 192 0)
SF-COLOR _"Lower color" '(128 108 0) SF-COLOR _"Lower color" '(128 108 0)
SF-COLOR _"Text color" "black" SF-COLOR _"Text color" '(0 0 0)
SF-COLOR _"Upper color (active)" '(255 255 0) SF-COLOR _"Upper color (active)" '(255 255 0)
SF-COLOR _"Lower color (active)" '(128 108 0) SF-COLOR _"Lower color (active)" '(128 108 0)
SF-COLOR _"Text color (active)" '(0 0 192) SF-COLOR _"Text color (active)" '(0 0 192)
SF-ADJUSTMENT _"Padding X" '(4 0 100 1 10 0 1) SF-ADJUSTMENT _"Padding X" '(4 0 100 1 10 0 1)
SF-ADJUSTMENT _"Padding Y" '(4 0 100 1 10 0 1) SF-ADJUSTMENT _"Padding Y" '(4 0 100 1 10 0 1)
SF-ADJUSTMENT _"Bevel width" '(2 0 100 1 10 0 1) SF-ADJUSTMENT _"Bevel width" '(2 0 100 1 10 0 1)
SF-ADJUSTMENT _"Round ratio" '(1 0.05 20 0.05 1 2 1) SF-ADJUSTMENT _"Round ratio" '(1 0.05 20 0.05 1 2 1)
SF-TOGGLE _"Not pressed" TRUE SF-TOGGLE _"Not pressed" TRUE
SF-TOGGLE _"Not pressed (active)" TRUE SF-TOGGLE _"Not pressed (active)" TRUE
SF-TOGGLE _"Pressed" TRUE) SF-TOGGLE _"Pressed" TRUE
)
(script-fu-menu-register "script-fu-round-button" (script-fu-menu-register "script-fu-round-button"
"<Toolbox>/Xtns/Buttons") "<Toolbox>/Xtns/Buttons")

View File

@ -5,25 +5,26 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-render-map inSize (define (script-fu-render-map inSize
inGrain inGrain
inGrad inGrad
inWiden) inWiden)
(let* ( (let* (
(theWidth inSize) (theWidth inSize)
(theHeight inSize) (theHeight inSize)
(theImage (car (gimp-image-new theWidth theHeight RGB))) (theImage (car(gimp-image-new theWidth theHeight RGB)))
(theLayer) (theLayer)
(thinLayer) (thinLayer)
) )
@ -33,58 +34,59 @@
(gimp-selection-all theImage) (gimp-selection-all theImage)
(set! theLayer (car (gimp-layer-new theImage theWidth theHeight (set! theLayer (car (gimp-layer-new theImage theWidth theHeight
RGBA-IMAGE RGBA-IMAGE
"I've got more rubber ducks than you!" "I've got more rubber ducks than you!"
100 NORMAL-MODE))) 100 NORMAL-MODE)))
(gimp-image-add-layer theImage theLayer 0) (gimp-image-add-layer theImage theLayer 0)
(plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536) (plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536)
inGrain inGrain inGrain) inGrain inGrain inGrain)
(if (= inWiden 1) (if (= inWiden 1)
(begin (begin
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight
RGBA-IMAGE "Camo Thin Layer" RGBA-IMAGE "Camo Thin Layer"
100 NORMAL-MODE))) 100 NORMAL-MODE)))
(gimp-image-add-layer theImage thinLayer 0) (gimp-image-add-layer theImage thinLayer 0)
(let ((theBigGrain (min 15 (* 2 inGrain)))) (let ((theBigGrain (min 15 (* 2 inGrain))))
(plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536) (plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536)
theBigGrain theBigGrain theBigGrain)) theBigGrain theBigGrain theBigGrain))
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-context-set-foreground '(0 0 0)) (gimp-context-set-foreground '(0 0 0))
(let ((theMask (car (gimp-layer-create-mask thinLayer 0)))) (let ((theMask (car (gimp-layer-create-mask thinLayer 0))))
(gimp-layer-add-mask thinLayer theMask) (gimp-layer-add-mask thinLayer theMask)
(gimp-edit-blend theMask FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend theMask FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-LINEAR 100 0 REPEAT-TRIANGULAR FALSE GRADIENT-LINEAR 100 0 REPEAT-TRIANGULAR FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
0 0 0 (/ theHeight 2))) 0 0 0 (/ theHeight 2)))
(set! theLayer (car(gimp-image-flatten theImage)))))
(set! theLayer (car(gimp-image-flatten theImage)))))
(gimp-selection-none theImage) (gimp-selection-none theImage)
(gimp-context-set-gradient inGrad) (gimp-context-set-gradient inGrad)
(plug-in-gradmap TRUE theImage theLayer) (plug-in-gradmap TRUE theImage theLayer)
(gimp-display-new theImage) (gimp-display-new theImage)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-render-map" (script-fu-register "script-fu-render-map"
_"Render _Map..." _"Render _Map..."
_"Create an image filled with an Earth-like map pattern" _"Create an image filled with an Earth-like map pattern"
"Chris Gutteridge: cjg@ecs.soton.ac.uk" "Chris Gutteridge: cjg@ecs.soton.ac.uk"
"28th April 1998" "28th April 1998"
"Chris Gutteridge / ECS @ University of Southampton, England" "Chris Gutteridge / ECS @ University of Southampton, England"
"" ""
SF-ADJUSTMENT _"Image size" '(256 0 2048 1 10 0 0) SF-ADJUSTMENT _"Image size" '(256 0 2048 1 10 0 0)
SF-ADJUSTMENT _"Granularity" '(4 0 15 1 1 0 0) SF-ADJUSTMENT _"Granularity" '(4 0 15 1 1 0 0)
SF-GRADIENT _"Gradient" "Land and Sea" SF-GRADIENT _"Gradient" "Land and Sea"
SF-TOGGLE _"Gradient reverse" FALSE SF-TOGGLE _"Gradient reverse" FALSE
SF-OPTION _"Behavior" '(_"Tile" SF-OPTION _"Behavior" '(_"Tile" _"Detail in Middle")
_"Detail in middle")) )
(script-fu-menu-register "script-fu-render-map" (script-fu-menu-register "script-fu-render-map"
"<Toolbox>/Xtns/Patterns") "<Toolbox>/Xtns/Patterns")

View File

@ -1,35 +1,43 @@
;; reverse-layers.scm: Reverse the order of layers in the current image. ;; reverse-layers.scm: Reverse the order of layers in the current image.
;; Copyright (C) 2006 by Akkana Peck. ;; Copyright (C) 2006 by Akkana Peck.
;; ;;
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License. ;; it under the terms of the GNU General Public License.
(define (script-fu-reverse-layers img drawable) (define (script-fu-reverse-layers img drawable)
(let* ((layers (gimp-image-get-layers img)) (let* (
(num-layers (car layers)) (layers (gimp-image-get-layers img))
(layer-array (cadr layers)) (num-layers (car layers))
(i (- num-layers 1))) (layer-array (cadr layers))
(i (- num-layers 1))
)
(gimp-image-undo-group-start img) (gimp-image-undo-group-start img)
(while (>= i 0) (while (>= i 0)
(let ((layer (aref layer-array i))) (let ((layer (aref layer-array i)))
(if (= (car (gimp-layer-is-floating-sel layer)) FALSE) (if (= (car (gimp-layer-is-floating-sel layer)) FALSE)
(gimp-image-lower-layer-to-bottom img layer))) (gimp-image-lower-layer-to-bottom img layer))
(set! i (- i 1))) )
(set! i (- i 1))
)
(gimp-image-undo-group-end img) (gimp-image-undo-group-end img)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-reverse-layers" (script-fu-register "script-fu-reverse-layers"
_"Reverse Layer Order" _"Reverse Layer Order"
_"Reverse the order of layers in the image" _"Reverse the order of layers in the image"
"Akkana Peck" "Akkana Peck"
"Akkana Peck" "Akkana Peck"
"August 2006" "August 2006"
"*" "*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0) SF-DRAWABLE "Drawable" 0
)
(script-fu-menu-register "script-fu-reverse-layers" (script-fu-menu-register "script-fu-reverse-layers"
"<Image>/Layer/Stack") "<Image>/Layer/Stack")

View File

@ -6,35 +6,42 @@
; of saving animations (i.e. the GIF plugin). ; of saving animations (i.e. the GIF plugin).
; ;
(define (copy-layer-ripple dest-image dest-drawable source-image source-drawable)
(gimp-selection-all dest-image)
(gimp-edit-clear dest-drawable)
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-drawable)
(gimp-selection-none source-image)
(let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel)))
(define (script-fu-ripply-anim img drawable displacement num-frames edge-type) (define (script-fu-ripply-anim img drawable displacement num-frames edge-type)
(let* ((width (car (gimp-drawable-width drawable)))
(height (car (gimp-drawable-height drawable)))
(ripple-image (car (gimp-image-new width height GRAY)))
(ripple-layer (car (gimp-layer-new ripple-image width height GRAY-IMAGE "Ripple Texture" 100 NORMAL-MODE)))
(rippletiled-ret)
(rippletiled-image)
(rippletiled-layer)
(remaining-frames)
(xpos)
(ypos)
(xoffset)
(yoffset)
)
; this script generates its own displacement map (define (copy-layer-ripple dest-image dest-drawable source-image source-drawable)
(gimp-selection-all dest-image)
(gimp-edit-clear dest-drawable)
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-drawable)
(gimp-selection-none source-image)
(gimp-floating-sel-anchor (car (gimp-edit-paste dest-drawable FALSE)))
)
(let* (
(width (car (gimp-drawable-width drawable)))
(height (car (gimp-drawable-height drawable)))
(ripple-image (car (gimp-image-new width height GRAY)))
(ripple-layer (car (gimp-layer-new ripple-image width height GRAY-IMAGE "Ripple Texture" 100 NORMAL-MODE)))
(rippletiled-ret)
(rippletiled-image)
(rippletiled-layer)
(remaining-frames)
(xpos)
(ypos)
(xoffset)
(yoffset)
(dup-image)
(layer-name)
(this-image)
(this-layer)
(dup-layer)
)
(gimp-context-push) (gimp-context-push)
; this script generates its own displacement map
(gimp-image-undo-disable ripple-image) (gimp-image-undo-disable ripple-image)
(gimp-context-set-background '(127 127 127) ) (gimp-context-set-background '(127 127 127) )
(gimp-image-add-layer ripple-image ripple-layer 0) (gimp-image-add-layer ripple-image ripple-layer 0)
@ -65,64 +72,60 @@
(set! xoffset (/ width num-frames)) (set! xoffset (/ width num-frames))
(set! yoffset (/ height num-frames)) (set! yoffset (/ height num-frames))
(let* ( (let* ((out-imagestack (car (gimp-image-new width height RGB))))
(out-imagestack (car (gimp-image-new width height RGB)))
(dup-image)
(dup-layer)
(layer-name)
(this-layer)
)
(gimp-image-undo-disable out-imagestack) (gimp-image-undo-disable out-imagestack)
(while (> remaining-frames 0)
(set! dup-image (car (gimp-image-duplicate rippletiled-image)))
(gimp-image-undo-disable dup-image)
(gimp-image-crop dup-image width height xpos ypos)
(set! layer-name (string-append "Frame "
(number->string (- num-frames remaining-frames) 10)
" (replace)"))
(set! this-layer (car (gimp-layer-new out-imagestack
width height RGB
layer-name 100 NORMAL-MODE)))
(gimp-image-add-layer out-imagestack this-layer 0)
(copy-layer-ripple out-imagestack this-layer img drawable)
(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)
(gimp-image-undo-enable dup-image)
(gimp-image-delete dup-image)
(set! remaining-frames (- remaining-frames 1))
(set! xpos (+ xoffset xpos))
(set! ypos (+ yoffset ypos)))
(gimp-image-undo-enable rippletiled-image)
(gimp-image-delete rippletiled-image)
(gimp-image-undo-enable out-imagestack)
(gimp-display-new out-imagestack))
(gimp-context-pop))) (while (> remaining-frames 0)
(set! dup-image (car (gimp-image-duplicate rippletiled-image)))
(gimp-image-undo-disable dup-image)
(gimp-image-crop dup-image width height xpos ypos)
(set! layer-name (string-append "Frame "
(number->string (- num-frames remaining-frames) 10)
" (replace)"))
(set! this-layer (car (gimp-layer-new out-imagestack
width height RGB
layer-name 100 NORMAL-MODE)))
(gimp-image-add-layer out-imagestack this-layer 0)
(copy-layer-ripple out-imagestack this-layer img drawable)
(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)
(gimp-image-undo-enable dup-image)
(gimp-image-delete dup-image)
(set! remaining-frames (- remaining-frames 1))
(set! xpos (+ xoffset xpos))
(set! ypos (+ yoffset ypos))
)
(gimp-image-undo-enable rippletiled-image)
(gimp-image-delete rippletiled-image)
(gimp-image-undo-enable out-imagestack)
(gimp-display-new out-imagestack))
(gimp-context-pop)
)
)
(script-fu-register "script-fu-ripply-anim" (script-fu-register "script-fu-ripply-anim"
_"_Rippling..." _"_Rippling..."
_"Create a multi-layer image by adding a ripple effect to the current image" _"Create a multi-layer image by adding a ripple effect to the current image"
"Adam D. Moss (adam@foxbox.org)" "Adam D. Moss (adam@foxbox.org)"
"Adam D. Moss" "Adam D. Moss"
"1997" "1997"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image to animage" 0 SF-IMAGE "Image to animage" 0
SF-DRAWABLE "Drawable to animate" 0 SF-DRAWABLE "Drawable to animate" 0
SF-ADJUSTMENT _"Rippling strength" '(3 0 256 1 10 1 0) SF-ADJUSTMENT _"Rippling strength" '(3 0 256 1 10 1 0)
SF-ADJUSTMENT _"Number of frames" '(15 0 256 1 10 0 1) SF-ADJUSTMENT _"Number of frames" '(15 0 256 1 10 0 1)
SF-OPTION _"Edge behavior" '(_"Wrap" SF-OPTION _"Edge behavior" '(_"Wrap" _"Smear" _"Black")
_"Smear" )
_"Black"))
(script-fu-menu-register "script-fu-ripply-anim" (script-fu-menu-register "script-fu-ripply-anim"
"<Image>/Filters/Animation/Animators") "<Image>/Filters/Animation/Animators")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -22,52 +22,54 @@
; 1.00 - initial release ; 1.00 - initial release
; 1.01 - some code cleanup, no real changes ; 1.01 - some code cleanup, no real changes
; ;
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org> ; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
; ;
; ;
; Rounds the corners of an image, optionally adding a drop-shadow and ; Rounds the corners of an image, optionally adding a drop-shadow and
; a background layer ; a background layer
; ;
; The script works on RGB and grayscale images that contain only ; The script works on RGB and grayscale images that contain only
; one layer. It creates a copy of the image or can optionally work ; one layer. It creates a copy of the image or can optionally work
; on the original. The script uses the current background color to ; on the original. The script uses the current background color to
; create a background layer. It makes a call to the script drop-shadow. ; create a background layer. It makes a call to the script drop-shadow.
; ;
; This script is derived from my script add-shadow, which has become ; This script is derived from my script add-shadow, which has become
; obsolet now. ; obsolete now.
(define (script-fu-round-corners img (define (script-fu-round-corners img
drawable drawable
radius radius
shadow-toggle shadow-toggle
shadow-x shadow-x
shadow-y shadow-y
shadow-blur shadow-blur
background-toggle background-toggle
work-on-copy) work-on-copy)
(let* ((shadow-blur (abs shadow-blur)) (let* ((shadow-blur (abs shadow-blur))
(radius (abs radius)) (radius (abs radius))
(diam (* 2 radius)) (diam (* 2 radius))
(width (car (gimp-image-width img))) (width (car (gimp-image-width img)))
(height (car (gimp-image-height img))) (height (car (gimp-image-height img)))
(type (car (gimp-drawable-type-with-alpha drawable))) (type (car (gimp-drawable-type-with-alpha drawable)))
(image (cond ((= work-on-copy TRUE) (image (cond ((= work-on-copy TRUE)
(car (gimp-image-duplicate img))) (car (gimp-image-duplicate img)))
((= work-on-copy FALSE) ((= work-on-copy FALSE)
img))) img)))
(pic-layer (car (gimp-image-get-active-drawable image)))) (pic-layer (car (gimp-image-get-active-drawable image))))
(cond ((= work-on-copy TRUE) (if (= work-on-copy TRUE)
(gimp-image-undo-disable image)) (gimp-image-undo-disable image)
((= work-on-copy FALSE) (gimp-image-undo-group-start image)
(gimp-image-undo-group-start image))) )
(gimp-image-undo-disable image)
; add an alpha channel to the image ; add an alpha channel to the image
(gimp-layer-add-alpha pic-layer) (gimp-layer-add-alpha pic-layer)
; round the edges ; round the edges
(gimp-selection-none image) (gimp-selection-none image)
(gimp-rect-select image 0 0 radius radius CHANNEL-OP-ADD 0 0) (gimp-rect-select image 0 0 radius radius CHANNEL-OP-ADD 0 0)
(gimp-ellipse-select image 0 0 diam diam CHANNEL-OP-SUBTRACT TRUE 0 0) (gimp-ellipse-select image 0 0 diam diam CHANNEL-OP-SUBTRACT TRUE 0 0)
@ -76,67 +78,69 @@
(gimp-rect-select image 0 (- height radius) radius radius CHANNEL-OP-ADD 0 0) (gimp-rect-select image 0 (- height radius) radius radius CHANNEL-OP-ADD 0 0)
(gimp-ellipse-select image 0 (- height diam) diam diam CHANNEL-OP-SUBTRACT TRUE 0 0) (gimp-ellipse-select image 0 (- height diam) diam diam CHANNEL-OP-SUBTRACT TRUE 0 0)
(gimp-rect-select image (- width radius) (- height radius) (gimp-rect-select image (- width radius) (- height radius)
radius radius CHANNEL-OP-ADD 0 0) radius radius CHANNEL-OP-ADD 0 0)
(gimp-ellipse-select image (- width diam) (- height diam) (gimp-ellipse-select image (- width diam) (- height diam)
diam diam CHANNEL-OP-SUBTRACT TRUE 0 0) diam diam CHANNEL-OP-SUBTRACT TRUE 0 0)
(gimp-edit-clear pic-layer) (gimp-edit-clear pic-layer)
(gimp-selection-none image) (gimp-selection-none image)
; optionally add a shadow ; optionally add a shadow
(if (= shadow-toggle TRUE) (if (= shadow-toggle TRUE)
(begin (begin
(script-fu-drop-shadow image (script-fu-drop-shadow image
pic-layer pic-layer
shadow-x shadow-x
shadow-y shadow-y
shadow-blur shadow-blur
'(0 0 0) '(0 0 0)
80 80
TRUE) TRUE)
(set! width (car (gimp-image-width image))) (set! width (car (gimp-image-width image)))
(set! height (car (gimp-image-height image))))) (set! height (car (gimp-image-height image)))))
; optionally add a background ; optionally add a background
(if (= background-toggle TRUE) (if (= background-toggle TRUE)
(let* ((bg-layer (car (gimp-layer-new image (let* ((bg-layer (car (gimp-layer-new image
width width
height height
type type
"Background" "Background"
100 100
NORMAL-MODE)))) NORMAL-MODE))))
(gimp-drawable-fill bg-layer BACKGROUND-FILL) (gimp-drawable-fill bg-layer BACKGROUND-FILL)
(gimp-image-add-layer image bg-layer -1) (gimp-image-add-layer image bg-layer -1)
(gimp-image-raise-layer image pic-layer) (gimp-image-raise-layer image pic-layer)
(if (= shadow-toggle TRUE) (if (= shadow-toggle TRUE)
(gimp-image-lower-layer image bg-layer)))) (gimp-image-lower-layer image bg-layer))))
; clean up after the script ; clean up after the script
(cond ((= work-on-copy TRUE) (if (= work-on-copy TRUE)
(gimp-image-undo-enable image)) (gimp-image-undo-enable image)
((= work-on-copy FALSE) (gimp-image-undo-group-end image)
(gimp-image-undo-group-end image))) )
(if (= work-on-copy TRUE) (if (= work-on-copy TRUE)
(gimp-display-new image)) (gimp-display-new image))
(gimp-displays-flush))) (gimp-displays-flush))
)
(script-fu-register "script-fu-round-corners" (script-fu-register "script-fu-round-corners"
_"_Round Corners..." _"_Round Corners..."
_"Round the corners of an image and optionally add a drop-shadow and background" _"Round the corners of an image and optionally add a drop-shadow and background"
"Sven Neumann <sven@gimp.org>" "Sven Neumann <sven@gimp.org>"
"Sven Neumann" "Sven Neumann"
"1999/12/21" "1999/12/21"
"RGB GRAY" "RGB GRAY"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Edge radius" '(15 0 4096 1 10 0 1) SF-ADJUSTMENT _"Edge radius" '(15 0 4096 1 10 0 1)
SF-TOGGLE _"Add drop-shadow" TRUE SF-TOGGLE _"Add drop-shadow" TRUE
SF-ADJUSTMENT _"Shadow X offset" '(8 -4096 4096 1 10 0 1) 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 _"Shadow Y offset" '(8 -4096 4096 1 10 0 1)
SF-ADJUSTMENT _"Blur radius" '(15 0 1024 1 10 0 1) SF-ADJUSTMENT _"Blur radius" '(15 0 1024 1 10 0 1)
SF-TOGGLE _"Add background" TRUE SF-TOGGLE _"Add background" TRUE
SF-TOGGLE _"Work on copy" TRUE) SF-TOGGLE _"Work on copy" TRUE
)
(script-fu-menu-register "script-fu-round-corners" (script-fu-menu-register "script-fu-round-corners"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -19,11 +19,15 @@
; The resulting image has the selected layer size. ; The resulting image has the selected layer size.
; Copyright (C) 2002 Chauk-Mean PROUM ; Copyright (C) 2002 Chauk-Mean PROUM
; ;
(define (script-fu-util-image-resize-from-layer image (define (script-fu-util-image-resize-from-layer image layer)
layer) (let* (
(let* (width (car (gimp-drawable-width layer)))
((width (car (gimp-drawable-width layer))) (height (car (gimp-drawable-height layer)))
(height (car (gimp-drawable-height layer))) (posx (- (car (gimp-drawable-offsets layer))))
(posx (- (car (gimp-drawable-offsets layer)))) (posy (- (cadr (gimp-drawable-offsets layer))))
(posy (- (cadr (gimp-drawable-offsets layer))))) )
(gimp-image-resize image width height posx posy)))
(gimp-image-resize image width height posx posy)
)
)

View File

@ -1,26 +1,26 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Selection-to-brush ; Selection-to-brush
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
; ;
; Takes the current selection, saves it as a brush, and makes it the ; Takes the current selection, saves it as a brush, and makes it the
; active brush.. ; active brush..
; ;
; Parts of this script from Sven Neuman's Drop-Shadow and ; Parts of this script from Sven Neuman's Drop-Shadow and
; Seth Burgess's mkbrush scripts. ; Seth Burgess's mkbrush scripts.
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -31,46 +31,58 @@
name name
filename filename
spacing) spacing)
(let* ((type (car (gimp-drawable-type-with-alpha drawable))) (let* (
(selection-bounds (gimp-selection-bounds image)) (type (car (gimp-drawable-type-with-alpha drawable)))
(select-offset-x (cadr selection-bounds)) (selection-bounds (gimp-selection-bounds image))
(select-offset-y (caddr selection-bounds)) (select-offset-x (cadr selection-bounds))
(selection-width (- (cadr (cddr selection-bounds)) select-offset-x)) (select-offset-y (caddr selection-bounds))
(selection-height (- (caddr (cddr selection-bounds)) select-offset-y))) (selection-width (- (cadr (cddr selection-bounds)) select-offset-x))
(selection-height (- (caddr (cddr selection-bounds)) select-offset-y))
(from-selection)
(active-selection)
(brush-draw-type)
(brush-image-type)
(brush-image)
(brush-draw)
(filename2)
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable image) (gimp-image-undo-disable image)
(if (= (car (gimp-selection-is-empty image)) TRUE) (if (= (car (gimp-selection-is-empty image)) TRUE)
(begin (begin
(gimp-selection-layer-alpha drawable) (gimp-selection-layer-alpha drawable)
(set! from-selection FALSE)) (set! from-selection FALSE)
(begin )
(set! from-selection TRUE) (begin
(set! active-selection (car (gimp-selection-save image))))) (set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image)))
)
)
(gimp-edit-copy drawable) (gimp-edit-copy drawable)
(set! brush_draw_type (set! brush-draw-type
(if (= type GRAYA-IMAGE) (if (= type GRAYA-IMAGE)
GRAY-IMAGE GRAY-IMAGE
RGBA-IMAGE)) RGBA-IMAGE))
(set! brush_image_type (set! brush-image-type
(if (= type GRAYA-IMAGE) (if (= type GRAYA-IMAGE)
GRAY GRAY
RGB)) RGB))
(set! brush-image (car (gimp-image-new selection-width (set! brush-image (car (gimp-image-new selection-width
selection-height selection-height
brush_image_type))) brush-image-type)))
(set! brush-draw (set! brush-draw
(car (gimp-layer-new brush-image (car (gimp-layer-new brush-image
selection-width selection-width
selection-height selection-height
brush_draw_type brush-draw-type
"Brush" "Brush"
100 100
NORMAL-MODE))) NORMAL-MODE)))
@ -80,26 +92,30 @@
(gimp-selection-none brush-image) (gimp-selection-none brush-image)
(if (= type GRAYA-IMAGE) (if (= type GRAYA-IMAGE)
(begin (begin
(gimp-context-set-background '(255 255 255)) (gimp-context-set-background '(255 255 255))
(gimp-drawable-fill brush-draw BACKGROUND-FILL)) (gimp-drawable-fill brush-draw BACKGROUND-FILL))
(gimp-drawable-fill brush-draw TRANSPARENT-FILL)) (gimp-drawable-fill brush-draw TRANSPARENT-FILL)
)
(let ((floating-sel (car (gimp-edit-paste brush-draw FALSE)))) (let ((floating-sel (car (gimp-edit-paste brush-draw FALSE))))
(gimp-floating-sel-anchor floating-sel)) (gimp-floating-sel-anchor floating-sel)
)
(set! filename2 (string-append gimp-directory (set! filename2 (string-append gimp-directory DIR-SEPARATOR
"/brushes/" "brushes" DIR-SEPARATOR
filename filename
(number->string image) (number->string image)
".gbr")) ".gbr"))
(file-gbr-save 1 brush-image brush-draw filename2 "" spacing name) (file-gbr-save 1 brush-image brush-draw filename2 "" spacing name)
(if (= from-selection TRUE) (if (= from-selection TRUE)
(begin (begin
(gimp-selection-load active-selection) (gimp-selection-load active-selection)
(gimp-image-remove-channel image active-selection))) (gimp-image-remove-channel image active-selection)
)
)
(gimp-image-undo-enable image) (gimp-image-undo-enable image)
(gimp-image-set-active-layer image drawable) (gimp-image-set-active-layer image drawable)
@ -109,17 +125,20 @@
(gimp-context-pop) (gimp-context-pop)
(gimp-brushes-refresh) (gimp-brushes-refresh)
(gimp-context-set-brush name))) (gimp-context-set-brush name)
)
)
(script-fu-register "script-fu-selection-to-brush" (script-fu-register "script-fu-selection-to-brush"
_"To _Brush..." _"To _Brush..."
"Convert a selection to a brush" _"Convert a selection to a brush"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"Adrian Likins" "Adrian Likins"
"10/07/97" "10/07/97"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-STRING _"Brush name" "My Brush" SF-STRING _"Brush name" "My Brush"
SF-STRING _"File name" "mybrush" SF-STRING _"File name" "mybrush"
SF-ADJUSTMENT _"Spacing" '(25 0 1000 1 1 1 0)) SF-ADJUSTMENT _"Spacing" '(25 0 1000 1 1 1 0)
)

View File

@ -1,6 +1,6 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Selection to Image ; Selection to Image
; Copyright (c) 1997 Adrian Likins ; Copyright (c) 1997 Adrian Likins
; aklikins@eos.ncsu.edu ; aklikins@eos.ncsu.edu
@ -12,65 +12,78 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-selection-to-image image drawable) (define (script-fu-selection-to-image image drawable)
(let* ((draw-type (car (gimp-drawable-type-with-alpha drawable))) (let* (
(image-type (car (gimp-image-base-type image))) (draw-type (car (gimp-drawable-type-with-alpha drawable)))
(selection-bounds (gimp-selection-bounds image)) (image-type (car (gimp-image-base-type image)))
(select-offset-x (cadr selection-bounds)) (selection-bounds (gimp-selection-bounds image))
(select-offset-y (caddr selection-bounds)) (select-offset-x (cadr selection-bounds))
(selection-width (- (cadr (cddr selection-bounds)) select-offset-x)) (select-offset-y (caddr selection-bounds))
(selection-height (- (caddr (cddr selection-bounds)) select-offset-y))) (selection-width (- (cadr (cddr selection-bounds)) select-offset-x))
(selection-height (- (caddr (cddr selection-bounds)) select-offset-y))
(active-selection)
(from-selection)
(new-image)
(new-draw)
)
(gimp-context-push) (gimp-context-push)
(gimp-image-undo-disable image) (gimp-image-undo-disable image)
(if (= (car (gimp-selection-is-empty image)) TRUE) (if (= (car (gimp-selection-is-empty image)) TRUE)
(begin (begin
(gimp-selection-layer-alpha drawable) (gimp-selection-layer-alpha drawable)
(set! active-selection (car (gimp-selection-save image))) (set! active-selection (car (gimp-selection-save image)))
(set! from-selection FALSE)) (set! from-selection FALSE)
(begin )
(set! from-selection TRUE) (begin
(set! active-selection (car (gimp-selection-save image))))) (set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image)))
)
)
(gimp-edit-copy drawable) (gimp-edit-copy drawable)
(set! new-image (car (gimp-image-new selection-width (set! new-image (car (gimp-image-new selection-width
selection-height image-type))) selection-height image-type)))
(set! new-draw (car (gimp-layer-new new-image (set! new-draw (car (gimp-layer-new new-image
selection-width selection-height selection-width selection-height
draw-type "Selection" 100 NORMAL-MODE))) draw-type "Selection" 100 NORMAL-MODE)))
(gimp-image-add-layer new-image new-draw 0) (gimp-image-add-layer new-image new-draw 0)
(gimp-drawable-fill new-draw BACKGROUND-FILL) (gimp-drawable-fill new-draw BACKGROUND-FILL)
(let ((floating-sel (car (gimp-edit-paste new-draw FALSE)))) (let ((floating-sel (car (gimp-edit-paste new-draw FALSE))))
(gimp-floating-sel-anchor floating-sel)) (gimp-floating-sel-anchor floating-sel)
)
(gimp-image-undo-enable image) (gimp-image-undo-enable image)
(gimp-image-set-active-layer image drawable) (gimp-image-set-active-layer image drawable)
(gimp-display-new new-image) (gimp-display-new new-image)
(gimp-displays-flush) (gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-selection-to-image" (script-fu-register "script-fu-selection-to-image"
_"To _Image" _"To _Image"
"Convert a selection to an image" _"Convert a selection to an image"
"Adrian Likins <adrian@gimp.org>" "Adrian Likins <adrian@gimp.org>"
"Adrian Likins" "Adrian Likins"
"10/07/97" "10/07/97"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0) SF-DRAWABLE "Drawable" 0
)

View File

@ -1,8 +1,8 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; Based on select-to-brush by ; Based on select-to-brush by
; Copyright (c) 1997 Adrian Likins aklikins@eos.ncsu.edu ; Copyright (c) 1997 Adrian Likins aklikins@eos.ncsu.edu
; Author Cameron Gregory, http://www.flamingtext.com/ ; Author Cameron Gregory, http://www.flamingtext.com/
; ;
; Takes the current selection, saves it as a pattern and makes it the active ; Takes the current selection, saves it as a pattern and makes it the active
@ -12,12 +12,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -25,29 +25,46 @@
(define (script-fu-selection-to-pattern image drawable desc filename) (define (script-fu-selection-to-pattern image drawable desc filename)
(let* (
(selection-width)
(selection-height)
(selection-bounds)
(select-offset-x)
(select-offset-y)
(pattern-draw-type)
(pattern-image-type)
(pattern-image)
(pattern-draw)
(filename2)
)
(if (= (car (gimp-selection-is-empty image)) TRUE) (if (= (car (gimp-selection-is-empty image)) TRUE)
(begin (begin
(set! selection-width (car (gimp-drawable-width drawable))) (set! selection-width (car (gimp-drawable-width drawable)))
(set! selection-height (car (gimp-drawable-height drawable)))) (set! selection-height (car (gimp-drawable-height drawable)))
)
(begin (begin
(set! selection-bounds (gimp-drawable-mask-bounds drawable)) (set! selection-bounds (gimp-drawable-mask-bounds drawable))
(set! select-offset-x (cadr selection-bounds)) (set! select-offset-x (cadr selection-bounds))
(set! select-offset-y (caddr selection-bounds)) (set! select-offset-y (caddr selection-bounds))
(set! selection-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! selection-width (- (cadr (cddr selection-bounds)) select-offset-x))
(set! selection-height (- (caddr (cddr selection-bounds)) select-offset-y)))) (set! selection-height (- (caddr (cddr selection-bounds)) select-offset-y))
)
)
(if (= (car (gimp-drawable-has-alpha drawable)) TRUE) (if (= (car (gimp-drawable-has-alpha drawable)) TRUE)
(set! pattern-draw-type RGBA-IMAGE) (set! pattern-draw-type RGBA-IMAGE)
(set! pattern-draw-type RGB-IMAGE)) (set! pattern-draw-type RGB-IMAGE)
)
(set! pattern-image-type RGB) (set! pattern-image-type RGB)
(set! pattern-image (car (gimp-image-new selection-width selection-height (set! pattern-image (car (gimp-image-new selection-width selection-height
pattern-image-type))) pattern-image-type)))
(set! pattern-draw (set! pattern-draw
(car (gimp-layer-new pattern-image selection-width selection-height (car (gimp-layer-new pattern-image selection-width selection-height
pattern-draw-type "Pattern" 100 NORMAL-MODE))) pattern-draw-type "Pattern" 100 NORMAL-MODE)))
(gimp-drawable-fill pattern-draw TRANSPARENT-FILL) (gimp-drawable-fill pattern-draw TRANSPARENT-FILL)
@ -58,27 +75,30 @@
(let ((floating-sel (car (gimp-edit-paste pattern-draw FALSE)))) (let ((floating-sel (car (gimp-edit-paste pattern-draw FALSE))))
(gimp-floating-sel-anchor floating-sel)) (gimp-floating-sel-anchor floating-sel))
(set! filename2 (string-append gimp-directory (set! filename2 (string-append gimp-directory DIR-SEPARATOR
"/patterns/" "patterns" DIR-SEPARATOR
filename filename
(number->string image) (number->string image)
".pat")) ".pat"))
(file-pat-save 1 pattern-image pattern-draw filename2 "" desc) (file-pat-save 1 pattern-image pattern-draw filename2 "" desc)
(gimp-patterns-refresh) (gimp-patterns-refresh)
(gimp-context-set-pattern desc) (gimp-context-set-pattern desc)
(gimp-image-delete pattern-image) (gimp-image-delete pattern-image)
(gimp-displays-flush)) (gimp-displays-flush)
)
)
(script-fu-register "script-fu-selection-to-pattern" (script-fu-register "script-fu-selection-to-pattern"
_"To _Pattern..." _"To _Pattern..."
"Convert a selection to a pattern" _"Convert a selection to a pattern"
"Cameron Gregory <cameron@bloke.com>" "Cameron Gregory <cameron@bloke.com>"
"Cameron Gregory" "Cameron Gregory"
"09/02/2003" "09/02/2003"
"RGB* GRAY*" "RGB* GRAY*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-STRING _"Pattern name" "My Pattern" SF-STRING _"Pattern name" "My Pattern"
SF-STRING _"File name" "mypattern") SF-STRING _"File name" "mypattern"
)

View File

@ -1,18 +1,18 @@
;; selection-rounded-rectangle.scm -*-scheme-*- ;; selection-rounded-rectangle.scm -*-scheme-*-
;; The GIMP -- an image manipulation program ;; The GIMP -- an image manipulation program
;; Copyright (C) 1995 Spencer Kimball and Peter Mattis ;; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;; ;;
;; This program is free software; you can redistribute it and/or modify ;; 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 ;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or ;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version. ;; (at your option) any later version.
;; ;;
;; This program is distributed in the hope that it will be useful, ;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details. ;; GNU General Public License for more details.
;; ;;
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software ;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -23,152 +23,159 @@
;; 1.02 - made script undoable ;; 1.02 - made script undoable
;; 2.00 - ALAN's Branch. changed name, menu, location, and description ;; 2.00 - ALAN's Branch. changed name, menu, location, and description
;; 2.01 - fixed to work if there was no current selection. ;; 2.01 - fixed to work if there was no current selection.
;; 2.02 - changed scale to percentages, usability tweaking. ;; 2.02 - changed scale to percentages, usability tweaking.
;; 2.10 - added concave round edges, updated description. ;; 2.10 - added concave round edges, updated description.
;; 2.11 - tweeked description, changed comments, relinquished any rights. ;; 2.11 - tweeked description, changed comments, relinquished any rights.
;; Copyright (C) 1997, 1998, Sven Neumann ;; Copyright (C) 1997, 1998, Sven Neumann
;; Copyright (C) 2004, Alan Horkan. ;; Copyright (C) 2004, Alan Horkan.
;; Alan Horkan relinquishes all rights to his changes, ;; Alan Horkan relinquishes all rights to his changes,
;; full ownership of this script belongs to Sven Neumann. ;; full ownership of this script belongs to Sven Neumann.
(define (script-fu-selection-rounded-rectangle image drawable radius concave) (define (script-fu-selection-rounded-rectangle image drawable radius concave)
(gimp-image-undo-group-start image) (gimp-image-undo-group-start image)
(if (= (car (gimp-selection-is-empty image)) TRUE) (gimp-selection-all image)) (if (= (car (gimp-selection-is-empty image)) TRUE) (gimp-selection-all image))
(let* ((radius (/ radius 100)) ; convert from percentages (let* (
(radius (min radius 1.0)) (radius (/ radius 100)) ; convert from percentages
(radius (max radius 0.0)) (radius (min radius 1.0))
(select-bounds (gimp-selection-bounds image)) (radius (max radius 0.0))
(has-selection (car select-bounds)) (select-bounds (gimp-selection-bounds image))
(select-x1 (cadr select-bounds)) (has-selection (car select-bounds))
(select-y1 (caddr select-bounds)) (select-x1 (cadr select-bounds))
(select-x2 (cadr (cddr select-bounds))) (select-y1 (caddr select-bounds))
(select-y2 (caddr (cddr select-bounds))) (select-x2 (cadr (cddr select-bounds)))
(select-width (- select-x2 select-x1)) (select-y2 (caddr (cddr select-bounds)))
(select-height (- select-y2 select-y1)) (select-width (- select-x2 select-x1))
(cut-radius 0) (select-height (- select-y2 select-y1))
(ellipse-radius 0)) (cut-radius 0)
(ellipse-radius 0)
)
;; select to the full bounds of the selection, ;; select to the full bounds of the selection,
;; fills in irregular shapes or holes. ;; fills in irregular shapes or holes.
(gimp-rect-select image (gimp-rect-select image
select-x1 select-y1 select-width select-height select-x1 select-y1 select-width select-height
CHANNEL-OP-ADD FALSE 0) CHANNEL-OP-ADD FALSE 0)
(if (> select-width select-height) (if (> select-width select-height)
(set! cut-radius (trunc (+ 1 (* radius (/ select-height 2))))) (set! cut-radius (trunc (+ 1 (* radius (/ select-height 2)))))
(set! cut-radius (trunc (+ 1 (* radius (/ select-width 2)))))) (set! cut-radius (trunc (+ 1 (* radius (/ select-width 2)))))
)
(set! ellipse-radius (* cut-radius 2)) (set! ellipse-radius (* cut-radius 2))
;; cut away rounded (concave) corners ;; cut away rounded (concave) corners
; top right ; top right
(gimp-ellipse-select image (gimp-ellipse-select image
(- select-x1 cut-radius) (- select-x1 cut-radius)
(- select-y1 cut-radius) (- select-y1 cut-radius)
(* cut-radius 2) (* cut-radius 2)
(* cut-radius 2) (* cut-radius 2)
CHANNEL-OP-SUBTRACT CHANNEL-OP-SUBTRACT
TRUE TRUE
FALSE 0) FALSE 0)
; lower left ; lower left
(gimp-ellipse-select image (gimp-ellipse-select image
(- select-x1 cut-radius) (- select-x1 cut-radius)
(- select-y2 cut-radius) (- select-y2 cut-radius)
(* cut-radius 2) (* cut-radius 2)
(* cut-radius 2) (* cut-radius 2)
CHANNEL-OP-SUBTRACT CHANNEL-OP-SUBTRACT
TRUE TRUE
FALSE 0) FALSE 0)
; top right ; top right
(gimp-ellipse-select image (gimp-ellipse-select image
(- select-x2 cut-radius) (- select-x2 cut-radius)
(- select-y1 cut-radius) (- select-y1 cut-radius)
(* cut-radius 2) (* cut-radius 2)
(* cut-radius 2) (* cut-radius 2)
CHANNEL-OP-SUBTRACT CHANNEL-OP-SUBTRACT
TRUE TRUE
FALSE 0) FALSE 0)
; bottom left ; bottom left
(gimp-ellipse-select image (gimp-ellipse-select image
(- select-x2 cut-radius) (- select-x2 cut-radius)
(- select-y2 cut-radius) (- select-y2 cut-radius)
(* cut-radius 2) (* cut-radius 2)
(* cut-radius 2) (* cut-radius 2)
CHANNEL-OP-SUBTRACT CHANNEL-OP-SUBTRACT
TRUE TRUE
FALSE 0) FALSE 0)
;; add in rounded (convex) corners ;; add in rounded (convex) corners
(if (= concave FALSE) (if (= concave FALSE)
(begin (begin
(gimp-ellipse-select image (gimp-ellipse-select image
select-x1 select-x1
select-y1 select-y1
ellipse-radius ellipse-radius
ellipse-radius ellipse-radius
CHANNEL-OP-ADD CHANNEL-OP-ADD
TRUE TRUE
FALSE 0) FALSE 0)
(gimp-ellipse-select image (gimp-ellipse-select image
select-x1 select-x1
(- select-y2 ellipse-radius) (- select-y2 ellipse-radius)
ellipse-radius ellipse-radius
ellipse-radius ellipse-radius
CHANNEL-OP-ADD CHANNEL-OP-ADD
TRUE TRUE
FALSE 0) FALSE 0)
(gimp-ellipse-select image (gimp-ellipse-select image
(- select-x2 ellipse-radius) (- select-x2 ellipse-radius)
select-y1 select-y1
ellipse-radius ellipse-radius
ellipse-radius ellipse-radius
CHANNEL-OP-ADD CHANNEL-OP-ADD
TRUE TRUE
FALSE 0) FALSE 0)
(gimp-ellipse-select image (gimp-ellipse-select image
(- select-x2 ellipse-radius) (- select-x2 ellipse-radius)
(- select-y2 ellipse-radius) (- select-y2 ellipse-radius)
ellipse-radius ellipse-radius
ellipse-radius ellipse-radius
CHANNEL-OP-ADD CHANNEL-OP-ADD
TRUE TRUE
FALSE 0))) FALSE 0)
)
)
(gimp-image-undo-group-end image) (gimp-image-undo-group-end image)
(gimp-displays-flush))) (gimp-displays-flush)
)
)
(define (script-fu-selection-round image (define (script-fu-selection-round image drawable radius)
drawable (script-fu-selection-rounded-rectangle image drawable (* radius 100))
radius) )
(script-fu-selection-rounded-rectangle image drawable (* radius 100)))
(script-fu-register "script-fu-selection-rounded-rectangle" (script-fu-register "script-fu-selection-rounded-rectangle"
_"Rounded R_ectangle..." _"Rounded R_ectangle..."
_"Round the corners of the current selection" _"Round the corners of the current selection"
"Alan Horkan, Sven Neumann" ; authors "Alan Horkan, Sven Neumann" ; authors
"Sven Neumann" ; copyright "Sven Neumann" ; copyright
"2004/06/07" "2004/06/07"
"*" "*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Radius (%)" '(50 0 100 1 10 0 0) SF-ADJUSTMENT _"Radius (%)" '(50 0 100 1 10 0 0)
SF-TOGGLE _"Concave" FALSE) SF-TOGGLE _"Concave" FALSE
)
(script-fu-menu-register "script-fu-selection-rounded-rectangle"
"<Image>/Select/Modify")
(script-fu-register "script-fu-selection-round" (script-fu-register "script-fu-selection-round"
"" ""
_"Round the corners of the current selection (deprecated, use Rounded Rectangle)" _"Round the corners of the current selection (deprecated, use Rounded Rectangle)"
"Sven Neumann" ; authors "Sven Neumann" ; authors
"Sven Neumann" ; copyright "Sven Neumann" ; copyright
"1998/02/06" "1998/02/06"
"*" "*"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Relative radius" '(1 0 128 .1 1 1 1)) SF-ADJUSTMENT "Relative radius" '(1 0 128 .1 1 1 1)
)
(script-fu-menu-register "script-fu-selection-rounded-rectangle"
"<Image>/Select/Modify")

View File

@ -1,16 +1,16 @@
; The GIMP -- an image manipulation program ; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -22,7 +22,7 @@
; 0.20 - first public release ; 0.20 - first public release
; 0.30 - some code cleanup ; 0.30 - some code cleanup
; now uses the rotate plug-in to improve speed ; now uses the rotate plug-in to improve speed
; 0.40 - changes to work with gimp-1.1 ; 0.40 - changes to work with gimp-1.1
; if the image was rotated, rotate the whole thing back when finished ; if the image was rotated, rotate the whole thing back when finished
; 0.41 - changes to work with gimp-2.0, slightly correct text offsets, ; 0.41 - changes to work with gimp-2.0, slightly correct text offsets,
; Nils Philippsen <nphilipp@redhat.com> 2004/03/28 ; Nils Philippsen <nphilipp@redhat.com> 2004/03/28
@ -34,214 +34,220 @@
; - ? ; - ?
; ;
; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org> ; Copyright (C) 1997-1999 Sven Neumann <sven@gimp.org>
; ;
; makes your picture look like a slide ; makes your picture look like a slide
; ;
; The script works on RGB and grayscale images that contain only ; The script works on RGB and grayscale images that contain only
; one layer. The image is cropped to fit into an aspect ratio of 1:1,5. ; one layer. The image is cropped to fit into an aspect ratio of 1:1,5.
; It creates a copy of the image or can optionally work on the original. ; It creates a copy of the image or can optionally work on the original.
; The script uses the current background color to create a background ; The script uses the current background color to create a background
; layer. ; layer.
(define (crop width height ratio)
(cond ((>= width (* ratio height)) (* ratio height))
((< width (* ratio height)) width)))
(define (script-fu-slide img (define (script-fu-slide img
drawable drawable
text text
number number
fontname fontname
font-color font-color
work-on-copy) work-on-copy)
(let* ((type (car (gimp-drawable-type-with-alpha drawable)))
(image (cond ((= work-on-copy TRUE)
(car (gimp-image-duplicate img)))
((= work-on-copy FALSE)
img)))
(owidth (car (gimp-image-width image)))
(oheight (car (gimp-image-height image)))
(ratio (if (>= owidth oheight) (/ 3 2)
(/ 2 3)))
(crop-width (crop owidth oheight ratio))
(crop-height (/ crop-width ratio))
(width (* (max crop-width crop-height) 1.05))
(height (* (min crop-width crop-height) 1.5))
(hole-width (/ width 20))
(hole-space (/ width 8))
(hole-height (/ width 12))
(hole-radius (/ hole-width 4))
(hole-start (- (/ (rand 1000) 1000) 0.5))
(film-layer (car (gimp-layer-new image
width
height
type
"Film"
100
NORMAL-MODE)))
(bg-layer (car (gimp-layer-new image
width
height
type
"Background"
100
NORMAL-MODE)))
(pic-layer (car (gimp-image-get-active-drawable image)))
(numbera (string-append number "A")))
(gimp-context-push) (define (crop width height ratio)
(cond ((>= width (* ratio height)) (* ratio height))
((< width (* ratio height)) width)))
(gimp-image-undo-disable image)
(let* (
(type (car (gimp-drawable-type-with-alpha drawable)))
(image (cond ((= work-on-copy TRUE)
(car (gimp-image-duplicate img)))
((= work-on-copy FALSE)
img)))
(owidth (car (gimp-image-width image)))
(oheight (car (gimp-image-height image)))
(ratio (if (>= owidth oheight) (/ 3 2)
(/ 2 3)))
(crop-width (crop owidth oheight ratio))
(crop-height (/ crop-width ratio))
(width (* (max crop-width crop-height) 1.05))
(height (* (min crop-width crop-height) 1.5))
(hole-width (/ width 20))
(hole-space (/ width 8))
(hole-height (/ width 12))
(hole-radius (/ hole-width 4))
(hole-start (- (/ (rand 1000) 1000) 0.5))
(film-layer (car (gimp-layer-new image
width
height
type
"Film"
100
NORMAL-MODE)))
(bg-layer (car (gimp-layer-new image
width
height
type
"Background"
100
NORMAL-MODE)))
(pic-layer (car (gimp-image-get-active-drawable image)))
(numbera (string-append number "A"))
)
(gimp-context-push)
(gimp-image-undo-disable image)
; add an alpha channel to the image ; add an alpha channel to the image
(gimp-layer-add-alpha pic-layer) (gimp-layer-add-alpha pic-layer)
; crop, resize and eventually rotate the image ; crop, resize and eventually rotate the image
(gimp-image-crop image (gimp-image-crop image
crop-width crop-width
crop-height crop-height
(/ (- owidth crop-width) 2) (/ (- owidth crop-width) 2)
(/ (- oheight crop-height) 2)) (/ (- oheight crop-height) 2))
(gimp-image-resize image (gimp-image-resize image
width width
height height
(/ (- width crop-width) 2) (/ (- width crop-width) 2)
(/ (- height crop-height) 2)) (/ (- height crop-height) 2))
(if (< ratio 1) (plug-in-rotate 1 (if (< ratio 1)
image (plug-in-rotate 1 image pic-layer 1 FALSE)
pic-layer )
1
FALSE))
; add the background layer ; add the background layer
(gimp-drawable-fill bg-layer BACKGROUND-FILL) (gimp-drawable-fill bg-layer BACKGROUND-FILL)
(gimp-image-add-layer image bg-layer -1) (gimp-image-add-layer image bg-layer -1)
; add the film layer ; add the film layer
(gimp-context-set-background '(0 0 0)) (gimp-context-set-background '(0 0 0))
(gimp-drawable-fill film-layer BACKGROUND-FILL) (gimp-drawable-fill film-layer BACKGROUND-FILL)
(gimp-image-add-layer image film-layer -1) (gimp-image-add-layer image film-layer -1)
; add the text ; add the text
(gimp-context-set-foreground font-color) (gimp-context-set-foreground font-color)
(gimp-floating-sel-anchor (car (gimp-text-fontname image (gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer film-layer
(+ hole-start (* -0.25 width)) (+ hole-start (* -0.25 width))
(* 0.01 height) (* 0.01 height)
text text
0 0
TRUE TRUE
(* 0.040 height) PIXELS fontname))) (* 0.040 height) PIXELS fontname)))
(gimp-floating-sel-anchor (car (gimp-text-fontname image (gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer film-layer
(+ hole-start (* 0.75 width)) (+ hole-start (* 0.75 width))
(* 0.01 height) (* 0.01 height)
text text
0 0
TRUE TRUE
(* 0.040 height) PIXELS (* 0.040 height) PIXELS
fontname ))) fontname )))
(gimp-floating-sel-anchor (car (gimp-text-fontname image (gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer film-layer
(+ hole-start (* 0.35 width)) (+ hole-start (* 0.35 width))
0.0 0.0
number number
0 0
TRUE TRUE
(* 0.050 height) PIXELS (* 0.050 height) PIXELS
fontname ))) fontname )))
(gimp-floating-sel-anchor (car (gimp-text-fontname image (gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer film-layer
(+ hole-start (* 0.35 width)) (+ hole-start (* 0.35 width))
(* 0.94 height) (* 0.94 height)
number number
0 0
TRUE TRUE
(* 0.050 height) PIXELS (* 0.050 height) PIXELS
fontname ))) fontname )))
(gimp-floating-sel-anchor (car (gimp-text-fontname image (gimp-floating-sel-anchor (car (gimp-text-fontname image
film-layer film-layer
(+ hole-start (* 0.85 width)) (+ hole-start (* 0.85 width))
(* 0.945 height) (* 0.945 height)
numbera numbera
0 0
TRUE TRUE
(* 0.045 height) PIXELS (* 0.045 height) PIXELS
fontname ))) fontname )))
; create a mask for the holes and cut them out ; create a mask for the holes and cut them out
(let* ((film-mask (car (gimp-layer-create-mask film-layer ADD-WHITE-MASK))) (let* (
(hole hole-start) (film-mask (car (gimp-layer-create-mask film-layer ADD-WHITE-MASK)))
(top-y (* height 0.06)) (hole hole-start)
(bottom-y(* height 0.855))) (top-y (* height 0.06))
(bottom-y(* height 0.855))
)
(gimp-layer-add-mask film-layer film-mask) (gimp-layer-add-mask film-layer film-mask)
(gimp-selection-none image) (gimp-selection-none image)
(while (< hole 8) (while (< hole 8)
(gimp-rect-select image (gimp-rect-select image
(* hole-space hole) (* hole-space hole)
top-y top-y
hole-width hole-width
hole-height hole-height
CHANNEL-OP-ADD CHANNEL-OP-ADD
FALSE FALSE
0) 0)
(gimp-rect-select image (gimp-rect-select image
(* hole-space hole) (* hole-space hole)
bottom-y bottom-y
hole-width hole-width
hole-height hole-height
CHANNEL-OP-ADD CHANNEL-OP-ADD
FALSE FALSE
0) 0)
(set! hole (+ hole 1))) (set! hole (+ hole 1))
)
(gimp-context-set-foreground '(0 0 0)) (gimp-context-set-foreground '(0 0 0))
(gimp-edit-fill film-mask BACKGROUND-FILL) (gimp-edit-fill film-mask BACKGROUND-FILL)
(gimp-selection-none image) (gimp-selection-none image)
(plug-in-gauss-rle 1 image film-mask hole-radius TRUE TRUE) (plug-in-gauss-rle 1 image film-mask hole-radius TRUE TRUE)
(gimp-threshold film-mask 127 255) (gimp-threshold film-mask 127 255)
(gimp-layer-remove-mask film-layer MASK-APPLY)) (gimp-layer-remove-mask film-layer MASK-APPLY)
)
; reorder the layers ; reorder the layers
(gimp-image-raise-layer image pic-layer) (gimp-image-raise-layer image pic-layer)
(gimp-image-raise-layer image pic-layer) (gimp-image-raise-layer image pic-layer)
; eventually rotate the whole thing back ; eventually rotate the whole thing back
(if (< ratio 1) (if (< ratio 1)
(plug-in-rotate 1 (plug-in-rotate 1 image pic-layer 3 TRUE)
image )
pic-layer
3
TRUE))
; clean up after the script ; clean up after the script
(gimp-selection-none image) (gimp-selection-none image)
(gimp-image-undo-enable image) (gimp-image-undo-enable image)
(if (= work-on-copy TRUE) (if (= work-on-copy TRUE)
(gimp-display-new image)) (gimp-display-new image)
(gimp-displays-flush) )
(gimp-displays-flush)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-slide" (script-fu-register "script-fu-slide"
_"_Slide..." _"_Slide..."
_"Add a slide-film like frame, sprocket holes, and labels to an image" _"Add a slide-film like frame, sprocket holes, and labels to an image"
"Sven Neumann <sven@gimp.org>" "Sven Neumann <sven@gimp.org>"
"Sven Neumann" "Sven Neumann"
"2004/03/28" "2004/03/28"
"RGB GRAY" "RGB GRAY"
SF-IMAGE "Image" 0 SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0 SF-DRAWABLE "Drawable" 0
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-STRING _"Number" "32" SF-STRING _"Number" "32"
SF-FONT _"Font" "Serif" SF-FONT _"Font" "Serif"
SF-COLOR _"Font color" "darkorange" SF-COLOR _"Font color" '(255 180 0)
SF-TOGGLE _"Work on copy" TRUE) SF-TOGGLE _"Work on copy" TRUE
)
(script-fu-menu-register "script-fu-slide" (script-fu-menu-register "script-fu-slide"
"<Image>/Filters/Decor") "<Image>/Filters/Decor")

View File

@ -2,88 +2,108 @@
; State of the art chrome logos ; State of the art chrome logos
; ;
(define (set-pt a index x y) (define (script-fu-sota-chrome-logo chrome-saturation chrome-lightness
(prog1 chrome-factor text size fontname
(aset a (* index 2) x) env-map hc cc)
(aset a (+ (* index 2) 1) y)))
(define (spline1) (define (set-pt a index x y)
(let* ((a (cons-array 18 'byte))) (begin
(set-pt a 0 0 0) (aset a (* index 2) x)
(set-pt a 1 31 235) (aset a (+ (* index 2) 1) y)
(set-pt a 2 63 23) )
(set-pt a 3 95 230) )
(set-pt a 4 127 25)
(set-pt a 5 159 210)
(set-pt a 6 191 20)
(set-pt a 7 223 240)
(set-pt a 8 255 31)
a))
(define (brush brush-size) (define (spline1)
(cond ((<= brush-size 5) "Circle Fuzzy (05)") (let* ((a (cons-array 18 'byte)))
((<= brush-size 7) "Circle Fuzzy (07)") (set-pt a 0 0 0)
((<= brush-size 9) "Circle Fuzzy (09)") (set-pt a 1 31 235)
((<= brush-size 11) "Circle Fuzzy (11)") (set-pt a 2 63 23)
((<= brush-size 13) "Circle Fuzzy (13)") (set-pt a 3 95 230)
((<= brush-size 15) "Circle Fuzzy (15)") (set-pt a 4 127 25)
((<= brush-size 17) "Circle Fuzzy (17)") (set-pt a 5 159 210)
(else "Circle Fuzzy (19)"))) (set-pt a 6 191 20)
(set-pt a 7 223 240)
(set-pt a 8 255 31)
a
)
)
(define (shadows val) (define (brush brush-size)
(/ (* 0.96 val) 2.55)) (cond ((<= brush-size 5) "Circle Fuzzy (05)")
((<= brush-size 7) "Circle Fuzzy (07)")
((<= brush-size 9) "Circle Fuzzy (09)")
((<= brush-size 11) "Circle Fuzzy (11)")
((<= brush-size 13) "Circle Fuzzy (13)")
((<= brush-size 15) "Circle Fuzzy (15)")
((<= brush-size 17) "Circle Fuzzy (17)")
(else "Circle Fuzzy (19)")
)
)
(define (midtones val) (define (shadows val)
(/ val 2.55)) (/ (* 0.96 val) 2.55)
)
(define (highlights val) (define (midtones val)
(let ((h (/ (* 1.108 val) 2.55))) (/ val 2.55)
(if (> h 100) 100 h))) )
(define (rval col) (define (highlights val)
(car col)) (let ((h (/ (* 1.108 val) 2.55)))
(if (> h 100) 100 h)
)
)
(define (gval col) (define (rval col)
(cadr col)) (car col)
)
(define (bval col) (define (gval col)
(caddr col)) (cadr col)
)
(define (sota-scale val scale chrome-factor) (define (bval col)
(* (sqrt val) (* scale chrome-factor))) (caddr col)
)
(define (copy-layer-sota dest-image dest-drawable source-image source-drawable) (define (sota-scale val scale chrome-factor)
(gimp-selection-all dest-image) (* (sqrt val) (* scale chrome-factor))
(gimp-edit-clear dest-drawable) )
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-drawable)
(let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel)))
(define (script-fu-sota-chrome-logo chrome-saturation chrome-lightness chrome-factor (define (copy-layer-sota dest-image dest-drawable source-image source-drawable)
text size fontname env-map hc cc) (gimp-selection-all dest-image)
(let* ((img (car (gimp-image-new 256 256 GRAY))) (gimp-edit-clear dest-drawable)
(banding-img (car (gimp-file-load 1 env-map env-map))) (gimp-selection-none dest-image)
(banding-layer (car (gimp-image-get-active-drawable banding-img))) (gimp-selection-all source-image)
(banding-height (car (gimp-drawable-height banding-layer))) (gimp-edit-copy source-drawable)
(banding-width (car (gimp-drawable-width banding-layer))) (let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(banding-type (car (gimp-drawable-type banding-layer))) (gimp-floating-sel-anchor floating-sel)
(b-size (sota-scale size 2 chrome-factor)) )
(offx1 (sota-scale size 0.33 chrome-factor)) )
(offy1 (sota-scale size 0.25 chrome-factor))
(offx2 (sota-scale size (- 0.33) chrome-factor)) (let* (
(offy2 (sota-scale size (- 0.25) chrome-factor)) (img (car (gimp-image-new 256 256 GRAY)))
(feather (sota-scale size 0.5 chrome-factor)) (banding-img (car (gimp-file-load 1 env-map env-map)))
(brush-size (sota-scale size 0.5 chrome-factor)) (banding-layer (car (gimp-image-get-active-drawable banding-img)))
(text-layer (car (gimp-text-fontname img -1 0 0 text (* b-size 2) TRUE size PIXELS fontname))) (banding-height (car (gimp-drawable-height banding-layer)))
(width (car (gimp-drawable-width text-layer))) (banding-width (car (gimp-drawable-width banding-layer)))
(height (car (gimp-drawable-height text-layer))) (banding-type (car (gimp-drawable-type banding-layer)))
(layer1 (car (gimp-layer-new img banding-width banding-height banding-type "Layer1" 100 NORMAL-MODE))) (b-size (sota-scale size 2 chrome-factor))
(layer2 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 2" 100 DIFFERENCE-MODE))) (offx1 (sota-scale size 0.33 chrome-factor))
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE))) (offy1 (sota-scale size 0.25 chrome-factor))
(shadow (car (gimp-layer-new img width height GRAYA-IMAGE "Drop Shadow" 100 NORMAL-MODE))) (offx2 (sota-scale size (- 0.33) chrome-factor))
(layer-mask 0)) (offy2 (sota-scale size (- 0.25) chrome-factor))
(feather (sota-scale size 0.5 chrome-factor))
(brush-size (sota-scale size 0.5 chrome-factor))
(text-layer (car (gimp-text-fontname img -1 0 0 text (* b-size 2) TRUE size PIXELS fontname)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(layer1 (car (gimp-layer-new img banding-width banding-height banding-type "Layer1" 100 NORMAL-MODE)))
(layer2 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 2" 100 DIFFERENCE-MODE)))
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(shadow (car (gimp-layer-new img width height GRAYA-IMAGE "Drop Shadow" 100 NORMAL-MODE)))
(layer-mask 0)
)
(gimp-context-push) (gimp-context-push)
@ -123,8 +143,8 @@
(gimp-layer-scale layer1 width height FALSE) (gimp-layer-scale layer1 width height FALSE)
(plug-in-gauss-iir 1 img layer1 10 TRUE TRUE) (plug-in-gauss-iir 1 img layer1 10 TRUE TRUE)
(gimp-layer-set-opacity layer1 50) (gimp-layer-set-opacity layer1 50)
(gimp-drawable-set-visible layer1 TRUE) (gimp-drawable-set-visible layer1 TRUE)
(gimp-drawable-set-visible layer2 TRUE) (gimp-drawable-set-visible layer2 TRUE)
(set! layer1 (car (gimp-image-merge-visible-layers img CLIP-TO-IMAGE))) (set! layer1 (car (gimp-image-merge-visible-layers img CLIP-TO-IMAGE)))
(gimp-curves-spline layer1 0 18 (spline1)) (gimp-curves-spline layer1 0 18 (spline1))
@ -175,27 +195,31 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-sota-chrome-logo" (script-fu-register "script-fu-sota-chrome-logo"
_"SOTA Chrome..." _"SOTA Chrome..."
_"Create a State Of The Art chromed logo" _"Create a State Of The Art chromed logo"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1997" "1997"
"" ""
SF-ADJUSTMENT _"Chrome saturation" '(-80 -100 100 1 10 0 0) SF-ADJUSTMENT _"Chrome saturation" '(-80 -100 100 1 10 0 0)
SF-ADJUSTMENT _"Chrome lightness" '(-47 -100 100 1 10 0 0) SF-ADJUSTMENT _"Chrome lightness" '(-47 -100 100 1 10 0 0)
SF-ADJUSTMENT _"Chrome factor" '(.75 0 1 .1 .01 2 0) SF-ADJUSTMENT _"Chrome factor" '(.75 0 1 .1 .01 2 0)
SF-STRING _"Text" "GIMP" SF-STRING _"Text" "The GIMP"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "RoostHeavy" SF-FONT _"Font" "RoostHeavy"
SF-FILENAME _"Environment map" SF-FILENAME _"Environment map"
(string-append "" (string-append gimp-data-directory DIR-SEPARATOR
gimp-data-directory "scripts" DIR-SEPARATOR
"/scripts/images/beavis.jpg") "images" DIR-SEPARATOR
SF-COLOR _"Highlight balance" '(211 95 0) "beavis.jpg")
SF-COLOR _"Chrome balance" "black") SF-COLOR _"Highlight balance" '(211 95 0)
SF-COLOR _"Chrome balance" '(0 0 0)
)
(script-fu-menu-register "script-fu-sota-chrome-logo" (script-fu-menu-register "script-fu-sota-chrome-logo"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -3,34 +3,37 @@
; ;
; ;
; Based on alien glow code from Adrian Likins ; Based on alien glow code from Adrian Likins
; ;
; This program is free software; you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-speed-text string font font-size density text-color bg-color) (define (script-fu-speed-text string font font-size density text-color bg-color)
(let* ((text-ext (gimp-text-get-extents-fontname string font-size PIXELS font)) (let* (
(wid (+ (car text-ext) 20)) (text-ext (gimp-text-get-extents-fontname string font-size PIXELS font))
(hi (+ (nth 1 text-ext) 20)) (wid (+ (car text-ext) 20))
(img (car (gimp-image-new wid hi RGB))) (hi (+ (list-ref text-ext 1) 20))
(bg-layer (car (gimp-layer-new img wid hi RGB-IMAGE "Background" 100 NORMAL-MODE))) (img (car (gimp-image-new wid hi RGB)))
(text-layer (car (gimp-layer-new img wid hi RGBA-IMAGE "Text layer" 100 NORMAL-MODE))) (bg-layer (car (gimp-layer-new img wid hi RGB-IMAGE "Background" 100 NORMAL-MODE)))
(text-mask 0) (text-layer (car (gimp-layer-new img wid hi RGBA-IMAGE "Text layer" 100 NORMAL-MODE)))
(saved-select 0) (text-mask 0)
(cell-size (/ font-size 8)) (saved-select 0)
(grey (/ (* density 255) 100)) (cell-size (/ font-size 8))
(saved-sel)) (grey (/ (* density 255) 100))
(saved-sel)
(text-mask)
)
(gimp-context-push) (gimp-context-push)
@ -75,21 +78,24 @@
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-speed-text" (script-fu-register "script-fu-speed-text"
_"Speed Text..." _"Speed Text..."
_"Create a logo using a speedy text effect" _"Create a logo with a speedy text effect"
"Austin Donnelly" "Austin Donnelly"
"Austin Donnelly" "Austin Donnelly"
"1998" "1998"
"" ""
SF-STRING _"Text" "Speed!" SF-STRING _"Text" "Speed!"
SF-FONT _"Font" "Charter" SF-FONT _"Font" "Charter"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1) SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-ADJUSTMENT _"Density (%)" '(80 0 100 1 10 0 0) SF-ADJUSTMENT _"Density (%)" '(80 0 100 1 10 0 0)
SF-COLOR _"Text color" "black" SF-COLOR _"Text color" '(0 0 0)
SF-COLOR _"Background color" "white") SF-COLOR _"Background color" '(255 255 255)
)
(script-fu-menu-register "script-fu-speed-text" (script-fu-menu-register "script-fu-speed-text"
"<Toolbox>/Xtns/Logos") "<Toolbox>/Xtns/Logos")

View File

@ -8,23 +8,26 @@
; shadow: whather to create a shadow as well ; shadow: whather to create a shadow as well
(define (script-fu-sphere radius (define (script-fu-sphere radius
light light
shadow shadow
bg-color bg-color
sphere-color) sphere-color)
(let* ((width (* radius 3.75)) (let* (
(height (* radius 2.5)) (width (* radius 3.75))
(img (car (gimp-image-new width height RGB))) (height (* radius 2.5))
(drawable (car (gimp-layer-new img width height RGB-IMAGE (img (car (gimp-image-new width height RGB)))
"Sphere Layer" 100 NORMAL-MODE))) (drawable (car (gimp-layer-new img width height RGB-IMAGE
(radians (/ (* light *pi*) 180)) "Sphere Layer" 100 NORMAL-MODE)))
(cx (/ width 2)) (*pi* (* 4 (atan 1.0)))
(cy (/ height 2)) (radians (/ (* light *pi*) 180))
(light-x (+ cx (* radius (* 0.6 (cos radians))))) (cx (/ width 2))
(light-y (- cy (* radius (* 0.6 (sin radians))))) (cy (/ height 2))
(light-end-x (+ cx (* radius (cos (+ *pi* radians))))) (light-x (+ cx (* radius (* 0.6 (cos radians)))))
(light-end-y (- cy (* radius (sin (+ *pi* radians))))) (light-y (- cy (* radius (* 0.6 (sin radians)))))
(offset (* radius 0.1))) (light-end-x (+ cx (* radius (cos (+ *pi* radians)))))
(light-end-y (- cy (* radius (sin (+ *pi* radians)))))
(offset (* radius 0.1))
)
(gimp-context-push) (gimp-context-push)
@ -35,47 +38,50 @@
(gimp-edit-fill drawable BACKGROUND-FILL) (gimp-edit-fill drawable BACKGROUND-FILL)
(gimp-context-set-background '(20 20 20)) (gimp-context-set-background '(20 20 20))
(if (and (if (and
(or (and (>= light 45) (<= light 75)) (or (and (>= light 45) (<= light 75))
(and (<= light 135) (>= light 105))) (and (<= light 135) (>= light 105)))
(= shadow TRUE)) (= shadow TRUE))
(let ((shadow-w (* (* radius 2.5) (cos (+ *pi* radians)))) (let ((shadow-w (* (* radius 2.5) (cos (+ *pi* radians))))
(shadow-h (* radius 0.5)) (shadow-h (* radius 0.5))
(shadow-x cx) (shadow-x cx)
(shadow-y (+ cy (* radius 0.65)))) (shadow-y (+ cy (* radius 0.65))))
(if (< shadow-w 0) (if (< shadow-w 0)
(prog1 (set! shadow-x (+ cx shadow-w)) (begin (set! shadow-x (+ cx shadow-w))
(set! shadow-w (- shadow-w)))) (set! shadow-w (- shadow-w))))
(gimp-ellipse-select img shadow-x shadow-y shadow-w shadow-h (gimp-ellipse-select img shadow-x shadow-y shadow-w shadow-h
CHANNEL-OP-REPLACE TRUE TRUE 7.5) CHANNEL-OP-REPLACE TRUE TRUE 7.5)
(gimp-edit-bucket-fill drawable BG-BUCKET-FILL MULTIPLY-MODE 100 0 FALSE 0 0))) (gimp-edit-bucket-fill drawable BG-BUCKET-FILL MULTIPLY-MODE 100 0 FALSE 0 0)))
(gimp-ellipse-select img (- cx radius) (- cy radius) (gimp-ellipse-select img (- cx radius) (- cy radius)
(* 2 radius) (* 2 radius) CHANNEL-OP-REPLACE TRUE FALSE 0) (* 2 radius) (* 2 radius) CHANNEL-OP-REPLACE TRUE FALSE 0)
(gimp-edit-blend drawable FG-BG-RGB-MODE NORMAL-MODE (gimp-edit-blend drawable FG-BG-RGB-MODE NORMAL-MODE
GRADIENT-RADIAL 100 offset REPEAT-NONE FALSE GRADIENT-RADIAL 100 offset REPEAT-NONE FALSE
FALSE 0 0 TRUE FALSE 0 0 TRUE
light-x light-y light-end-x light-end-y) light-x light-y light-end-x light-end-y)
(gimp-selection-none img) (gimp-selection-none img)
(gimp-image-undo-enable img) (gimp-image-undo-enable img)
(gimp-display-new img) (gimp-display-new img)
(gimp-context-pop))) (gimp-context-pop)
)
)
(script-fu-register "script-fu-sphere" (script-fu-register "script-fu-sphere"
_"_Sphere..." _"_Sphere..."
_"Create a simple sphere with a drop shadow" _"Create a simple sphere with a drop shadow"
"Spencer Kimball" "Spencer Kimball"
"Spencer Kimball" "Spencer Kimball"
"1996" "1996"
"" ""
SF-ADJUSTMENT _"Radius (pixels)" '(100 5 500 1 10 0 1) SF-ADJUSTMENT _"Radius (pixels)" '(100 5 500 1 10 0 1)
SF-ADJUSTMENT _"Lighting (degrees)" '(45 0 360 1 10 0 0) SF-ADJUSTMENT _"Lighting (degrees)" '(45 0 360 1 10 0 0)
SF-TOGGLE _"Shadow" TRUE SF-TOGGLE _"Shadow" TRUE
SF-COLOR _"Background color" "white" SF-COLOR _"Background color" '(255 255 255)
SF-COLOR _"Sphere color" "red") SF-COLOR _"Sphere color" '(255 0 0)
)
(script-fu-menu-register "script-fu-sphere" (script-fu-menu-register "script-fu-sphere"
"<Toolbox>/Xtns/Misc") "<Toolbox>/Xtns/Misc")

View File

@ -8,12 +8,12 @@
; it under the terms of the GNU General Public License as published by ; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or ; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. ; (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -21,103 +21,93 @@
; Define the function: ; Define the function:
(define (script-fu-spinning-globe inImage (define (script-fu-spinning-globe inImage
inLayer inLayer
inFrames inFrames
inFromLeft inFromLeft
inTransparent inTransparent
inIndex inIndex
inCopy) inCopy)
(let* ( (let* (
(theImage (if (= inCopy TRUE) (theImage (if (= inCopy TRUE)
(car (gimp-image-duplicate inImage)) (car (gimp-image-duplicate inImage))
inImage)) inImage))
(theLayer (car (gimp-image-get-active-layer theImage))) (theLayer (car (gimp-image-get-active-layer theImage)))
(n 0) (n 0)
(ang (* (/ 360 inFrames) (ang (* (/ 360 inFrames)
(if (= inFromLeft TRUE) 1 -1) )) (if (= inFromLeft TRUE) 1 -1) ))
(theFrame)
(theFrame) (theFrame)
) )
(gimp-layer-add-alpha theLayer) (gimp-layer-add-alpha theLayer)
(while (> inFrames n) (while (> inFrames n)
(set! n (+ n 1)) (set! n (+ n 1))
(set! theFrame (car (gimp-layer-copy theLayer FALSE))) (set! theFrame (car (gimp-layer-copy theLayer FALSE)))
(gimp-image-add-layer theImage theFrame 0) (gimp-image-add-layer theImage theFrame 0)
(gimp-drawable-set-name theFrame (gimp-drawable-set-name theFrame
(string-append "Anim Frame: " (string-append "Anim Frame: "
(number->string (- inFrames n) 10) (number->string (- inFrames n) 10)
" (replace)")) " (replace)"))
(plug-in-map-object RUN-NONINTERACTIVE (plug-in-map-object RUN-NONINTERACTIVE
theImage theFrame theImage theFrame ; mapping
; mapping 1 ; viewpoint
1 0.5 0.5 2.0 ; object pos
; viewpoint 0.5 0.5 0.0 ; first axis
0.5 0.5 2.0 1.0 0.0 0.0 ; 2nd axis
; object pos 0.0 1.0 0.0 ; axis rotation
0.5 0.5 0.0 0.0 (* n ang) 0.0 ; light (type, color)
; first axis 0 '(255 255 255) ; light position
1.0 0.0 0.0 -0.5 -0.5 2.0 ; light direction
; 2nd axis -1.0 -1.0 1.0 ; material (amb, diff, refl, spec, high)
0.0 1.0 0.0 0.3 1.0 0.5 0.0 27.0 ; antialias
; axis rotation TRUE ; tile
0.0 (* n ang) 0.0 FALSE ; new image
; light (type, color) FALSE ; transparency
0 '(255 255 255) inTransparent ; radius
; light position 0.25 ; unused parameters
-0.5 -0.5 2.0 1.0 1.0 1.0 1.0
; light direction -1 -1 -1 -1 -1 -1 -1 -1
-1.0 -1.0 1.0 )
; material (amb, diff, refl, spec, high) )
0.3 1.0 0.5 0.0 27.0
; antialias
TRUE
; tile
FALSE
; new image
FALSE
; transparency
inTransparent
; radius
0.25
; unused parameters
1.0 1.0 1.0 1.0
-1 -1 -1 -1 -1 -1 -1 -1)
; end while:
)
(gimp-image-remove-layer theImage theLayer) (gimp-image-remove-layer theImage theLayer)
(plug-in-autocrop RUN-NONINTERACTIVE theImage theFrame) (plug-in-autocrop RUN-NONINTERACTIVE theImage theFrame)
(if (= inIndex 0) (if (= inIndex 0)
() ()
(gimp-image-convert-indexed theImage FS-DITHER MAKE-PALETTE inIndex (gimp-image-convert-indexed theImage FS-DITHER MAKE-PALETTE inIndex
FALSE FALSE "")) FALSE FALSE ""))
(if (= inCopy TRUE) (if (= inCopy TRUE)
(begin (begin
(gimp-image-clean-all theImage) (gimp-image-clean-all theImage)
(gimp-display-new theImage)) (gimp-display-new theImage)
()) )
)
(gimp-displays-flush) (gimp-displays-flush)
) )
) )
(script-fu-register "script-fu-spinning-globe" ; Register the function with the GIMP:
_"_Spinning Globe..."
_"Create an animation by mapping the current image onto a spinning sphere" (script-fu-register
"Chris Gutteridge" "script-fu-spinning-globe"
"1998, Chris Gutteridge / ECS dept, University of Southampton, England." _"_Spinning Globe..."
"16th April 1998" _"Create an animation by mapping the current image onto a spinning sphere"
"RGB* GRAY*" "Chris Gutteridge"
SF-IMAGE "The Image" 0 "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
SF-DRAWABLE "The Layer" 0 "16th April 1998"
SF-ADJUSTMENT _"Frames" '(10 1 360 1 10 0 1) "RGB* GRAY*"
SF-TOGGLE _"Turn from left to right" FALSE SF-IMAGE "The Image" 0
SF-TOGGLE _"Transparent background" TRUE SF-DRAWABLE "The Layer" 0
SF-ADJUSTMENT _"Index to n colors (0 = remain RGB)" '(63 0 256 1 10 0 1) SF-ADJUSTMENT _"Frames" '(10 1 360 1 10 0 1)
SF-TOGGLE _"Work on copy" TRUE) SF-TOGGLE _"Turn from left to right" FALSE
SF-TOGGLE _"Transparent background" TRUE
SF-ADJUSTMENT _"Index to n colors (0 = remain RGB)" '(63 0 256 1 10 0 1)
SF-TOGGLE _"Work on copy" TRUE
)
(script-fu-menu-register "script-fu-spinning-globe" (script-fu-menu-register "script-fu-spinning-globe"
"<Image>/Filters/Animation/Animators") "<Image>/Filters/Animation/Animators")

View File

@ -1,364 +1,353 @@
;; spyrogimp.scm -*-scheme-*- ;; spyrogimp.scm -*-scheme-*-
;; Draws Spirographs, Epitrochoids and Lissajous Curves. ;; Draws Spirographs, Epitrochoids and Lissajous Curves.
;; More info at http://www.wisdom.weizmann.ac.il/~elad/spyrogimp/ ;; More info at http://www.wisdom.weizmann.ac.il/~elad/spyrogimp/
;; Version 1.2 ;; Version 1.2
;; ;;
;; Copyright (C) 2003 by Elad Shahar <elad@wisdom.weizmann.ac.il> ;; Copyright (C) 2003 by Elad Shahar <elad@wisdom.weizmann.ac.il>
;; ;;
;; This program is free software; you can redistribute it and/or ;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License ;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2 ;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version. ;; of the License, or (at your option) any later version.
;; ;;
;; This program is distributed in the hope that it will be useful, ;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details. ;; GNU General Public License for more details.
;; ;;
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software ;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Internal function to draw the spyro.
(define (script-fu-spyrogimp-internal img drw ; This routine is invoked by a dialog.
x1 y1 x2 y2 ; Bounding box. ; It is the main routine in this file.
type ; = 0 (Spirograph), 1 (Epitrochoid), 2(Lissajous) . (define (script-fu-spyrogimp img drw
shape ; = 0 (Circle), 1 (Frame), >2 (Polygons) . type shape
oteeth iteeth ; Outer and inner teeth. oteeth iteeth
margin hole-ratio margin hole-ratio start-angle
start-angle ; 0 <= start-angle < 360 . tool brush
tool ; = 0 (Pencil), 1 (Brush), 2 (Airbrush) . color-method color grad)
brush
color-method ; = 0 (Single color), 1 (Grad. Loop Sawtooth), 2 (Grad. Loop triangle) . ; Internal function to draw the spyro.
color ; Used when color-method = Single color . (define (script-fu-spyrogimp-internal img drw
grad ; Gradient used in Gradient color methods. x1 y1 x2 y2 ; Bounding box.
) type ; = 0 (Spirograph), 1 (Epitrochoid), 2(Lissajous) .
shape ; = 0 (Circle), 1 (Frame), >2 (Polygons) .
; Find minimum number n such that it is divisible by both a and b. oteeth iteeth ; Outer and inner teeth.
; (least common multiplier) margin hole-ratio
(define (calc-min-mult a b) start-angle ; 0 <= start-angle < 360 .
(let* ((c 1) (fac 2) (diva 0) (divb 0)) tool ; = 0 (Pencil), 1 (Brush), 2 (Airbrush) .
(while ( <= fac (max a b) ) brush
(set! diva ( = 0 (fmod (/ a fac) 1) ) ) color-method ; = 0 (Single color), 1 (Grad. Loop Sawtooth),
(set! divb ( = 0 (fmod (/ b fac) 1) ) ) ; 2 (Grad. Loop triangle) .
color ; Used when color-method = Single color .
(if diva (set! a (/ a fac))) grad ; Gradient used in Gradient color methods.
(if divb (set! b (/ b fac))) )
(if (or diva divb)
(set! c (* c fac)) ; This function returns a list of samples according to the gradient.
(set! fac (+ 1 fac)) ) (define (get-gradient steps color-method grad)
) (if (= color-method 1)
c ; option 1
) ; Just return the gradient
) (gimp-gradient-get-uniform-samples grad (min steps 50) FALSE)
; option 2
; This function returns a list of samples according to the gradient. ; The returned list is such that the gradient appears two times, once
(define (get-gradient steps color-method grad) ; in the normal order and once in reverse. This way there are no color
(if (= color-method 1) ; jumps if we go beyond the edge
; option 1 (let* (
; Just return the gradient ; Sample the gradient into array "gr".
(gimp-gradient-get-uniform-samples grad (min steps 50) FALSE) (gr (gimp-gradient-get-uniform-samples grad
(/ (min steps 50) 2)
; option 2 FALSE))
; The returned list is such that the gradient appears two times, once
; in the normal order and once in reverse. This way there are no color (grn (car gr)) ; length of sample array.
; jumps if we go beyond the edge (gra (cadr gr)) ; array of color samples (R1,G1,B1,A1, R2,....)
(let* (
; Sample the gradient into array "gr". ; Allocate array gra-new of size (2 * grn) - 8,
(gr (gimp-gradient-get-uniform-samples grad (/ (min steps 50) 2) FALSE)) ; but since each 4 items is actually one (RGBA) tuple,
; it contains 2x - 2 entries.
(grn (car gr)) ; length of sample array. (grn-new (+ grn grn -8))
(gra (cadr gr)) ; array of color samples (R1,G1,B1,A1, R2,....) (gra-new (cons-array grn-new 'double))
; Allocate array gra-new of size (2 * grn) - 8, (gr-index 0)
; but since each 4 items is actually one (RGBA) tuple, (gr-index2 0)
; it contains 2x - 2 entries. )
(grn-new (+ grn grn -8))
(gra-new (cons-array grn-new 'double)) ; Copy original array gra to gra_new.
(while (< gr-index grn)
(gr-index 0) (aset gra-new gr-index (aref gra gr-index))
(gr-index2 0) (set! gr-index (+ 1 gr-index))
) )
; Copy original array gra to gra_new. ; Copy second time, but in reverse
(while (< gr-index grn) (set! gr-index2 (- gr-index 8))
(aset gra-new gr-index (aref gra gr-index)) (while (< gr-index grn-new)
(set! gr-index (+ 1 gr-index)) (aset gra-new gr-index (aref gra gr-index2))
) (set! gr-index (+ 1 gr-index))
(set! gr-index2 (+ 1 gr-index2))
; Copy second time, but in reverse
(set! gr-index2 (- gr-index 8)) (if (= (fmod gr-index 4) 0)
(while (< gr-index grn-new) (set! gr-index2 (- gr-index2 8))
(aset gra-new gr-index (aref gra gr-index2)) )
(set! gr-index (+ 1 gr-index)) )
(set! gr-index2 (+ 1 gr-index2))
; Return list.
(if (= (fmod gr-index 4) 0) (list grn-new gra-new)
(set! gr-index2 (- gr-index2 8)) )
) )
) )
; Return list.
(list grn-new gra-new) (let* (
) (steps (+ 1 (lcm oteeth iteeth)))
) (*points* (cons-array (* steps 2) 'double))
)
(ot 0) ; current outer tooth
(cx 0) ; Current x,y
(let* ((steps (+ 1 (calc-min-mult oteeth iteeth))) (cy 0)
(*points* (cons-array (* steps 2) 'double))
; If its a polygon or frame, how many sides does it have.
(ot 0) ; current outer tooth (poly (if (= shape 1) 4 ; A frame has four sides.
(cx 0) ; Current x,y (if (> shape 1) (+ shape 1) 0)))
(cy 0)
(2pi (* 2 *pi*))
; If its a polygon or frame, how many sides does it have.
(poly (if (= shape 1) 4 ; A frame has four sides. (drw-width (- x2 x1))
(if (> shape 1) (+ shape 1) 0))) (drw-height (- y2 y1))
(half-width (/ drw-width 2))
(2pi (* 2 *pi*)) (half-height (/ drw-height 2))
(midx (+ x1 half-width))
(drw-width (- x2 x1)) (midy (+ y1 half-height))
(drw-height (- y2 y1))
(half-width (/ drw-width 2)) (hole (* hole-ratio
(half-height (/ drw-height 2)) (- (/ (min drw-width drw-height) 2) margin)
(midx (+ x1 half-width)) )
(midy (+ y1 half-height)) )
(irad (+ hole margin))
(hole (* hole-ratio
(- (/ (min drw-width drw-height) 2) margin) (radx (- half-width irad)) ;
) (rady (- half-height irad)) ;
)
(irad (+ hole margin)) (gradt (get-gradient steps color-method grad))
(grada (cadr gradt)) ; Gradient array.
(radx (- half-width irad)) ; (gradn (car gradt)) ; Number of entries of gradients.
(rady (- half-height irad)) ;
; Indexes
(gradt (get-gradient steps color-method grad)) (grad-index 0) ; for array: grada
(grada (cadr gradt)) ; Gradient array. (point-index 0) ; for array: *points*
(gradn (car gradt)) ; Number of entries of gradients. (index 0)
)
; Indexes
(grad-index 0) ; for array: grada ; Do one step of the loop.
(point-index 0) ; for array: *points* (define (calc-and-step!)
(index 0) (let* (
) (oangle (* 2pi (/ ot oteeth)) )
(shifted-oangle (+ oangle (* 2pi (/ start-angle 360))) )
(xfactor (cos shifted-oangle))
; Do one step of the loop. (yfactor (sin shifted-oangle))
(define (calc-and-step!) (lenfactor 1)
(let* ( (ofactor (/ (+ oteeth iteeth) iteeth))
(oangle (* 2pi (/ ot oteeth)) )
(shifted-oangle (+ oangle (* 2pi (/ start-angle 360))) ) ; The direction of the factor changes according
(xfactor (cos shifted-oangle)) ; to whether the type is a sypro or an epitcorhoid.
(yfactor (sin shifted-oangle)) (mfactor (if (= type 0) (- ofactor) ofactor))
(lenfactor 1) )
(ofactor (/ (+ oteeth iteeth) iteeth))
; If we are drawing a polygon then compute a contortion
; The direction of the factor changes according ; factor "lenfactor" which deforms the standard circle.
; to whether the type is a sypro or an epitcorhoid. (if (> poly 2)
(mfactor (if (= type 0) (- ofactor) ofactor)) (let* (
) (pi4 (/ *pi* poly))
(pi2 (* pi4 2))
; If we are drawing a polygon then compute a contortion
; factor "lenfactor" which deforms the standard circle. (oanglemodpi2 (fmod (+ oangle
(if (> poly 2) (if (= 1 (fmod poly 2))
(let* ( 0 ;(/ pi4 2)
(pi4 (/ *pi* poly)) 0
(pi2 (* pi4 2)) )
)
(oanglemodpi2 (fmod (+ oangle pi2))
(if (= 1 (fmod poly 2)) )
0 ;(/ pi4 2)
0 (set! lenfactor (/ ( if (= shape 1) 1 (cos pi4) )
) (cos
) (if (< oanglemodpi2 pi4)
pi2 oanglemodpi2
)) (- pi2 oanglemodpi2)
) )
(set! lenfactor (/ ( if (= shape 1) 1 (cos pi4) ) )
(cos )
(if (< oanglemodpi2 pi4) )
oanglemodpi2 )
(- pi2 oanglemodpi2) )
)
) (if (= type 2)
) (begin ; Lissajous
) (set! cx (+ midx
) (* half-width (cos shifted-oangle)) ))
) (set! cy (+ midy
(* half-height (cos (* mfactor oangle))) ))
(if (= type 2) )
(begin ; Lissajous (begin ; Spyrograph or Epitrochoid
(set! cx (+ midx (set! cx (+ midx
(* half-width (cos shifted-oangle)) )) (* radx xfactor lenfactor)
(set! cy (+ midy (* hole (cos (* mfactor oangle) ) ) ))
(* half-height (cos (* mfactor oangle))) )) (set! cy (+ midy
) (* rady yfactor lenfactor)
(begin ; Spyrograph or Epitrochoid (* hole (sin (* mfactor oangle) ) ) ))
(set! cx (+ midx )
(* radx xfactor lenfactor) )
(* hole (cos (* mfactor oangle) ) ) ))
(set! cy (+ midy ;; Advance teeth
(* rady yfactor lenfactor) (set! ot (+ ot 1))
(* hole (sin (* mfactor oangle) ) ) )) )
) )
)
;; Advance teeth ;; Draw all the points in *points* with appropriate tool.
(set! ot (+ ot 1)) (define (flush-points len)
)) (if (= tool 0)
(gimp-pencil drw len *points*) ; Use pencil
(if (= tool 1)
;; Draw all the points in *points* with appropriate tool. (gimp-paintbrush-default drw len *points*); use paintbrush
(define (flush-points len) (gimp-airbrush-default drw len *points*) ; use airbrush
)
(if (= tool 0) )
(gimp-pencil drw len *points*) ; Use pencil
(if (= tool 1) ; Reset points array, but copy last point to first
(gimp-paintbrush-default drw len *points*); use paintbrush ; position so it will connect the next time.
(gimp-airbrush-default drw len *points*) ; use airbrush (aset *points* 0 (aref *points* (- point-index 2)))
) (aset *points* 1 (aref *points* (- point-index 1)))
) (set! point-index 2)
)
; Reset points array, but copy last point to first
; position so it will connect the next time. ;;
(aset *points* 0 (aref *points* (- point-index 2))) ;; Execution starts here.
(aset *points* 1 (aref *points* (- point-index 1))) ;;
(set! point-index 2)
) (gimp-context-push)
;; (gimp-image-undo-group-start img)
;; Execution starts here.
;; ; Set new color, brush, opacity, paint mode.
(gimp-context-set-foreground color)
(gimp-context-push) (gimp-context-set-brush (car brush))
(gimp-context-set-opacity (* 100 (car (cdr brush))))
(gimp-image-undo-group-start img) (gimp-context-set-paint-mode (car (cdr (cdr (cdr brush)))))
; Set new color, brush, opacity, paint mode. (while (< index steps)
(gimp-context-set-foreground color)
(gimp-context-set-brush (car brush)) (calc-and-step!)
(gimp-context-set-opacity (* 100 (car (cdr brush))))
(gimp-context-set-paint-mode (car (cdr (cdr (cdr brush))))) (aset *points* point-index cx)
(aset *points* (+ point-index 1) cy)
(while (< index steps) (set! point-index (+ point-index 2))
(calc-and-step!) ; Change color and draw points if using gradient.
(if (< 0 color-method) ; use gradient.
(aset *points* point-index cx) (if (< (/ (+ grad-index 4) gradn) (/ index steps))
(aset *points* (+ point-index 1) cy) (begin
(set! point-index (+ point-index 2)) (gimp-context-set-foreground
(list
; Change color and draw points if using gradient. (* 255 (aref grada grad-index))
(if (< 0 color-method) ; use gradient. (* 255 (aref grada (+ 1 grad-index)) )
(if (< (/ (+ grad-index 4) gradn) (/ index steps)) (* 255 (aref grada (+ 2 grad-index)) )
(begin )
(gimp-context-set-foreground )
(list (gimp-context-set-opacity (* 100 (aref grada (+ 3 grad-index) ) ) )
(* 255 (aref grada grad-index)) (set! grad-index (+ 4 grad-index))
(* 255 (aref grada (+ 1 grad-index)) )
(* 255 (aref grada (+ 2 grad-index)) ) ; Draw points
) (flush-points point-index)
) )
(gimp-context-set-opacity (* 100 (aref grada (+ 3 grad-index) ) ) ) )
(set! grad-index (+ 4 grad-index)) )
; Draw points (set! index (+ index 1))
(flush-points point-index) )
)
)
) ; Draw remaining points.
(flush-points point-index)
(set! index (+ index 1))
) (gimp-image-undo-group-end img)
(gimp-displays-flush)
; Draw remaining points. (gimp-context-pop)
(flush-points point-index) )
)
(gimp-image-undo-group-end img)
(gimp-displays-flush) (let* (
; Get current selection to determine where to draw.
(gimp-context-pop))) (bounds (cdr (gimp-selection-bounds img)))
(x1 (car bounds))
(y1 (cadr bounds))
; This routine is invoked by a dialog. (x2 (caddr bounds))
; It is the main routine in this file. (y2 (car (cdddr bounds)))
(define (script-fu-spyrogimp img drw )
type shape
oteeth iteeth (set! oteeth (trunc (+ oteeth 0.5)))
margin hole-ratio start-angle (set! iteeth (trunc (+ iteeth 0.5)))
tool brush
color-method color grad) (script-fu-spyrogimp-internal img drw
(let* x1 y1 x2 y2
type shape
; Get current selection to determine where to draw. oteeth iteeth
( margin hole-ratio start-angle
(bounds (cdr (gimp-selection-bounds img))) tool brush
(x1 (car bounds)) color-method color grad)
(y1 (cadr bounds)) )
(x2 (caddr bounds)) )
(y2 (car (cdddr bounds)))
)
(set! oteeth (trunc (+ oteeth 0.5))) (script-fu-register "script-fu-spyrogimp"
(set! iteeth (trunc (+ iteeth 0.5))) _"_Spyrogimp..."
_"Add Spirographs, Epitrochoids, and Lissajous Curves to the current layer"
(script-fu-spyrogimp-internal img drw "Elad Shahar <elad@wisdom.weizmann.ac.il>"
x1 y1 x2 y2 "Elad Shahar"
type shape "June 2003"
oteeth iteeth "RGB*, INDEXED*, GRAY*"
margin hole-ratio start-angle SF-IMAGE "Image" 0
tool brush SF-DRAWABLE "Drawable" 0
color-method color grad)
) SF-OPTION _"Type" '(_"Spyrograph"
) _"Epitrochoid"
_"Lissajous")
SF-OPTION _"Shape" '(_"Circle"
(script-fu-register "script-fu-spyrogimp" _"Frame"
_"_Spyrogimp..." _"Triangle"
_"Add Spirographs, Epitrochoids and Lissajous Curves to the current layer" _"Square"
"Elad Shahar <elad@wisdom.weizmann.ac.il>" _"Pentagon"
"Elad Shahar" _"Hexagon"
"June 2003" _"Polygon: 7 sides"
"RGB*, INDEXED*, GRAY*" _"Polygon: 8 sides"
SF-IMAGE "Image" 0 _"Polygon: 9 sides"
SF-DRAWABLE "Drawable" 0 _"Polygon: 10 sides")
SF-ADJUSTMENT _"Outer teeth" '(86 1 120 1 10 0 0)
SF-OPTION _"Type" '(_"Spyrograph" SF-ADJUSTMENT _"Inner teeth" '(70 1 120 1 10 0 0)
_"Epitrochoid" SF-ADJUSTMENT _"Margin (pixels)" '(0 -10000 10000 1 10 0 1)
_"Lissajous") SF-ADJUSTMENT _"Hole ratio" '(0.4 0.0 1.0 0.01 0.1 2 0)
SF-OPTION _"Shape" '(_"Circle" SF-ADJUSTMENT _"Start angle" '(0 0 359 1 10 0 0)
_"Frame"
_"Triangle" SF-OPTION _"Tool" '(_"Pencil"
_"Square" _"Brush"
_"Pentagon" _"Airbrush")
_"Hexagon" SF-BRUSH _"Brush" '("Circle (01)" 1.0 -1 0)
_"Polygon: 7 sides"
_"Polygon: 8 sides" SF-OPTION _"Color method" '(_"Solid Color"
_"Polygon: 9 sides" _"Gradient: Loop Sawtooth"
_"Polygon: 10 sides") _"Gradient: Loop Triangle")
SF-ADJUSTMENT _"Outer teeth" '(86 1 120 1 10 0 0) SF-COLOR _"Color" '(0 0 0)
SF-ADJUSTMENT _"Inner teeth" '(70 1 120 1 10 0 0) SF-GRADIENT _"Gradient" "Deep Sea"
SF-ADJUSTMENT _"Margin (pixels)" '(0 -10000 10000 1 10 0 1) )
SF-ADJUSTMENT _"Hole ratio" '(0.4 0.0 1.0 0.01 0.1 2 0)
SF-ADJUSTMENT _"Start angle" '(0 0 359 1 10 0 0) ;; End of syprogimp.scm
SF-OPTION _"Tool" '(_"Pencil" (script-fu-menu-register "script-fu-spyrogimp"
_"Brush" "<Image>/Filters/Render")
_"Airbrush")
SF-BRUSH _"Brush" '("Circle (01)" 1.0 -1 0)
SF-OPTION _"Color method" '(_"Solid Color"
_"Gradient: loop sawtooth"
_"Gradient: loop triangle")
SF-COLOR _"Color" "black"
SF-GRADIENT _"Gradient" "Deep Sea")
(script-fu-menu-register "script-fu-spyrogimp"
"<Image>/Filters/Render")

Some files were not shown because too many files have changed in this diff Show More