Fixed most of the bugs the Script-Fu logo scripts triggered:

2003-02-14  Michael Natterer  <mitch@gimp.org>

	Fixed most of the bugs the Script-Fu logo scripts triggered:

	* app/core/gimpdrawable-bucket-fill.[ch]
	(gimp_drawable_bucket_fill): added "gboolean do_seed_fill"
	parameter instead of assuming TRUE.
	(gimp_drawable_bucket_fill_full): moved "color" and "pattern"
	parameters to the end.

	* app/tools/gimpbucketfilltool.c
	* app/display/gimpdisplayshell-dnd.c
	* app/widgets/gimpdrawablelistview.c: changed accordingly.

	* tools/pdbgen/pdb/misc_tools.pdb: only pass TRUE if the selection
	is empty. Restores old PDB behaviour.

	* app/core/gimpimage-undo.c (gimp_image_undo_group_end): return
	early if gimage->undo_on is FALSE. Fixes bogus criticals.

	* app/core/gimpimage.c (gimp_image_add_[layer|channel|vectors]):
	clamp the passed position to sane values before calling
	gimp_container_insert() (Scripts adding layers at wrong indices
	are broken but should not crash the core).

	* tools/pdbgen/pdb/paint_tools.pdb: need to copy the relevant
	paint parameters from the current context now that the paint
	options are contexts themselves.

	* tools/pdbgen/pdb/palette.pdb: removed useless includes.

	(Mostly) fixed text PDB functions:

	* app/text/gimptext-compat.[ch] (text_render): don't set
	text->font_size = -1 but get the size from the PangoFontDescrition.
	(text_get_extents): return the logical_rect, not the ink_rect
	because the size of the created text layer will be the logical_rect.

	* tools/pdbgen/pdb/text_tool.pdb: removed text_fontname_create()
	utility function and the usage of pass_through and implement all
	invokers in-place, using the correct parameters.

	* plug-ins/script-fu/siod-wrapper.c: fixed BG-IMAGE-FILL compat
	define so we can BG fill again. Cleaned up color handling code.

	* plug-ins/script-fu/scripts/coolmetal-logo.scm
	* plug-ins/script-fu/scripts/glossy.scm
	* plug-ins/script-fu/scripts/land.scm
	* plug-ins/script-fu/scripts/lava.scm
	* plug-ins/script-fu/scripts/test-sphere.scm: use new gradient names.

	* app/pdb/misc_tools_cmds.c
	* app/pdb/paint_tools_cmds.c
	* app/pdb/palette_cmds.c
	* app/pdb/text_tool_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2003-02-14 22:33:22 +00:00 committed by Michael Natterer
parent 59fc2eade4
commit a4a224587b
26 changed files with 327 additions and 186 deletions

View file

@ -1,3 +1,59 @@
2003-02-14 Michael Natterer <mitch@gimp.org>
Fixed most of the bugs the Script-Fu logo scripts triggered:
* app/core/gimpdrawable-bucket-fill.[ch]
(gimp_drawable_bucket_fill): added "gboolean do_seed_fill"
parameter instead of assuming TRUE.
(gimp_drawable_bucket_fill_full): moved "color" and "pattern"
parameters to the end.
* app/tools/gimpbucketfilltool.c
* app/display/gimpdisplayshell-dnd.c
* app/widgets/gimpdrawablelistview.c: changed accordingly.
* tools/pdbgen/pdb/misc_tools.pdb: only pass TRUE if the selection
is empty. Restores old PDB behaviour.
* app/core/gimpimage-undo.c (gimp_image_undo_group_end): return
early if gimage->undo_on is FALSE. Fixes bogus criticals.
* app/core/gimpimage.c (gimp_image_add_[layer|channel|vectors]):
clamp the passed position to sane values before calling
gimp_container_insert() (Scripts adding layers at wrong indices
are broken but should not crash the core).
* tools/pdbgen/pdb/paint_tools.pdb: need to copy the relevant
paint parameters from the current context now that the paint
options are contexts themselves.
* tools/pdbgen/pdb/palette.pdb: removed useless includes.
(Mostly) fixed text PDB functions:
* app/text/gimptext-compat.[ch] (text_render): don't set
text->font_size = -1 but get the size from the PangoFontDescrition.
(text_get_extents): return the logical_rect, not the ink_rect
because the size of the created text layer will be the logical_rect.
* tools/pdbgen/pdb/text_tool.pdb: removed text_fontname_create()
utility function and the usage of pass_through and implement all
invokers in-place, using the correct parameters.
* plug-ins/script-fu/siod-wrapper.c: fixed BG-IMAGE-FILL compat
define so we can BG fill again. Cleaned up color handling code.
* plug-ins/script-fu/scripts/coolmetal-logo.scm
* plug-ins/script-fu/scripts/glossy.scm
* plug-ins/script-fu/scripts/land.scm
* plug-ins/script-fu/scripts/lava.scm
* plug-ins/script-fu/scripts/test-sphere.scm: use new gradient names.
* app/pdb/misc_tools_cmds.c
* app/pdb/paint_tools_cmds.c
* app/pdb/palette_cmds.c
* app/pdb/text_tool_cmds.c: regenerated.
2003-02-14 Michael Natterer <mitch@gimp.org>
Moved the undo step implementations to the core and pass around

View file

@ -76,6 +76,7 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
GimpBucketFillMode fill_mode,
gint paint_mode,
gdouble opacity,
gboolean do_seed_fill,
gboolean fill_transparent,
gdouble threshold,
gboolean sample_merged,
@ -121,19 +122,17 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
gimp_drawable_bucket_fill_full (drawable,
fill_mode,
&color, pattern,
paint_mode, opacity,
TRUE /* do seed fill */,
do_seed_fill,
fill_transparent,
threshold, sample_merged,
x, y);
x, y,
&color, pattern);
}
void
gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
GimpBucketFillMode fill_mode,
const GimpRGB *color,
GimpPattern *pattern,
gint paint_mode,
gdouble opacity,
gboolean do_seed_fill,
@ -141,7 +140,9 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
gdouble threshold,
gboolean sample_merged,
gdouble x,
gdouble y)
gdouble y,
const GimpRGB *color,
GimpPattern *pattern)
{
GimpImage *gimage;
TileManager *buf_tiles;

View file

@ -24,6 +24,7 @@ void gimp_drawable_bucket_fill (GimpDrawable *drawable,
GimpBucketFillMode fill_mode,
gint paint_mode,
gdouble opacity,
gboolean do_seed_fill,
gboolean fill_transparent,
gdouble threshold,
gboolean sample_merged,
@ -32,8 +33,6 @@ void gimp_drawable_bucket_fill (GimpDrawable *drawable,
void gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
GimpBucketFillMode fill_mode,
const GimpRGB *color,
GimpPattern *pattern,
gint paint_mode,
gdouble opacity,
gboolean do_seed_fill,
@ -41,7 +40,9 @@ void gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
gdouble threshold,
gboolean sample_merged,
gdouble x,
gdouble y);
gdouble y,
const GimpRGB *color,
GimpPattern *pattern);
#endif /* __GIMP_DRAWABLE_BUCKET_FILL_H__ */

View file

@ -153,11 +153,12 @@ gboolean
gimp_image_undo_group_end (GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (gimage->group_count > 0, FALSE);
if (! gimage->undo_on)
return FALSE;
g_return_val_if_fail (gimage->group_count > 0, FALSE);
gimage->group_count--;
if (gimage->group_count == 0)

View file

@ -2733,6 +2733,10 @@ gimp_image_add_layer (GimpImage *gimage,
alpha_changed = TRUE;
}
/* Don't add at a non-existing index */
if (position > gimp_container_num_children (gimage->layers))
position = gimp_container_num_children (gimage->layers);
gimp_container_insert (gimage->layers, GIMP_OBJECT (layer), position);
g_object_unref (layer);
@ -3025,6 +3029,10 @@ gimp_image_add_channel (GimpImage *gimage,
}
}
/* Don't add at a non-existing index */
if (position > gimp_container_num_children (gimage->channels))
position = gimp_container_num_children (gimage->channels);
gimp_container_insert (gimage->channels, GIMP_OBJECT (channel), position);
g_object_unref (channel);
@ -3216,6 +3224,10 @@ gimp_image_add_vectors (GimpImage *gimage,
}
}
/* Don't add at a non-existing index */
if (position > gimp_container_num_children (gimage->vectors))
position = gimp_container_num_children (gimage->vectors);
gimp_container_insert (gimage->vectors, GIMP_OBJECT (vectors), position);
g_object_unref (vectors);

View file

@ -112,11 +112,11 @@ gimp_display_shell_bucket_fill (GimpImage *gimage,
gimp_drawable_bucket_fill_full (drawable,
fill_mode,
color, pattern,
gimp_context_get_paint_mode (context),
gimp_context_get_opacity (context),
FALSE /* no seed fill */,
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */);
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */,
color, pattern);
gimp_image_flush (gimage);
}

View file

@ -33,6 +33,7 @@
#include "core/gimpdrawable-blend.h"
#include "core/gimpdrawable-bucket-fill.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-pick-color.h"
#include "core/gimpimage.h"
@ -279,8 +280,13 @@ bucket_fill_invoker (Gimp *gimp,
}
else
{
gboolean do_seed_fill;
do_seed_fill = gimp_image_mask_is_empty (gimp_item_get_image (GIMP_ITEM (drawable)));
gimp_drawable_bucket_fill (drawable, fill_mode,
paint_mode, opacity / 100.0,
do_seed_fill,
FALSE /* don't fill transparent */,
threshold, sample_merged, x, y);
}

View file

@ -99,6 +99,15 @@ paint_tools_stroke (Gimp *gimp,
gboolean retval;
gint i;
/* undefine the paint-relevant context properties and get them
* from the current context
*/
gimp_context_define_properties (GIMP_CONTEXT (options),
GIMP_CONTEXT_PAINT_PROPS_MASK,
FALSE);
gimp_context_set_parent (GIMP_CONTEXT (options),
gimp_get_current_context (gimp));
core = g_object_new (core_type, NULL);
coords = g_new (GimpCoords, n_strokes);

View file

@ -20,7 +20,6 @@
#include "config.h"
#include <string.h>
#include <glib-object.h>
@ -31,9 +30,6 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimplist.h"
#include "core/gimppalette.h"
#include "libgimpcolor/gimpcolor.h"

View file

@ -52,21 +52,6 @@ register_text_tool_procs (Gimp *gimp)
procedural_db_register (gimp, &text_get_extents_proc);
}
static gchar *
text_fontname_create (gchar *foundry,
gchar *family,
gchar *weight,
gchar *slant,
gchar *set_width,
gchar *spacing,
gchar *registry,
gchar *encoding)
{
/* create the fontname */
return g_strdup_printf ("%s %s", family, weight);
}
static Argument *
text_fontname_invoker (Gimp *gimp,
Argument *args)
@ -342,8 +327,16 @@ text_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
int i;
Argument argv[10];
Argument *return_args;
GimpImage *gimage;
GimpDrawable *drawable;
gdouble x;
gdouble y;
gchar *text;
gint32 border;
gboolean antialias;
gdouble size;
gint32 size_type;
gchar *foundry;
gchar *family;
gchar *weight;
@ -352,6 +345,36 @@ text_invoker (Gimp *gimp,
gchar *spacing;
gchar *registry;
gchar *encoding;
GimpLayer *text_layer = NULL;
gchar *real_fontname;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
x = args[2].value.pdb_float;
y = args[3].value.pdb_float;
text = (gchar *) args[4].value.pdb_pointer;
if (text == NULL)
success = FALSE;
border = args[5].value.pdb_int;
if (border < -1)
success = FALSE;
antialias = args[6].value.pdb_int ? TRUE : FALSE;
size = args[7].value.pdb_float;
if (size <= 0.0)
success = FALSE;
size_type = args[8].value.pdb_int;
if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS)
success = FALSE;
foundry = (gchar *) args[9].value.pdb_pointer;
if (foundry == NULL)
@ -385,24 +408,24 @@ text_invoker (Gimp *gimp,
if (encoding == NULL)
success = FALSE;
if (!success)
return procedural_db_return_args (&text_proc, FALSE);
if (success)
{
real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
text_layer = text_render (gimage, drawable, x, y, real_fontname, text,
border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname);
}
for (i = 0; i < 9; i++)
argv[i] = args[i];
return_args = procedural_db_return_args (&text_proc, success);
argv[9].arg_type = GIMP_PDB_STRING;
argv[9].value.pdb_pointer =
text_fontname_create (foundry,
family,
weight,
slant,
set_width,
spacing,
registry,
encoding);
if (success)
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (text_layer));
return text_fontname_invoker (gimp, argv);
return return_args;
}
static ProcArg text_inargs[] =
@ -525,8 +548,10 @@ text_get_extents_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
int i;
Argument argv[4];
Argument *return_args;
gchar *text;
gdouble size;
gint32 size_type;
gchar *foundry;
gchar *family;
gchar *weight;
@ -535,6 +560,23 @@ text_get_extents_invoker (Gimp *gimp,
gchar *spacing;
gchar *registry;
gchar *encoding;
gint32 width;
gint32 height;
gint32 ascent;
gint32 descent;
gchar *real_fontname;
text = (gchar *) args[0].value.pdb_pointer;
if (text == NULL)
success = FALSE;
size = args[1].value.pdb_float;
if (size <= 0.0)
success = FALSE;
size_type = args[2].value.pdb_int;
if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS)
success = FALSE;
foundry = (gchar *) args[3].value.pdb_pointer;
if (foundry == NULL)
@ -568,24 +610,28 @@ text_get_extents_invoker (Gimp *gimp,
if (encoding == NULL)
success = FALSE;
if (!success)
return procedural_db_return_args (&text_get_extents_proc, FALSE);
if (success)
{
real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
success = text_get_extents (real_fontname, text,
&width, &height,
&ascent, &descent);
g_free (real_fontname);
}
for (i = 0; i < 3; i++)
argv[i] = args[i];
return_args = procedural_db_return_args (&text_get_extents_proc, success);
argv[3].arg_type = GIMP_PDB_STRING;
argv[3].value.pdb_pointer =
text_fontname_create (foundry,
family,
weight,
slant,
set_width,
spacing,
registry,
encoding);
if (success)
{
return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = height;
return_args[3].value.pdb_int = ascent;
return_args[4].value.pdb_int = descent;
}
return text_get_extents_fontname_invoker (gimp, argv);
return return_args;
}
static ProcArg text_get_extents_inargs[] =

View file

@ -53,30 +53,39 @@ text_render (GimpImage *gimage,
const gchar *fontname,
const gchar *text,
gint border,
gint antialias)
gboolean antialias)
{
GimpText *gtext;
GimpLayer *layer;
GimpRGB color;
PangoFontDescription *desc;
GimpText *gtext;
GimpLayer *layer;
GimpRGB color;
gdouble size;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (fontname != NULL, FALSE);
g_return_val_if_fail (text != NULL, FALSE);
if (border < 0)
border = 0;
g_print ("text_render: x = %d, y = %d, fontname = '%s', border = %d\n",
text_x, text_y, fontname, border);
desc = pango_font_description_from_string (fontname);
size = PANGO_PIXELS (pango_font_description_get_size (desc));
pango_font_description_free (desc);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp),
&color);
gtext = GIMP_TEXT (g_object_new (GIMP_TYPE_TEXT,
"text", text,
"font", fontname,
"border", border,
"color", &color,
NULL));
/* if font-size is < 0, it is taken from the font name */
gtext->font_size = -1.0;
gtext = g_object_new (GIMP_TYPE_TEXT,
"text", text,
"font", fontname,
"font-size", size,
"border", border,
"color", &color,
NULL);
layer = gimp_text_layer_new (gimage, gtext);
@ -87,7 +96,7 @@ text_render (GimpImage *gimage,
/* Start a group undo */
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TEXT,
_("Text"));
_("Add Text Layer"));
/* Set the layer offsets */
GIMP_DRAWABLE (layer)->offset_x = text_x;
@ -124,37 +133,32 @@ text_get_extents (const gchar *fontname,
PangoFontDescription *font_desc;
PangoContext *context;
PangoLayout *layout;
PangoRectangle ink_rect;
PangoRectangle logical_rect;
g_return_val_if_fail (fontname != NULL, FALSE);
g_return_val_if_fail (text != NULL, FALSE);
font_desc = pango_font_description_from_string (fontname);
if (!font_desc)
return FALSE;
/* FIXME: resolution */
context = pango_ft2_get_context (72.0, 72.0);
layout = pango_layout_new (context);
g_object_unref (context);
font_desc = pango_font_description_from_string (fontname);
pango_layout_set_font_description (layout, font_desc);
pango_font_description_free (font_desc);
pango_layout_set_text (layout, text, -1);
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
if (width)
*width = ink_rect.width;
*width = logical_rect.width;
if (height)
*height = ink_rect.height;
*height = logical_rect.height;
if (ascent)
*ascent = -ink_rect.y;
*ascent = -logical_rect.y;
if (descent)
*descent = ink_rect.height + ink_rect.y;
*descent = logical_rect.height + logical_rect.y;
g_object_unref (layout);

View file

@ -32,7 +32,7 @@ GimpLayer * text_render (GimpImage *gimage,
const gchar *fontname,
const gchar *text,
gint border,
gint antialias);
gboolean antialias);
gboolean text_get_extents (const gchar *fontname,
const gchar *text,
gint *width,

View file

@ -201,6 +201,7 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
options->fill_mode,
gimp_context_get_paint_mode (context),
gimp_context_get_opacity (context),
TRUE, /* do seed fill */
options->fill_transparent,
options->threshold,
options->sample_merged,

View file

@ -225,11 +225,11 @@ gimp_drawable_list_view_new_dropped (GimpItemListView *view,
gimp_drawable_bucket_fill_full (drawable,
fill_mode,
color, pattern,
gimp_context_get_paint_mode (context),
gimp_context_get_opacity (context),
FALSE /* no seed fill */,
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */);
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */,
color, pattern);
gimp_image_undo_group_end (view->gimage);

View file

@ -225,11 +225,11 @@ gimp_drawable_list_view_new_dropped (GimpItemListView *view,
gimp_drawable_bucket_fill_full (drawable,
fill_mode,
color, pattern,
gimp_context_get_paint_mode (context),
gimp_context_get_opacity (context),
FALSE /* no seed fill */,
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */);
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */,
color, pattern);
gimp_image_undo_group_end (view->gimage);

View file

@ -293,7 +293,7 @@ init_constants (void)
setvar (cintern ("CUSTOM"), flocons (GIMP_CUSTOM_MODE), NIL);
setvar (cintern ("FG-IMAGE-FILL"), flocons (GIMP_FOREGROUND_FILL), NIL);
setvar (cintern ("BG-IMAGE-FILL"), flocons (GIMP_FOREGROUND_FILL), NIL);
setvar (cintern ("BG-IMAGE-FILL"), flocons (GIMP_BACKGROUND_FILL), NIL);
setvar (cintern ("WHITE-IMAGE-FILL"), flocons (GIMP_WHITE_FILL), NIL);
setvar (cintern ("TRANS-IMAGE-FILL"), flocons (GIMP_TRANSPARENT_FILL), NIL);
setvar (cintern ("NO-IMAGE-FILL"), flocons (GIMP_NO_FILL), NIL);
@ -396,15 +396,14 @@ marshall_proc_db_call (LISP a)
gint nreturn_vals;
GimpParamDef *params;
GimpParamDef *return_vals;
gchar error_str[256];
gint i;
gint success = TRUE;
LISP color_list;
LISP intermediate_val;
LISP return_val = NIL;
gchar *string;
gint string_len;
LISP a_saved;
gchar error_str[256];
gint i;
gint success = TRUE;
LISP intermediate_val;
LISP return_val = NIL;
gchar *string;
gint string_len;
LISP a_saved;
/* Save a in case it is needed for an error message. */
a_saved = a;
@ -587,6 +586,7 @@ marshall_proc_db_call (LISP a)
success = FALSE;
if (success)
{
LISP color_list;
guchar r, g, b;
args[i].type = GIMP_PDB_COLOR;
@ -597,7 +597,7 @@ marshall_proc_db_call (LISP a)
color_list = cdr (color_list);
b = CLAMP (get_c_long (car (color_list)), 0, 255);
gimp_rgb_set_uchar (&args[i].data.d_color, r, g, b);
gimp_rgba_set_uchar (&args[i].data.d_color, r, g, b, 255);
}
break;
@ -730,14 +730,14 @@ marshall_proc_db_call (LISP a)
switch (values[0].data.d_status)
{
case GIMP_PDB_EXECUTION_ERROR:
strcpy (error_str, "Procedural database execution failed:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
strcpy (error_str, "Procedural database execution failed:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
return my_err (error_str, NIL);
break;
case GIMP_PDB_CALLING_ERROR:
strcpy (error_str, "Procedural database execution failed on invalid input arguments:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
strcpy (error_str, "Procedural database execution failed on invalid input arguments:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
return my_err (error_str, NIL);
break;
@ -846,11 +846,13 @@ marshall_proc_db_call (LISP a)
case GIMP_PDB_COLOR:
{
guchar color[3];
gimp_rgb_get_uchar (&values[i + 1].data.d_color, color, color + 1, color + 2);
intermediate_val = cons (flocons ((int) color[0]),
cons (flocons ((int) color[1]),
cons (flocons ((int) color[2]),
guchar r, g, b;
gimp_rgb_get_uchar (&values[i + 1].data.d_color, &r, &g, &b);
intermediate_val = cons (flocons (r),
cons (flocons (g),
cons (flocons (b),
NIL)));
return_val = cons (intermediate_val, return_val);
break;
@ -993,4 +995,3 @@ script_fu_quit_call (LISP a)
return NIL;
}

View file

@ -117,7 +117,7 @@
SF-DRAWABLE "Drawable" 0
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-GRADIENT _"Gradient" "Horizon 1"
)
@ -145,5 +145,5 @@
SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Crillee"
SF-COLOR _"Background Color" '(255 255 255)
SF-GRADIENT _"Gradient" "Horizon_1"
SF-GRADIENT _"Gradient" "Horizon 1"
)

View file

@ -161,8 +161,8 @@
"RGBA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-GRADIENT _"Blend Gradient (Text)" "Shadows_2"
SF-GRADIENT _"Blend Gradient (Outline)" "Shadows_2"
SF-GRADIENT _"Blend Gradient (Text)" "Shadows 2"
SF-GRADIENT _"Blend Gradient (Outline)" "Shadows 2"
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
@ -219,8 +219,8 @@
SF-STRING _"Text" "Galaxy"
SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Eras"
SF-GRADIENT _"Blend Gradient (Text)" "Shadows_2"
SF-GRADIENT _"Blend Gradient (Outline)" "Shadows_2"
SF-GRADIENT _"Blend Gradient (Text)" "Shadows 2"
SF-GRADIENT _"Blend Gradient (Outline)" "Shadows 2"
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

View file

@ -80,4 +80,4 @@
SF-ADJUSTMENT _"Sea Depth" '(4 1 65 1 10 0 1)
SF-ADJUSTMENT _"Scale X" '(4 0.1 16 1 5 0.1 0)
SF-ADJUSTMENT _"Scale Y" '(4 0.1 16 1 5 0.1 0)
SF-GRADIENT _"Gradient" "Land_1")
SF-GRADIENT _"Gradient" "Land 1")

View file

@ -110,7 +110,7 @@
SF-ADJUSTMENT _"Seed" '(10 1 30000 1 10 0 1)
SF-ADJUSTMENT _"Size" '(10 0 100 1 10 0 1)
SF-ADJUSTMENT _"Roughness" '(7 3 50 1 10 0 0)
SF-GRADIENT _"Gradient" "German_flag_smooth"
SF-GRADIENT _"Gradient" "German flag smooth"
SF-TOGGLE _"Keep Selection" TRUE
SF-TOGGLE _"Separate Layer" TRUE
SF-TOGGLE _"Use Current Gradient" FALSE)

View file

@ -67,11 +67,11 @@
; gradient. If the button is pressed a gradient selection dialog will popup.
;
; Usage:
; SF-GRADIENT "Gradient" "Deep_Sea"
; SF-GRADIENT "Gradient" "Deep Sea"
;
; The value returned when the script is invoked is a string containing the
; gradient name. If the above selection was not altered the string would
; contain "Deep_Sea"
; contain "Deep Sea"
; ----------------------------------------------------------------------
; SF-FILENAME
; Only useful in interactive mode. It will create a widget in the control
@ -197,14 +197,12 @@
SF-TOGGLE "Shadow" TRUE
SF-COLOR "Background Color" '(255 255 255)
SF-COLOR "Sphere Color" '(255 0 0)
SF-BRUSH "Brush" '("Circle (03)" 1.0 44 0)
SF-BRUSH "Brush" '("Circle (03)" 1.0 44 0)
SF-STRING "Text" "Script-Fu rocks!"
SF-PATTERN "Pattern" "Maple Leaves"
SF-GRADIENT "Gradient" "Deep Sea"
SF-FONT "Font" "Agate"
SF-ADJUSTMENT "Font Size (pixels)" '(50 1 1000 1 10 0 1)
SF-ADJUSTMENT "Font Size (pixels)" '(50 1 1000 1 10 0 1)
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
SF-OPTION "Orientation" '("Horzontal" "Vertical")
SF-DIRNAME "Output Directory" "/var/tmp/")

View file

@ -293,7 +293,7 @@ init_constants (void)
setvar (cintern ("CUSTOM"), flocons (GIMP_CUSTOM_MODE), NIL);
setvar (cintern ("FG-IMAGE-FILL"), flocons (GIMP_FOREGROUND_FILL), NIL);
setvar (cintern ("BG-IMAGE-FILL"), flocons (GIMP_FOREGROUND_FILL), NIL);
setvar (cintern ("BG-IMAGE-FILL"), flocons (GIMP_BACKGROUND_FILL), NIL);
setvar (cintern ("WHITE-IMAGE-FILL"), flocons (GIMP_WHITE_FILL), NIL);
setvar (cintern ("TRANS-IMAGE-FILL"), flocons (GIMP_TRANSPARENT_FILL), NIL);
setvar (cintern ("NO-IMAGE-FILL"), flocons (GIMP_NO_FILL), NIL);
@ -396,15 +396,14 @@ marshall_proc_db_call (LISP a)
gint nreturn_vals;
GimpParamDef *params;
GimpParamDef *return_vals;
gchar error_str[256];
gint i;
gint success = TRUE;
LISP color_list;
LISP intermediate_val;
LISP return_val = NIL;
gchar *string;
gint string_len;
LISP a_saved;
gchar error_str[256];
gint i;
gint success = TRUE;
LISP intermediate_val;
LISP return_val = NIL;
gchar *string;
gint string_len;
LISP a_saved;
/* Save a in case it is needed for an error message. */
a_saved = a;
@ -587,6 +586,7 @@ marshall_proc_db_call (LISP a)
success = FALSE;
if (success)
{
LISP color_list;
guchar r, g, b;
args[i].type = GIMP_PDB_COLOR;
@ -597,7 +597,7 @@ marshall_proc_db_call (LISP a)
color_list = cdr (color_list);
b = CLAMP (get_c_long (car (color_list)), 0, 255);
gimp_rgb_set_uchar (&args[i].data.d_color, r, g, b);
gimp_rgba_set_uchar (&args[i].data.d_color, r, g, b, 255);
}
break;
@ -730,14 +730,14 @@ marshall_proc_db_call (LISP a)
switch (values[0].data.d_status)
{
case GIMP_PDB_EXECUTION_ERROR:
strcpy (error_str, "Procedural database execution failed:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
strcpy (error_str, "Procedural database execution failed:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
return my_err (error_str, NIL);
break;
case GIMP_PDB_CALLING_ERROR:
strcpy (error_str, "Procedural database execution failed on invalid input arguments:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
strcpy (error_str, "Procedural database execution failed on invalid input arguments:\n ");
lprin1s (a_saved, error_str + strlen(error_str));
return my_err (error_str, NIL);
break;
@ -846,11 +846,13 @@ marshall_proc_db_call (LISP a)
case GIMP_PDB_COLOR:
{
guchar color[3];
gimp_rgb_get_uchar (&values[i + 1].data.d_color, color, color + 1, color + 2);
intermediate_val = cons (flocons ((int) color[0]),
cons (flocons ((int) color[1]),
cons (flocons ((int) color[2]),
guchar r, g, b;
gimp_rgb_get_uchar (&values[i + 1].data.d_color, &r, &g, &b);
intermediate_val = cons (flocons (r),
cons (flocons (g),
cons (flocons (b),
NIL)));
return_val = cons (intermediate_val, return_val);
break;
@ -993,4 +995,3 @@ script_fu_quit_call (LISP a)
return NIL;
}

View file

@ -170,7 +170,8 @@ HELP
}
%invoke = (
headers => [ qw ("core/gimpdrawable-bucket-fill.h") ],
headers => [ qw ("core/gimpdrawable-bucket-fill.h"
"core/gimpimage-mask.h") ],
code => <<'CODE'
{
if (! gimp_item_get_image (GIMP_ITEM (drawable)))
@ -179,8 +180,13 @@ HELP
}
else
{
gboolean do_seed_fill;
do_seed_fill = gimp_image_mask_is_empty (gimp_item_get_image (GIMP_ITEM (drawable)));
gimp_drawable_bucket_fill (drawable, fill_mode,
paint_mode, opacity / 100.0,
do_seed_fill,
FALSE /* don't fill transparent */,
threshold, sample_merged, x, y);
}

View file

@ -746,6 +746,15 @@ paint_tools_stroke (Gimp *gimp,
gboolean retval;
gint i;
/* undefine the paint-relevant context properties and get them
* from the current context
*/
gimp_context_define_properties (GIMP_CONTEXT (options),
GIMP_CONTEXT_PAINT_PROPS_MASK,
FALSE);
gimp_context_set_parent (GIMP_CONTEXT (options),
gimp_get_current_context (gimp));
core = g_object_new (core_type, NULL);
coords = g_new (GimpCoords, n_strokes);

View file

@ -144,8 +144,7 @@ HELP
}
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h"
"core/gimpdatafactory.h" "core/gimplist.h" "core/gimppalette.h");
@headers = qw("core/gimp.h" "core/gimpcontext.h");
@procs = qw(palette_get_foreground palette_get_background
palette_set_foreground palette_set_background

View file

@ -73,14 +73,6 @@ sub font_prop_args {
@result;
}
sub fontname_makearg {
my $arg = { type => 'string', code => "%%arg%% =\n text_fontname_create (" };
foreach (@props) { $arg->{code} .= "\t\t $_,\n" }
$arg->{code} =~ s/\(\s+/(/;
$arg->{code} =~ s/,\n$/);\n/s;
$arg;
}
sub render_outargs {
@outargs = (
{ name => 'text_layer', type => 'layer',
@ -212,9 +204,19 @@ HELP
&render_outargs;
%invoke = (
pass_through => 'text_fontname',
pass_args => [ 0..8 ],
make_args => [ &fontname_makearg ]
vars => [ 'gchar *real_fontname' ],
code => <<'CODE'
{
real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
text_layer = text_render (gimage, drawable, x, y, real_fontname, text,
border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname);
}
CODE
);
}
@ -239,32 +241,24 @@ HELP
$outargs[0]->{void_ret} = 1;
%invoke = (
pass_through => 'text_get_extents_fontname',
pass_args => [ 0..2 ],
make_args => [ &fontname_makearg ]
vars => [ 'gchar *real_fontname' ],
code => <<'CODE'
{
real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
success = text_get_extents (real_fontname, text,
&width, &height,
&ascent, &descent);
g_free (real_fontname);
}
CODE
);
}
@headers = qw("libgimpbase/gimpbase.h" "text/gimptext-compat.h"
<stdio.h> <string.h>);
$extra{app}->{code} = <<'CODE';
static gchar *
text_fontname_create (gchar *foundry,
gchar *family,
gchar *weight,
gchar *slant,
gchar *set_width,
gchar *spacing,
gchar *registry,
gchar *encoding)
{
/* create the fontname */
return g_strdup_printf ("%s %s", family, weight);
}
CODE
@procs = qw(text_fontname text_get_extents_fontname text text_get_extents);
%exports = (app => [@procs], lib => [@procs]);