added "gboolean reverse" to gimp_gradient_get_color_at() so all gradients

2003-07-22  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpgradient.[ch]: added "gboolean reverse" to
	gimp_gradient_get_color_at() so all gradients can be used
	reversed.

	* app/core/gimpdrawable-blend.[ch] (gimp_drawable_blend)
	* app/core/gimppalette-import.[ch] (gimp_palette_import_from_gradient):
	added "gboolean reverse".

	* app/paint/paint-enums.[ch]: removed enum GimpGradientRepeatMode
	since it is identical to GimpRepeatMode, except for the now
	obsolete ONCE_BACKWARD value.

	* app/paint/gimppaintcore.[ch]: removed
	gimp_paint_core_get_color_from_gradient()...

	* app/paint/gimppaintoptions.[ch]: ...and added
	gimp_paint_options_get_gradient_color(), which is much more
	general. Added a "reverse" property to GimpGradientOptions and
	changed the type of the "repeat" property to GimpRepeatMode.

	* app/paint/gimppaintbrush.c: use
	gimp_paint_options_get_gradient_color().

	* app/tools/gimpblendoptions.[ch]: removed the "repeat" property
	since it is in the parent class now.

	* app/gui/gradient-select.c
	* app/gui/palette-import-dialog.c
	* app/widgets/gimpgradienteditor.c
	* app/tools/gimpblendtool.c
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/misc_tools.pdb: changed accordingly.

	* app/tools/gimppaintoptions-gui.c: added a "Reverse" toggle right
	of the gradient preview.

	* app/widgets/gimppreviewrenderergradient.[ch]: added "gboolean
	reverse" member and gimp_preview_renderer_gradient_set_reverse()
	API.

	* tools/pdbgen/pdb/paint_tools.pdb: fixed the paintbrush invoker
	to set GimpPaintOption's "use-fade" and "use-gradient" properties
	correctly.

	* app/pdb/gradients_cmds.c
	* app/pdb/misc_tools_cmds.c
	* app/pdb/paint_tools_cmds.c
	* libgimp/gimpenums.h
	* libgimp/gimpmisctools_pdb.[ch]
	* plug-ins/pygimp/gimpenums.py
	* plug-ins/script-fu/script-fu-constants.c
	* tools/pdbgen/enums.pl: regenerated.

	* libgimp/gimpcompat.h
	* plug-ins/script-fu/siod-wrapper.c: removed GimpGradientPaintMode
	here too since it was only exported accidentially (it's not used
	by any external API).

	* plug-ins/script-fu/scripts/3dTruchet.scm
	* plug-ins/script-fu/scripts/alien-glow-arrow.scm
	* plug-ins/script-fu/scripts/alien-glow-bar.scm
	* plug-ins/script-fu/scripts/alien-glow-bullet.scm
	* plug-ins/script-fu/scripts/alien-glow-button.scm
	* plug-ins/script-fu/scripts/alien-glow-logo.scm
	* plug-ins/script-fu/scripts/basic1-logo.scm
	* plug-ins/script-fu/scripts/basic2-logo.scm
	* plug-ins/script-fu/scripts/beveled-button.scm
	* plug-ins/script-fu/scripts/blended-logo.scm
	* plug-ins/script-fu/scripts/burn-in-anim.scm
	* plug-ins/script-fu/scripts/coffee.scm
	* plug-ins/script-fu/scripts/comic-logo.scm
	* plug-ins/script-fu/scripts/coolmetal-logo.scm
	* plug-ins/script-fu/scripts/glossy.scm
	* plug-ins/script-fu/scripts/gradient-bevel-logo.scm
	* plug-ins/script-fu/scripts/gradient-example.scm
	* plug-ins/script-fu/scripts/pupi-button.scm
	* plug-ins/script-fu/scripts/rendermap.scm
	* plug-ins/script-fu/scripts/sphere.scm
	* plug-ins/script-fu/scripts/starscape-logo.scm
	* plug-ins/script-fu/scripts/test-sphere.scm
	* plug-ins/script-fu/scripts/textured-logo.scm
	* plug-ins/script-fu/scripts/title-header.scm
	* plug-ins/script-fu/scripts/weave.scm: pass "reverse" to
	gimp_blend(). Pass FALSE in most cases and added script
	parameters were it makes sense.
This commit is contained in:
Michael Natterer 2003-07-22 14:24:11 +00:00 committed by Michael Natterer
parent a1d33d15c4
commit 075195d16b
63 changed files with 1451 additions and 1126 deletions

View File

@ -1,3 +1,91 @@
2003-07-22 Michael Natterer <mitch@gimp.org>
* app/core/gimpgradient.[ch]: added "gboolean reverse" to
gimp_gradient_get_color_at() so all gradients can be used
reversed.
* app/core/gimpdrawable-blend.[ch] (gimp_drawable_blend)
* app/core/gimppalette-import.[ch] (gimp_palette_import_from_gradient):
added "gboolean reverse".
* app/paint/paint-enums.[ch]: removed enum GimpGradientRepeatMode
since it is identical to GimpRepeatMode, except for the now
obsolete ONCE_BACKWARD value.
* app/paint/gimppaintcore.[ch]: removed
gimp_paint_core_get_color_from_gradient()...
* app/paint/gimppaintoptions.[ch]: ...and added
gimp_paint_options_get_gradient_color(), which is much more
general. Added a "reverse" property to GimpGradientOptions and
changed the type of the "repeat" property to GimpRepeatMode.
* app/paint/gimppaintbrush.c: use
gimp_paint_options_get_gradient_color().
* app/tools/gimpblendoptions.[ch]: removed the "repeat" property
since it is in the parent class now.
* app/gui/gradient-select.c
* app/gui/palette-import-dialog.c
* app/widgets/gimpgradienteditor.c
* app/tools/gimpblendtool.c
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/misc_tools.pdb: changed accordingly.
* app/tools/gimppaintoptions-gui.c: added a "Reverse" toggle right
of the gradient preview.
* app/widgets/gimppreviewrenderergradient.[ch]: added "gboolean
reverse" member and gimp_preview_renderer_gradient_set_reverse()
API.
* tools/pdbgen/pdb/paint_tools.pdb: fixed the paintbrush invoker
to set GimpPaintOption's "use-fade" and "use-gradient" properties
correctly.
* app/pdb/gradients_cmds.c
* app/pdb/misc_tools_cmds.c
* app/pdb/paint_tools_cmds.c
* libgimp/gimpenums.h
* libgimp/gimpmisctools_pdb.[ch]
* plug-ins/pygimp/gimpenums.py
* plug-ins/script-fu/script-fu-constants.c
* tools/pdbgen/enums.pl: regenerated.
* libgimp/gimpcompat.h
* plug-ins/script-fu/siod-wrapper.c: removed GimpGradientPaintMode
here too since it was only exported accidentially (it's not used
by any external API).
* plug-ins/script-fu/scripts/3dTruchet.scm
* plug-ins/script-fu/scripts/alien-glow-arrow.scm
* plug-ins/script-fu/scripts/alien-glow-bar.scm
* plug-ins/script-fu/scripts/alien-glow-bullet.scm
* plug-ins/script-fu/scripts/alien-glow-button.scm
* plug-ins/script-fu/scripts/alien-glow-logo.scm
* plug-ins/script-fu/scripts/basic1-logo.scm
* plug-ins/script-fu/scripts/basic2-logo.scm
* plug-ins/script-fu/scripts/beveled-button.scm
* plug-ins/script-fu/scripts/blended-logo.scm
* plug-ins/script-fu/scripts/burn-in-anim.scm
* plug-ins/script-fu/scripts/coffee.scm
* plug-ins/script-fu/scripts/comic-logo.scm
* plug-ins/script-fu/scripts/coolmetal-logo.scm
* plug-ins/script-fu/scripts/glossy.scm
* plug-ins/script-fu/scripts/gradient-bevel-logo.scm
* plug-ins/script-fu/scripts/gradient-example.scm
* plug-ins/script-fu/scripts/pupi-button.scm
* plug-ins/script-fu/scripts/rendermap.scm
* plug-ins/script-fu/scripts/sphere.scm
* plug-ins/script-fu/scripts/starscape-logo.scm
* plug-ins/script-fu/scripts/test-sphere.scm
* plug-ins/script-fu/scripts/textured-logo.scm
* plug-ins/script-fu/scripts/title-header.scm
* plug-ins/script-fu/scripts/weave.scm: pass "reverse" to
gimp_blend(). Pass FALSE in most cases and added script
parameters were it makes sense.
2003-07-22 Jakub Steiner <jimmac@ximian.com>
* data/images/gimp_splash.png: special Gimpcon splash

View File

@ -50,6 +50,7 @@ typedef gdouble (* BlendRepeatFunc) (gdouble);
typedef struct
{
GimpGradient *gradient;
gboolean reverse;
gdouble offset;
gdouble sx, sy;
GimpBlendMode blend_mode;
@ -142,7 +143,8 @@ static void gradient_fill_region (GimpImage *gimage,
GimpGradientType gradient_type,
gdouble offset,
GimpRepeatMode repeat,
gint supersample,
gboolean reverse,
gboolean supersample,
gint max_depth,
gdouble threshold,
gboolean dither,
@ -173,12 +175,13 @@ static PixelRegion distR =
void
gimp_drawable_blend (GimpDrawable *drawable,
GimpBlendMode blend_mode,
int paint_mode,
GimpLayerModeEffects paint_mode,
GimpGradientType gradient_type,
gdouble opacity,
gdouble offset,
GimpRepeatMode repeat,
gint supersample,
gboolean reverse,
gboolean supersample,
gint max_depth,
gdouble threshold,
gboolean dither,
@ -222,7 +225,7 @@ gimp_drawable_blend (GimpDrawable *drawable,
gradient_fill_region (gimage, drawable,
&bufPR, (x2 - x1), (y2 - y1),
blend_mode, gradient_type, offset, repeat,
blend_mode, gradient_type, offset, repeat, reverse,
supersample, max_depth, threshold, dither,
(startx - x1), (starty - y1),
(endx - x1), (endy - y1),
@ -763,12 +766,15 @@ gradient_render_pixel (double x,
if (rbd->blend_mode == GIMP_CUSTOM_MODE)
{
gimp_gradient_get_color_at (rbd->gradient, factor, color);
gimp_gradient_get_color_at (rbd->gradient, factor, rbd->reverse, color);
}
else
{
/* Blend values */
if (rbd->reverse)
factor = 1.0 - factor;
color->r = rbd->fg.r + (rbd->bg.r - rbd->fg.r) * factor;
color->g = rbd->fg.g + (rbd->bg.g - rbd->fg.g) * factor;
color->b = rbd->fg.b + (rbd->bg.b - rbd->fg.b) * factor;
@ -823,13 +829,13 @@ gradient_put_pixel (int x,
ftmp = color->b * 255.0;
itmp = ftmp;
dither_prob = ftmp - itmp;
if(g_rand_double (ppd->dither_rand) < dither_prob)
if (g_rand_double (ppd->dither_rand) < dither_prob)
color->b += (1.0 / 255.0);
ftmp = color->a * 255.0;
itmp = ftmp;
dither_prob = ftmp - itmp;
if(g_rand_double (ppd->dither_rand) < dither_prob)
if (g_rand_double (ppd->dither_rand) < dither_prob)
color->a += (1.0 / 255.0);
if (color->r > 1.0) color->r = 1.0;
@ -889,7 +895,8 @@ gradient_fill_region (GimpImage *gimage,
GimpGradientType gradient_type,
gdouble offset,
GimpRepeatMode repeat,
gint supersample,
gboolean reverse,
gboolean supersample,
gint max_depth,
gdouble threshold,
gboolean dither,
@ -913,6 +920,7 @@ gradient_fill_region (GimpImage *gimage,
context = gimp_get_current_context (gimage->gimp);
rbd.gradient = gimp_context_get_gradient (context);
rbd.reverse = reverse;
/* Get foreground and background colors, normalized */

View File

@ -22,12 +22,13 @@
void gimp_drawable_blend (GimpDrawable *drawable,
GimpBlendMode blend_mode,
gint paint_mode,
GimpLayerModeEffects paint_mode,
GimpGradientType gradient_type,
gdouble opacity,
gdouble offset,
GimpRepeatMode repeat,
gint supersample,
gboolean reverse,
gboolean supersample,
gint max_depth,
gdouble threshold,
gboolean dither,

View File

@ -238,7 +238,7 @@ gimp_gradient_get_new_preview (GimpViewable *viewable,
for (x = 0; x < width; x++)
{
gimp_gradient_get_color_at (gradient, cur_x, &color);
gimp_gradient_get_color_at (gradient, cur_x, FALSE, &color);
*p++ = color.r * 255.0;
*p++ = color.g * 255.0;
@ -657,6 +657,7 @@ gimp_gradient_save_as_pov (GimpGradient *gradient,
void
gimp_gradient_get_color_at (GimpGradient *gradient,
gdouble pos,
gboolean reverse,
GimpRGB *color)
{
gdouble factor = 0.0;
@ -668,17 +669,10 @@ gimp_gradient_get_color_at (GimpGradient *gradient,
g_return_if_fail (GIMP_IS_GRADIENT (gradient));
g_return_if_fail (color != NULL);
/* if there is no gradient return a totally transparent black */
if (gradient == NULL)
{
gimp_rgba_set (color, 0.0, 0.0, 0.0, 0.0);
return;
}
pos = CLAMP (pos, 0.0, 1.0);
if (pos < 0.0)
pos = 0.0;
else if (pos > 1.0)
pos = 1.0;
if (reverse)
pos = 1.0 - pos;
seg = gimp_gradient_get_segment_at (gradient, pos);
@ -985,7 +979,7 @@ gimp_gradient_segment_split_midpoint (GimpGradient *gradient,
g_return_if_fail (newr != NULL);
/* Get color at original segment's midpoint */
gimp_gradient_get_color_at (gradient, lseg->middle, &color);
gimp_gradient_get_color_at (gradient, lseg->middle, FALSE, &color);
/* Create a new segment and insert it in the list */
@ -1063,8 +1057,8 @@ gimp_gradient_segment_split_uniform (GimpGradient *gradient,
seg->right = lseg->left + (i + 1) * seg_len;
seg->middle = (seg->left + seg->right) / 2.0;
gimp_gradient_get_color_at (gradient, seg->left, &seg->left_color);
gimp_gradient_get_color_at (gradient, seg->right, &seg->right_color);
gimp_gradient_get_color_at (gradient, seg->left, FALSE, &seg->left_color);
gimp_gradient_get_color_at (gradient, seg->right, FALSE, &seg->right_color);
seg->type = lseg->type;
seg->color = lseg->color;

View File

@ -82,6 +82,7 @@ gboolean gimp_gradient_save_as_pov (GimpGradient *gradient,
void gimp_gradient_get_color_at (GimpGradient *gradient,
gdouble pos,
gboolean reverse,
GimpRGB *color);
GimpGradientSegment * gimp_gradient_get_segment_at (GimpGradient *grad,
gdouble pos);

View File

@ -44,6 +44,7 @@
GimpPalette *
gimp_palette_import_from_gradient (GimpGradient *gradient,
gboolean reverse,
const gchar *palette_name,
gint n_colors)
{
@ -62,7 +63,7 @@ gimp_palette_import_from_gradient (GimpGradient *gradient,
for (loop = 0, cur_x = 0; loop < n_colors; loop++, cur_x += dx)
{
gimp_gradient_get_color_at (gradient, cur_x, &color);
gimp_gradient_get_color_at (gradient, cur_x, reverse, &color);
gimp_palette_add_entry (palette, NULL, &color);
}

View File

@ -21,6 +21,7 @@
GimpPalette * gimp_palette_import_from_gradient (GimpGradient *gradient,
gboolean reverse,
const gchar *palette_name,
gint n_colors);
GimpPalette * gimp_palette_import_from_image (GimpImage *gimage,

View File

@ -599,6 +599,7 @@ palette_import_make_palette (ImportDialog *import_dialog)
{
case GRADIENT_IMPORT:
palette = gimp_palette_import_from_gradient (gradient,
FALSE,
palette_name,
n_colors);
break;

View File

@ -244,7 +244,7 @@ gradient_select_change_callbacks (GradientSelect *gsp,
while (i--)
{
gimp_gradient_get_color_at (gradient, pos, &color);
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
*pv++ = color.r;
*pv++ = color.g;

View File

@ -599,6 +599,7 @@ palette_import_make_palette (ImportDialog *import_dialog)
{
case GRADIENT_IMPORT:
palette = gimp_palette_import_from_gradient (gradient,
FALSE,
palette_name,
n_colors);
break;

View File

@ -143,8 +143,8 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
GimpGradientOptions *gradient_options;
GimpContext *context;
GimpImage *gimage;
GimpRGB gradient_color;
TempBuf *area;
gdouble gradient_length;
guchar col[MAX_CHANNELS];
gdouble scale;
GimpPaintApplicationMode paint_appl_mode;
@ -166,35 +166,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
paint_appl_mode = paint_options->application_mode;
if (gradient_options->use_gradient)
{
gdouble unit_factor;
switch (gradient_options->gradient_unit)
{
case GIMP_UNIT_PIXEL:
gradient_length = gradient_options->gradient_length;
break;
case GIMP_UNIT_PERCENT:
gradient_length = (MAX (gimage->width, gimage->height) *
gradient_options->gradient_length / 100);
break;
default:
unit_factor = gimp_unit_get_factor (gradient_options->gradient_unit);
gradient_length = (gradient_options->gradient_length *
MAX (gimage->xresolution,
gimage->yresolution) / unit_factor);
break;
}
}
else
{
gradient_length = 0.0;
}
if (pressure_options->color)
gradient_length = 1.0; /* not really used, only for if cases */
if (pressure_options->size)
scale = paint_core->cur_coords.pressure;
else
@ -204,27 +175,14 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
if (! (area = gimp_paint_core_get_paint_area (paint_core, drawable, scale)))
return;
if (gradient_length)
{
GimpGradient *gradient;
GimpRGB color;
gradient = gimp_context_get_gradient (context);
if (pressure_options->color)
gimp_gradient_get_color_at (gradient,
if (gimp_paint_options_get_gradient_color (paint_options, gimage,
paint_core->cur_coords.pressure,
&color);
else
gimp_paint_core_get_color_from_gradient (paint_core,
gradient,
gradient_length,
&color,
gradient_options->gradient_type);
paint_core->pixel_dist,
&gradient_color))
{
opacity *= gradient_color.a;
opacity *= color.a;
gimp_rgb_get_uchar (&color,
gimp_rgb_get_uchar (&gradient_color,
&col[RED_PIX],
&col[GREEN_PIX],
&col[BLUE_PIX]);

View File

@ -822,34 +822,6 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
/* protected functions */
void
gimp_paint_core_get_color_from_gradient (GimpPaintCore *core,
GimpGradient *gradient,
gdouble gradient_length,
GimpRGB *color,
GimpGradientPaintMode mode)
{
gdouble pos;
if (gradient_length > 0.0)
pos = (gdouble) core->pixel_dist / gradient_length;
else
pos = 1.0;
/* for the once modes, set pos close to 1.0 after the first chunk */
if ((mode == GIMP_GRADIENT_ONCE_FORWARD ||
mode == GIMP_GRADIENT_ONCE_BACKWARD) && pos >= 1.0)
pos = 0.9999999;
if ((((gint) pos & 1) && mode != GIMP_GRADIENT_LOOP_SAWTOOTH) ||
mode == GIMP_GRADIENT_ONCE_BACKWARD)
pos = 1.0 - (pos - (gint) pos);
else
pos = pos - (gint) pos;
gimp_gradient_get_color_at (gradient, pos, color);
}
TempBuf *
gimp_paint_core_get_paint_area (GimpPaintCore *core,
GimpDrawable *drawable,

View File

@ -163,13 +163,6 @@ void gimp_paint_core_interpolate (GimpPaintCore *core,
/* protected functions */
void gimp_paint_core_get_color_from_gradient
(GimpPaintCore *core,
GimpGradient *gradient,
gdouble gradient_length,
GimpRGB *color,
GimpGradientPaintMode mode);
TempBuf * gimp_paint_core_get_paint_area (GimpPaintCore *core,
GimpDrawable *drawable,
gdouble scale);

View File

@ -29,6 +29,7 @@
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpgradient.h"
#include "gimppaintoptions.h"
@ -45,10 +46,12 @@
#define DEFAULT_USE_FADE FALSE
#define DEFAULT_FADE_LENGTH 100.0
#define DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
#define DEFAULT_USE_GRADIENT FALSE
#define DEFAULT_GRADIENT_REVERSE FALSE
#define DEFAULT_GRADIENT_REPEAT GIMP_REPEAT_TRIANGULAR
#define DEFAULT_GRADIENT_LENGTH 100.0
#define DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
#define DEFAULT_GRADIENT_TYPE GIMP_GRADIENT_LOOP_TRIANGLE
enum
@ -65,9 +68,10 @@ enum
PROP_FADE_LENGTH,
PROP_FADE_UNIT,
PROP_USE_GRADIENT,
PROP_GRADIENT_REVERSE,
PROP_GRADIENT_REPEAT,
PROP_GRADIENT_LENGTH,
PROP_GRADIENT_UNIT,
PROP_GRADIENT_TYPE
PROP_GRADIENT_UNIT
};
@ -179,6 +183,14 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_GRADIENT,
"use-gradient", NULL,
DEFAULT_USE_GRADIENT, 0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GRADIENT_REVERSE,
"gradient-reverse", NULL,
DEFAULT_GRADIENT_REVERSE, 0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_GRADIENT_REPEAT,
"gradient-repeat", NULL,
GIMP_TYPE_REPEAT_MODE,
DEFAULT_GRADIENT_REPEAT,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GRADIENT_LENGTH,
"gradient-length", NULL,
0.0, 32767.0, DEFAULT_GRADIENT_LENGTH,
@ -187,11 +199,6 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
"gradient-unit", NULL,
TRUE, TRUE, DEFAULT_GRADIENT_UNIT,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_GRADIENT_TYPE,
"gradient-type", NULL,
GIMP_TYPE_GRADIENT_PAINT_MODE,
DEFAULT_GRADIENT_TYPE,
0);
}
static void
@ -271,15 +278,18 @@ gimp_paint_options_set_property (GObject *object,
case PROP_USE_GRADIENT:
gradient_options->use_gradient = g_value_get_boolean (value);
break;
case PROP_GRADIENT_REVERSE:
gradient_options->gradient_reverse = g_value_get_boolean (value);
break;
case PROP_GRADIENT_REPEAT:
gradient_options->gradient_repeat = g_value_get_enum (value);
break;
case PROP_GRADIENT_LENGTH:
gradient_options->gradient_length = g_value_get_double (value);
break;
case PROP_GRADIENT_UNIT:
gradient_options->gradient_unit = g_value_get_int (value);
break;
case PROP_GRADIENT_TYPE:
gradient_options->gradient_type = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -342,15 +352,18 @@ gimp_paint_options_get_property (GObject *object,
case PROP_USE_GRADIENT:
g_value_set_boolean (value, gradient_options->use_gradient);
break;
case PROP_GRADIENT_REVERSE:
g_value_set_boolean (value, gradient_options->gradient_reverse);
break;
case PROP_GRADIENT_REPEAT:
g_value_set_enum (value, gradient_options->gradient_repeat);
break;
case PROP_GRADIENT_LENGTH:
g_value_set_double (value, gradient_options->gradient_length);
break;
case PROP_GRADIENT_UNIT:
g_value_set_int (value, gradient_options->gradient_unit);
break;
case PROP_GRADIENT_TYPE:
g_value_set_enum (value, gradient_options->gradient_type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -454,6 +467,82 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
return GIMP_OPACITY_OPAQUE;
}
gboolean
gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
GimpImage *gimage,
gdouble pressure,
gdouble pixel_dist,
GimpRGB *color)
{
GimpPressureOptions *pressure_options;
GimpGradientOptions *gradient_options;
GimpGradient *gradient;
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (color != NULL, FALSE);
pressure_options = paint_options->pressure_options;
gradient_options = paint_options->gradient_options;
gradient = gimp_context_get_gradient (GIMP_CONTEXT (paint_options));
if (pressure_options->color)
{
gimp_gradient_get_color_at (gradient, pressure,
gradient_options->gradient_reverse,
color);
return TRUE;
}
else if (gradient_options->use_gradient)
{
gdouble gradient_length = 0.0;
gdouble unit_factor;
gdouble pos;
switch (gradient_options->gradient_unit)
{
case GIMP_UNIT_PIXEL:
gradient_length = gradient_options->gradient_length;
break;
case GIMP_UNIT_PERCENT:
gradient_length = (MAX (gimage->width, gimage->height) *
gradient_options->gradient_length / 100);
break;
default:
unit_factor = gimp_unit_get_factor (gradient_options->gradient_unit);
gradient_length = (gradient_options->gradient_length *
MAX (gimage->xresolution,
gimage->yresolution) / unit_factor);
break;
}
if (gradient_length > 0.0)
pos = pixel_dist / gradient_length;
else
pos = 1.0;
/* for no repeat, set pos close to 1.0 after the first chunk */
if (gradient_options->gradient_repeat == GIMP_REPEAT_NONE && pos >= 1.0)
pos = 0.9999999;
if (((gint) pos & 1) &&
gradient_options->gradient_repeat != GIMP_REPEAT_SAWTOOTH)
pos = 1.0 - (pos - (gint) pos);
else
pos = pos - (gint) pos;
gimp_gradient_get_color_at (gradient, pos,
gradient_options->gradient_reverse,
color);
return TRUE;
}
return FALSE;
}
GimpBrushApplicationMode
gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options)
{

View File

@ -51,9 +51,10 @@ struct _GimpFadeOptions
struct _GimpGradientOptions
{
gboolean use_gradient;
gboolean gradient_reverse;
gdouble gradient_length;
GimpUnit gradient_unit;
gint gradient_type;
GimpRepeatMode gradient_repeat;
};
@ -96,6 +97,12 @@ gdouble gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
GimpImage *gimage,
gdouble pixel_dist);
gboolean gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
GimpImage *gimage,
gdouble pressure,
gdouble pixel_dist,
GimpRGB *color);
GimpBrushApplicationMode
gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options);

View File

@ -66,27 +66,6 @@ gimp_dodge_burn_type_get_type (void)
}
static const GEnumValue gimp_gradient_paint_mode_enum_values[] =
{
{ GIMP_GRADIENT_ONCE_FORWARD, N_("Once Forward"), "once-forward" },
{ GIMP_GRADIENT_ONCE_BACKWARD, N_("Once Backward"), "once-backward" },
{ GIMP_GRADIENT_LOOP_SAWTOOTH, N_("Loop Sawtooth"), "loop-sawtooth" },
{ GIMP_GRADIENT_LOOP_TRIANGLE, N_("Loop Triangle"), "loop-triangle" },
{ 0, NULL, NULL }
};
GType
gimp_gradient_paint_mode_get_type (void)
{
static GType enum_type = 0;
if (!enum_type)
enum_type = g_enum_register_static ("GimpGradientPaintMode", gimp_gradient_paint_mode_enum_values);
return enum_type;
}
static const GEnumValue gimp_convolve_type_enum_values[] =
{
{ GIMP_BLUR_CONVOLVE, N_("Blur"), "blur-convolve" },

View File

@ -70,19 +70,6 @@ typedef enum
} GimpDodgeBurnType;
#define GIMP_TYPE_GRADIENT_PAINT_MODE (gimp_gradient_paint_mode_get_type ())
GType gimp_gradient_paint_mode_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_GRADIENT_ONCE_FORWARD, /*< desc="Once Forward" >*/
GIMP_GRADIENT_ONCE_BACKWARD, /*< desc="Once Backward" >*/
GIMP_GRADIENT_LOOP_SAWTOOTH, /*< desc="Loop Sawtooth" >*/
GIMP_GRADIENT_LOOP_TRIANGLE /*< desc="Loop Triangle" >*/
} GimpGradientPaintMode;
#define GIMP_TYPE_CONVOLVE_TYPE (gimp_convolve_type_get_type ())
GType gimp_convolve_type_get_type (void) G_GNUC_CONST;

View File

@ -271,7 +271,7 @@ gradients_sample_uniform_invoker (Gimp *gimp,
while (i--)
{
gimp_gradient_get_color_at (gradient, pos, &color);
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
*pv++ = color.r;
*pv++ = color.g;
@ -362,7 +362,7 @@ gradients_sample_custom_invoker (Gimp *gimp,
while (i--)
{
gimp_gradient_get_color_at (gradient, *pos, &color);
gimp_gradient_get_color_at (gradient, *pos, FALSE, &color);
*pv++ = color.r;
*pv++ = color.g;
@ -456,12 +456,14 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
name);
}
else
{
gradient = gimp_context_get_gradient (gimp_get_current_context (gimp));;
}
if (gradient)
success = TRUE;
}
else
success = (gradient = gimp_context_get_gradient (gimp_get_current_context (gimp))) != NULL;
if (success)
{
@ -478,7 +480,7 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
while (i--)
{
gimp_gradient_get_color_at (gradient, pos, &color);
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
*pv++ = color.r;
*pv++ = color.g;

View File

@ -62,6 +62,7 @@ blend_invoker (Gimp *gimp,
gdouble opacity;
gdouble offset;
gint32 repeat;
gboolean reverse;
gboolean supersample;
gint32 max_depth;
gdouble threshold;
@ -99,25 +100,27 @@ blend_invoker (Gimp *gimp,
if (repeat < GIMP_REPEAT_NONE || repeat > GIMP_REPEAT_TRIANGULAR)
success = FALSE;
supersample = args[7].value.pdb_int ? TRUE : FALSE;
reverse = args[7].value.pdb_int ? TRUE : FALSE;
max_depth = args[8].value.pdb_int;
supersample = args[8].value.pdb_int ? TRUE : FALSE;
max_depth = args[9].value.pdb_int;
if (supersample && (max_depth < 1 || max_depth > 9))
success = FALSE;
threshold = args[9].value.pdb_float;
threshold = args[10].value.pdb_float;
if (supersample && (threshold < 0.0 || threshold > 4.0))
success = FALSE;
dither = args[10].value.pdb_int ? TRUE : FALSE;
dither = args[11].value.pdb_int ? TRUE : FALSE;
x1 = args[11].value.pdb_float;
x1 = args[12].value.pdb_float;
y1 = args[12].value.pdb_float;
y1 = args[13].value.pdb_float;
x2 = args[13].value.pdb_float;
x2 = args[14].value.pdb_float;
y2 = args[14].value.pdb_float;
y2 = args[15].value.pdb_float;
if (success)
{
@ -132,7 +135,7 @@ blend_invoker (Gimp *gimp,
paint_mode,
gradient_type,
opacity / 100.0,
offset, repeat,
offset, repeat, reverse,
supersample, max_depth,
threshold, dither,
x1, y1, x2, y2,
@ -180,6 +183,11 @@ static ProcArg blend_inargs[] =
"repeat",
"Repeat mode: { GIMP_REPEAT_NONE (0), GIMP_REPEAT_SAWTOOTH (1), GIMP_REPEAT_TRIANGULAR (2) }"
},
{
GIMP_PDB_INT32,
"reverse",
"Use the reverse gradient (TRUE or FALSE)"
},
{
GIMP_PDB_INT32,
"supersample",
@ -231,7 +239,7 @@ static ProcRecord blend_proc =
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
15,
16,
blend_inargs,
0,
NULL,

View File

@ -1033,7 +1033,9 @@ paintbrush_invoker (Gimp *gimp,
g_object_set (options,
"application-mode", method,
"use-fade", fade_out > 0.0,
"fade-length", fade_out,
"use-gradient", gradient_length > 0.0,
"gradient-length", gradient_length,
NULL);

View File

@ -44,7 +44,6 @@ enum
PROP_0,
PROP_OFFSET,
PROP_GRADIENT_TYPE,
PROP_REPEAT,
PROP_SUPERSAMPLE,
PROP_SUPERSAMPLE_DEPTH,
PROP_SUPERSAMPLE_THRESHOLD,
@ -121,11 +120,6 @@ gimp_blend_options_class_init (GimpBlendOptionsClass *klass)
GIMP_TYPE_GRADIENT_TYPE,
GIMP_LINEAR,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_REPEAT,
"repeat", NULL,
GIMP_TYPE_REPEAT_MODE,
GIMP_REPEAT_NONE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SUPERSAMPLE,
"supersample", NULL,
@ -169,9 +163,6 @@ gimp_blend_options_set_property (GObject *object,
case PROP_GRADIENT_TYPE:
options->gradient_type = g_value_get_enum (value);
break;
case PROP_REPEAT:
options->repeat = g_value_get_enum (value);
break;
case PROP_SUPERSAMPLE:
options->supersample = g_value_get_boolean (value);
@ -211,9 +202,6 @@ gimp_blend_options_get_property (GObject *object,
case PROP_GRADIENT_TYPE:
g_value_set_enum (value, options->gradient_type);
break;
case PROP_REPEAT:
g_value_set_enum (value, options->repeat);
break;
case PROP_SUPERSAMPLE:
g_value_set_boolean (value, options->supersample);
@ -267,7 +255,7 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
menu, 2, TRUE);
/* the repeat option */
menu = gimp_prop_enum_option_menu_new (config, "repeat", 0, 0);
menu = gimp_prop_enum_option_menu_new (config, "gradient-repeat", 0, 0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 5,
_("Repeat:"), 1.0, 0.5,
menu, 2, TRUE);

View File

@ -40,13 +40,12 @@ struct _GimpBlendOptions
gdouble offset;
GimpGradientType gradient_type;
GimpRepeatMode repeat;
gboolean dither;
gboolean supersample;
gint supersample_depth;
gdouble supersample_threshold;
gboolean dither;
};

View File

@ -215,13 +215,15 @@ gimp_blend_tool_button_release (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpBlendTool *blend_tool;
GimpPaintOptions *paint_options;
GimpBlendOptions *options;
GimpContext *context;
GimpImage *gimage;
GimpProgress *progress;
blend_tool = GIMP_BLEND_TOOL (tool);
options = GIMP_BLEND_OPTIONS (tool->tool_info->tool_options);
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
options = GIMP_BLEND_OPTIONS (paint_options);
context = GIMP_CONTEXT (options);
gimage = gdisp->gimage;
@ -246,7 +248,8 @@ gimp_blend_tool_button_release (GimpTool *tool,
options->gradient_type,
gimp_context_get_opacity (context),
options->offset,
options->repeat,
paint_options->gradient_options->gradient_repeat,
paint_options->gradient_options->gradient_reverse,
options->supersample,
options->supersample_depth,
options->supersample_threshold,

View File

@ -787,7 +787,7 @@ preview_set_hint (GimpGradientEditor *editor,
xpos = control_calc_g_pos (editor, x);
gimp_gradient_get_color_at (GIMP_GRADIENT (data_editor->data),
xpos, &rgb);
xpos, FALSE, &rgb);
gimp_rgb_to_hsv (&rgb, &hsv);
@ -823,7 +823,7 @@ preview_set_foreground (GimpGradientEditor *editor,
xpos = control_calc_g_pos (editor, x);
gimp_gradient_get_color_at (gradient, xpos, &color);
gimp_gradient_get_color_at (gradient, xpos, FALSE, &color);
gimp_context_set_foreground (user_context, &color);
@ -857,7 +857,7 @@ preview_set_background (GimpGradientEditor *editor,
xpos = control_calc_g_pos (editor, x);
gimp_gradient_get_color_at (gradient, xpos, &color);
gimp_gradient_get_color_at (gradient, xpos, FALSE, &color);
gimp_context_set_background (user_context, &color);

View File

@ -106,6 +106,7 @@ gimp_preview_renderer_gradient_init (GimpPreviewRendererGradient *renderer)
renderer->width = -1;
renderer->left = 0.0;
renderer->right = 1.0;
renderer->reverse = FALSE;
}
static void
@ -173,7 +174,7 @@ gimp_preview_renderer_gradient_render (GimpPreviewRenderer *renderer,
{
guchar r, g, b;
gimp_gradient_get_color_at (gradient, cur_x, &color);
gimp_gradient_get_color_at (gradient, cur_x, rendergrad->reverse, &color);
cur_x += dx;
a = ((gint) (color.a * 255.0)) << 8;
@ -242,3 +243,18 @@ gimp_preview_renderer_gradient_set_offsets (GimpPreviewRendererGradient *rendere
gimp_preview_renderer_update (GIMP_PREVIEW_RENDERER (renderer));
}
}
void
gimp_preview_renderer_gradient_set_reverse (GimpPreviewRendererGradient *renderer,
gboolean reverse)
{
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER_GRADIENT (renderer));
if (reverse != renderer->reverse)
{
renderer->reverse = reverse ? TRUE : FALSE;
gimp_preview_renderer_invalidate (GIMP_PREVIEW_RENDERER (renderer));
gimp_preview_renderer_update (GIMP_PREVIEW_RENDERER (renderer));
}
}

View File

@ -106,6 +106,7 @@ gimp_preview_renderer_gradient_init (GimpPreviewRendererGradient *renderer)
renderer->width = -1;
renderer->left = 0.0;
renderer->right = 1.0;
renderer->reverse = FALSE;
}
static void
@ -173,7 +174,7 @@ gimp_preview_renderer_gradient_render (GimpPreviewRenderer *renderer,
{
guchar r, g, b;
gimp_gradient_get_color_at (gradient, cur_x, &color);
gimp_gradient_get_color_at (gradient, cur_x, rendergrad->reverse, &color);
cur_x += dx;
a = ((gint) (color.a * 255.0)) << 8;
@ -242,3 +243,18 @@ gimp_preview_renderer_gradient_set_offsets (GimpPreviewRendererGradient *rendere
gimp_preview_renderer_update (GIMP_PREVIEW_RENDERER (renderer));
}
}
void
gimp_preview_renderer_gradient_set_reverse (GimpPreviewRendererGradient *renderer,
gboolean reverse)
{
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER_GRADIENT (renderer));
if (reverse != renderer->reverse)
{
renderer->reverse = reverse ? TRUE : FALSE;
gimp_preview_renderer_invalidate (GIMP_PREVIEW_RENDERER (renderer));
gimp_preview_renderer_update (GIMP_PREVIEW_RENDERER (renderer));
}
}

View File

@ -107,14 +107,6 @@ enum
GIMP_DISCARD = GIMP_MASK_DISCARD
};
enum
{
GIMP_ONCE_FORWARD = GIMP_GRADIENT_ONCE_FORWARD,
GIMP_ONCE_BACKWARDS = GIMP_GRADIENT_ONCE_BACKWARD,
GIMP_LOOP_SAWTOOTH = GIMP_GRADIENT_LOOP_SAWTOOTH,
GIMP_LOOP_TRIANGLE = GIMP_GRADIENT_LOOP_TRIANGLE,
};
enum
{
GIMP_HARD = GIMP_BRUSH_HARD,

View File

@ -132,14 +132,6 @@ typedef enum
GIMP_NO_FILL
} GimpFillType;
typedef enum
{
GIMP_GRADIENT_ONCE_FORWARD,
GIMP_GRADIENT_ONCE_BACKWARD,
GIMP_GRADIENT_LOOP_SAWTOOTH,
GIMP_GRADIENT_LOOP_TRIANGLE
} GimpGradientPaintMode;
typedef enum
{
GIMP_LINEAR,

View File

@ -34,6 +34,7 @@
* @opacity: The opacity of the final blend.
* @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
* @repeat: Repeat mode.
* @reverse: Use the reverse gradient.
* @supersample: Do adaptive supersampling.
* @max_depth: Maximum recursion levels for supersampling.
* @threshold: Supersampling threshold.
@ -61,6 +62,7 @@ gimp_blend (gint32 drawable_ID,
gdouble opacity,
gdouble offset,
GimpRepeatMode repeat,
gboolean reverse,
gboolean supersample,
gint max_depth,
gdouble threshold,
@ -83,6 +85,7 @@ gimp_blend (gint32 drawable_ID,
GIMP_PDB_FLOAT, opacity,
GIMP_PDB_FLOAT, offset,
GIMP_PDB_INT32, repeat,
GIMP_PDB_INT32, reverse,
GIMP_PDB_INT32, supersample,
GIMP_PDB_INT32, max_depth,
GIMP_PDB_FLOAT, threshold,

View File

@ -36,6 +36,7 @@ gboolean gimp_blend (gint32 drawable_ID,
gdouble opacity,
gdouble offset,
GimpRepeatMode repeat,
gboolean reverse,
gboolean supersample,
gint max_depth,
gdouble threshold,

View File

@ -113,12 +113,6 @@ WHITE_FILL = 2
TRANSPARENT_FILL = 3
NO_FILL = 4
# GimpGradientPaintMode
GRADIENT_ONCE_FORWARD = 0
GRADIENT_ONCE_BACKWARD = 1
GRADIENT_LOOP_SAWTOOTH = 2
GRADIENT_LOOP_TRIANGLE = 3
# GimpGradientType
LINEAR = 0
BILINEAR = 1

View File

@ -315,11 +315,6 @@ init_constants (void)
setvar (cintern ("HARD"), flocons (GIMP_BRUSH_HARD), NIL);
setvar (cintern ("SOFT"), flocons (GIMP_BRUSH_SOFT), NIL);
setvar (cintern ("ONCE-FORWARD"), flocons (GIMP_GRADIENT_ONCE_FORWARD), NIL);
setvar (cintern ("ONCE-BACKWARDS"), flocons (GIMP_GRADIENT_ONCE_BACKWARD), NIL);
setvar (cintern ("LOOP-SAWTOOTH"), flocons (GIMP_GRADIENT_LOOP_SAWTOOTH), NIL);
setvar (cintern ("LOOP-TRIANGLE"), flocons (GIMP_GRADIENT_LOOP_TRIANGLE), NIL);
setvar (cintern ("CONTINUOUS"), flocons (GIMP_PAINT_CONSTANT), NIL);
setvar (cintern ("INCREMENTAL"), flocons (GIMP_PAINT_INCREMENTAL), NIL);

View File

@ -89,11 +89,6 @@ init_generated_constants (void)
setvar (cintern ("TRANSPARENT-FILL"), flocons (3), NIL);
setvar (cintern ("NO-FILL"), flocons (4), NIL);
setvar (cintern ("GRADIENT-ONCE-FORWARD"), flocons (0), NIL);
setvar (cintern ("GRADIENT-ONCE-BACKWARD"), flocons (1), NIL);
setvar (cintern ("GRADIENT-LOOP-SAWTOOTH"), flocons (2), NIL);
setvar (cintern ("GRADIENT-LOOP-TRIANGLE"), flocons (3), NIL);
setvar (cintern ("LINEAR"), flocons (0), NIL);
setvar (cintern ("BILINEAR"), flocons (1), NIL);
setvar (cintern ("RADIAL"), flocons (2), NIL);

View File

@ -25,10 +25,26 @@
;
; The utility of this script is left as an exercise for the reader.
(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 (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 (use-tile img drawable height width img2 drawable2 xoffset yoffset)
(define (use-tile img
drawable
height
width
img2
drawable2
xoffset
yoffset)
(gimp-edit-copy drawable2)
(let ((floating-sel (car (gimp-edit-paste drawable FALSE))))
(gimp-layer-set-offsets floating-sel xoffset yoffset)
@ -37,7 +53,15 @@
)
(define (create-tile img drawable1 drawable2 size thickness backcolor begincolor endcolor supersample)
(define (create-tile img
drawable1
drawable2
size
thickness
backcolor
begincolor
endcolor
supersample)
(let* (
(half-thickness (/ thickness 2))
(outer-radius (+ (/ size 2) half-thickness))
@ -51,8 +75,10 @@
(let* (
(tempSize (* size 3))
(temp-img (car (gimp-image-new tempSize tempSize RGB)))
(temp-draw (car (gimp-layer-new temp-img tempSize tempSize RGB_IMAGE "Jabar" 100 NORMAL)))
(temp-draw2 (car (gimp-layer-new temp-img tempSize tempSize RGB_IMAGE "Jabar" 100 NORMAL))))
(temp-draw (car (gimp-layer-new temp-img tempSize tempSize
RGB_IMAGE "Jabar" 100 NORMAL)))
(temp-draw2 (car (gimp-layer-new temp-img tempSize tempSize
RGB_IMAGE "Jabar" 100 NORMAL))))
(gimp-image-undo-disable temp-img)
(gimp-image-add-layer temp-img temp-draw 0)
@ -65,20 +91,37 @@
(gimp-palette-set-background begincolor)
(gimp-palette-set-foreground endcolor)
(center-ellipse temp-img size size outer-radius outer-radius REPLACE TRUE FALSE 0)
(center-ellipse temp-img size size inner-radius inner-radius SUB TRUE FALSE 0)
(center-ellipse temp-img size size outer-radius outer-radius
REPLACE TRUE FALSE 0)
(center-ellipse temp-img size size inner-radius inner-radius
SUB TRUE FALSE 0)
(center-ellipse temp-img (* size 2) (* size 2) outer-radius outer-radius ADD TRUE FALSE 0)
(center-ellipse temp-img (* size 2) (* size 2) inner-radius inner-radius SUB TRUE FALSE 0)
(gimp-blend temp-draw FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 FALSE supersample 3 .2 TRUE size size (* size 2) (/ size 2) )
(center-ellipse temp-img (* size 2) (* size 2) outer-radius outer-radius
ADD TRUE FALSE 0)
(center-ellipse temp-img (* size 2) (* size 2) inner-radius inner-radius
SUB TRUE FALSE 0)
(center-ellipse temp-img size (* size 2) outer-radius outer-radius REPLACE TRUE FALSE 0)
(center-ellipse temp-img size (* size 2) inner-radius inner-radius SUB TRUE FALSE 0)
(gimp-blend temp-draw FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
supersample 3 .2 TRUE
size size (* size 2) (/ size 2))
(center-ellipse temp-img size (* size 2) outer-radius outer-radius
REPLACE TRUE FALSE 0)
(center-ellipse temp-img size (* size 2) inner-radius inner-radius
SUB TRUE FALSE 0)
(center-ellipse temp-img (* size 2) size outer-radius outer-radius
ADD TRUE FALSE 0)
(center-ellipse temp-img (* size 2) size inner-radius inner-radius
SUB TRUE FALSE 0)
(center-ellipse temp-img (* size 2) size outer-radius outer-radius ADD TRUE FALSE 0)
(center-ellipse temp-img (* size 2) size inner-radius inner-radius SUB TRUE FALSE 0)
;(gimp-edit-fill temp-img temp-draw2 BG-IMAGE-FILL)
(gimp-blend temp-draw2 FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 FALSE supersample 3 .2 TRUE size size (* size 2) (* size 2) )
(gimp-blend temp-draw2 FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
supersample 3 .2 TRUE
size size (* size 2) (* size 2))
(gimp-selection-none temp-img)
@ -105,7 +148,14 @@
)
(define (script-fu-3dtruchet size thickness backcolor begincolor endcolor supersample xtiles ytiles)
(define (script-fu-3dtruchet size
thickness
backcolor
begincolor
endcolor
supersample
xtiles
ytiles)
(let* (
(width (* size xtiles))
(height (* size ytiles))
@ -127,21 +177,23 @@
(gimp-image-add-layer tile tiledraw1 0)
(gimp-image-add-layer tile tiledraw2 0)
;just to look a little better
(gimp-selection-all img)
(gimp-palette-set-background backcolor)
(gimp-edit-fill layer-one BG-IMAGE-FILL)
(gimp-selection-none img)
(create-tile tile tiledraw1 tiledraw2 size thickness backcolor begincolor endcolor supersample)
(create-tile tile tiledraw1 tiledraw2 size thickness
backcolor begincolor endcolor supersample)
(while (<= Xindex xtiles)
(while (<= Yindex ytiles)
(if (= (rand 2) 0)
(use-tile img layer-one height width tile tiledraw1 (* Xindex size) (* Yindex size))
(use-tile img layer-one height width tile tiledraw2 (* Xindex size) (* Yindex size))
(use-tile img layer-one height width tile
tiledraw1 (* Xindex size) (* Yindex size))
(use-tile img layer-one height width tile
tiledraw2 (* Xindex size) (* Yindex size))
)
(set! Yindex (+ Yindex 1))
)
@ -149,7 +201,6 @@
(set! Xindex (+ Xindex 1))
)
(gimp-image-delete tile)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)
@ -172,5 +223,4 @@
SF-COLOR _"End Blend" '(255 255 255)
SF-TOGGLE _"Supersample" TRUE
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))

View File

@ -1,5 +1,3 @@
; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
@ -26,11 +24,8 @@
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (make-point x y)
(define (make-point x
y)
(cons x y))
(define (point-x p)
@ -52,13 +47,16 @@
(convert point-list a 0)
a))
(define (make-arrow size offset)
(define (make-arrow size
offset)
(list (make-point offset offset)
(make-point (- size offset) (/ size 2))
(make-point offset (- size offset))))
(define (rotate-points points size orientation)
(define (rotate-points points
size
orientation)
(if (null? points)
'()
(let* ((p (car points))
@ -71,7 +69,11 @@
(rotate-points (cdr points) size orientation))
(define (script-fu-alien-glow-right-arrow size orientation glow-color bg-color flatten)
(define (script-fu-alien-glow-right-arrow size
orientation
glow-color
bg-color
flatten)
(let* ((img (car (gimp-image-new size size RGB)))
(grow-amount (/ size 12))
(blur-radius (/ size 3))
@ -93,12 +95,15 @@
(gimp-edit-clear glow-layer)
(gimp-edit-clear ruler-layer)
(gimp-free-select img 6 big-arrow REPLACE TRUE FALSE 0)
(gimp-palette-set-foreground '(103 103 103))
(gimp-palette-set-background '(0 0 0))
(gimp-blend ruler-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 size size)
(gimp-blend ruler-layer FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 size size)
(gimp-selection-grow img grow-amount)
(gimp-palette-set-foreground glow-color)

View File

@ -20,7 +20,11 @@
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-alien-glow-horizontal-ruler length height glow-color bg-color flatten)
(define (script-fu-alien-glow-horizontal-ruler length
height
glow-color
bg-color
flatten)
(let* ((img (car (gimp-image-new height length RGB)))
(border (/ height 4))
(ruler-layer (car (gimp-layer-new img (+ length height) (+ height height) RGBA_IMAGE "Ruler" 100 NORMAL)))
@ -43,7 +47,11 @@
(gimp-rect-select img (/ height 2) (/ height 2) length height REPLACE FALSE 0)
(gimp-palette-set-foreground '(79 79 79))
(gimp-palette-set-background '(0 0 0))
(gimp-blend ruler-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 height height)
(gimp-blend ruler-layer FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 height height)
(gimp-palette-set-foreground glow-color)
(gimp-selection-grow img border)
@ -61,8 +69,6 @@
(gimp-display-new img)))
(script-fu-register "script-fu-alien-glow-horizontal-ruler"
_"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow/Hrule..."
"Create an Hrule with the Alien Glow look"
@ -75,7 +81,3 @@
SF-COLOR _"Glow Color" '(63 252 0)
SF-COLOR _"Background Color" '(0 0 0)
SF-TOGGLE _"Flatten Image" TRUE)

View File

@ -19,12 +19,23 @@
; along with this program; if not, write to the Free Software
; 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 (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 glow-color bg-color flatten)
(define (script-fu-alien-glow-bullet radius
glow-color
bg-color
flatten)
(let* ((img (car (gimp-image-new radius radius RGB)))
(border (/ radius 4))
(diameter (* radius 2))
@ -35,6 +46,7 @@
(bg-layer (car (gimp-layer-new img diameter diameter RGB_IMAGE "Back" 100 NORMAL)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-image-undo-disable img)
(gimp-image-resize img diameter diameter 0 0)
(gimp-image-add-layer img bg-layer 1)
@ -47,12 +59,18 @@
(gimp-edit-clear glow-layer)
(gimp-edit-clear bullet-layer)
(center-ellipse img radius radius half-radius half-radius REPLACE TRUE FALSE 0)
(center-ellipse img radius radius half-radius half-radius
REPLACE TRUE FALSE 0)
; (gimp-rect-select img (/ height 2) (/ height 2) length height REPLACE FALSE 0)
; (gimp-rect-select img (/ height 2) (/ height 2) length height REPLACE FALSE 0)
(gimp-palette-set-foreground '(90 90 90))
(gimp-palette-set-background '(0 0 0))
(gimp-blend bullet-layer FG-BG-RGB NORMAL RADIAL 100 0 REPEAT-NONE FALSE 0 0 TRUE blend-start blend-start (+ half-radius radius)(+ half-radius radius ))
(gimp-blend bullet-layer FG-BG-RGB NORMAL
RADIAL 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
blend-start blend-start
(+ half-radius radius) (+ half-radius radius))
(gimp-palette-set-foreground glow-color)
(gimp-selection-grow img border)
@ -71,9 +89,6 @@
(gimp-image-undo-enable img)
(gimp-display-new img)))
(script-fu-register "script-fu-alien-glow-bullet"
_"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow/Bullet..."
"Create a Bullet with an Alien Glow theme for web pages"
@ -85,4 +100,3 @@
SF-COLOR _"Glow Color" '(63 252 0)
SF-COLOR _"Background Color" '(0 0 0)
SF-TOGGLE _"Flatten Image" TRUE)

View File

@ -35,22 +35,16 @@
(define (text-descent extents)
(cadr (cddr extents)))
(define (blend-bumpmap img drawable x1 y1 x2 y2)
(gimp-blend drawable
FG-BG-RGB
DARKEN-ONLY
LINEAR
100
0
REPEAT-NONE
FALSE
0
0
TRUE
(define (blend-bumpmap img
drawable
x1
y1
x2
y2))
y2)
(gimp-blend drawable FG-BG-RGB DARKEN-ONLY
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
x1 y1 x2 y2))
(define (script-fu-alien-glow-button text
font
@ -101,9 +95,21 @@
(gimp-rect-select img 0 0 img-width img-height REPLACE FALSE 0)
(gimp-palette-set-foreground '(100 100 100))
(gimp-palette-set-background '(0 0 0))
(gimp-blend button-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 img-height img-width)
(gimp-blend button-layer FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 img-height img-width)
(gimp-edit-clear glow-layer)
(gimp-rect-select img (/ glow-radius 4) (/ glow-radius 4) (- img-width (/ glow-radius 2)) (- img-height (/ glow-radius 2)) REPLACE FALSE 0 )
(gimp-rect-select img
(/ glow-radius 4)
(/ glow-radius 4)
(- img-width (/ glow-radius 2))
(- img-height (/ glow-radius 2))
REPLACE FALSE 0 )
(gimp-palette-set-foreground glow-color)
(gimp-edit-fill glow-layer FG-IMAGE-FILL)
(gimp-selection-none img)
@ -123,8 +129,6 @@
(gimp-image-flatten img))
(gimp-display-new img)))
; Register!
(script-fu-register "script-fu-alien-glow-button"
_"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow/Button..."
"Button with an eerie glow"

View File

@ -14,6 +14,7 @@
(glow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Alien Glow" 100 NORMAL)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
@ -28,9 +29,15 @@
(gimp-palette-set-foreground glow-color)
(gimp-edit-fill glow-layer FG-IMAGE-FILL)
(gimp-selection-none img)
(gimp-palette-set-background '(0 0 0))
(gimp-palette-set-foreground '(79 79 79))
(gimp-blend logo-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 1 1)
(gimp-blend logo-layer FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 1 1)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
@ -69,6 +76,7 @@
(height (car (gimp-drawable-height text-layer)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-image-undo-disable img)
(gimp-layer-set-name text-layer text)
(apply-alien-glow-logo-effect img text-layer size glow-color)

View File

@ -11,6 +11,7 @@
(shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img shadow-layer 1)
@ -27,7 +28,12 @@
(gimp-edit-fill shadow-layer BG-IMAGE-FILL)
(gimp-selection-none img)
(gimp-palette-set-foreground '(255 255 255))
(gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 TRUE 0 0 width height)
(gimp-blend logo-layer FG-BG-RGB MULTIPLY
RADIAL 100 20 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 width height)
(gimp-layer-translate shadow-layer 3 3)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
@ -61,6 +67,7 @@
text-color)
(let* ((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-layer-set-name text-layer text)
(apply-basic1-logo-effect img text-layer bg-color text-color)

View File

@ -5,6 +5,7 @@
(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)))
@ -23,6 +24,7 @@
(shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
@ -43,7 +45,12 @@
(gimp-edit-fill shadow-layer BG-IMAGE-FILL)
(gimp-selection-none img)
(gimp-palette-set-foreground '(255 255 255))
(gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 TRUE 0 0 width height)
(gimp-blend logo-layer FG-BG-RGB MULTIPLY
RADIAL 100 20 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 width height)
(gimp-layer-translate shadow-layer 3 3)
(gimp-layer-translate highlight-layer (- posx 2) (- posy 2))
(gimp-layer-set-name highlight-layer "Highlight")
@ -79,6 +86,7 @@
text-color)
(let* ((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-layer-set-name text-layer text)
(apply-basic2-logo-effect img text-layer bg-color text-color)

View File

@ -38,22 +38,16 @@
(define (text-descent extents)
(cadr (cddr extents)))
(define (blend-bumpmap img drawable x1 y1 x2 y2)
(gimp-blend drawable
FG-BG-RGB
DARKEN-ONLY
LINEAR
100
0
REPEAT-NONE
FALSE
0
0
TRUE
(define (blend-bumpmap img
drawable
x1
y1
x2
y2))
y2)
(gimp-blend drawable FG-BG-RGB DARKEN-ONLY
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
x1 y1 x2 y2))
(define (script-fu-button00 text
size
@ -112,23 +106,14 @@
(gimp-image-add-layer img gradient -1)
(gimp-palette-set-foreground ul-color)
(gimp-palette-set-background lr-color)
(gimp-blend gradient
FG-BG-RGB
NORMAL
LINEAR
100
0
REPEAT-NONE
FALSE
0
0
TRUE
0
0
(- img-width 1)
(- img-height 1))
(plug-in-bump-map 1 img gradient bumpmap 135 45 bevel-width 0 0 0 0 TRUE pressed 0)
(gimp-blend gradient FG-BG-RGB NORMAL
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 (- img-width 1) (- img-height 1))
(plug-in-bump-map 1 img gradient bumpmap
135 45 bevel-width 0 0 0 0 TRUE pressed 0)
; Create text layer
@ -147,8 +132,6 @@
(gimp-image-undo-enable img)
(gimp-display-new img)))
; Register!
(script-fu-register "script-fu-button00"
_"<Toolbox>/Xtns/Script-Fu/Buttons/Simple Beveled Button..."
"Simple beveled button"

View File

@ -5,7 +5,9 @@
; if the blend colors are specified as high intensity, the sharp option
; should be enabled or the logo will come out blurry
(define (scale size percent) (* size percent))
(define (scale size
percent)
(* size percent))
(define (apply-blended-logo-effect img
logo-layer
@ -14,7 +16,8 @@
blend-mode
blend-fg
blend-bg
blend-gradient)
blend-gradient
blend-gradient-reverse)
(let* ((b-size-2 (scale b-size 0.5))
(f-size (scale b-size 0.75))
(ds-size (scale b-size 0.5))
@ -30,6 +33,7 @@
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-grad (car (gimp-gradients-get-gradient))))
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img shadow-layer 1)
(gimp-image-add-layer img blend-layer 1)
@ -54,12 +58,22 @@
(gimp-palette-set-background '(0 0 0))
(gimp-edit-fill text-shadow-layer BG-IMAGE-FILL)
(gimp-palette-set-foreground '(255 255 255))
(gimp-blend text-shadow-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 1 1)
(gimp-blend text-shadow-layer FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 1 1)
(gimp-selection-none img)
(gimp-palette-set-foreground blend-fg)
(gimp-palette-set-background blend-bg)
(gimp-gradients-set-gradient blend-gradient)
(gimp-blend blend-layer blend-mode NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 width 0)
(gimp-blend blend-layer blend-mode NORMAL
LINEAR 100 0 REPEAT-NONE blend-gradient-reverse
FALSE 0 0 TRUE
0 0 width 0)
(gimp-layer-translate logo-layer (- b-size-2) (- b-size-2))
(gimp-layer-translate blend-layer (- b-size) (- b-size))
(gimp-layer-translate text-shadow-layer (- ts-size) (- ts-size))
@ -81,11 +95,13 @@
blend-mode
blend-fg
blend-bg
blend-gradient)
blend-gradient
blend-gradient-reverse)
(begin
(gimp-undo-push-group-start img)
(apply-blended-logo-effect img logo-layer b-size bg-color
blend-mode blend-fg blend-bg blend-gradient)
blend-mode blend-fg blend-bg
blend-gradient blend-gradient-reverse)
(gimp-undo-push-group-end img)
(gimp-displays-flush)))
@ -107,7 +123,7 @@
SF-COLOR _"Start Blend" '(22 9 129)
SF-COLOR _"End Blend" '(129 9 82)
SF-GRADIENT _"Gradient" "Golden"
)
SF-TOGGLE _"Gradient Reverse" FALSE)
(define (script-fu-blended-logo text
size
@ -117,7 +133,8 @@
blend-mode
blend-fg
blend-bg
blend-gradient)
blend-gradient
blend-gradient-reverse)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(b-size (scale size 0.1))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
@ -129,7 +146,8 @@
(gimp-edit-fill text-layer FG-IMAGE-FILL)
(gimp-palette-set-foreground old-fg)
(apply-blended-logo-effect img text-layer b-size bg-color
blend-mode blend-fg blend-bg blend-gradient)
blend-mode blend-fg blend-bg
blend-gradient blend-gradient-reverse)
(gimp-image-undo-enable img)
(gimp-display-new img)))
@ -145,10 +163,11 @@
SF-FONT _"Font" "Crillee"
SF-COLOR _"Text Color" '(124 174 255)
SF-COLOR _"Background Color" '(255 255 255)
SF-OPTION _"Blend Mode" '(_"FG-BG-RGB" _"FG-BG-HSV"
SF-OPTION _"Blend Mode" '(_"FG-BG-RGB"
_"FG-BG-HSV"
_"FG-Transparent"
_"Custom Gradient")
SF-COLOR _"Start Blend" '(22 9 129)
SF-COLOR _"End Blend" '(129 9 82)
SF-GRADIENT _"Gradient" "Golden"
)
SF-TOGGLE _"Gradient Reverse" FALSE)

View File

@ -11,21 +11,29 @@
; Copying Policy: GNU Public License http://www.gnu.org
;
(define (script-fu-burn-in-anim org-img org-layer glow-color
fadeout bl-width corona-width after-glow show-glow optimize speed)
(define (script-fu-burn-in-anim org-img
org-layer
glow-color
fadeout
bl-width
corona-width
after-glow
show-glow
optimize
speed)
(let* (
(let* (
;--- main variable: "bl-x" runs from 0 to layer-width
(bl-x 0)
(frame-nr 0)
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))) )
(old-bg (car (gimp-palette-get-background))))
(if (< speed 1)
(set! speed (* -1 speed)) )
;--- check image and work on a copy
(if (= (car (gimp-image-get-layers org-img)) 2)
;--- check image and work on a copy
(if (= (car (gimp-image-get-layers org-img)) 2)
;--- main program structure starts here, begin of "if-1"
(begin
@ -37,12 +45,12 @@
(set! bg-source-layer (aref (cadr (gimp-image-get-layers img)) 1 ))
(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-layer-set-visible source-layer FALSE)
(gimp-layer-set-visible bg-source-layer FALSE)
;--- process image horizontal with pixel-speed
(while (< bl-x (+ source-layer-width bl-width))
;--- process image horizontal with pixel-speed
(while (< bl-x (+ source-layer-width bl-width))
(set! bl-layer (car (gimp-layer-copy source-layer TRUE)))
(set! bl-layer-name (string-append "fr-nr"
(number->string frame-nr 10) ) )
@ -53,19 +61,19 @@
(gimp-layer-set-preserve-trans bl-layer TRUE)
(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)
(set! bl-mask (car (gimp-layer-create-mask bl-layer BLACK-MASK)))
(gimp-image-add-layer-mask img bl-layer bl-mask)
;--- handle layer geometry
;--- handle layer geometry
(set! bl-layer-width source-layer-width)
(set! bl-height (car (gimp-drawable-height bl-layer)))
(set! bl-x-off (- bl-x bl-width))
(set! bl-x-off (+ bl-x-off (car (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 REPLACE 0 0)
;--- select at least 1 pixel!
(gimp-rect-select img bl-x-off bl-y-off (+ bl-width 1) bl-height ADD 0 0)
@ -76,41 +84,42 @@
(set! nofadeout-bl-width (+ nofadeout-bl-x-off bl-x))
(set! nofadeout-bl-width (max nofadeout-bl-width 1))
(gimp-rect-select img nofadeout-bl-x-off bl-y-off
nofadeout-bl-width bl-height REPLACE 0 0)
) )
nofadeout-bl-width bl-height
REPLACE 0 0)))
;--- alpha blending text to trans (fadeout)
;--- alpha blending text to trans (fadeout)
(gimp-palette-set-foreground '(255 255 255))
(gimp-palette-set-background '( 0 0 0))
(if (= fadeout TRUE)
(begin
; blend with 20% offset to get less transparency in the front
(gimp-blend bl-mask FG-BG-RGB NORMAL-MODE LINEAR 100 20 REPEAT-NONE
(gimp-blend bl-mask FG-BG-RGB NORMAL-MODE
LINEAR 100 20 REPEAT-NONE FALSE
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)
(begin
(gimp-palette-set-foreground '(255 255 255))
(gimp-bucket-fill bl-mask FG-BUCKET-FILL NORMAL-MODE
100 255 0 0 0) ) )
100 255 0 0 0)))
(gimp-image-remove-layer-mask img bl-layer APPLY)
;--- add bright glow in front
(if (= show-glow TRUE) (begin
;--- add bright glow in front
(if (= show-glow TRUE)
(begin
;--- add some brightness to whole text
(if (= fadeout TRUE)
(gimp-brightness-contrast bl-layer 100 0)
)
(gimp-brightness-contrast bl-layer 100 0)))
;--- blend glow color inside the letters
(gimp-palette-set-foreground glow-color)
(gimp-blend bl-layer FG-TRANS NORMAL-MODE LINEAR 100 0 REPEAT-NONE
(gimp-blend bl-layer FG-TRANS NORMAL-MODE
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
(+ 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
(gimp-selection-layer-alpha bl-layer)
@ -119,60 +128,54 @@
(gimp-layer-set-preserve-trans bl-layer FALSE)
(gimp-selection-feather img corona-width)
(gimp-palette-set-foreground glow-color)
(gimp-blend bl-layer FG-TRANS NORMAL-MODE LINEAR 100 0 REPEAT-NONE
(gimp-blend bl-layer FG-TRANS NORMAL-MODE
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
(- (+ 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)))
(gimp-image-add-layer img bg-layer -1)
(gimp-image-lower-layer img bg-layer)
(set! bg-layer-name (string-append "bg-"
(number->string frame-nr 10) ) )
(number->string frame-nr 10)))
(gimp-layer-set-name bg-layer bg-layer-name)
(gimp-layer-set-visible bg-layer TRUE)
(set! blended-layer (car (gimp-image-merge-visible-layers img CLIP-TO-IMAGE)))
;(set! blended-layer bl-layer)
(gimp-layer-set-visible blended-layer FALSE)
;--- end of "while" loop
;--- end of "while" loop
(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-image-remove-layer img source-layer)
(gimp-image-remove-layer img bg-source-layer)
(gimp-image-set-filename img "burn-in")
(if (= optimize TRUE) (begin
(if (= optimize TRUE)
(begin
(gimp-convert-indexed img 1 WEB-PALETTE 250 FALSE TRUE "")
(set! img-out (car (plug-in-animationoptimize 0 img bl-layer)))
))
(set! img-out (car (plug-in-animationoptimize 0 img bl-layer)))))
(gimp-layer-set-visible (aref (cadr (gimp-image-get-layers img)) 0 ) TRUE)
(gimp-layer-set-visible (aref (cadr (gimp-image-get-layers img)) 0)
TRUE)
(gimp-image-undo-enable img)
(gimp-image-clean-all img)
(set! img-display (car (gimp-display-new img)))
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-displays-flush)
(gimp-displays-flush))
;--- false form of "if-1"
)
(gimp-message _"Burn-In: Need two layers in total!
A foreground text layer with transparency
and a background layer.")
)
;--- end of main program
))
;--- false form of "if-1"
(gimp-message _"Burn-In: Need two layers in total!"
"A foreground text layer with transparency"
"and a background layer.")))
(script-fu-register "script-fu-burn-in-anim"
@ -191,5 +194,4 @@
SF-VALUE _"After Glow" "50"
SF-TOGGLE _"Add Glowing" TRUE
SF-TOGGLE _"Prepare for GIF" FALSE
SF-VALUE _"Speed (pixels/frame)" "50"
)
SF-VALUE _"Speed (pixels/frame)" "50")

View File

@ -53,8 +53,11 @@
(gimp-gradients-set-gradient "Coffee")
(gimp-blend theStain CUSTOM NORMAL SHAPEBURST-DIMPLED
100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 0 0)
(gimp-blend theStain CUSTOM NORMAL
SHAPEBURST-DIMPLED 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 0 0)
(gimp-layer-set-offsets theStain
(- (rand theWidth) (/ theSize 2))
(- (rand theHeight) (/ theSize 2)) theSize))

View File

@ -22,6 +22,7 @@
(define (apply-comic-logo-effect img
logo-layer
gradient
gradient-reverse
ol-width
ol-color
bg-color)
@ -35,6 +36,7 @@
(old-gradient (car (gimp-gradients-get-gradient)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
(gimp-image-add-layer img white-layer 1)
@ -71,7 +73,12 @@
(gimp-gradients-set-gradient gradient)
(gimp-layer-set-preserve-trans logo-layer TRUE)
(gimp-selection-all img)
(gimp-blend logo-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 (* height 0.33333) 0 (* height 0.83333))
(gimp-blend logo-layer CUSTOM NORMAL
LINEAR 100 0 REPEAT-NONE gradient-reverse
FALSE 0 0 TRUE
0 (* height 0.33333) 0 (* height 0.83333))
(plug-in-noisify 1 img logo-layer 0 0.20 0.20 0.20 0.20)
(gimp-selection-none img)
(gimp-layer-set-preserve-trans logo-layer FALSE)
@ -105,16 +112,17 @@
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-GRADIENT _"Gradient" "Incandescent"
SF-TOGGLE _"Gradient Reverse" FALSE
SF-ADJUSTMENT _"Outline Size" '(5 1 100 1 10 0 1)
SF-COLOR _"Outline Color" '(255 255 255)
SF-COLOR _"Background Color" '(255 255 255)
)
SF-COLOR _"Background Color" '(255 255 255))
(define (script-fu-comic-logo text
size
font
gradient
gradient-reverse
ol-width
ol-color
bg-color)
@ -123,7 +131,8 @@
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
(gimp-image-undo-disable img)
(gimp-layer-set-name text-layer text)
(apply-comic-logo-effect img text-layer gradient ol-width ol-color
(apply-comic-logo-effect img text-layer gradient gradient-reverse
ol-width ol-color
bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
@ -139,7 +148,7 @@
SF-ADJUSTMENT _"Font Size (pixels)" '(85 2 1000 1 10 0 1)
SF-FONT _"Font" "Tribeca"
SF-GRADIENT _"Gradient" "Incandescent"
SF-TOGGLE _"Gradient Reverse" FALSE
SF-ADJUSTMENT _"Outline Size" '(5 1 100 1 10 0 1)
SF-COLOR _"Outline Color" '(255 255 255)
SF-COLOR _"Background Color" '(255 255 255)
)
SF-COLOR _"Background Color" '(255 255 255))

View File

@ -8,7 +8,8 @@
logo-layer
size
bg-color
gradient)
gradient
gradient-reverse)
(let* ((feather (/ size 5))
(smear 7.5)
(period (/ size 3))
@ -30,6 +31,7 @@
(old-gradient (car (gimp-gradients-get-gradient)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-selection-none img)
(gimp-image-resize img img-width img-height posx posy)
(gimp-image-add-layer img bg-layer 1)
@ -44,7 +46,12 @@
(gimp-edit-fill shadow-layer BG-IMAGE-FILL)
(gimp-gradients-set-gradient gradient)
(gimp-blend logo-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 0 (+ height 5))
(gimp-blend logo-layer CUSTOM NORMAL
LINEAR 100 0 REPEAT-NONE gradient-reverse
FALSE 0 0 TRUE
0 0 0 (+ height 5))
(gimp-rect-select img 0 (- (/ height 2) feather) img-width (* 2 feather) REPLACE 0 0)
(plug-in-gauss-iir 1 img logo-layer smear TRUE TRUE)
(gimp-selection-none img)
@ -88,8 +95,10 @@
(gimp-image-add-layer-mask img reflect-layer layer-mask)
(gimp-palette-set-foreground '(255 255 255))
(gimp-palette-set-background '(0 0 0))
(gimp-blend layer-mask FG-BG-RGB NORMAL LINEAR 100 0 REPEAT-NONE
FALSE 0 0 TRUE 0 (- (/ height 2)) 0 height)
(gimp-blend layer-mask FG-BG-RGB NORMAL
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 (- (/ height 2)) 0 height)
(gimp-image-remove-channel img channel)
@ -102,10 +111,12 @@
logo-layer
size
bg-color
gradient)
gradient
gradient-reverse)
(begin
(gimp-undo-push-group-start img)
(apply-cool-metal-logo-effect img logo-layer size bg-color gradient)
(apply-cool-metal-logo-effect img logo-layer size bg-color
gradient gradient-reverse)
(gimp-undo-push-group-end img)
(gimp-displays-flush)))
@ -121,19 +132,22 @@
SF-ADJUSTMENT _"Effect Size (pixels)" '(100 2 1000 1 10 0 1)
SF-COLOR _"Background Color" '(255 255 255)
SF-GRADIENT _"Gradient" "Horizon 1"
)
SF-TOGGLE _"Gradient Reverse" FALSE)
(define (script-fu-cool-metal-logo text
size
font
bg-color
gradient)
gradient
gradient-reverse)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE 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-layer-set-name text-layer text)
(apply-cool-metal-logo-effect img text-layer size bg-color gradient)
(apply-cool-metal-logo-effect img text-layer size bg-color
gradient gradient-reverse)
(gimp-image-undo-enable img)
(gimp-display-new img)))
@ -149,4 +163,4 @@
SF-FONT _"Font" "Crillee"
SF-COLOR _"Background Color" '(255 255 255)
SF-GRADIENT _"Gradient" "Horizon 1"
)
SF-TOGGLE _"Gradient Reverse" FALSE)

View File

@ -25,7 +25,9 @@
(define (apply-glossy-logo-effect img
logo-layer
blend-gradient-text
blend-gradient-text-reverse
blend-gradient-outline
blend-gradient-outline-reverse
grow-size
bg-color
use-pattern-text
@ -77,7 +79,11 @@
(if (= use-pattern-text FALSE)
(begin
(gimp-gradients-set-gradient blend-gradient-text)
(gimp-blend logo-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 0 (+ height 5))))
(gimp-blend logo-layer CUSTOM NORMAL
LINEAR 100 0 REPEAT-NONE blend-gradient-text-reverse
FALSE 0 0 TRUE
0 0 0 (+ height 5))))
(gimp-selection-none img)
@ -98,7 +104,11 @@
(if (= use-pattern-outline FALSE)
(begin
(gimp-gradients-set-gradient blend-gradient-outline)
(gimp-blend grow-me CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 0 (+ height 5))))
(gimp-blend grow-me CUSTOM NORMAL
LINEAR 100 0 REPEAT-NONE blend-gradient-outline-reverse
FALSE 0 0 TRUE
0 0 0 (+ height 5))))
(gimp-selection-none img)
@ -129,7 +139,9 @@
(define (script-fu-glossy-logo-alpha img
logo-layer
blend-gradient-text
blend-gradient-text-reverse
blend-gradient-outline
blend-gradient-outline-reverse
grow-size
bg-color
use-pattern-text
@ -144,8 +156,12 @@
s-offset-y)
(begin
(gimp-undo-push-group-start img)
(apply-glossy-logo-effect img logo-layer blend-gradient-text
blend-gradient-outline grow-size bg-color
(apply-glossy-logo-effect img logo-layer
blend-gradient-text
blend-gradient-text-reverse
blend-gradient-outline
blend-gradient-outline-reverse
grow-size bg-color
use-pattern-text pattern-text
use-pattern-outline pattern-outline
use-pattern-overlay pattern-overlay
@ -165,7 +181,9 @@
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-GRADIENT _"Blend Gradient (Text)" "Shadows 2"
SF-TOGGLE _"Text Gradient Reverse" FALSE
SF-GRADIENT _"Blend Gradient (Outline)" "Shadows 2"
SF-TOGGLE _"Outline Gradient Reverse" FALSE
SF-ADJUSTMENT _"Outline Size" '(5 0 250 1 10 0 1)
SF-COLOR _"Background Color" '(255 255 255)
SF-TOGGLE _"Use Pattern for Text instead of Gradient" FALSE
@ -177,15 +195,16 @@
SF-TOGGLE _"Default Bumpmap Settings" TRUE
SF-TOGGLE _"Shadow" TRUE
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))
(define (script-fu-glossy-logo text
size
font
blend-gradient-text
blend-gradient-text-reverse
blend-gradient-outline
blend-gradient-outline-reverse
grow-size
bg-color
use-pattern-text
@ -202,8 +221,12 @@
(text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font))))
(gimp-image-undo-disable img)
(gimp-layer-set-name text-layer text)
(apply-glossy-logo-effect img text-layer blend-gradient-text
blend-gradient-outline grow-size bg-color
(apply-glossy-logo-effect img text-layer
blend-gradient-text
blend-gradient-text-reverse
blend-gradient-outline
blend-gradient-outline-reverse
grow-size bg-color
use-pattern-text pattern-text
use-pattern-outline pattern-outline
use-pattern-overlay pattern-overlay
@ -223,7 +246,9 @@
SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Eras"
SF-GRADIENT _"Blend Gradient (Text)" "Shadows 2"
SF-TOGGLE _"Text Gradient Reverse" FALSE
SF-GRADIENT _"Blend Gradient (Outline)" "Shadows 2"
SF-TOGGLE _"Outline Gradient Reverse" FALSE
SF-ADJUSTMENT _"Outline Size" '(5 0 250 1 10 0 1)
SF-COLOR _"Background Color" '(255 255 255)
SF-TOGGLE _"Use Pattern for Text instead of Gradient" FALSE
@ -235,5 +260,4 @@
SF-TOGGLE _"Default Bumpmap Settings" TRUE
SF-TOGGLE _"Shadow" TRUE
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))

View File

@ -33,6 +33,7 @@
(blur-layer (car (gimp-layer-new img width height RGBA_IMAGE "Blur" 100 NORMAL)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
(gimp-image-add-layer img blur-layer 1)
@ -57,7 +58,12 @@
(gimp-palette-set-foreground '(255 255 255))
(gimp-layer-set-preserve-trans logo-layer TRUE)
(gimp-selection-all img)
(gimp-blend logo-layer FG-BG-RGB NORMAL RADIAL 95 0 REPEAT-NONE FALSE 0 0 TRUE indentX indentY indentX (- height indentY))
(gimp-blend logo-layer FG-BG-RGB NORMAL
RADIAL 95 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
indentX indentY indentX (- height indentY))
(gimp-selection-none img)
(gimp-layer-set-preserve-trans logo-layer FALSE)
(plug-in-bump-map 1 img logo-layer blur-layer 115 bevel-height 5 0 0 0 15 TRUE FALSE 0)
@ -93,8 +99,7 @@
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 Width" '(2.5 1 200 1 10 1 1)
SF-COLOR _"Background Color" '(255 255 255)
)
SF-COLOR _"Background Color" '(255 255 255))
(define (script-fu-gradient-bevel-logo text
size
@ -104,7 +109,8 @@
bg-color)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(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-layer-set-name text-layer text)
(apply-gradient-bevel-logo-effect img text-layer border
@ -124,5 +130,4 @@
SF-FONT _"Font" "Futura_Poster"
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-COLOR _"Background Color" '(255 255 255)
)
SF-COLOR _"Background Color" '(255 255 255))

View File

@ -19,9 +19,12 @@
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-gradient-example width height)
(define (script-fu-gradient-example width
height
gradient-reverse)
(let* ((img (car (gimp-image-new width height RGB)))
(drawable (car (gimp-layer-new img width height RGB "Gradient example" 100 NORMAL)))
(drawable (car (gimp-layer-new img width height RGB
"Gradient example" 100 NORMAL)))
; Save old foreground and background colors
@ -44,7 +47,10 @@
; Render gradient
(gimp-blend drawable CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 (- width 1) 0)
(gimp-blend drawable CUSTOM NORMAL
LINEAR 100 0 REPEAT-NONE gradient-reverse
FALSE 0 0 TRUE
0 0 (- width 1) 0)
; Terminate
@ -61,4 +67,5 @@
"June 1997"
""
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)

View File

@ -37,7 +37,12 @@
(define (text-descent extents)
(cadr (cddr extents)))
(define (round-select img x y width height ratio)
(define (round-select img
x
y
width
height
ratio)
(let* ((diameter (* ratio height)))
(gimp-ellipse-select img x y diameter height ADD FALSE 0 0)
(gimp-ellipse-select img (+ x (- width diameter)) y
@ -109,6 +114,7 @@
RGBA_IMAGE "Bumpmap" 100 NORMAL)))
(gradient (car (gimp-layer-new img width height
RGBA_IMAGE "Button" 100 NORMAL))))
(gimp-image-undo-disable img)
; Create bumpmap layer
@ -134,21 +140,10 @@
(gimp-palette-set-foreground ul-color)
(gimp-palette-set-background lr-color)
(gimp-blend gradient
FG-BG-RGB
NORMAL
LINEAR
100
0
REPEAT-NONE
FALSE
0
0
TRUE
0
0
0
(- height 1))
(gimp-blend gradient FG-BG-RGB NORMAL
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 0 (- height 1))
(gimp-selection-none img)
@ -185,8 +180,6 @@
(gimp-image-undo-enable img)
(gimp-display-new img)))
; Register!
(script-fu-register "script-fu-round-button"
_"<Toolbox>/Xtns/Script-Fu/Buttons/Round Button..."
"Round button"
@ -210,5 +203,3 @@
SF-TOGGLE _"Not Pressed" TRUE
SF-TOGGLE _"Not Pressed (Active)" TRUE
SF-TOGGLE _"Pressed" TRUE)

View File

@ -1,6 +1,3 @@
;
;
;
; Chris Gutteridge (cjg@ecs.soton.ac.uk)
; At ECS Dept, University of Southampton, England.
@ -19,7 +16,10 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (script-fu-render-map inSize inGrain inGrad inWiden)
(define (script-fu-render-map inSize
inGrain
inGrad
inWiden)
(set! old-gradient (car (gimp-gradients-get-gradient)))
(set! old-fg (car (gimp-palette-get-foreground)))
@ -31,25 +31,37 @@
(gimp-selection-all theImage)
(set! theLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "I've got more rubber ducks than you!" 100 NORMAL)))
(set! theLayer (car (gimp-layer-new theImage theWidth theHeight
RGBA_IMAGE
"I've got more rubber ducks than you!"
100 NORMAL)))
(gimp-image-add-layer theImage theLayer 0)
(plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536) inGrain inGrain inGrain)
(plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536)
inGrain inGrain inGrain)
(if (= inWiden 1) (begin
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "Camo Thin Layer" 100 NORMAL)))
(if (= inWiden 1)
(begin
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight
RGBA_IMAGE "Camo Thin Layer"
100 NORMAL)))
(gimp-image-add-layer theImage thinLayer 0)
(let ((theBigGrain (min 15 (* 2 inGrain))))
(plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536) theBigGrain theBigGrain theBigGrain)
)
(plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536)
theBigGrain theBigGrain theBigGrain))
(gimp-palette-set-background '(255 255 255))
(gimp-palette-set-foreground '(0 0 0))
(let ((theMask (car(gimp-layer-create-mask thinLayer 0))))
(let ((theMask (car (gimp-layer-create-mask thinLayer 0))))
(gimp-image-add-layer-mask theImage thinLayer theMask)
(gimp-blend theMask FG-BG-RGB NORMAL LINEAR 100
0 REPEAT-TRIANGULAR FALSE 0 0 TRUE 0 0 0 (/ theHeight 2) )
)
(set! theLayer (car(gimp-image-flatten theImage)))
))
(gimp-blend theMask FG-BG-RGB NORMAL
LINEAR 100 0 REPEAT-TRIANGULAR FALSE
FALSE 0 0 TRUE
0 0 0 (/ theHeight 2)))
(set! theLayer (car(gimp-image-flatten theImage)))))
(gimp-selection-none theImage)
(gimp-gradients-set-gradient inGrad)
@ -57,15 +69,9 @@
(gimp-gradients-set-gradient old-gradient)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)
(gimp-display-new theImage)
)
(gimp-display-new theImage))
; Register the function with the GIMP:
(script-fu-register
"script-fu-render-map"
(script-fu-register "script-fu-render-map"
_"<Toolbox>/Xtns/Script-Fu/Patterns/Render Map..."
"Another pattern which resembles a map"
"Chris Gutteridge: cjg@ecs.soton.ac.uk"
@ -75,6 +81,6 @@
SF-ADJUSTMENT _"Image Size" '(256 0 2048 1 10 0 0)
SF-ADJUSTMENT _"Granularity" '(4 0 15 1 1 0 0)
SF-GRADIENT _"Gradient" "Land and Sea"
SF-OPTION _"Behaviour" '(_"Tile" _"Detail in Middle")
)
SF-TOGGLE _"Gradient Reverse" FALSE
SF-OPTION _"Behaviour" '(_"Tile"
_"Detail in Middle"))

View File

@ -7,11 +7,16 @@
; light: angle of light source in degrees
; shadow: whather to create a shadow as well
(define (script-fu-sphere radius light shadow bg-color sphere-color)
(define (script-fu-sphere radius
light
shadow
bg-color
sphere-color)
(let* ((width (* radius 3.75))
(height (* radius 2.5))
(img (car (gimp-image-new width height RGB)))
(drawable (car (gimp-layer-new img width height RGB_IMAGE "Sphere Layer" 100 NORMAL)))
(drawable (car (gimp-layer-new img width height RGB_IMAGE
"Sphere Layer" 100 NORMAL)))
(radians (/ (* light *pi*) 180))
(cx (/ width 2))
(cy (/ height 2))
@ -22,6 +27,7 @@
(offset (* radius 0.1))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-image-undo-disable img)
(gimp-image-add-layer img drawable 0)
(gimp-palette-set-foreground sphere-color)
@ -29,7 +35,8 @@
(gimp-edit-fill drawable BG-IMAGE-FILL)
(gimp-palette-set-background '(20 20 20))
(if (and
(or (and (>= light 45) (<= light 75)) (and (<= light 135) (>= light 105)))
(or (and (>= light 45) (<= light 75))
(and (<= light 135) (>= light 105)))
(= shadow TRUE))
(let ((shadow-w (* (* radius 2.5) (cos (+ *pi* radians))))
(shadow-h (* radius 0.5))
@ -38,11 +45,19 @@
(if (< shadow-w 0)
(prog1 (set! shadow-x (+ cx shadow-w))
(set! shadow-w (- shadow-w))))
(gimp-ellipse-select img shadow-x shadow-y shadow-w shadow-h REPLACE TRUE TRUE 7.5)
(gimp-ellipse-select img shadow-x shadow-y shadow-w shadow-h
REPLACE TRUE TRUE 7.5)
(gimp-bucket-fill drawable BG-BUCKET-FILL MULTIPLY 100 0 FALSE 0 0)))
(gimp-ellipse-select img (- cx radius) (- cy radius) (* 2 radius) (* 2 radius) REPLACE TRUE FALSE 0)
(gimp-blend drawable FG-BG-RGB NORMAL RADIAL 100 offset REPEAT-NONE
FALSE 0 0 TRUE light-x light-y light-end-x light-end-y)
(gimp-ellipse-select img (- cx radius) (- cy radius)
(* 2 radius) (* 2 radius) REPLACE TRUE FALSE 0)
(gimp-blend drawable FG-BG-RGB NORMAL
RADIAL 100 offset REPEAT-NONE FALSE
FALSE 0 0 TRUE
light-x light-y light-end-x light-end-y)
(gimp-selection-none img)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)

View File

@ -1,13 +1,17 @@
; Nova Starscape
; Create a text effect that simulates an eerie alien glow around text
(define (find-blend-coords w h)
(define (find-blend-coords w
h)
(let* ((denom (+ (/ w h) (/ h w)))
(bx (/ (* -2 h) denom))
(by (/ (* -2 w) denom)))
(cons bx by)))
(define (find-nova-x-coord drawable x1 x2 y)
(define (find-nova-x-coord drawable
x1
x2
y)
(let* ((x 0)
(alpha 3)
(range (- x2 x1))
@ -59,6 +63,7 @@
(old-pattern (car (gimp-patterns-get-pattern)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
@ -88,14 +93,19 @@
(gimp-selection-none img)
(gimp-palette-set-background '(31 31 31))
(gimp-palette-set-foreground '(255 255 255))
(gimp-blend logo-layer FG-BG-RGB NORMAL BILINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE cx cy bx by)
(gimp-blend logo-layer FG-BG-RGB NORMAL
BILINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
cx cy bx by)
(plug-in-nova 1 img glow-layer novax novay glow-color novaradius 100 0)
(gimp-selection-all img)
(gimp-patterns-set-pattern "Stone")
(gimp-bucket-fill bump-channel PATTERN-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
(plug-in-bump-map 1 img logo-layer bump-channel 135.0 45.0 4 0 0 0 0 FALSE FALSE 0)
(plug-in-bump-map 1 img logo-layer bump-channel
135.0 45.0 4 0 0 0 0 FALSE FALSE 0)
(gimp-image-remove-channel img bump-channel)
(gimp-selection-none img)
@ -103,7 +113,6 @@
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(define (script-fu-starscape-logo-alpha img
logo-layer
size
@ -124,8 +133,7 @@
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Effect Size (pixels * 4)" '(150 1 1000 1 10 0 1)
SF-COLOR _"Glow Color" '(28 65 188)
)
SF-COLOR _"Glow Color" '(28 65 188))
(define (script-fu-starscape-logo text
@ -134,7 +142,8 @@
glow-color)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS fontname))))
(text-layer (car (gimp-text-fontname img -1 0 0 text border
TRUE size PIXELS fontname))))
(gimp-image-undo-disable img)
(gimp-layer-set-name text-layer text)
(apply-starscape-logo-effect img text-layer size glow-color)
@ -151,5 +160,4 @@
SF-STRING _"Text" "Nova"
SF-ADJUSTMENT _"Font Size (pixels)" '(150 1 1000 1 10 0 1)
SF-FONT _"Font" "Engraver"
SF-COLOR _"Glow Color" '(28 65 188)
)
SF-COLOR _"Glow Color" '(28 65 188))

View File

@ -116,6 +116,7 @@
text
pattern
gradient
gradient-reverse
font
size
filename
@ -124,7 +125,8 @@
(let* ((width (* radius 3.75))
(height (* radius 2.5))
(img (car (gimp-image-new width height RGB)))
(drawable (car (gimp-layer-new img width height RGB_IMAGE "Sphere Layer" 100 NORMAL)))
(drawable (car (gimp-layer-new img width height RGB_IMAGE
"Sphere Layer" 100 NORMAL)))
(radians (/ (* light *pi*) 180))
(cx (/ width 2))
(cy (/ height 2))
@ -140,14 +142,17 @@
(old-gradient (car (gimp-gradients-get-gradient)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(gimp-image-undo-disable img)
(gimp-image-add-layer img drawable 0)
(gimp-palette-set-foreground sphere-color)
(gimp-palette-set-background bg-color)
(gimp-edit-fill drawable BG-IMAGE-FILL)
(gimp-palette-set-background '(20 20 20))
(if (and
(or (and (>= light 45) (<= light 75)) (and (<= light 135) (>= light 105)))
(or (and (>= light 45) (<= light 75))
(and (<= light 135) (>= light 105)))
(= shadow TRUE))
(let ((shadow-w (* (* radius 2.5) (cos (+ *pi* radians))))
(shadow-h (* radius 0.5))
@ -156,18 +161,31 @@
(if (< shadow-w 0)
(prog1 (set! shadow-x (+ cx shadow-w))
(set! shadow-w (- shadow-w))))
(gimp-ellipse-select img shadow-x shadow-y shadow-w shadow-h REPLACE TRUE TRUE 7.5)
(gimp-ellipse-select img shadow-x shadow-y shadow-w shadow-h
REPLACE TRUE TRUE 7.5)
(gimp-patterns-set-pattern pattern)
(gimp-bucket-fill drawable PATTERN-BUCKET-FILL MULTIPLY 100 0 FALSE 0 0)))
(gimp-ellipse-select img (- cx radius) (- cy radius) (* 2 radius) (* 2 radius) REPLACE TRUE FALSE 0)
(gimp-blend drawable FG-BG-RGB NORMAL RADIAL 100 offset REPEAT-NONE
FALSE 0 0 TRUE light-x light-y light-end-x light-end-y)
(gimp-bucket-fill drawable PATTERN-BUCKET-FILL MULTIPLY
100 0 FALSE 0 0)))
(gimp-ellipse-select img (- cx radius) (- cy radius)
(* 2 radius) (* 2 radius) REPLACE TRUE FALSE 0)
(gimp-blend drawable FG-BG-RGB NORMAL
RADIAL 100 offset REPEAT-NONE FALSE
FALSE 0 0 TRUE
light-x light-y light-end-x light-end-y)
(gimp-selection-none img)
(gimp-gradients-set-gradient gradient)
(gimp-ellipse-select img 10 10 50 50 REPLACE TRUE FALSE 0)
(gimp-blend drawable CUSTOM NORMAL LINEAR 100 offset REPEAT-NONE
FALSE 0 0 TRUE 10 10 30 60)
(gimp-blend drawable CUSTOM NORMAL
LINEAR 100 offset REPEAT-NONE gradient-reverse
FALSE 0 0 TRUE
10 10 30 60)
(gimp-selection-none img)
(gimp-palette-set-foreground '(0 0 0))
@ -201,6 +219,7 @@
SF-STRING "Text" "Script-Fu rocks!"
SF-PATTERN "Pattern" "Maple Leaves"
SF-GRADIENT "Gradient" "Deep Sea"
SF-TOGGLE "Gradient Reverse" FALSE
SF-FONT "Font" "Agate"
SF-ADJUSTMENT "Font Size (pixels)" '(50 1 1000 1 10 0 1)
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")

View File

@ -21,15 +21,22 @@
(ts-size (- b-size-2 3))
(width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(blend-layer (car (gimp-layer-new img width height RGBA_IMAGE "Blend" 100 NORMAL)))
(shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 NORMAL)))
(text-shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Text Shadow" 100 MULTIPLY)))
(tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer BLACK-MASK)))
(drop-shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Drop Shadow" 100 MULTIPLY)))
(dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer BLACK-MASK)))
(blend-layer (car (gimp-layer-new img width height RGBA_IMAGE
"Blend" 100 NORMAL)))
(shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE
"Shadow" 100 NORMAL)))
(text-shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE
"Text Shadow" 100 MULTIPLY)))
(tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer
BLACK-MASK)))
(drop-shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE
"Drop Shadow" 100 MULTIPLY)))
(dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer
BLACK-MASK)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-pattern (car (gimp-patterns-get-pattern))))
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img shadow-layer 1)
(gimp-image-add-layer img blend-layer 1)
@ -44,7 +51,8 @@
(gimp-edit-clear drop-shadow-layer)
(gimp-palette-set-background bg-color)
(gimp-drawable-fill shadow-layer BG-IMAGE-FILL)
(gimp-rect-select img b-size-2 b-size-2 (- width b-size) (- height b-size) REPLACE TRUE b-size-2)
(gimp-rect-select img b-size-2 b-size-2 (- width b-size) (- height b-size)
REPLACE TRUE b-size-2)
(gimp-palette-set-background '(0 0 0))
(gimp-edit-fill shadow-layer BG-IMAGE-FILL)
(gimp-selection-layer-alpha logo-layer)
@ -57,12 +65,24 @@
(gimp-palette-set-background '(0 0 0))
(gimp-edit-fill text-shadow-layer BG-IMAGE-FILL)
(gimp-palette-set-foreground '(255 255 255))
(gimp-blend text-shadow-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 1 1)
(gimp-blend text-shadow-layer FG-BG-RGB NORMAL
SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 1 1)
(gimp-selection-none img)
(gimp-palette-set-foreground blend-fg)
(gimp-palette-set-background blend-bg)
(gimp-blend blend-layer FG-BG-RGB NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 TRUE 0 0 width 0)
(plug-in-mosaic 1 img blend-layer 12 1 1 0.7 TRUE 135 0.2 TRUE FALSE tile-type 1 0)
(gimp-blend blend-layer FG-BG-RGB NORMAL
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 0 width 0)
(plug-in-mosaic 1 img blend-layer 12 1 1 0.7 TRUE 135 0.2 TRUE FALSE
tile-type 1 0)
(gimp-layer-translate logo-layer (- b-size-2) (- b-size-2))
(gimp-layer-translate blend-layer (- b-size) (- b-size))
(gimp-layer-translate text-shadow-layer (- ts-size) (- ts-size))
@ -103,11 +123,12 @@
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Border Size (pixels)" '(20 1 100 1 10 0 1)
SF-PATTERN _"Pattern" "Fibers"
SF-OPTION _"Mosaic Tile Type" '(_"Squares" _"Hexagons" _"Octagons")
SF-OPTION _"Mosaic Tile Type" '(_"Squares"
_"Hexagons"
_"Octagons")
SF-COLOR _"Background Color" '(255 255 255)
SF-COLOR _"Starting Blend" '(32 106 0)
SF-COLOR _"Ending Blend" '(0 0 106)
)
SF-COLOR _"Ending Blend" '(0 0 106))
(define (script-fu-textured-logo text
size
@ -119,7 +140,8 @@
blend-bg)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(b-size (scale size 0.1))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS fontname))))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size
TRUE size PIXELS fontname))))
(gimp-image-undo-disable img)
(gimp-layer-set-name text-layer text)
(apply-textured-logo-effect img text-layer b-size text-pattern tile-type
@ -138,8 +160,9 @@
SF-ADJUSTMENT _"Font Size (pixels)" '(200 1 1000 1 10 0 1)
SF-FONT _"Font" "CuneiFont"
SF-PATTERN _"Text Pattern" "Fibers"
SF-OPTION _"Mosaic Tile Type" '(_"Squares" _"Hexagons" _"Octagons")
SF-OPTION _"Mosaic Tile Type" '(_"Squares"
_"Hexagons"
_"Octagons")
SF-COLOR _"Background Color" '(255 255 255)
SF-COLOR _"Starting Blend" '(32 106 0)
SF-COLOR _"Ending Blend" '(0 0 106)
)
SF-COLOR _"Ending Blend" '(0 0 106))

View File

@ -30,12 +30,8 @@
(define (script-fu-title-header text
size
; foundry
; family
; weight
; slant
; set-width
fontname)
fontname
gradient-reverse)
(let* (; Parameters
(padding 8)
@ -75,7 +71,8 @@
; Additional layers
(bg-layer (car (gimp-layer-new img img-width img-height RGBA_IMAGE "bg-layer" 100 NORMAL)))
(bg-layer (car (gimp-layer-new img img-width img-height RGBA_IMAGE
"bg-layer" 100 NORMAL)))
(bumpmap-layer (car (gimp-layer-new img
text-width
text-height
@ -83,7 +80,8 @@
"bumpmap-layer"
100
NORMAL)))
(fore-layer (car (gimp-layer-new img text-width text-height RGBA_IMAGE "fore-layer" 100 NORMAL))))
(fore-layer (car (gimp-layer-new img text-width text-height RGBA_IMAGE
"fore-layer" 100 NORMAL))))
; Create image
@ -122,11 +120,12 @@
(gimp-layer-set-visible text-layer TRUE)
(gimp-layer-set-preserve-trans text-layer TRUE)
(gimp-blend text-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0.2 3 TRUE
padding
padding
(- text-width padding 1)
(- text-height padding 1))
(gimp-blend text-layer CUSTOM NORMAL
LINEAR 100 0 REPEAT-NONE gradient-reverse
FALSE 0.2 3 TRUE
padding padding
(- text-width padding 1) (- text-height padding 1))
; Semicircle at the left
@ -134,29 +133,23 @@
(gimp-edit-fill bg-layer BG-IMAGE-FILL)
(gimp-ellipse-select img 0 0 text-height text-height REPLACE TRUE FALSE 0)
(gimp-palette-set-background (car (gimp-color-picker img text-layer text-layers-offset 0 TRUE FALSE 0)))
(gimp-palette-set-background (car (gimp-color-picker img text-layer
text-layers-offset 0
TRUE FALSE 0)))
(gimp-edit-fill bg-layer BG-IMAGE-FILL)
; Fade-out gradient at the right
(gimp-rect-select img (- img-width fade-width) 0 fade-width text-height REPLACE FALSE 0)
(gimp-rect-select img (- img-width fade-width) 0 fade-width text-height
REPLACE FALSE 0)
(gimp-palette-set-foreground (car (gimp-palette-get-background)))
(gimp-palette-set-background '(0 0 0))
(gimp-blend bg-layer
FG-BG-RGB
NORMAL
LINEAR
100
0
REPEAT-NONE
FALSE
0.2
3
TRUE
(- img-width fade-width)
0
(- img-width 1)
0)
(gimp-blend bg-layer FG-BG-RGB NORMAL
LINEAR 100 0 REPEAT-NONE FALSE
FALSE 0.2 3 TRUE
(- img-width fade-width) 0 (- img-width 1) 0)
(gimp-selection-none img)
; Done
@ -176,9 +169,5 @@
""
SF-STRING _"Text" "Hello world!"
SF-ADJUSTMENT _"Font Size (pixels)" '(32 2 256 1 10 0 0)
SF-FONT _"Font" "Sans")
SF-FONT _"Font" "Sans"
SF-TOGGLE _"Gradient Reverse" FALSE)

View File

@ -22,7 +22,14 @@
; Copies the specified rectangle from/to the specified drawable
(define (copy-rectangle img drawable x1 y1 width height dest-x dest-y)
(define (copy-rectangle img
drawable
x1
y1
width
height
dest-x
dest-y)
(gimp-rect-select img x1 y1 width height REPLACE FALSE 0)
(gimp-edit-copy drawable)
(let ((floating-sel (car (gimp-edit-paste drawable FALSE))))
@ -32,11 +39,15 @@
; Creates a single weaving tile
(define (create-weave-tile ribbon-width ribbon-spacing shadow-darkness shadow-depth)
(define (create-weave-tile ribbon-width
ribbon-spacing
shadow-darkness
shadow-depth)
(let* ((tile-size (+ (* 2 ribbon-width) (* 2 ribbon-spacing)))
(darkness (* 255 (/ (- 100 shadow-darkness) 100)))
(img (car (gimp-image-new tile-size tile-size RGB)))
(drawable (car (gimp-layer-new img tile-size tile-size RGB_IMAGE "Weave tile" 100 NORMAL))))
(drawable (car (gimp-layer-new img tile-size tile-size RGB_IMAGE
"Weave tile" 100 NORMAL))))
(gimp-image-undo-disable img)
(gimp-image-add-layer img drawable 0)
@ -56,21 +67,11 @@
REPLACE
FALSE
0)
(gimp-blend drawable
FG-BG-RGB
NORMAL
BILINEAR
100
(- 100 shadow-depth)
REPEAT-NONE
FALSE
0
0
TRUE
(/ (+ (* 2 ribbon-spacing) ribbon-width -1) 2)
0
0
0)
(gimp-blend drawable FG-BG-RGB NORMAL
BILINEAR 100 (- 100 shadow-depth) REPEAT-NONE FALSE
FALSE 0 0 TRUE
(/ (+ (* 2 ribbon-spacing) ribbon-width -1) 2) 0 0 0)
; Create main vertical ribbon
@ -82,21 +83,11 @@
REPLACE
FALSE
0)
(gimp-blend drawable
FG-BG-RGB
NORMAL
BILINEAR
100
(- 100 shadow-depth)
REPEAT-NONE
FALSE
0
0
TRUE
0
(/ (+ (* 2 ribbon-spacing) ribbon-width -1) 2)
0
0)
(gimp-blend drawable FG-BG-RGB NORMAL
BILINEAR 100 (- 100 shadow-depth) REPEAT-NONE FALSE
FALSE 0 0 TRUE
0 (/ (+ (* 2 ribbon-spacing) ribbon-width -1) 2) 0 0)
; Create the secondary horizontal ribbon
@ -146,8 +137,14 @@
; Creates a complete weaving mask
(define (create-weave width height ribbon-width ribbon-spacing shadow-darkness shadow-depth)
(let* ((tile (create-weave-tile ribbon-width ribbon-spacing shadow-darkness shadow-depth))
(define (create-weave width
height
ribbon-width
ribbon-spacing
shadow-darkness
shadow-depth)
(let* ((tile (create-weave-tile ribbon-width ribbon-spacing shadow-darkness
shadow-depth))
(tile-img (car tile))
(tile-layer (cadr tile))
(weaving (plug-in-tile 1 tile-img tile-layer width height TRUE)))
@ -156,13 +153,24 @@
; Creates a single tile for masking
(define (create-mask-tile ribbon-width ribbon-spacing
r1-x1 r1-y1 r1-width r1-height
r2-x1 r2-y1 r2-width r2-height
r3-x1 r3-y1 r3-width r3-height)
(define (create-mask-tile ribbon-width
ribbon-spacing
r1-x1
r1-y1
r1-width
r1-height
r2-x1
r2-y1
r2-width
r2-height
r3-x1
r3-y1
r3-width
r3-height)
(let* ((tile-size (+ (* 2 ribbon-width) (* 2 ribbon-spacing)))
(img (car (gimp-image-new tile-size tile-size RGB)))
(drawable (car (gimp-layer-new img tile-size tile-size RGB_IMAGE "Mask" 100 NORMAL))))
(drawable (car (gimp-layer-new img tile-size tile-size RGB_IMAGE
"Mask" 100 NORMAL))))
(gimp-image-undo-disable img)
(gimp-image-add-layer img drawable 0)
@ -183,24 +191,39 @@
; Creates a complete mask image
(define (create-mask final-width final-height
ribbon-width ribbon-spacing
r1-x1 r1-y1 r1-width r1-height
r2-x1 r2-y1 r2-width r2-height
r3-x1 r3-y1 r3-width r3-height)
(define (create-mask final-width
final-height
ribbon-width
ribbon-spacing
r1-x1
r1-y1
r1-width
r1-height
r2-x1
r2-y1
r2-width
r2-height
r3-x1
r3-y1
r3-width
r3-height)
(let* ((tile (create-mask-tile ribbon-width ribbon-spacing
r1-x1 r1-y1 r1-width r1-height
r2-x1 r2-y1 r2-width r2-height
r3-x1 r3-y1 r3-width r3-height))
(tile-img (car tile))
(tile-layer (cadr tile))
(mask (plug-in-tile 1 tile-img tile-layer final-width final-height TRUE)))
(mask (plug-in-tile 1 tile-img tile-layer final-width final-height
TRUE)))
(gimp-image-delete tile-img)
mask))
; Creates the mask for horizontal ribbons
(define (create-horizontal-mask ribbon-width ribbon-spacing final-width final-height)
(define (create-horizontal-mask ribbon-width
ribbon-spacing
final-width
final-height)
(create-mask final-width
final-height
ribbon-width
@ -220,7 +243,10 @@
; Creates the mask for vertical ribbons
(define (create-vertical-mask ribbon-width ribbon-spacing final-width final-height)
(define (create-vertical-mask ribbon-width
ribbon-spacing
final-width
final-height)
(create-mask final-width
final-height
ribbon-width
@ -240,8 +266,14 @@
; Adds a threads layer at a certain orientation to the specified image
(define (create-threads-layer img width height length density orientation)
(let* ((drawable (car (gimp-layer-new img width height RGBA_IMAGE "Threads" 100 NORMAL)))
(define (create-threads-layer img
width
height
length
density
orientation)
(let* ((drawable (car (gimp-layer-new img width height RGBA_IMAGE
"Threads" 100 NORMAL)))
(dense (/ density 100.0)))
(gimp-image-add-layer img drawable -1)
(gimp-palette-set-background '(255 255 255))
@ -264,17 +296,21 @@
thread-length
thread-density
thread-intensity)
(let* ((weave (create-weave width height ribbon-width ribbon-spacing shadow-darkness shadow-depth))
(let* ((weave (create-weave width height ribbon-width ribbon-spacing
shadow-darkness shadow-depth))
(w-img (car weave))
(w-layer (cadr weave))
(h-layer (create-threads-layer w-img width height thread-length thread-density 'horizontal))
(h-layer (create-threads-layer w-img width height thread-length
thread-density 'horizontal))
(h-mask (car (gimp-layer-create-mask h-layer WHITE-MASK)))
(v-layer (create-threads-layer w-img width height thread-length thread-density 'vertical))
(v-layer (create-threads-layer w-img width height thread-length
thread-density 'vertical))
(v-mask (car (gimp-layer-create-mask v-layer WHITE-MASK)))
(hmask (create-horizontal-mask ribbon-width ribbon-spacing width height))
(hmask (create-horizontal-mask ribbon-width ribbon-spacing
width height))
(hm-img (car hmask))
(hm-layer (cadr hmask))
@ -349,8 +385,6 @@
(gimp-palette-set-background old-bg-color)
(gimp-displays-flush)))
; Register!
(script-fu-register "script-fu-weave"
_"<Image>/Script-Fu/Alchemy/Weave..."
"Weave effect like Alien Skin"

View File

@ -315,11 +315,6 @@ init_constants (void)
setvar (cintern ("HARD"), flocons (GIMP_BRUSH_HARD), NIL);
setvar (cintern ("SOFT"), flocons (GIMP_BRUSH_SOFT), NIL);
setvar (cintern ("ONCE-FORWARD"), flocons (GIMP_GRADIENT_ONCE_FORWARD), NIL);
setvar (cintern ("ONCE-BACKWARDS"), flocons (GIMP_GRADIENT_ONCE_BACKWARD), NIL);
setvar (cintern ("LOOP-SAWTOOTH"), flocons (GIMP_GRADIENT_LOOP_SAWTOOTH), NIL);
setvar (cintern ("LOOP-TRIANGLE"), flocons (GIMP_GRADIENT_LOOP_TRIANGLE), NIL);
setvar (cintern ("CONTINUOUS"), flocons (GIMP_PAINT_CONSTANT), NIL);
setvar (cintern ("INCREMENTAL"), flocons (GIMP_PAINT_INCREMENTAL), NIL);

View File

@ -378,18 +378,6 @@ package Gimp::CodeGen::enums;
mapping => { GIMP_DODGE => '0',
GIMP_BURN => '1' }
},
GimpGradientPaintMode =>
{ contig => 1,
header => 'paint/paint-enums.h',
symbols => [ qw(GIMP_GRADIENT_ONCE_FORWARD
GIMP_GRADIENT_ONCE_BACKWARD
GIMP_GRADIENT_LOOP_SAWTOOTH
GIMP_GRADIENT_LOOP_TRIANGLE) ],
mapping => { GIMP_GRADIENT_ONCE_FORWARD => '0',
GIMP_GRADIENT_ONCE_BACKWARD => '1',
GIMP_GRADIENT_LOOP_SAWTOOTH => '2',
GIMP_GRADIENT_LOOP_TRIANGLE => '3' }
},
GimpConvolveType =>
{ contig => 1,
header => 'paint/paint-enums.h',

View File

@ -188,7 +188,7 @@ HELP
while (i--)
{
gimp_gradient_get_color_at (gradient, pos, &color);
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
*pv++ = color.r;
*pv++ = color.g;
@ -240,7 +240,7 @@ HELP
while (i--)
{
gimp_gradient_get_color_at (gradient, *pos, &color);
gimp_gradient_get_color_at (gradient, *pos, FALSE, &color);
*pv++ = color.r;
*pv++ = color.g;
@ -303,12 +303,14 @@ HELP
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
name);
}
else
{
gradient = gimp_context_get_gradient (gimp_get_current_context (gimp));;
}
if (gradient)
success = TRUE;
}
else
success = (gradient = gimp_context_get_gradient (gimp_get_current_context (gimp))) != NULL;
if (success)
{
@ -325,7 +327,7 @@ HELP
while (i--)
{
gimp_gradient_get_color_at (gradient, pos, &color);
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
*pv++ = color.r;
*pv++ = color.g;

View File

@ -80,6 +80,8 @@ HELP
(%%desc%%)' },
{ name => 'repeat', type => 'enum GimpRepeatMode',
desc => 'Repeat mode: { %%desc%% }' },
{ name => 'reverse', type => 'boolean',
desc => 'Use the reverse gradient (%%desc%%)' },
{ name => 'supersample', type => 'boolean',
desc => 'Do adaptive supersampling (%%desc%%)' },
{ name => 'max_depth', type => '1 <= int32 <= 9',
@ -115,7 +117,7 @@ HELP
paint_mode,
gradient_type,
opacity / 100.0,
offset, repeat,
offset, repeat, reverse,
supersample, max_depth,
threshold, dither,
x1, y1, x2, y2,

View File

@ -468,7 +468,9 @@ HELP
g_object_set (options,
"application-mode", method,
"use-fade", fade_out > 0.0,
"fade-length", fade_out,
"use-gradient", gradient_length > 0.0,
"gradient-length", gradient_length,
NULL);