tools/pdbgen/pdb/brush.pdb tools/pdbgen/pdb/brushes.pdb

2006-03-15  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/brush.pdb
	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/context.pdb
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/drawable_transform.pdb
	* tools/pdbgen/pdb/gradient.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/palette.pdb
	* tools/pdbgen/pdb/palettes.pdb
	* tools/pdbgen/pdb/paths.pdb
	* tools/pdbgen/pdb/pattern.pdb
	* tools/pdbgen/pdb/patterns.pdb
	* tools/pdbgen/pdb/procedural_db.pdb
	* tools/pdbgen/pdb/transform_tools.pdb: let pdbgen handle *only*
	variables for arguments and return values and declare all local
	variables inside the C code. Removed lots of alias => '<expression>'
	and no_declare => 1 stuff from return values, instead let pdbgen
	declare the variables and assign them manually in the C code.
	More cleanup.

	* tools/pdbgen/app.pl: removed support for proc->vars.

	* app/pdb/brush_cmds.c
	* app/pdb/brushes_cmds.c
	* app/pdb/context_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/drawable_transform_cmds.c
	* app/pdb/gradient_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/image_cmds.c
	* app/pdb/palette_cmds.c
	* app/pdb/palettes_cmds.c
	* app/pdb/paths_cmds.c
	* app/pdb/pattern_cmds.c
	* app/pdb/patterns_cmds.c
	* app/pdb/procedural_db_cmds.c
	* app/pdb/transform_tools_cmds.c
	* libgimp/gimpbrush_pdb.c
	* libgimp/gimpbrushes_pdb.c
	* libgimp/gimpgradient_pdb.c
	* libgimp/gimpgradients_pdb.c
	* libgimp/gimppalette_pdb.c
	* libgimp/gimppalettes_pdb.c
	* libgimp/gimppatterns_pdb.c: regenerated.
This commit is contained in:
Michael Natterer 2006-03-15 12:49:25 +00:00 committed by Michael Natterer
parent ce4f646661
commit 59771587ae
39 changed files with 1288 additions and 971 deletions

View File

@ -1,3 +1,51 @@
2006-03-15 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/brush.pdb
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/context.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/gradient.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/palette.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/paths.pdb
* tools/pdbgen/pdb/pattern.pdb
* tools/pdbgen/pdb/patterns.pdb
* tools/pdbgen/pdb/procedural_db.pdb
* tools/pdbgen/pdb/transform_tools.pdb: let pdbgen handle *only*
variables for arguments and return values and declare all local
variables inside the C code. Removed lots of alias => '<expression>'
and no_declare => 1 stuff from return values, instead let pdbgen
declare the variables and assign them manually in the C code.
More cleanup.
* tools/pdbgen/app.pl: removed support for proc->vars.
* app/pdb/brush_cmds.c
* app/pdb/brushes_cmds.c
* app/pdb/context_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/drawable_transform_cmds.c
* app/pdb/gradient_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/image_cmds.c
* app/pdb/palette_cmds.c
* app/pdb/palettes_cmds.c
* app/pdb/paths_cmds.c
* app/pdb/pattern_cmds.c
* app/pdb/patterns_cmds.c
* app/pdb/procedural_db_cmds.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpbrush_pdb.c
* libgimp/gimpbrushes_pdb.c
* libgimp/gimpgradient_pdb.c
* libgimp/gimpgradients_pdb.c
* libgimp/gimppalette_pdb.c
* libgimp/gimppalettes_pdb.c
* libgimp/gimppatterns_pdb.c: regenerated.
2006-03-15 Sven Neumann <sven@gimp.org> 2006-03-15 Sven Neumann <sven@gimp.org>
* app/actions/channels-actions.c * app/actions/channels-actions.c

View File

@ -94,7 +94,7 @@ brush_new_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpData *data = NULL; gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -103,15 +103,22 @@ brush_new_invoker (Gimp *gimp,
if (success) if (success)
{ {
if (strlen (name)) if (strlen (name))
data = gimp_data_factory_data_new (gimp->brush_factory, name); {
GimpData *data = gimp_data_factory_data_new (gimp->brush_factory, name);
success = (data != NULL); if (data)
actual_name = g_strdup (GIMP_OBJECT (data)->name);
else
success = FALSE;
}
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_new_proc, success); return_args = procedural_db_return_args (&brush_new_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (data)->name); return_args[1].value.pdb_pointer = actual_name;
return return_args; return return_args;
} }
@ -129,7 +136,7 @@ static ProcArg brush_new_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The actual new brush name" "The actual new brush name"
} }
}; };
@ -161,8 +168,7 @@ brush_duplicate_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gchar *copy_name = NULL;
GimpBrush *brush_copy = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -170,16 +176,19 @@ brush_duplicate_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
{ {
brush_copy = (GimpBrush *) GimpBrush *brush_copy = (GimpBrush *)
gimp_data_factory_data_duplicate (gimp->brush_factory, gimp_data_factory_data_duplicate (gimp->brush_factory,
GIMP_DATA (brush)); GIMP_DATA (brush));
success = (brush_copy != NULL); if (brush_copy)
copy_name = g_strdup (GIMP_OBJECT (brush_copy)->name);
else
success = FALSE;
} }
else else
success = FALSE; success = FALSE;
@ -188,7 +197,7 @@ brush_duplicate_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_duplicate_proc, success); return_args = procedural_db_return_args (&brush_duplicate_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush_copy)->name); return_args[1].value.pdb_pointer = copy_name;
return return_args; return return_args;
} }
@ -206,7 +215,7 @@ static ProcArg brush_duplicate_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "copy-name",
"The name of the brush's copy" "The name of the brush's copy"
} }
}; };
@ -238,7 +247,7 @@ brush_is_generated_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gboolean generated = FALSE;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -246,11 +255,11 @@ brush_is_generated_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
success = TRUE; generated = GIMP_IS_BRUSH_GENERATED (brush);
else else
success = FALSE; success = FALSE;
} }
@ -258,7 +267,7 @@ brush_is_generated_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_is_generated_proc, success); return_args = procedural_db_return_args (&brush_is_generated_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_IS_BRUSH_GENERATED (brush); return_args[1].value.pdb_int = generated;
return return_args; return return_args;
} }
@ -309,7 +318,7 @@ brush_rename_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gchar *new_name; gchar *new_name;
GimpBrush *brush = NULL; gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -321,11 +330,14 @@ brush_rename_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable) if (brush && GIMP_DATA (brush)->writable)
gimp_object_set_name (GIMP_OBJECT (brush), new_name); {
gimp_object_set_name (GIMP_OBJECT (brush), new_name);
actual_name = g_strdup (GIMP_OBJECT (brush)->name);
}
else else
success = FALSE; success = FALSE;
} }
@ -333,7 +345,7 @@ brush_rename_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_rename_proc, success); return_args = procedural_db_return_args (&brush_rename_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); return_args[1].value.pdb_pointer = actual_name;
return return_args; return return_args;
} }
@ -356,7 +368,7 @@ static ProcArg brush_rename_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The actual new name of the brush" "The actual new name of the brush"
} }
}; };
@ -387,7 +399,6 @@ brush_delete_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -395,7 +406,7 @@ brush_delete_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->deletable) if (brush && GIMP_DATA (brush)->deletable)
@ -455,7 +466,7 @@ brush_is_editable_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gboolean editable = FALSE;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -463,11 +474,11 @@ brush_is_editable_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
success = TRUE; editable = GIMP_DATA (brush)->writable;
else else
success = FALSE; success = FALSE;
} }
@ -475,7 +486,7 @@ brush_is_editable_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_is_editable_proc, success); return_args = procedural_db_return_args (&brush_is_editable_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_DATA (brush)->writable; return_args[1].value.pdb_int = editable;
return return_args; return return_args;
} }
@ -525,7 +536,10 @@ brush_get_info_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gint32 width = 0;
gint32 height = 0;
gint32 mask_bpp = 0;
gint32 color_bpp = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -533,20 +547,28 @@ brush_get_info_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL); if (brush)
{
width = brush->mask->width;
height = brush->mask->height;
mask_bpp = brush->mask->bytes;
color_bpp = brush->pixmap ? brush->pixmap->bytes : 0;
}
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_info_proc, success); return_args = procedural_db_return_args (&brush_get_info_proc, success);
if (success) if (success)
{ {
return_args[1].value.pdb_int = brush->mask->width; return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = brush->mask->height; return_args[2].value.pdb_int = height;
return_args[3].value.pdb_int = brush->mask->bytes; return_args[3].value.pdb_int = mask_bpp;
return_args[4].value.pdb_int = brush->pixmap ? brush->pixmap->bytes : 0; return_args[4].value.pdb_int = color_bpp;
} }
return return_args; return return_args;
@ -612,13 +634,14 @@ brush_get_pixels_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gint32 width = 0;
gint32 height = 0;
gint32 mask_bpp = 0; gint32 mask_bpp = 0;
gint32 num_mask_bytes = 0; gint32 num_mask_bytes = 0;
guint8 *mask_bytes = NULL; guint8 *mask_bytes = NULL;
gint32 color_bpp = 0; gint32 color_bpp = 0;
gint32 num_color_bytes = 0; gint32 num_color_bytes = 0;
guint8 *color_bytes = NULL; guint8 *color_bytes = NULL;
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -626,11 +649,13 @@ brush_get_pixels_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
{ {
width = brush->mask->width;
height = brush->mask->height;
mask_bpp = brush->mask->bytes; mask_bpp = brush->mask->bytes;
num_mask_bytes = brush->mask->height * brush->mask->width; num_mask_bytes = brush->mask->height * brush->mask->width;
mask_bytes = g_memdup (temp_buf_data (brush->mask), num_mask_bytes); mask_bytes = g_memdup (temp_buf_data (brush->mask), num_mask_bytes);
@ -651,8 +676,8 @@ brush_get_pixels_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_int = brush->mask->width; return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = brush->mask->height; return_args[2].value.pdb_int = height;
return_args[3].value.pdb_int = mask_bpp; return_args[3].value.pdb_int = mask_bpp;
return_args[4].value.pdb_int = num_mask_bytes; return_args[4].value.pdb_int = num_mask_bytes;
return_args[5].value.pdb_pointer = mask_bytes; return_args[5].value.pdb_pointer = mask_bytes;
@ -744,7 +769,7 @@ brush_get_spacing_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gint32 spacing = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -752,16 +777,19 @@ brush_get_spacing_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL); if (brush)
spacing = gimp_brush_get_spacing (brush);
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_spacing_proc, success); return_args = procedural_db_return_args (&brush_get_spacing_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = gimp_brush_get_spacing (brush); return_args[1].value.pdb_int = spacing;
return return_args; return return_args;
} }
@ -811,7 +839,6 @@ brush_set_spacing_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
gint32 spacing; gint32 spacing;
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -823,7 +850,7 @@ brush_set_spacing_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
@ -876,7 +903,7 @@ brush_get_shape_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gint32 shape = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -884,16 +911,19 @@ brush_get_shape_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
shape = GIMP_BRUSH_GENERATED (brush)->shape;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_shape_proc, success); return_args = procedural_db_return_args (&brush_get_shape_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->shape; return_args[1].value.pdb_int = shape;
return return_args; return return_args;
} }
@ -943,7 +973,7 @@ brush_get_radius_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gdouble radius = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -951,16 +981,19 @@ brush_get_radius_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
radius = GIMP_BRUSH_GENERATED (brush)->radius;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_radius_proc, success); return_args = procedural_db_return_args (&brush_get_radius_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->radius; return_args[1].value.pdb_float = radius;
return return_args; return return_args;
} }
@ -1010,7 +1043,7 @@ brush_get_spikes_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gint32 spikes = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1018,16 +1051,19 @@ brush_get_spikes_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_spikes_proc, success); return_args = procedural_db_return_args (&brush_get_spikes_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->spikes; return_args[1].value.pdb_int = spikes;
return return_args; return return_args;
} }
@ -1077,7 +1113,7 @@ brush_get_hardness_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gdouble hardness = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1085,16 +1121,19 @@ brush_get_hardness_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_hardness_proc, success); return_args = procedural_db_return_args (&brush_get_hardness_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->hardness; return_args[1].value.pdb_float = hardness;
return return_args; return return_args;
} }
@ -1144,7 +1183,7 @@ brush_get_aspect_ratio_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gdouble aspect_ratio = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1152,16 +1191,19 @@ brush_get_aspect_ratio_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_aspect_ratio_proc, success); return_args = procedural_db_return_args (&brush_get_aspect_ratio_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; return_args[1].value.pdb_float = aspect_ratio;
return return_args; return return_args;
} }
@ -1211,7 +1253,7 @@ brush_get_angle_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpBrush *brush = NULL; gdouble angle = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1219,16 +1261,19 @@ brush_get_angle_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
angle = GIMP_BRUSH_GENERATED (brush)->angle;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&brush_get_angle_proc, success); return_args = procedural_db_return_args (&brush_get_angle_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->angle; return_args[1].value.pdb_float = angle;
return return_args; return return_args;
} }
@ -1279,7 +1324,7 @@ brush_set_shape_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gint32 shape_in; gint32 shape_in;
GimpBrush *brush = NULL; gint32 shape_out = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1289,11 +1334,15 @@ brush_set_shape_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush), shape_in); {
gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush),
shape_in);
shape_out = GIMP_BRUSH_GENERATED (brush)->shape;
}
else else
success = FALSE; success = FALSE;
} }
@ -1301,7 +1350,7 @@ brush_set_shape_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_set_shape_proc, success); return_args = procedural_db_return_args (&brush_set_shape_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->shape; return_args[1].value.pdb_int = shape_out;
return return_args; return return_args;
} }
@ -1357,7 +1406,7 @@ brush_set_radius_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gdouble radius_in; gdouble radius_in;
GimpBrush *brush = NULL; gdouble radius_out = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1367,11 +1416,15 @@ brush_set_radius_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush), radius_in); {
gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush),
radius_in);
radius_out = GIMP_BRUSH_GENERATED (brush)->radius;
}
else else
success = FALSE; success = FALSE;
} }
@ -1379,7 +1432,7 @@ brush_set_radius_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_set_radius_proc, success); return_args = procedural_db_return_args (&brush_set_radius_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->radius; return_args[1].value.pdb_float = radius_out;
return return_args; return return_args;
} }
@ -1435,7 +1488,7 @@ brush_set_spikes_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gint32 spikes_in; gint32 spikes_in;
GimpBrush *brush = NULL; gint32 spikes_out = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1445,11 +1498,15 @@ brush_set_spikes_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush), spikes_in); {
gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush),
spikes_in);
spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes;
}
else else
success = FALSE; success = FALSE;
} }
@ -1457,7 +1514,7 @@ brush_set_spikes_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_set_spikes_proc, success); return_args = procedural_db_return_args (&brush_set_spikes_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->spikes; return_args[1].value.pdb_int = spikes_out;
return return_args; return return_args;
} }
@ -1513,7 +1570,7 @@ brush_set_hardness_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gdouble hardness_in; gdouble hardness_in;
GimpBrush *brush = NULL; gdouble hardness_out = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1523,11 +1580,15 @@ brush_set_hardness_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush), hardness_in); {
gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush),
hardness_in);
hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness;
}
else else
success = FALSE; success = FALSE;
} }
@ -1535,7 +1596,7 @@ brush_set_hardness_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_set_hardness_proc, success); return_args = procedural_db_return_args (&brush_set_hardness_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->hardness; return_args[1].value.pdb_float = hardness_out;
return return_args; return return_args;
} }
@ -1591,7 +1652,7 @@ brush_set_aspect_ratio_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gdouble aspect_ratio_in; gdouble aspect_ratio_in;
GimpBrush *brush = NULL; gdouble aspect_ratio_out = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1601,11 +1662,15 @@ brush_set_aspect_ratio_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush), aspect_ratio_in); {
gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush),
aspect_ratio_in);
aspect_ratio_out = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
}
else else
success = FALSE; success = FALSE;
} }
@ -1613,7 +1678,7 @@ brush_set_aspect_ratio_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_set_aspect_ratio_proc, success); return_args = procedural_db_return_args (&brush_set_aspect_ratio_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; return_args[1].value.pdb_float = aspect_ratio_out;
return return_args; return return_args;
} }
@ -1669,7 +1734,7 @@ brush_set_angle_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gdouble angle_in; gdouble angle_in;
GimpBrush *brush = NULL; gdouble angle_out = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1679,11 +1744,15 @@ brush_set_angle_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush), angle_in); {
gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush),
angle_in);
angle_out = GIMP_BRUSH_GENERATED (brush)->angle;
}
else else
success = FALSE; success = FALSE;
} }
@ -1691,7 +1760,7 @@ brush_set_angle_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&brush_set_angle_proc, success); return_args = procedural_db_return_args (&brush_set_angle_proc, success);
if (success) if (success)
return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->angle; return_args[1].value.pdb_float = angle_out;
return return_args; return return_args;
} }

View File

@ -160,18 +160,31 @@ brushes_get_brush_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpBrush *brush; gchar *name = NULL;
gint32 width = 0;
gint32 height = 0;
gint32 spacing = 0;
success = (brush = gimp_context_get_brush (context)) != NULL; GimpBrush *brush = gimp_context_get_brush (context);
if (brush)
{
name = g_strdup (GIMP_OBJECT (brush)->name);
width = brush->mask->width;
height = brush->mask->height;
spacing = gimp_brush_get_spacing (brush);
}
else
success = FALSE;
return_args = procedural_db_return_args (&brushes_get_brush_proc, success); return_args = procedural_db_return_args (&brushes_get_brush_proc, success);
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); return_args[1].value.pdb_pointer = name;
return_args[2].value.pdb_int = brush->mask->width; return_args[2].value.pdb_int = width;
return_args[3].value.pdb_int = brush->mask->height; return_args[3].value.pdb_int = height;
return_args[4].value.pdb_int = gimp_brush_get_spacing (brush); return_args[4].value.pdb_int = spacing;
} }
return return_args; return return_args;
@ -225,10 +238,21 @@ brushes_get_spacing_invoker (Gimp *gimp,
GimpProgress *progress, GimpProgress *progress,
Argument *args) Argument *args)
{ {
gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gint32 spacing = 0;
return_args = procedural_db_return_args (&brushes_get_spacing_proc, TRUE); GimpBrush *brush = gimp_context_get_brush (context);
return_args[1].value.pdb_int = gimp_brush_get_spacing (gimp_context_get_brush (context));
if (brush)
spacing = gimp_brush_get_spacing (brush);
else
success = FALSE;
return_args = procedural_db_return_args (&brushes_get_spacing_proc, success);
if (success)
return_args[1].value.pdb_int = spacing;
return return_args; return return_args;
} }
@ -315,9 +339,14 @@ brushes_get_brush_data_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gchar *actual_name = NULL;
gdouble opacity = 0;
gint32 spacing = 0;
gint32 paint_mode = 0;
gint32 width = 0;
gint32 height = 0;
gint32 length = 0; gint32 length = 0;
guint8 *mask_data = NULL; guint8 *mask_data = NULL;
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL)) if (name && !g_utf8_validate (name, -1, NULL))
@ -325,6 +354,8 @@ brushes_get_brush_data_invoker (Gimp *gimp,
if (success) if (success)
{ {
GimpBrush *brush;
if (name && strlen (name)) if (name && strlen (name))
{ {
brush = (GimpBrush *) brush = (GimpBrush *)
@ -337,8 +368,14 @@ brushes_get_brush_data_invoker (Gimp *gimp,
if (brush) if (brush)
{ {
length = brush->mask->height * brush->mask->width; actual_name = g_strdup (GIMP_OBJECT (brush)->name);
mask_data = g_memdup (temp_buf_data (brush->mask), length); opacity = 1.0;
spacing = gimp_brush_get_spacing (brush);
paint_mode = 0;
width = brush->mask->width;
height = brush->mask->height;
length = brush->mask->height * brush->mask->width;
mask_data = g_memdup (temp_buf_data (brush->mask), length);
} }
else else
success = FALSE; success = FALSE;
@ -348,12 +385,12 @@ brushes_get_brush_data_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); return_args[1].value.pdb_pointer = actual_name;
return_args[2].value.pdb_float = 1.0; return_args[2].value.pdb_float = opacity;
return_args[3].value.pdb_int = gimp_brush_get_spacing (brush); return_args[3].value.pdb_int = spacing;
return_args[4].value.pdb_int = 0; return_args[4].value.pdb_int = paint_mode;
return_args[5].value.pdb_int = brush->mask->width; return_args[5].value.pdb_int = width;
return_args[6].value.pdb_int = brush->mask->height; return_args[6].value.pdb_int = height;
return_args[7].value.pdb_int = length; return_args[7].value.pdb_int = length;
return_args[8].value.pdb_pointer = mask_data; return_args[8].value.pdb_pointer = mask_data;
} }
@ -374,7 +411,7 @@ static ProcArg brushes_get_brush_data_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The brush name" "The brush name"
}, },
{ {

View File

@ -97,13 +97,9 @@ context_push_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
if (gimp->current_plug_in && gimp->current_plug_in->open) if (gimp->current_plug_in && gimp->current_plug_in->open)
{ success = plug_in_context_push (gimp->current_plug_in);
success = plug_in_context_push (gimp->current_plug_in);
}
else else
{ success = FALSE;
success = FALSE;
}
return procedural_db_return_args (&context_push_proc, success); return procedural_db_return_args (&context_push_proc, success);
} }
@ -133,13 +129,9 @@ context_pop_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
if (gimp->current_plug_in && gimp->current_plug_in->open) if (gimp->current_plug_in && gimp->current_plug_in->open)
{ success = plug_in_context_pop (gimp->current_plug_in);
success = plug_in_context_pop (gimp->current_plug_in);
}
else else
{ success = FALSE;
success = FALSE;
}
return procedural_db_return_args (&context_pop_proc, success); return procedural_db_return_args (&context_pop_proc, success);
} }
@ -169,14 +161,19 @@ context_get_paint_method_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpPaintInfo *paint_info; gchar *name = NULL;
success = (paint_info = gimp_context_get_paint_info (context)) != NULL; GimpPaintInfo *paint_info = gimp_context_get_paint_info (context);
if (paint_info)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info)));
else
success = FALSE;
return_args = procedural_db_return_args (&context_get_paint_method_proc, success); return_args = procedural_db_return_args (&context_get_paint_method_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info))); return_args[1].value.pdb_pointer = name;
return return_args; return return_args;
} }
@ -216,7 +213,6 @@ context_set_paint_method_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpPaintInfo *paint_info;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -224,7 +220,7 @@ context_set_paint_method_invoker (Gimp *gimp,
if (success) if (success)
{ {
paint_info = (GimpPaintInfo *) GimpPaintInfo *paint_info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, name); gimp_container_get_child_by_name (gimp->paint_info_list, name);
if (paint_info) if (paint_info)
@ -675,14 +671,19 @@ context_get_brush_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpBrush *brush; gchar *name = NULL;
success = (brush = gimp_context_get_brush (context)) != NULL; GimpBrush *brush = gimp_context_get_brush (context);
if (brush)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
else
success = FALSE;
return_args = procedural_db_return_args (&context_get_brush_proc, success); return_args = procedural_db_return_args (&context_get_brush_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush))); return_args[1].value.pdb_pointer = name;
return return_args; return return_args;
} }
@ -722,7 +723,6 @@ context_set_brush_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpBrush *brush;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -730,7 +730,7 @@ context_set_brush_invoker (Gimp *gimp,
if (success) if (success)
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
@ -777,14 +777,19 @@ context_get_pattern_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpPattern *pattern; gchar *name = NULL;
success = (pattern = gimp_context_get_pattern (context)) != NULL; GimpPattern *pattern = gimp_context_get_pattern (context);
if (pattern)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)));
else
success = FALSE;
return_args = procedural_db_return_args (&context_get_pattern_proc, success); return_args = procedural_db_return_args (&context_get_pattern_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern))); return_args[1].value.pdb_pointer = name;
return return_args; return return_args;
} }
@ -824,7 +829,6 @@ context_set_pattern_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpPattern *pattern;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -832,7 +836,7 @@ context_set_pattern_invoker (Gimp *gimp,
if (success) if (success)
{ {
pattern = (GimpPattern *) GimpPattern *pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name); gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
if (pattern) if (pattern)
@ -879,14 +883,19 @@ context_get_gradient_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpGradient *gradient; gchar *name = NULL;
success = (gradient = gimp_context_get_gradient (context)) != NULL; GimpGradient *gradient = gimp_context_get_gradient (context);
if (gradient)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)));
else
success = FALSE;
return_args = procedural_db_return_args (&context_get_gradient_proc, success); return_args = procedural_db_return_args (&context_get_gradient_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient))); return_args[1].value.pdb_pointer = name;
return return_args; return return_args;
} }
@ -926,7 +935,6 @@ context_set_gradient_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpGradient *gradient;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -934,7 +942,7 @@ context_set_gradient_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -981,14 +989,19 @@ context_get_palette_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpPalette *palette; gchar *name = NULL;
success = (palette = gimp_context_get_palette (context)) != NULL; GimpPalette *palette = gimp_context_get_palette (context);
if (palette)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)));
else
success = FALSE;
return_args = procedural_db_return_args (&context_get_palette_proc, success); return_args = procedural_db_return_args (&context_get_palette_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette))); return_args[1].value.pdb_pointer = name;
return return_args; return return_args;
} }
@ -1028,7 +1041,6 @@ context_set_palette_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpPalette *palette;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1036,7 +1048,7 @@ context_set_palette_invoker (Gimp *gimp,
if (success) if (success)
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette) if (palette)
@ -1083,14 +1095,19 @@ context_get_font_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpFont *font; gchar *name = NULL;
success = (font = gimp_context_get_font (context)) != NULL; GimpFont *font = gimp_context_get_font (context);
if (font)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (font)));
else
success = FALSE;
return_args = procedural_db_return_args (&context_get_font_proc, success); return_args = procedural_db_return_args (&context_get_font_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (font))); return_args[1].value.pdb_pointer = name;
return return_args; return return_args;
} }
@ -1130,7 +1147,6 @@ context_set_font_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpFont *font;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1138,7 +1154,7 @@ context_set_font_invoker (Gimp *gimp,
if (success) if (success)
{ {
font = (GimpFont *) GimpFont *font = (GimpFont *)
gimp_container_get_child_by_name (gimp->fonts, name); gimp_container_get_child_by_name (gimp->fonts, name);
if (font) if (font)

View File

@ -1853,9 +1853,6 @@ drawable_get_pixel_invoker (Gimp *gimp,
gint32 y; gint32 y;
gint32 num_channels = 0; gint32 num_channels = 0;
guint8 *pixel = NULL; guint8 *pixel = NULL;
guint8 *p;
gint b;
Tile *tile;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
@ -1874,6 +1871,10 @@ drawable_get_pixel_invoker (Gimp *gimp,
if (x < gimp_item_width (GIMP_ITEM (drawable)) && if (x < gimp_item_width (GIMP_ITEM (drawable)) &&
y < gimp_item_height (GIMP_ITEM (drawable))) y < gimp_item_height (GIMP_ITEM (drawable)))
{ {
Tile *tile;
guint8 *p;
gint b;
num_channels = gimp_drawable_bytes (drawable); num_channels = gimp_drawable_bytes (drawable);
pixel = g_new (guint8, num_channels); pixel = g_new (guint8, num_channels);
@ -1967,9 +1968,6 @@ drawable_set_pixel_invoker (Gimp *gimp,
gint32 y; gint32 y;
gint32 num_channels; gint32 num_channels;
guint8 *pixel; guint8 *pixel;
guint8 *p;
gint b;
Tile *tile;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
@ -1993,6 +1991,10 @@ drawable_set_pixel_invoker (Gimp *gimp,
y < gimp_item_height (GIMP_ITEM (drawable)) && y < gimp_item_height (GIMP_ITEM (drawable)) &&
num_channels == gimp_drawable_bytes (drawable)) num_channels == gimp_drawable_bytes (drawable))
{ {
Tile *tile;
guint8 *p;
gint b;
tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y, tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y,
TRUE, TRUE); TRUE, TRUE);

View File

@ -500,32 +500,39 @@ drawable_transform_perspective_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gdouble x0;
gdouble y0;
gdouble x1;
gdouble y1;
gdouble x2;
gdouble y2;
gdouble x3;
gdouble y3;
gint32 transform_direction; gint32 transform_direction;
gint32 interpolation; gint32 interpolation;
gboolean supersample; gboolean supersample;
gint32 recursion_level; gint32 recursion_level;
gboolean clip_result; gboolean clip_result;
gdouble trans_info[8];
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
trans_info[X0] = args[1].value.pdb_float; x0 = args[1].value.pdb_float;
trans_info[Y0] = args[2].value.pdb_float; y0 = args[2].value.pdb_float;
trans_info[X1] = args[3].value.pdb_float; x1 = args[3].value.pdb_float;
trans_info[Y1] = args[4].value.pdb_float; y1 = args[4].value.pdb_float;
trans_info[X2] = args[5].value.pdb_float; x2 = args[5].value.pdb_float;
trans_info[Y2] = args[6].value.pdb_float; y2 = args[6].value.pdb_float;
trans_info[X3] = args[7].value.pdb_float; x3 = args[7].value.pdb_float;
trans_info[Y3] = args[8].value.pdb_float; y3 = args[8].value.pdb_float;
transform_direction = args[9].value.pdb_int; transform_direction = args[9].value.pdb_int;
if (transform_direction < GIMP_TRANSFORM_FORWARD || transform_direction > GIMP_TRANSFORM_BACKWARD) if (transform_direction < GIMP_TRANSFORM_FORWARD || transform_direction > GIMP_TRANSFORM_BACKWARD)
@ -558,10 +565,10 @@ drawable_transform_perspective_invoker (Gimp *gimp,
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_perspective (&matrix, gimp_transform_matrix_perspective (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], trans_info[Y0], x0, y0,
trans_info[X1], trans_info[Y1], x1, y1,
trans_info[X2], trans_info[Y2], x2, y2,
trans_info[X3], trans_info[Y3]); x3, y3);
if (progress) if (progress)
gimp_progress_start (progress, _("Perspective"), FALSE); gimp_progress_start (progress, _("Perspective"), FALSE);
@ -696,29 +703,36 @@ drawable_transform_perspective_default_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gdouble x0;
gdouble y0;
gdouble x1;
gdouble y1;
gdouble x2;
gdouble y2;
gdouble x3;
gdouble y3;
gboolean interpolate; gboolean interpolate;
gboolean clip_result; gboolean clip_result;
gdouble trans_info[8];
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
trans_info[X0] = args[1].value.pdb_float; x0 = args[1].value.pdb_float;
trans_info[Y0] = args[2].value.pdb_float; y0 = args[2].value.pdb_float;
trans_info[X1] = args[3].value.pdb_float; x1 = args[3].value.pdb_float;
trans_info[Y1] = args[4].value.pdb_float; y1 = args[4].value.pdb_float;
trans_info[X2] = args[5].value.pdb_float; x2 = args[5].value.pdb_float;
trans_info[Y2] = args[6].value.pdb_float; y2 = args[6].value.pdb_float;
trans_info[X3] = args[7].value.pdb_float; x3 = args[7].value.pdb_float;
trans_info[Y3] = args[8].value.pdb_float; y3 = args[8].value.pdb_float;
interpolate = args[9].value.pdb_int ? TRUE : FALSE; interpolate = args[9].value.pdb_int ? TRUE : FALSE;
@ -740,10 +754,10 @@ drawable_transform_perspective_default_invoker (Gimp *gimp,
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_perspective (&matrix, gimp_transform_matrix_perspective (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], trans_info[Y0], x0, y0,
trans_info[X1], trans_info[Y1], x1, y1,
trans_info[X2], trans_info[Y2], x2, y2,
trans_info[X3], trans_info[Y3]); x3, y3);
if (interpolate) if (interpolate)
interpolation_type = gimp->config->interpolation_type; interpolation_type = gimp->config->interpolation_type;
@ -1296,24 +1310,27 @@ drawable_transform_scale_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gdouble x0;
gdouble y0;
gdouble x1;
gdouble y1;
gint32 transform_direction; gint32 transform_direction;
gint32 interpolation; gint32 interpolation;
gboolean supersample; gboolean supersample;
gint32 recursion_level; gint32 recursion_level;
gboolean clip_result; gboolean clip_result;
gdouble trans_info[4];
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
trans_info[X0] = args[1].value.pdb_float; x0 = args[1].value.pdb_float;
trans_info[Y0] = args[2].value.pdb_float; y0 = args[2].value.pdb_float;
trans_info[X1] = args[3].value.pdb_float; x1 = args[3].value.pdb_float;
trans_info[Y1] = args[4].value.pdb_float; y1 = args[4].value.pdb_float;
transform_direction = args[5].value.pdb_int; transform_direction = args[5].value.pdb_int;
if (transform_direction < GIMP_TRANSFORM_FORWARD || transform_direction > GIMP_TRANSFORM_BACKWARD) if (transform_direction < GIMP_TRANSFORM_FORWARD || transform_direction > GIMP_TRANSFORM_BACKWARD)
@ -1335,9 +1352,7 @@ drawable_transform_scale_invoker (Gimp *gimp,
{ {
gint x, y, width, height; gint x, y, width, height;
success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && x0 < x1 && y0 < y1);
trans_info[X0] < trans_info[X1] &&
trans_info[Y0] < trans_info[Y1]);
if (success && if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -1348,10 +1363,9 @@ drawable_transform_scale_invoker (Gimp *gimp,
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_scale (&matrix, gimp_transform_matrix_scale (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], x0, y0,
trans_info[Y0], x1 - x0,
trans_info[X1] - trans_info[X0], y1 - y0);
trans_info[Y1] - trans_info[Y0]);
if (progress) if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE); gimp_progress_start (progress, _("Scaling"), FALSE);
@ -1466,21 +1480,24 @@ drawable_transform_scale_default_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gdouble x0;
gdouble y0;
gdouble x1;
gdouble y1;
gboolean interpolate; gboolean interpolate;
gboolean clip_result; gboolean clip_result;
gdouble trans_info[4];
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
success = FALSE; success = FALSE;
trans_info[X0] = args[1].value.pdb_float; x0 = args[1].value.pdb_float;
trans_info[Y0] = args[2].value.pdb_float; y0 = args[2].value.pdb_float;
trans_info[X1] = args[3].value.pdb_float; x1 = args[3].value.pdb_float;
trans_info[Y1] = args[4].value.pdb_float; y1 = args[4].value.pdb_float;
interpolate = args[5].value.pdb_int ? TRUE : FALSE; interpolate = args[5].value.pdb_int ? TRUE : FALSE;
@ -1490,9 +1507,7 @@ drawable_transform_scale_default_invoker (Gimp *gimp,
{ {
gint x, y, width, height; gint x, y, width, height;
success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && x0 < x1 && y0 < y1);
trans_info[X0] < trans_info[X1] &&
trans_info[Y0] < trans_info[Y1]);
if (success && if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -1504,10 +1519,9 @@ drawable_transform_scale_default_invoker (Gimp *gimp,
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_scale (&matrix, gimp_transform_matrix_scale (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], x0, y0,
trans_info[Y0], x1 - x0,
trans_info[X1] - trans_info[X0], y1 - y0);
trans_info[Y1] - trans_info[Y0]);
if (interpolate) if (interpolate)
interpolation_type = gimp->config->interpolation_type; interpolation_type = gimp->config->interpolation_type;

View File

@ -111,7 +111,7 @@ gradient_new_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpData *data = NULL; gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -120,15 +120,22 @@ gradient_new_invoker (Gimp *gimp,
if (success) if (success)
{ {
if (strlen (name)) if (strlen (name))
data = gimp_data_factory_data_new (gimp->gradient_factory, name); {
GimpData *data = gimp_data_factory_data_new (gimp->gradient_factory, name);
success = (data != NULL); if (data)
actual_name = g_strdup (GIMP_OBJECT (data)->name);
else
success = FALSE;
}
else
success = FALSE;
} }
return_args = procedural_db_return_args (&gradient_new_proc, success); return_args = procedural_db_return_args (&gradient_new_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (data)->name); return_args[1].value.pdb_pointer = actual_name;
return return_args; return return_args;
} }
@ -146,7 +153,7 @@ static ProcArg gradient_new_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The actual new gradient name" "The actual new gradient name"
} }
}; };
@ -178,8 +185,7 @@ gradient_duplicate_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpGradient *gradient = NULL; gchar *copy_name = NULL;
GimpGradient *gradient_copy = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -187,16 +193,19 @@ gradient_duplicate_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
{ {
gradient_copy = (GimpGradient *) GimpGradient *gradient_copy = (GimpGradient *)
gimp_data_factory_data_duplicate (gimp->gradient_factory, gimp_data_factory_data_duplicate (gimp->gradient_factory,
GIMP_DATA (gradient)); GIMP_DATA (gradient));
success = (gradient_copy != NULL); if (gradient_copy)
copy_name = g_strdup (GIMP_OBJECT (gradient_copy)->name);
else
success = FALSE;
} }
else else
success = FALSE; success = FALSE;
@ -205,7 +214,7 @@ gradient_duplicate_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&gradient_duplicate_proc, success); return_args = procedural_db_return_args (&gradient_duplicate_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gradient_copy)->name); return_args[1].value.pdb_pointer = copy_name;
return return_args; return return_args;
} }
@ -223,7 +232,7 @@ static ProcArg gradient_duplicate_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "copy-name",
"The name of the gradient's copy" "The name of the gradient's copy"
} }
}; };
@ -255,7 +264,7 @@ gradient_is_editable_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpGradient *gradient = NULL; gboolean editable = FALSE;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -263,11 +272,11 @@ gradient_is_editable_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
success = TRUE; editable = GIMP_DATA (gradient)->writable;
else else
success = FALSE; success = FALSE;
} }
@ -275,7 +284,7 @@ gradient_is_editable_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&gradient_is_editable_proc, success); return_args = procedural_db_return_args (&gradient_is_editable_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_DATA (gradient)->writable; return_args[1].value.pdb_int = editable;
return return_args; return return_args;
} }
@ -326,7 +335,7 @@ gradient_rename_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gchar *new_name; gchar *new_name;
GimpGradient *gradient = NULL; gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -338,11 +347,14 @@ gradient_rename_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient && GIMP_DATA (gradient)->writable) if (gradient && GIMP_DATA (gradient)->writable)
gimp_object_set_name (GIMP_OBJECT (gradient), new_name); {
gimp_object_set_name (GIMP_OBJECT (gradient), new_name);
actual_name = g_strdup (GIMP_OBJECT (gradient)->name);
}
else else
success = FALSE; success = FALSE;
} }
@ -350,7 +362,7 @@ gradient_rename_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&gradient_rename_proc, success); return_args = procedural_db_return_args (&gradient_rename_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gradient)->name); return_args[1].value.pdb_pointer = actual_name;
return return_args; return return_args;
} }
@ -373,7 +385,7 @@ static ProcArg gradient_rename_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The actual new name of the gradient" "The actual new name of the gradient"
} }
}; };
@ -404,7 +416,6 @@ gradient_delete_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
gchar *name; gchar *name;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -412,7 +423,7 @@ gradient_delete_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient && GIMP_DATA (gradient)->deletable) if (gradient && GIMP_DATA (gradient)->deletable)
@ -476,7 +487,6 @@ gradient_get_uniform_samples_invoker (Gimp *gimp,
gboolean reverse; gboolean reverse;
gint32 num_color_samples = 0; gint32 num_color_samples = 0;
gdouble *color_samples = NULL; gdouble *color_samples = NULL;
GimpGradient *gradient;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -490,7 +500,7 @@ gradient_get_uniform_samples_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -598,7 +608,6 @@ gradient_get_custom_samples_invoker (Gimp *gimp,
gboolean reverse; gboolean reverse;
gint32 num_color_samples = 0; gint32 num_color_samples = 0;
gdouble *color_samples = NULL; gdouble *color_samples = NULL;
GimpGradient *gradient;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -614,7 +623,7 @@ gradient_get_custom_samples_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -723,7 +732,6 @@ gradient_segment_get_left_color_invoker (Gimp *gimp,
gint32 segment; gint32 segment;
GimpRGB color; GimpRGB color;
gdouble opacity = 0; gdouble opacity = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -735,7 +743,7 @@ gradient_segment_get_left_color_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -824,7 +832,6 @@ gradient_segment_set_left_color_invoker (Gimp *gimp,
gint32 segment; gint32 segment;
GimpRGB color; GimpRGB color;
gdouble opacity; gdouble opacity;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -842,7 +849,7 @@ gradient_segment_set_left_color_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -920,7 +927,6 @@ gradient_segment_get_right_color_invoker (Gimp *gimp,
gint32 segment; gint32 segment;
GimpRGB color; GimpRGB color;
gdouble opacity = 0; gdouble opacity = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -932,7 +938,7 @@ gradient_segment_get_right_color_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1021,7 +1027,6 @@ gradient_segment_set_right_color_invoker (Gimp *gimp,
gint32 segment; gint32 segment;
GimpRGB color; GimpRGB color;
gdouble opacity; gdouble opacity;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1039,7 +1044,7 @@ gradient_segment_set_right_color_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1116,7 +1121,6 @@ gradient_segment_get_left_pos_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 segment; gint32 segment;
gdouble pos = 0; gdouble pos = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1128,7 +1132,7 @@ gradient_segment_get_left_pos_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1209,7 +1213,6 @@ gradient_segment_set_left_pos_invoker (Gimp *gimp,
gint32 segment; gint32 segment;
gdouble pos; gdouble pos;
gdouble final_pos = 0; gdouble final_pos = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1225,7 +1228,7 @@ gradient_segment_set_left_pos_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1311,7 +1314,6 @@ gradient_segment_get_middle_pos_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 segment; gint32 segment;
gdouble pos = 0; gdouble pos = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1323,7 +1325,7 @@ gradient_segment_get_middle_pos_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1404,7 +1406,6 @@ gradient_segment_set_middle_pos_invoker (Gimp *gimp,
gint32 segment; gint32 segment;
gdouble pos; gdouble pos;
gdouble final_pos = 0; gdouble final_pos = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1420,7 +1421,7 @@ gradient_segment_set_middle_pos_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1506,7 +1507,6 @@ gradient_segment_get_right_pos_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 segment; gint32 segment;
gdouble pos = 0; gdouble pos = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1518,7 +1518,7 @@ gradient_segment_get_right_pos_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1599,7 +1599,6 @@ gradient_segment_set_right_pos_invoker (Gimp *gimp,
gint32 segment; gint32 segment;
gdouble pos; gdouble pos;
gdouble final_pos = 0; gdouble final_pos = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1615,7 +1614,7 @@ gradient_segment_set_right_pos_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1701,7 +1700,6 @@ gradient_segment_get_blending_function_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 segment; gint32 segment;
gint32 blend_func = 0; gint32 blend_func = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1713,7 +1711,7 @@ gradient_segment_get_blending_function_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1794,7 +1792,6 @@ gradient_segment_get_coloring_type_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 segment; gint32 segment;
gint32 coloring_type = 0; gint32 coloring_type = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1806,7 +1803,7 @@ gradient_segment_get_coloring_type_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -1887,7 +1884,6 @@ gradient_segment_range_set_blending_function_invoker (Gimp *gimp,
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
gint32 blending_function; gint32 blending_function;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -1905,7 +1901,7 @@ gradient_segment_range_set_blending_function_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2004,7 +2000,6 @@ gradient_segment_range_set_coloring_type_invoker (Gimp *gimp,
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
gint32 coloring_type; gint32 coloring_type;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2022,7 +2017,7 @@ gradient_segment_range_set_coloring_type_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2120,7 +2115,6 @@ gradient_segment_range_flip_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2134,7 +2128,7 @@ gradient_segment_range_flip_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2228,7 +2222,6 @@ gradient_segment_range_replicate_invoker (Gimp *gimp,
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
gint32 replicate_times; gint32 replicate_times;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2246,7 +2239,7 @@ gradient_segment_range_replicate_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2345,7 +2338,6 @@ gradient_segment_range_split_midpoint_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2359,7 +2351,7 @@ gradient_segment_range_split_midpoint_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2453,7 +2445,6 @@ gradient_segment_range_split_uniform_invoker (Gimp *gimp,
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
gint32 split_parts; gint32 split_parts;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2471,7 +2462,7 @@ gradient_segment_range_split_uniform_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2570,7 +2561,6 @@ gradient_segment_range_delete_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2584,7 +2574,7 @@ gradient_segment_range_delete_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2677,7 +2667,6 @@ gradient_segment_range_redistribute_handles_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2691,7 +2680,7 @@ gradient_segment_range_redistribute_handles_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2783,7 +2772,6 @@ gradient_segment_range_blend_colors_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2797,7 +2785,7 @@ gradient_segment_range_blend_colors_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -2891,7 +2879,6 @@ gradient_segment_range_blend_opacity_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 start_segment; gint32 start_segment;
gint32 end_segment; gint32 end_segment;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -2905,7 +2892,7 @@ gradient_segment_range_blend_opacity_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -3003,7 +2990,6 @@ gradient_segment_range_move_invoker (Gimp *gimp,
gdouble delta; gdouble delta;
gboolean control_compress; gboolean control_compress;
gdouble final_delta = 0; gdouble final_delta = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -3023,7 +3009,7 @@ gradient_segment_range_move_invoker (Gimp *gimp,
if (success) if (success)
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)

View File

@ -376,8 +376,9 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
gchar *name; gchar *name;
gint32 sample_size; gint32 sample_size;
gboolean reverse; gboolean reverse;
gchar *actual_name = NULL;
gint32 width = 0;
gdouble *values = NULL; gdouble *values = NULL;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL)) if (name && !g_utf8_validate (name, -1, NULL))
@ -391,6 +392,8 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
if (success) if (success)
{ {
GimpGradient *gradient;
if (name && strlen (name)) if (name && strlen (name))
{ {
gradient = (GimpGradient *) gradient = (GimpGradient *)
@ -408,15 +411,17 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
gdouble *pv; gdouble *pv;
gdouble pos, delta; gdouble pos, delta;
GimpRGB color; GimpRGB color;
gint i;
i = sample_size;
pos = 0.0; pos = 0.0;
delta = 1.0 / (i - 1); delta = 1.0 / (sample_size - 1);
pv = values = g_new (gdouble, i * 4); actual_name = g_strdup (GIMP_OBJECT (gradient)->name);
values = g_new (gdouble, sample_size * 4);
width = sample_size * 4;
while (i--) pv = values;
while (sample_size)
{ {
seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color); seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color);
@ -436,8 +441,8 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gradient)->name); return_args[1].value.pdb_pointer = actual_name;
return_args[2].value.pdb_int = sample_size * 4; return_args[2].value.pdb_int = width;
return_args[3].value.pdb_pointer = values; return_args[3].value.pdb_pointer = values;
} }
@ -467,7 +472,7 @@ static ProcArg gradients_get_gradient_data_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The gradient name" "The gradient name"
}, },
{ {

View File

@ -4378,7 +4378,6 @@ image_get_name_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
GimpImage *gimage; GimpImage *gimage;
gchar *name = NULL; gchar *name = NULL;
gchar *filename;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage)) if (! GIMP_IS_IMAGE (gimage))
@ -4386,7 +4385,7 @@ image_get_name_invoker (Gimp *gimp,
if (success) if (success)
{ {
filename = gimp_image_get_filename (gimage); gchar *filename = gimp_image_get_filename (gimage);
if (filename) if (filename)
name = g_filename_display_basename (filename); name = g_filename_display_basename (filename);

View File

@ -78,7 +78,7 @@ palette_new_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpData *data = NULL; gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -87,15 +87,22 @@ palette_new_invoker (Gimp *gimp,
if (success) if (success)
{ {
if (strlen (name)) if (strlen (name))
data = gimp_data_factory_data_new (gimp->palette_factory, name); {
GimpData *data = gimp_data_factory_data_new (gimp->palette_factory, name);
success = (data != NULL); if (data)
actual_name = g_strdup (GIMP_OBJECT (data)->name);
else
success = FALSE;
}
else
success = FALSE;
} }
return_args = procedural_db_return_args (&palette_new_proc, success); return_args = procedural_db_return_args (&palette_new_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (data)->name); return_args[1].value.pdb_pointer = actual_name;
return return_args; return return_args;
} }
@ -113,7 +120,7 @@ static ProcArg palette_new_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The actual new palette name" "The actual new palette name"
} }
}; };
@ -145,7 +152,7 @@ palette_duplicate_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpPalette *palette_copy = NULL; gchar *copy_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -158,11 +165,14 @@ palette_duplicate_invoker (Gimp *gimp,
if (palette) if (palette)
{ {
palette_copy = (GimpPalette *) GimpPalette *palette_copy = (GimpPalette *)
gimp_data_factory_data_duplicate (gimp->palette_factory, gimp_data_factory_data_duplicate (gimp->palette_factory,
GIMP_DATA (palette)); GIMP_DATA (palette));
success = (palette_copy != NULL); if (palette_copy)
copy_name = g_strdup (GIMP_OBJECT (palette_copy)->name);
else
success = FALSE;
} }
else else
success = FALSE; success = FALSE;
@ -171,7 +181,7 @@ palette_duplicate_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&palette_duplicate_proc, success); return_args = procedural_db_return_args (&palette_duplicate_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette_copy)->name); return_args[1].value.pdb_pointer = copy_name;
return return_args; return return_args;
} }
@ -189,7 +199,7 @@ static ProcArg palette_duplicate_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "copy-name",
"The name of the palette's copy" "The name of the palette's copy"
} }
}; };
@ -222,7 +232,7 @@ palette_rename_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gchar *new_name; gchar *new_name;
GimpPalette *palette = NULL; gchar *actual_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -234,11 +244,14 @@ palette_rename_invoker (Gimp *gimp,
if (success) if (success)
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable) if (palette && GIMP_DATA (palette)->writable)
gimp_object_set_name (GIMP_OBJECT (palette), new_name); {
gimp_object_set_name (GIMP_OBJECT (palette), new_name);
actual_name = g_strdup (GIMP_OBJECT (palette)->name);
}
else else
success = FALSE; success = FALSE;
} }
@ -246,7 +259,7 @@ palette_rename_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&palette_rename_proc, success); return_args = procedural_db_return_args (&palette_rename_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette)->name); return_args[1].value.pdb_pointer = actual_name;
return return_args; return return_args;
} }
@ -269,7 +282,7 @@ static ProcArg palette_rename_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The actual new name of the palette" "The actual new name of the palette"
} }
}; };
@ -367,7 +380,7 @@ palette_is_editable_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpPalette *palette = NULL; gboolean editable = FALSE;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -375,11 +388,11 @@ palette_is_editable_invoker (Gimp *gimp,
if (success) if (success)
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette) if (palette)
success = TRUE; editable = GIMP_DATA (palette)->writable;
else else
success = FALSE; success = FALSE;
} }
@ -387,7 +400,7 @@ palette_is_editable_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&palette_is_editable_proc, success); return_args = procedural_db_return_args (&palette_is_editable_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = GIMP_DATA (palette)->writable; return_args[1].value.pdb_int = editable;
return return_args; return return_args;
} }
@ -437,7 +450,7 @@ palette_get_info_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpPalette *palette = NULL; gint32 num_colors = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -445,16 +458,19 @@ palette_get_info_invoker (Gimp *gimp,
if (success) if (success)
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
success = (palette != NULL); if (palette)
num_colors = palette->n_colors;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&palette_get_info_proc, success); return_args = procedural_db_return_args (&palette_get_info_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = palette->n_colors; return_args[1].value.pdb_int = num_colors;
return return_args; return return_args;
} }
@ -504,7 +520,7 @@ palette_get_columns_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpPalette *palette = NULL; gint32 num_columns = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -512,16 +528,19 @@ palette_get_columns_invoker (Gimp *gimp,
if (success) if (success)
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
success = (palette != NULL); if (palette)
num_columns = palette->n_columns;
else
success = FALSE;
} }
return_args = procedural_db_return_args (&palette_get_columns_proc, success); return_args = procedural_db_return_args (&palette_get_columns_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = palette->n_columns; return_args[1].value.pdb_int = num_columns;
return return_args; return return_args;
} }
@ -637,7 +656,7 @@ palette_add_entry_invoker (Gimp *gimp,
gchar *name; gchar *name;
gchar *entry_name; gchar *entry_name;
GimpRGB color; GimpRGB color;
GimpPaletteEntry *entry = NULL; gint32 entry_num = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -655,7 +674,12 @@ palette_add_entry_invoker (Gimp *gimp,
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable) if (palette && GIMP_DATA (palette)->writable)
entry = gimp_palette_add_entry (palette, -1, entry_name, &color); {
GimpPaletteEntry *entry =
gimp_palette_add_entry (palette, -1, entry_name, &color);
entry_num = entry->position;
}
else else
success = FALSE; success = FALSE;
} }
@ -663,7 +687,7 @@ palette_add_entry_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&palette_add_entry_proc, success); return_args = procedural_db_return_args (&palette_add_entry_proc, success);
if (success) if (success)
return_args[1].value.pdb_int = entry->position; return_args[1].value.pdb_int = entry_num;
return return_args; return return_args;
} }
@ -963,7 +987,7 @@ palette_entry_get_name_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gint32 entry_num; gint32 entry_num;
GimpPaletteEntry *entry = NULL; gchar *entry_name = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -979,7 +1003,11 @@ palette_entry_get_name_invoker (Gimp *gimp,
if (palette) if (palette)
{ {
if (entry_num >= 0 && entry_num < palette->n_colors) if (entry_num >= 0 && entry_num < palette->n_colors)
entry = g_list_nth_data (palette->colors, entry_num); {
GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num);
entry_name = g_strdup (entry->name);
}
else else
success = FALSE; success = FALSE;
} }
@ -990,7 +1018,7 @@ palette_entry_get_name_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&palette_entry_get_name_proc, success); return_args = procedural_db_return_args (&palette_entry_get_name_proc, success);
if (success) if (success)
return_args[1].value.pdb_pointer = g_strdup (entry->name); return_args[1].value.pdb_pointer = entry_name;
return return_args; return return_args;
} }

View File

@ -157,16 +157,25 @@ palettes_get_palette_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpPalette *palette; gchar *name = NULL;
gint32 num_colors = 0;
success = (palette = gimp_context_get_palette (context)) != NULL; GimpPalette *palette = gimp_context_get_palette (context);
if (palette)
{
name = g_strdup (GIMP_OBJECT (palette)->name);
num_colors = palette->n_colors;
}
else
success = FALSE;
return_args = procedural_db_return_args (&palettes_get_palette_proc, success); return_args = procedural_db_return_args (&palettes_get_palette_proc, success);
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette)->name); return_args[1].value.pdb_pointer = name;
return_args[2].value.pdb_int = palette->n_colors; return_args[2].value.pdb_int = num_colors;
} }
return return_args; return return_args;
@ -214,8 +223,9 @@ palettes_get_palette_entry_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gint32 entry_num; gint32 entry_num;
gchar *actual_name = NULL;
gint32 num_colors = 0;
GimpRGB color; GimpRGB color;
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL)) if (name && !g_utf8_validate (name, -1, NULL))
@ -225,6 +235,8 @@ palettes_get_palette_entry_invoker (Gimp *gimp,
if (success) if (success)
{ {
GimpPalette *palette;
if (name && strlen (name)) if (name && strlen (name))
{ {
palette = (GimpPalette *) palette = (GimpPalette *)
@ -238,19 +250,16 @@ palettes_get_palette_entry_invoker (Gimp *gimp,
if (palette) if (palette)
{ {
if (entry_num < 0 || entry_num >= palette->n_colors) if (entry_num >= 0 && entry_num < palette->n_colors)
{ {
success = FALSE; GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num);
actual_name = g_strdup (GIMP_OBJECT (palette)->name);
num_colors = palette->n_colors;
color = entry->color;
} }
else else
{ success = FALSE;
GimpPaletteEntry *entry;
entry = (GimpPaletteEntry *)
g_list_nth_data (palette->colors, entry_num);
color = entry->color;
}
} }
else else
success = FALSE; success = FALSE;
@ -260,8 +269,8 @@ palettes_get_palette_entry_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette)->name); return_args[1].value.pdb_pointer = actual_name;
return_args[2].value.pdb_int = palette->n_colors; return_args[2].value.pdb_int = num_colors;
return_args[3].value.pdb_color = color; return_args[3].value.pdb_color = color;
} }
@ -286,7 +295,7 @@ static ProcArg palettes_get_palette_entry_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The palette name" "The palette name"
}, },
{ {

View File

@ -361,7 +361,6 @@ path_get_points_invoker (Gimp *gimp,
gint32 path_closed = 0; gint32 path_closed = 0;
gint32 num_point_details = 0; gint32 num_point_details = 0;
gdouble *points_pairs = NULL; gdouble *points_pairs = NULL;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage)) if (! GIMP_IS_IMAGE (gimage))
@ -373,7 +372,7 @@ path_get_points_invoker (Gimp *gimp,
if (success) if (success)
{ {
vectors = gimp_image_get_vectors_by_name (gimage, name); GimpVectors *vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors) if (vectors)
{ {

View File

@ -53,7 +53,9 @@ pattern_get_info_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
GimpPattern *pattern = NULL; gint32 width = 0;
gint32 height = 0;
gint32 bpp = 0;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -61,19 +63,26 @@ pattern_get_info_invoker (Gimp *gimp,
if (success) if (success)
{ {
pattern = (GimpPattern *) GimpPattern *pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name); gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
success = (pattern != NULL); if (pattern)
{
width = pattern->mask->width;
height = pattern->mask->height;
bpp = pattern->mask->bytes;
}
else
success = FALSE;
} }
return_args = procedural_db_return_args (&pattern_get_info_proc, success); return_args = procedural_db_return_args (&pattern_get_info_proc, success);
if (success) if (success)
{ {
return_args[1].value.pdb_int = pattern->mask->width; return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = pattern->mask->height; return_args[2].value.pdb_int = height;
return_args[3].value.pdb_int = pattern->mask->bytes; return_args[3].value.pdb_int = bpp;
} }
return return_args; return return_args;
@ -134,9 +143,11 @@ pattern_get_pixels_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gint32 width = 0;
gint32 height = 0;
gint32 bpp = 0;
gint32 num_color_bytes = 0; gint32 num_color_bytes = 0;
guint8 *color_bytes = NULL; guint8 *color_bytes = NULL;
GimpPattern *pattern = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL)) if (name == NULL || !g_utf8_validate (name, -1, NULL))
@ -144,11 +155,14 @@ pattern_get_pixels_invoker (Gimp *gimp,
if (success) if (success)
{ {
pattern = (GimpPattern *) GimpPattern *pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name); gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
if (pattern) if (pattern)
{ {
width = pattern->mask->width;
height = pattern->mask->height;
bpp = pattern->mask->bytes;
num_color_bytes = pattern->mask->height * pattern->mask->width * num_color_bytes = pattern->mask->height * pattern->mask->width *
pattern->mask->bytes; pattern->mask->bytes;
color_bytes = g_memdup (temp_buf_data (pattern->mask), color_bytes = g_memdup (temp_buf_data (pattern->mask),
@ -162,9 +176,9 @@ pattern_get_pixels_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_int = pattern->mask->width; return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = pattern->mask->height; return_args[2].value.pdb_int = height;
return_args[3].value.pdb_int = pattern->mask->bytes; return_args[3].value.pdb_int = bpp;
return_args[4].value.pdb_int = num_color_bytes; return_args[4].value.pdb_int = num_color_bytes;
return_args[5].value.pdb_pointer = color_bytes; return_args[5].value.pdb_pointer = color_bytes;
} }

View File

@ -156,17 +156,28 @@ patterns_get_pattern_invoker (Gimp *gimp,
{ {
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpPattern *pattern; gchar *name = NULL;
gint32 width = 0;
gint32 height = 0;
success = (pattern = gimp_context_get_pattern (context)) != NULL; GimpPattern *pattern = gimp_context_get_pattern (context);
if (pattern)
{
name = g_strdup (GIMP_OBJECT (pattern)->name);
width = pattern->mask->width;
height = pattern->mask->height;
}
else
success = FALSE;
return_args = procedural_db_return_args (&patterns_get_pattern_proc, success); return_args = procedural_db_return_args (&patterns_get_pattern_proc, success);
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (pattern)->name); return_args[1].value.pdb_pointer = name;
return_args[2].value.pdb_int = pattern->mask->width; return_args[2].value.pdb_int = width;
return_args[3].value.pdb_int = pattern->mask->height; return_args[3].value.pdb_int = height;
} }
return return_args; return return_args;
@ -218,9 +229,12 @@ patterns_get_pattern_data_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar *name; gchar *name;
gchar *actual_name = NULL;
gint32 width = 0;
gint32 height = 0;
gint32 mask_bpp = 0;
gint32 length = 0; gint32 length = 0;
guint8 *mask_data = NULL; guint8 *mask_data = NULL;
GimpPattern *pattern = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL)) if (name && !g_utf8_validate (name, -1, NULL))
@ -228,6 +242,8 @@ patterns_get_pattern_data_invoker (Gimp *gimp,
if (success) if (success)
{ {
GimpPattern *pattern;
if (name && strlen (name)) if (name && strlen (name))
{ {
pattern = (GimpPattern *) pattern = (GimpPattern *)
@ -241,9 +257,13 @@ patterns_get_pattern_data_invoker (Gimp *gimp,
if (pattern) if (pattern)
{ {
length = pattern->mask->height * pattern->mask->width * actual_name = g_strdup (GIMP_OBJECT (pattern)->name);
pattern->mask->bytes; width = pattern->mask->width;
mask_data = g_memdup (temp_buf_data (pattern->mask), length); height = pattern->mask->height;
mask_bpp = pattern->mask->bytes;
length = pattern->mask->height * pattern->mask->width *
pattern->mask->bytes;
mask_data = g_memdup (temp_buf_data (pattern->mask), length);
} }
else else
success = FALSE; success = FALSE;
@ -253,10 +273,10 @@ patterns_get_pattern_data_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (pattern)->name); return_args[1].value.pdb_pointer = actual_name;
return_args[2].value.pdb_int = pattern->mask->width; return_args[2].value.pdb_int = width;
return_args[3].value.pdb_int = pattern->mask->height; return_args[3].value.pdb_int = height;
return_args[4].value.pdb_int = pattern->mask->bytes; return_args[4].value.pdb_int = mask_bpp;
return_args[5].value.pdb_int = length; return_args[5].value.pdb_int = length;
return_args[6].value.pdb_pointer = mask_data; return_args[6].value.pdb_pointer = mask_data;
} }
@ -277,7 +297,7 @@ static ProcArg patterns_get_pattern_data_outargs[] =
{ {
{ {
GIMP_PDB_STRING, GIMP_PDB_STRING,
"name", "actual-name",
"The pattern name" "The pattern name"
}, },
{ {

View File

@ -165,8 +165,8 @@ procedural_db_query_invoker (Gimp *gimp,
gchar *copyright; gchar *copyright;
gchar *date; gchar *date;
gchar *proc_type; gchar *proc_type;
gint num_procs; gint32 num_matches = 0;
gchar **procs; gchar **procedure_names = NULL;
name = (gchar *) args[0].value.pdb_pointer; name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL) if (name == NULL)
@ -199,16 +199,17 @@ procedural_db_query_invoker (Gimp *gimp,
if (success) if (success)
{ {
success = procedural_db_query (gimp, success = procedural_db_query (gimp,
name, blurb, help, author, copyright, date, proc_type, name, blurb, help, author,
&num_procs, &procs); copyright, date, proc_type,
&num_matches, &procedure_names);
} }
return_args = procedural_db_return_args (&procedural_db_query_proc, success); return_args = procedural_db_return_args (&procedural_db_query_proc, success);
if (success) if (success)
{ {
return_args[1].value.pdb_int = num_procs; return_args[1].value.pdb_int = num_matches;
return_args[2].value.pdb_pointer = procs; return_args[2].value.pdb_pointer = procedure_names;
} }
return return_args; return return_args;
@ -420,8 +421,9 @@ procedural_db_proc_arg_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *proc_name; gchar *proc_name;
gint32 arg_num; gint32 arg_num;
ProcRecord *proc; gint32 arg_type = 0;
ProcArg *arg = NULL; gchar *arg_name = NULL;
gchar *arg_desc = NULL;
proc_name = (gchar *) args[0].value.pdb_pointer; proc_name = (gchar *) args[0].value.pdb_pointer;
if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL)) if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL))
@ -431,7 +433,8 @@ procedural_db_proc_arg_invoker (Gimp *gimp,
if (success) if (success)
{ {
gchar *canonical; ProcRecord *proc;
gchar *canonical;
canonical = gimp_canonicalize_identifier (proc_name); canonical = gimp_canonicalize_identifier (proc_name);
@ -450,7 +453,13 @@ procedural_db_proc_arg_invoker (Gimp *gimp,
g_free (canonical); g_free (canonical);
if (proc && (arg_num >= 0 && arg_num < proc->num_args)) if (proc && (arg_num >= 0 && arg_num < proc->num_args))
arg = &proc->args[arg_num]; {
ProcArg *arg = &proc->args[arg_num];
arg_type = arg->arg_type;
arg_name = g_strdup (arg->name);
arg_desc = g_strdup (arg->description);
}
else else
success = FALSE; success = FALSE;
} }
@ -459,9 +468,9 @@ procedural_db_proc_arg_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_int = arg->arg_type; return_args[1].value.pdb_int = arg_type;
return_args[2].value.pdb_pointer = g_strdup (arg->name); return_args[2].value.pdb_pointer = arg_name;
return_args[3].value.pdb_pointer = g_strdup (arg->description); return_args[3].value.pdb_pointer = arg_desc;
} }
return return_args; return return_args;
@ -528,8 +537,9 @@ procedural_db_proc_val_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
gchar *proc_name; gchar *proc_name;
gint32 val_num; gint32 val_num;
ProcRecord *proc; gint32 val_type = 0;
ProcArg *val = NULL; gchar *val_name = NULL;
gchar *val_desc = NULL;
proc_name = (gchar *) args[0].value.pdb_pointer; proc_name = (gchar *) args[0].value.pdb_pointer;
if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL)) if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL))
@ -539,7 +549,8 @@ procedural_db_proc_val_invoker (Gimp *gimp,
if (success) if (success)
{ {
gchar *canonical; ProcRecord *proc;
gchar *canonical;
canonical = gimp_canonicalize_identifier (proc_name); canonical = gimp_canonicalize_identifier (proc_name);
@ -558,7 +569,13 @@ procedural_db_proc_val_invoker (Gimp *gimp,
g_free (canonical); g_free (canonical);
if (proc && (val_num >= 0 && val_num < proc->num_values)) if (proc && (val_num >= 0 && val_num < proc->num_values))
val = &proc->values[val_num]; {
ProcArg *val = &proc->values[val_num];
val_type = val->arg_type;
val_name = g_strdup (val->name);
val_desc = g_strdup (val->description);
}
else else
success = FALSE; success = FALSE;
} }
@ -567,9 +584,9 @@ procedural_db_proc_val_invoker (Gimp *gimp,
if (success) if (success)
{ {
return_args[1].value.pdb_int = val->arg_type; return_args[1].value.pdb_int = val_type;
return_args[2].value.pdb_pointer = g_strdup (val->name); return_args[2].value.pdb_pointer = val_name;
return_args[3].value.pdb_pointer = g_strdup (val->description); return_args[3].value.pdb_pointer = val_desc;
} }
return return_args; return return_args;

View File

@ -147,7 +147,14 @@ perspective_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean interpolation; gboolean interpolation;
gdouble trans_info[8]; gdouble x0;
gdouble y0;
gdouble x1;
gdouble y1;
gdouble x2;
gdouble y2;
gdouble x3;
gdouble y3;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
@ -155,21 +162,21 @@ perspective_invoker (Gimp *gimp,
interpolation = args[1].value.pdb_int ? TRUE : FALSE; interpolation = args[1].value.pdb_int ? TRUE : FALSE;
trans_info[X0] = args[2].value.pdb_float; x0 = args[2].value.pdb_float;
trans_info[Y0] = args[3].value.pdb_float; y0 = args[3].value.pdb_float;
trans_info[X1] = args[4].value.pdb_float; x1 = args[4].value.pdb_float;
trans_info[Y1] = args[5].value.pdb_float; y1 = args[5].value.pdb_float;
trans_info[X2] = args[6].value.pdb_float; x2 = args[6].value.pdb_float;
trans_info[Y2] = args[7].value.pdb_float; y2 = args[7].value.pdb_float;
trans_info[X3] = args[8].value.pdb_float; x3 = args[8].value.pdb_float;
trans_info[Y3] = args[9].value.pdb_float; y3 = args[9].value.pdb_float;
if (success) if (success)
{ {
@ -187,10 +194,10 @@ perspective_invoker (Gimp *gimp,
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_perspective (&matrix, gimp_transform_matrix_perspective (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], trans_info[Y0], x0, y0,
trans_info[X1], trans_info[Y1], x1, y1,
trans_info[X2], trans_info[Y2], x2, y2,
trans_info[X3], trans_info[Y3]); x3, y3);
if (interpolation) if (interpolation)
interpolation_type = gimp->config->interpolation_type; interpolation_type = gimp->config->interpolation_type;
@ -418,7 +425,10 @@ scale_invoker (Gimp *gimp,
Argument *return_args; Argument *return_args;
GimpDrawable *drawable; GimpDrawable *drawable;
gboolean interpolation; gboolean interpolation;
gdouble trans_info[4]; gdouble x0;
gdouble y0;
gdouble x1;
gdouble y1;
drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
@ -426,21 +436,20 @@ scale_invoker (Gimp *gimp,
interpolation = args[1].value.pdb_int ? TRUE : FALSE; interpolation = args[1].value.pdb_int ? TRUE : FALSE;
trans_info[X0] = args[2].value.pdb_float; x0 = args[2].value.pdb_float;
trans_info[Y0] = args[3].value.pdb_float; y0 = args[3].value.pdb_float;
trans_info[X1] = args[4].value.pdb_float; x1 = args[4].value.pdb_float;
trans_info[Y1] = args[5].value.pdb_float; y1 = args[5].value.pdb_float;
if (success) if (success)
{ {
gint x, y, width, height; gint x, y, width, height;
success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && success = (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
trans_info[X0] < trans_info[X1] && x0 < x1 && y0 < y1);
trans_info[Y0] < trans_info[Y1]);
if (success && if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -452,10 +461,9 @@ scale_invoker (Gimp *gimp,
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_scale (&matrix, gimp_transform_matrix_scale (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], x0, y0,
trans_info[Y0], x1 - x0,
trans_info[X1] - trans_info[X0], y1 - y0);
trans_info[Y1] - trans_info[Y0]);
if (interpolation) if (interpolation)
interpolation_type = gimp->config->interpolation_type; interpolation_type = gimp->config->interpolation_type;

View File

@ -44,7 +44,7 @@ gimp_brush_new (const gchar *name)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-brush-new", return_vals = gimp_run_procedure ("gimp-brush-new",
&nreturn_vals, &nreturn_vals,
@ -52,11 +52,11 @@ gimp_brush_new (const gchar *name)
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }
/** /**
@ -76,7 +76,7 @@ gimp_brush_duplicate (const gchar *name)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *copy_name = NULL;
return_vals = gimp_run_procedure ("gimp-brush-duplicate", return_vals = gimp_run_procedure ("gimp-brush-duplicate",
&nreturn_vals, &nreturn_vals,
@ -84,11 +84,11 @@ gimp_brush_duplicate (const gchar *name)
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); copy_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return copy_name;
} }
/** /**
@ -142,7 +142,7 @@ gimp_brush_rename (const gchar *name,
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-brush-rename", return_vals = gimp_run_procedure ("gimp-brush-rename",
&nreturn_vals, &nreturn_vals,
@ -151,11 +151,11 @@ gimp_brush_rename (const gchar *name,
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }
/** /**

View File

@ -213,7 +213,7 @@ gimp_brushes_get_brush_data (const gchar *name,
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-brushes-get-brush-data", return_vals = gimp_run_procedure ("gimp-brushes-get-brush-data",
&nreturn_vals, &nreturn_vals,
@ -224,7 +224,7 @@ gimp_brushes_get_brush_data (const gchar *name,
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{ {
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
*opacity = return_vals[2].data.d_float; *opacity = return_vals[2].data.d_float;
*spacing = return_vals[3].data.d_int32; *spacing = return_vals[3].data.d_int32;
*paint_mode = return_vals[4].data.d_int32; *paint_mode = return_vals[4].data.d_int32;
@ -238,5 +238,5 @@ gimp_brushes_get_brush_data (const gchar *name,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }

View File

@ -44,7 +44,7 @@ gimp_gradient_new (const gchar *name)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-gradient-new", return_vals = gimp_run_procedure ("gimp-gradient-new",
&nreturn_vals, &nreturn_vals,
@ -52,11 +52,11 @@ gimp_gradient_new (const gchar *name)
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }
/** /**
@ -76,7 +76,7 @@ gimp_gradient_duplicate (const gchar *name)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *copy_name = NULL;
return_vals = gimp_run_procedure ("gimp-gradient-duplicate", return_vals = gimp_run_procedure ("gimp-gradient-duplicate",
&nreturn_vals, &nreturn_vals,
@ -84,11 +84,11 @@ gimp_gradient_duplicate (const gchar *name)
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); copy_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return copy_name;
} }
/** /**
@ -142,7 +142,7 @@ gimp_gradient_rename (const gchar *name,
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-gradient-rename", return_vals = gimp_run_procedure ("gimp-gradient-rename",
&nreturn_vals, &nreturn_vals,
@ -151,11 +151,11 @@ gimp_gradient_rename (const gchar *name,
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }
/** /**

View File

@ -198,7 +198,7 @@ gimp_gradients_get_gradient_data (const gchar *name,
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-gradients-get-gradient-data", return_vals = gimp_run_procedure ("gimp-gradients-get-gradient-data",
&nreturn_vals, &nreturn_vals,
@ -211,7 +211,7 @@ gimp_gradients_get_gradient_data (const gchar *name,
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{ {
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
*width = return_vals[2].data.d_int32; *width = return_vals[2].data.d_int32;
*grad_data = g_new (gdouble, *width); *grad_data = g_new (gdouble, *width);
memcpy (*grad_data, return_vals[3].data.d_floatarray, memcpy (*grad_data, return_vals[3].data.d_floatarray,
@ -220,5 +220,5 @@ gimp_gradients_get_gradient_data (const gchar *name,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }

View File

@ -42,7 +42,7 @@ gimp_palette_new (const gchar *name)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-palette-new", return_vals = gimp_run_procedure ("gimp-palette-new",
&nreturn_vals, &nreturn_vals,
@ -50,11 +50,11 @@ gimp_palette_new (const gchar *name)
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }
/** /**
@ -74,7 +74,7 @@ gimp_palette_duplicate (const gchar *name)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *copy_name = NULL;
return_vals = gimp_run_procedure ("gimp-palette-duplicate", return_vals = gimp_run_procedure ("gimp-palette-duplicate",
&nreturn_vals, &nreturn_vals,
@ -82,11 +82,11 @@ gimp_palette_duplicate (const gchar *name)
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); copy_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return copy_name;
} }
/** /**
@ -108,7 +108,7 @@ gimp_palette_rename (const gchar *name,
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-palette-rename", return_vals = gimp_run_procedure ("gimp-palette-rename",
&nreturn_vals, &nreturn_vals,
@ -117,11 +117,11 @@ gimp_palette_rename (const gchar *name,
GIMP_PDB_END); GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }
/** /**

View File

@ -146,7 +146,7 @@ gimp_palettes_get_palette_entry (const gchar *name,
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-palettes-get-palette-entry", return_vals = gimp_run_procedure ("gimp-palettes-get-palette-entry",
&nreturn_vals, &nreturn_vals,
@ -156,12 +156,12 @@ gimp_palettes_get_palette_entry (const gchar *name,
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{ {
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
*num_colors = return_vals[2].data.d_int32; *num_colors = return_vals[2].data.d_int32;
*color = return_vals[3].data.d_color; *color = return_vals[3].data.d_color;
} }
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }

View File

@ -154,7 +154,7 @@ gimp_patterns_get_pattern_data (const gchar *name,
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar *ret_name = NULL; gchar *actual_name = NULL;
return_vals = gimp_run_procedure ("gimp-patterns-get-pattern-data", return_vals = gimp_run_procedure ("gimp-patterns-get-pattern-data",
&nreturn_vals, &nreturn_vals,
@ -165,7 +165,7 @@ gimp_patterns_get_pattern_data (const gchar *name,
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{ {
ret_name = g_strdup (return_vals[1].data.d_string); actual_name = g_strdup (return_vals[1].data.d_string);
*width = return_vals[2].data.d_int32; *width = return_vals[2].data.d_int32;
*height = return_vals[3].data.d_int32; *height = return_vals[3].data.d_int32;
*mask_bpp = return_vals[4].data.d_int32; *mask_bpp = return_vals[4].data.d_int32;
@ -177,5 +177,5 @@ gimp_patterns_get_pattern_data (const gchar *name,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return ret_name; return actual_name;
} }

View File

@ -158,17 +158,6 @@ sub declare_args {
$result; $result;
} }
sub declare_vars {
my $proc = shift;
my $code = "";
if (exists $proc->{invoke}->{vars}) {
foreach (@{$proc->{invoke}->{vars}}) {
$code .= ' ' x 2 . $_ . ";\n";
}
}
$code;
}
sub make_arg_recs { sub make_arg_recs {
my $proc = shift; my $proc = shift;
@ -530,7 +519,6 @@ CODE
$pos++; $pos++;
} }
$code .= &declare_vars($proc);
$code .= "\n" if length($code); $code .= "\n" if length($code);
$code .= &format_code_frag($custom, 0) . "}\n"; $code .= &format_code_frag($custom, 0) . "}\n";
} }
@ -562,7 +550,6 @@ CODE
} }
$code .= &declare_args($tempproc, $out, qw(inargs)) . "\n"; $code .= &declare_args($tempproc, $out, qw(inargs)) . "\n";
$code .= &declare_vars($proc);
my $marshal = ""; my $marshal = "";
foreach (@{$tempproc->{inargs}}) { foreach (@{$tempproc->{inargs}}) {
@ -623,7 +610,6 @@ CODE
$invoker .= ' ' x 2 . "Argument *return_args;\n" if scalar @outargs; $invoker .= ' ' x 2 . "Argument *return_args;\n" if scalar @outargs;
$invoker .= &declare_args($proc, $out, qw(inargs outargs)); $invoker .= &declare_args($proc, $out, qw(inargs outargs));
$invoker .= &declare_vars($proc);
$invoker .= &marshal_inargs($proc, 0); $invoker .= &marshal_inargs($proc, 0);
$invoker .= "\n" if $invoker && $invoker !~ /\n\n/s; $invoker .= "\n" if $invoker && $invoker !~ /\n\n/s;

View File

@ -38,19 +38,24 @@ sub brush_new {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'actual_name', type => 'string', init => 1,
desc => 'The actual new brush name', desc => 'The actual new brush name' }
alias => 'g_strdup (GIMP_OBJECT (data)->name)', no_declare => 1 },
); );
%invoke = ( %invoke = (
vars => [ 'GimpData *data = NULL'],
code => <<'CODE' code => <<'CODE'
{ {
if (strlen (name)) if (strlen (name))
data = gimp_data_factory_data_new (gimp->brush_factory, name); {
GimpData *data = gimp_data_factory_data_new (gimp->brush_factory, name);
success = (data != NULL); if (data)
actual_name = g_strdup (GIMP_OBJECT (data)->name);
else
success = FALSE;
}
else
success = FALSE;
} }
CODE CODE
); );
@ -67,27 +72,26 @@ sub brush_duplicate {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'copy_name', type => 'string', init => 1,
desc => "The name of the brush's copy", desc => "The name of the brush's copy" }
alias => 'g_strdup (GIMP_OBJECT (brush_copy)->name)',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL',
'GimpBrush *brush_copy = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
{ {
brush_copy = (GimpBrush *) GimpBrush *brush_copy = (GimpBrush *)
gimp_data_factory_data_duplicate (gimp->brush_factory, gimp_data_factory_data_duplicate (gimp->brush_factory,
GIMP_DATA (brush)); GIMP_DATA (brush));
success = (brush_copy != NULL); if (brush_copy)
copy_name = g_strdup (GIMP_OBJECT (brush_copy)->name);
else
success = FALSE;
} }
else else
success = FALSE; success = FALSE;
@ -107,21 +111,18 @@ sub brush_is_generated {
); );
@outargs = ( @outargs = (
{ name => 'generated', type => 'boolean', { name => 'generated', type => 'boolean', init => 1,
desc => "True if the brush is generated", desc => "True if the brush is generated" }
alias => 'GIMP_IS_BRUSH_GENERATED (brush)',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
success = TRUE; generated = GIMP_IS_BRUSH_GENERATED (brush);
else else
success = FALSE; success = FALSE;
} }
@ -140,21 +141,18 @@ sub brush_is_editable {
); );
@outargs = ( @outargs = (
{ name => 'editable', type => 'boolean', { name => 'editable', type => 'boolean', init => 1,
desc => "True if the brush can be edited", desc => "True if the brush can be edited" }
alias => 'GIMP_DATA (brush)->writable',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
success = TRUE; editable = GIMP_DATA (brush)->writable;
else else
success = FALSE; success = FALSE;
} }
@ -175,20 +173,21 @@ sub brush_rename {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'actual_name', type => 'string', init => 1,
desc => "The actual new name of the brush", desc => "The actual new name of the brush" }
alias => 'g_strdup (GIMP_OBJECT (brush)->name)', no_declare => 1 },
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable) if (brush && GIMP_DATA (brush)->writable)
gimp_object_set_name (GIMP_OBJECT (brush), new_name); {
gimp_object_set_name (GIMP_OBJECT (brush), new_name);
actual_name = g_strdup (GIMP_OBJECT (brush)->name);
}
else else
success = FALSE; success = FALSE;
} }
@ -207,10 +206,9 @@ sub brush_delete {
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->deletable) if (brush && GIMP_DATA (brush)->deletable)
@ -248,28 +246,31 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'width', type => 'int32', no_declare => '1', { name => 'width', type => 'int32', init => 1, void_ret => 1,
alias => 'brush->mask->width', void_ret => '1',
desc => "The brush width" }, desc => "The brush width" },
{ name => 'height', type => 'int32', no_declare => '1', { name => 'height', type => 'int32', init => 1,
alias => 'brush->mask->height',
desc => "The brush height" }, desc => "The brush height" },
{ name => 'mask_bpp', type => 'int32', no_declare => '1', { name => 'mask_bpp', type => 'int32', init => 1,
alias => 'brush->mask->bytes',
desc => "The brush mask bpp" }, desc => "The brush mask bpp" },
{ name => 'color_bpp', type => 'int32', no_declare => '1', { name => 'color_bpp', type => 'int32', init => 1,
alias => 'brush->pixmap ? brush->pixmap->bytes : 0',
desc => "The brush color bpp" } desc => "The brush color bpp" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL); if (brush)
{
width = brush->mask->width;
height = brush->mask->height;
mask_bpp = brush->mask->bytes;
color_bpp = brush->pixmap ? brush->pixmap->bytes : 0;
}
else
success = FALSE;
} }
CODE CODE
); );
@ -292,11 +293,9 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'width', type => 'int32', no_declare => '1', { name => 'width', type => 'int32', init => 1, void_ret => '1',
alias => 'brush->mask->width', void_ret => '1',
desc => "The brush width" }, desc => "The brush width" },
{ name => 'height', type => 'int32', no_declare => '1', { name => 'height', type => 'int32', init => 1,
alias => 'brush->mask->height',
desc => "The brush height" }, desc => "The brush height" },
{ name => 'mask_bpp', type => 'int32', init => '1', { name => 'mask_bpp', type => 'int32', init => '1',
desc => "The brush mask bpp" }, desc => "The brush mask bpp" },
@ -313,14 +312,15 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
{ {
width = brush->mask->width;
height = brush->mask->height;
mask_bpp = brush->mask->bytes; mask_bpp = brush->mask->bytes;
num_mask_bytes = brush->mask->height * brush->mask->width; num_mask_bytes = brush->mask->height * brush->mask->width;
mask_bytes = g_memdup (temp_buf_data (brush->mask), num_mask_bytes); mask_bytes = g_memdup (temp_buf_data (brush->mask), num_mask_bytes);
@ -356,20 +356,21 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'spacing', type => '0 <= int32 <= 1000', { name => 'spacing', type => '0 <= int32 <= 1000', init => 1,
desc => 'The brush spacing: %%desc%%', desc => 'The brush spacing: %%desc%%',
alias => 'gimp_brush_get_spacing (brush)', void_ret => 1 }
no_declare => 1, void_ret => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL); if (brush)
spacing = gimp_brush_get_spacing (brush);
else
success = FALSE;
} }
CODE CODE
); );
@ -394,20 +395,21 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'shape', type => 'int32', no_declare => '1', { name => 'shape', type => 'int32', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->shape',
desc => "An enumerated value representing the brush shape" } desc => "An enumerated value representing the brush shape" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
shape = GIMP_BRUSH_GENERATED (brush)->shape;
else
success = FALSE;
} }
CODE CODE
); );
@ -428,20 +430,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'radius', type => 'float', no_declare => '1', { name => 'radius', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->radius',
desc => "The radius of the brush in pixels" } desc => "The radius of the brush in pixels" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
radius = GIMP_BRUSH_GENERATED (brush)->radius;
else
success = FALSE;
} }
CODE CODE
); );
@ -462,20 +464,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'spikes', type => 'int32', no_declare => '1', { name => 'spikes', type => 'int32', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->spikes',
desc => "The number of spikes on the brush." } desc => "The number of spikes on the brush." }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
else
success = FALSE;
} }
CODE CODE
); );
@ -498,20 +500,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'hardness', type => 'float', no_declare => '1', { name => 'hardness', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->hardness',
desc => "The hardness of the brush." } desc => "The hardness of the brush." }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
else
success = FALSE;
} }
CODE CODE
); );
@ -532,20 +534,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'aspect_ratio', type => 'float', no_declare => '1', { name => 'aspect_ratio', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->aspect_ratio',
desc => "The aspect ratio of the brush." } desc => "The aspect ratio of the brush." }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
else
success = FALSE;
} }
CODE CODE
); );
@ -566,20 +568,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'angle', type => 'float', no_declare => '1', { name => 'angle', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->angle',
desc => "The rotation angle of the brush." } desc => "The rotation angle of the brush." }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); if (GIMP_IS_BRUSH_GENERATED (brush))
angle = GIMP_BRUSH_GENERATED (brush)->angle;
else
success = FALSE;
} }
CODE CODE
); );
@ -602,10 +604,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
@ -639,20 +640,22 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'shape_out', type => 'int32', no_declare => '1', { name => 'shape_out', type => 'int32', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->shape',
desc => "The brush shape actually assigned" } desc => "The brush shape actually assigned" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush), shape_in); {
gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush),
shape_in);
shape_out = GIMP_BRUSH_GENERATED (brush)->shape;
}
else else
success = FALSE; success = FALSE;
} }
@ -678,20 +681,22 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'radius_out', type => 'float', no_declare => '1', { name => 'radius_out', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->radius',
desc => "The brush radius actually assigned" } desc => "The brush radius actually assigned" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush), radius_in); {
gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush),
radius_in);
radius_out = GIMP_BRUSH_GENERATED (brush)->radius;
}
else else
success = FALSE; success = FALSE;
} }
@ -717,20 +722,22 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'spikes_out', type => 'int32', no_declare => '1', { name => 'spikes_out', type => 'int32', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->spikes',
desc => "The number of spikes actually assigned" } desc => "The number of spikes actually assigned" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush), spikes_in); {
gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush),
spikes_in);
spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes;
}
else else
success = FALSE; success = FALSE;
} }
@ -756,20 +763,22 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'hardness_out', type => 'float', no_declare => '1', { name => 'hardness_out', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->hardness',
desc => "The brush hardness actually assigned" } desc => "The brush hardness actually assigned" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush), hardness_in); {
gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush),
hardness_in);
hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness;
}
else else
success = FALSE; success = FALSE;
} }
@ -795,20 +804,22 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'aspect_ratio_out', type => 'float', no_declare => '1', { name => 'aspect_ratio_out', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->aspect_ratio',
desc => "The brush aspect ratio actually assigned" } desc => "The brush aspect ratio actually assigned" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush), aspect_ratio_in); {
gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush),
aspect_ratio_in);
aspect_ratio_out = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
}
else else
success = FALSE; success = FALSE;
} }
@ -834,20 +845,22 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'angle_out', type => 'float', no_declare => '1', { name => 'angle_out', type => 'float', init => 1,
alias => 'GIMP_BRUSH_GENERATED (brush)->angle',
desc => "The brush rotation angle actually assigned" } desc => "The brush rotation angle actually assigned" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush), angle_in); {
gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush),
angle_in);
angle_out = GIMP_BRUSH_GENERATED (brush)->angle;
}
else else
success = FALSE; success = FALSE;
} }

View File

@ -66,23 +66,32 @@ sub brushes_get_brush {
&std_pdb_deprecated ('gimp-context-get-brush'); &std_pdb_deprecated ('gimp-context-get-brush');
@outargs = ( @outargs = (
{ name => 'name', type => 'string', no_declare => 1, { name => 'name', type => 'string', init => 1,
desc => 'The brush name', desc => 'The brush name' },
alias => 'g_strdup (GIMP_OBJECT (brush)->name)' }, { name => 'width', type => 'int32', init => 1,
{ name => 'width', type => 'int32', no_declare => 1, desc => 'The brush width' },
desc => 'The brush width', { name => 'height', type => 'int32', init => 1,
alias => 'brush->mask->width' }, desc => 'The brush height' },
{ name => 'height', type => 'int32', no_declare => 1, { name => 'spacing', type => '0 <= int32 <= 1000', init => 1,
desc => 'The brush height', desc => 'The brush spacing: %%desc%%' }
alias => 'brush->mask->height' },
{ name => 'spacing', type => '0 <= int32 <= 1000', no_declare => 1,
desc => 'The brush spacing: %%desc%%',
alias => 'gimp_brush_get_spacing (brush)' }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush' ], code =><<'CODE'
code => 'success = (brush = gimp_context_get_brush (context)) != NULL;' {
GimpBrush *brush = gimp_context_get_brush (context);
if (brush)
{
name = g_strdup (GIMP_OBJECT (brush)->name);
width = brush->mask->width;
height = brush->mask->height;
spacing = gimp_brush_get_spacing (brush);
}
else
success = FALSE;
}
CODE
); );
} }
@ -90,10 +99,21 @@ sub brushes_get_spacing {
&std_pdb_deprecated ('gimp-brush-get-spacing'); &std_pdb_deprecated ('gimp-brush-get-spacing');
@outargs = ( @outargs = (
{ name => 'spacing', type => '0 <= int32 <= 1000', { name => 'spacing', type => '0 <= int32 <= 1000', init => 1,
desc => 'The brush spacing: %%desc%%', desc => 'The brush spacing: %%desc%%' }
alias => 'gimp_brush_get_spacing (gimp_context_get_brush (context))', );
no_declare => 1 }
%invoke = (
code =><<'CODE'
{
GimpBrush *brush = gimp_context_get_brush (context);
if (brush)
spacing = gimp_brush_get_spacing (brush);
else
success = FALSE;
}
CODE
); );
} }
@ -120,25 +140,18 @@ sub brushes_get_brush_data {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', no_declare => 1, { name => 'actual_name', type => 'string', init => 1,
desc => 'The brush name', desc => 'The brush name' },
alias => 'g_strdup (GIMP_OBJECT (brush)->name)' }, { name => 'opacity', type => '0 <= float <= 100', init => 1,
{ name => 'opacity', type => '0 <= float <= 100', no_declare => 1, desc => 'The brush opacity: %%desc%%' },
desc => 'The brush opacity: %%desc%%', { name => 'spacing', type => '0 <= int32 <= 1000', init => 1,
alias => '1.0' }, desc => 'The brush spacing: %%desc%%' },
{ name => 'spacing', type => '0 <= int32 <= 1000', no_declare => 1, { name => 'paint_mode', type => 'enum GimpLayerModeEffects', init => 1,
desc => 'The brush spacing: %%desc%%', desc => 'The paint mode: { %%desc%% }' },
alias => 'gimp_brush_get_spacing (brush)' }, { name => 'width', type => 'int32', init => 1,
{ name => 'paint_mode', type => 'enum GimpLayerModeEffects', desc => 'The brush width' },
no_declare => 1, { name => 'height', type => 'int32', init => 1,
desc => 'The paint mode: { %%desc%% }', desc => 'The brush height' },
alias => '0' },
{ name => 'width', type => 'int32', no_declare => 1,
desc => 'The brush width',
alias => 'brush->mask->width' },
{ name => 'height', type => 'int32', no_declare => 1,
desc => 'The brush height',
alias => 'brush->mask->height' },
{ name => 'mask_data', type => 'int8array', init => 1, { name => 'mask_data', type => 'int8array', init => 1,
desc => 'The brush mask data', desc => 'The brush mask data',
array => { name => 'length', init => 1, array => { name => 'length', init => 1,
@ -146,9 +159,10 @@ sub brushes_get_brush_data {
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
GimpBrush *brush;
if (name && strlen (name)) if (name && strlen (name))
{ {
brush = (GimpBrush *) brush = (GimpBrush *)
@ -161,8 +175,14 @@ sub brushes_get_brush_data {
if (brush) if (brush)
{ {
length = brush->mask->height * brush->mask->width; actual_name = g_strdup (GIMP_OBJECT (brush)->name);
mask_data = g_memdup (temp_buf_data (brush->mask), length); opacity = 1.0;
spacing = gimp_brush_get_spacing (brush);
paint_mode = 0;
width = brush->mask->width;
height = brush->mask->height;
length = brush->mask->height * brush->mask->width;
mask_data = g_memdup (temp_buf_data (brush->mask), length);
} }
else else
success = FALSE; success = FALSE;

View File

@ -39,13 +39,9 @@ HELP
code => <<'CODE' code => <<'CODE'
{ {
if (gimp->current_plug_in && gimp->current_plug_in->open) if (gimp->current_plug_in && gimp->current_plug_in->open)
{ success = plug_in_context_push (gimp->current_plug_in);
success = plug_in_context_push (gimp->current_plug_in);
}
else else
{ success = FALSE;
success = FALSE;
}
} }
CODE CODE
); );
@ -66,13 +62,9 @@ HELP
code => <<'CODE' code => <<'CODE'
{ {
if (gimp->current_plug_in && gimp->current_plug_in->open) if (gimp->current_plug_in && gimp->current_plug_in->open)
{ success = plug_in_context_pop (gimp->current_plug_in);
success = plug_in_context_pop (gimp->current_plug_in);
}
else else
{ success = FALSE;
success = FALSE;
}
} }
CODE CODE
); );
@ -88,15 +80,21 @@ HELP
&mitch_pdb_misc('2005', '2.4'); &mitch_pdb_misc('2005', '2.4');
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'name', type => 'string', init => 1,
desc => 'The name of the active paint method', desc => 'The name of the active paint method' }
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info)))',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPaintInfo *paint_info' ], code => <<'CODE'
code => 'success = (paint_info = gimp_context_get_paint_info (context)) != NULL;' {
GimpPaintInfo *paint_info = gimp_context_get_paint_info (context);
if (paint_info)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info)));
else
success = FALSE;
}
CODE
); );
} }
@ -120,10 +118,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpPaintInfo *paint_info' ],
code => <<'CODE' code => <<'CODE'
{ {
paint_info = (GimpPaintInfo *) GimpPaintInfo *paint_info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, name); gimp_container_get_child_by_name (gimp->paint_info_list, name);
if (paint_info) if (paint_info)
@ -341,15 +338,21 @@ HELP
&pdb_misc; &pdb_misc;
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'name', type => 'string', init => 1,
desc => 'The name of the active brush', desc => 'The name of the active brush' }
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)))',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush' ], code => <<'CODE'
code => 'success = (brush = gimp_context_get_brush (context)) != NULL;' {
GimpBrush *brush = gimp_context_get_brush (context);
if (brush)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
else
success = FALSE;
}
CODE
); );
} }
@ -372,10 +375,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpBrush *brush' ],
code => <<'CODE' code => <<'CODE'
{ {
brush = (GimpBrush *) GimpBrush *brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name); gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush) if (brush)
@ -399,15 +401,21 @@ HELP
&pdb_misc; &pdb_misc;
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'name', type => 'string', init => 1,
desc => 'The name of the active pattern', desc => 'The name of the active pattern' }
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)))',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPattern *pattern' ], code => <<'CODE'
code => 'success = (pattern = gimp_context_get_pattern (context)) != NULL;' {
GimpPattern *pattern = gimp_context_get_pattern (context);
if (pattern)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)));
else
success = FALSE;
}
CODE
); );
} }
@ -430,10 +438,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpPattern *pattern' ],
code => <<'CODE' code => <<'CODE'
{ {
pattern = (GimpPattern *) GimpPattern *pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name); gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
if (pattern) if (pattern)
@ -455,15 +462,21 @@ HELP
&pdb_misc; &pdb_misc;
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'name', type => 'string', init => 1,
desc => 'The name of the active gradient', desc => 'The name of the active gradient' }
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)))',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient' ], code => <<'CODE'
code => 'success = (gradient = gimp_context_get_gradient (context)) != NULL;' {
GimpGradient *gradient = gimp_context_get_gradient (context);
if (gradient)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)));
else
success = FALSE;
}
CODE
); );
} }
@ -486,10 +499,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient' ],
code => <<'CODE' code => <<'CODE'
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -511,15 +523,21 @@ HELP
&pdb_misc; &pdb_misc;
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'name', type => 'string', init => 1,
desc => 'The name of the active palette', desc => 'The name of the active palette' }
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)))',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette' ], code => <<'CODE'
code => 'success = (palette = gimp_context_get_palette (context)) != NULL;' {
GimpPalette *palette = gimp_context_get_palette (context);
if (palette)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)));
else
success = FALSE;
}
CODE
); );
} }
@ -542,10 +560,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette' ],
code => <<'CODE' code => <<'CODE'
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette) if (palette)
@ -567,15 +584,21 @@ HELP
&pdb_misc; &pdb_misc;
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'name', type => 'string', init => 1,
desc => 'The name of the active font', desc => 'The name of the active font' }
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (font)))',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpFont *font' ], code => <<'CODE'
code => 'success = (font = gimp_context_get_font (context)) != NULL;' {
GimpFont *font = gimp_context_get_font (context);
if (font)
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (font)));
else
success = FALSE;
}
CODE
); );
} }
@ -598,10 +621,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpFont *font' ],
code => <<'CODE' code => <<'CODE'
{ {
font = (GimpFont *) GimpFont *font = (GimpFont *)
gimp_container_get_child_by_name (gimp->fonts, name); gimp_container_get_child_by_name (gimp->fonts, name);
if (font) if (font)

View File

@ -521,12 +521,15 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ],
code => <<'CODE' code => <<'CODE'
{ {
if (x < gimp_item_width (GIMP_ITEM (drawable)) && if (x < gimp_item_width (GIMP_ITEM (drawable)) &&
y < gimp_item_height (GIMP_ITEM (drawable))) y < gimp_item_height (GIMP_ITEM (drawable)))
{ {
Tile *tile;
guint8 *p;
gint b;
num_channels = gimp_drawable_bytes (drawable); num_channels = gimp_drawable_bytes (drawable);
pixel = g_new (guint8, num_channels); pixel = g_new (guint8, num_channels);
@ -577,13 +580,16 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ],
code => <<'CODE' code => <<'CODE'
{ {
if (x < gimp_item_width (GIMP_ITEM (drawable)) && if (x < gimp_item_width (GIMP_ITEM (drawable)) &&
y < gimp_item_height (GIMP_ITEM (drawable)) && y < gimp_item_height (GIMP_ITEM (drawable)) &&
num_channels == gimp_drawable_bytes (drawable)) num_channels == gimp_drawable_bytes (drawable))
{ {
Tile *tile;
guint8 *p;
gint b;
tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y, tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y,
TRUE, TRUE); TRUE, TRUE);

View File

@ -44,15 +44,14 @@ sub transform_options_default_args () {
} }
sub transform_invoke { sub transform_invoke {
my ($progress_text, $assemble_matrix, $variables, $check) = @_; my ($progress_text, $assemble_matrix, $check) = @_;
my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));'; my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));';
if ($check) { if ($check) {
$success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) &&\n" . $check; $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");";
} }
%invoke = ( %invoke = (
vars => $variables,
code => <<"CODE" code => <<"CODE"
{ {
gint x, y, width, height; gint x, y, width, height;
@ -86,15 +85,14 @@ CODE
} }
sub transform_default_invoke { sub transform_default_invoke {
my ($progress_text, $assemble_matrix, $variables, $check) = @_; my ($progress_text, $assemble_matrix, $check) = @_;
my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));'; my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));';
if ($check) { if ($check) {
$success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) &&\n" . $check; $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");";
} }
%invoke = ( %invoke = (
vars => $variables,
code => <<"CODE" code => <<"CODE"
{ {
gint x, y, width, height; gint x, y, width, height;
@ -316,8 +314,7 @@ HELP
push @inargs, push @inargs,
{ name => "$_$pos", type => 'float', { name => "$_$pos", type => 'float',
desc => "The new $_ coordinate of $where corner of original desc => "The new $_ coordinate of $where corner of original
bounding box", bounding box" }
alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
} }
$pos++; $pos++;
} }
@ -330,14 +327,14 @@ HELP
desc => 'The newly mapped drawable' } desc => 'The newly mapped drawable' }
); );
transform_invoke ("Perspective", <<CODE, [ 'gdouble trans_info[8]' ]); transform_invoke ("Perspective", <<CODE);
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_perspective (&matrix, gimp_transform_matrix_perspective (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], trans_info[Y0], x0, y0,
trans_info[X1], trans_info[Y1], x1, y1,
trans_info[X2], trans_info[Y2], x2, y2,
trans_info[X3], trans_info[Y3]); x3, y3);
CODE CODE
} }
@ -366,8 +363,7 @@ HELP
push @inargs, push @inargs,
{ name => "$_$pos", type => 'float', { name => "$_$pos", type => 'float',
desc => "The new $_ coordinate of $where corner of original desc => "The new $_ coordinate of $where corner of original
bounding box", bounding box" }
alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
} }
$pos++; $pos++;
} }
@ -380,14 +376,14 @@ HELP
desc => 'The newly mapped drawable' } desc => 'The newly mapped drawable' }
); );
transform_default_invoke ("Perspective", <<CODE, [ 'gdouble trans_info[8]' ]); transform_default_invoke ("Perspective", <<CODE);
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_perspective (&matrix, gimp_transform_matrix_perspective (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], trans_info[Y0], x0, y0,
trans_info[X1], trans_info[Y1], x1, y1,
trans_info[X2], trans_info[Y2], x2, y2,
trans_info[X3], trans_info[Y3]); x3, y3);
CODE CODE
} }
@ -559,20 +555,16 @@ HELP
desc => 'The affected drawable' }, desc => 'The affected drawable' },
{ name => 'x0', type => 'float', { name => 'x0', type => 'float',
desc => 'The new x coordinate of the upper-left corner of the desc => 'The new x coordinate of the upper-left corner of the
scaled region', scaled region' },
alias => 'trans_info[X0]', no_declare => 1 },
{ name => 'y0', type => 'float', { name => 'y0', type => 'float',
desc => 'The new y coordinate of the upper-left corner of the desc => 'The new y coordinate of the upper-left corner of the
scaled region', scaled region' },
alias => 'trans_info[Y0]', no_declare => 1 },
{ name => 'x1', type => 'float', { name => 'x1', type => 'float',
desc => 'The new x coordinate of the lower-right corner of the desc => 'The new x coordinate of the lower-right corner of the
scaled region', scaled region' },
alias => 'trans_info[X1]', no_declare => 1 },
{ name => 'y1', type => 'float', { name => 'y1', type => 'float',
desc => 'The new y coordinate of the lower-right corner of the desc => 'The new y coordinate of the lower-right corner of the
scaled region', scaled region' },
alias => 'trans_info[Y1]', no_declare => 1 },
&transform_options_args &transform_options_args
); );
@ -581,18 +573,14 @@ HELP
desc => 'The scaled drawable' } desc => 'The scaled drawable' }
); );
transform_invoke ("Scaling", <<CODE, [ 'gdouble trans_info[4]' ], <<CODE2); transform_invoke ("Scaling", <<CODE, 'x0 < x1 && y0 < y1');
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_scale (&matrix, gimp_transform_matrix_scale (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], x0, y0,
trans_info[Y0], x1 - x0,
trans_info[X1] - trans_info[X0], y1 - y0);
trans_info[Y1] - trans_info[Y0]);
CODE CODE
trans_info[X0] < trans_info[X1] &&
trans_info[Y0] < trans_info[Y1]);
CODE2
} }
@ -612,20 +600,16 @@ HELP
desc => 'The affected drawable' }, desc => 'The affected drawable' },
{ name => 'x0', type => 'float', { name => 'x0', type => 'float',
desc => 'The new x coordinate of the upper-left corner of the desc => 'The new x coordinate of the upper-left corner of the
scaled region', scaled region' },
alias => 'trans_info[X0]', no_declare => 1 },
{ name => 'y0', type => 'float', { name => 'y0', type => 'float',
desc => 'The new y coordinate of the upper-left corner of the desc => 'The new y coordinate of the upper-left corner of the
scaled region', scaled region' },
alias => 'trans_info[Y0]', no_declare => 1 },
{ name => 'x1', type => 'float', { name => 'x1', type => 'float',
desc => 'The new x coordinate of the lower-right corner of the desc => 'The new x coordinate of the lower-right corner of the
scaled region', scaled region' },
alias => 'trans_info[X1]', no_declare => 1 },
{ name => 'y1', type => 'float', { name => 'y1', type => 'float',
desc => 'The new y coordinate of the lower-right corner of the desc => 'The new y coordinate of the lower-right corner of the
scaled region', scaled region' },
alias => 'trans_info[Y1]', no_declare => 1 },
&transform_options_default_args &transform_options_default_args
); );
@ -634,18 +618,14 @@ HELP
desc => 'The scaled drawable' } desc => 'The scaled drawable' }
); );
transform_default_invoke ("Scaling", <<CODE, [ 'gdouble trans_info[4]' ], <<CODE2); transform_default_invoke ("Scaling", <<CODE, 'x0 < x1 && y0 < y1');
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_scale (&matrix, gimp_transform_matrix_scale (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], x0, y0,
trans_info[Y0], x1 - x0,
trans_info[X1] - trans_info[X0], y1 - y0);
trans_info[Y1] - trans_info[Y0]);
CODE CODE
trans_info[X0] < trans_info[X1] &&
trans_info[Y0] < trans_info[Y1]);
CODE2
} }

View File

@ -28,7 +28,7 @@ sub _gen_gradient_search_for_segment_code
return <<"CODE"; return <<"CODE";
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -83,7 +83,6 @@ HELP
} }
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => &_gen_gradient_search_for_segment_code(<<"CODE"), code => &_gen_gradient_search_for_segment_code(<<"CODE"),
color.a = opacity / 100.0; color.a = opacity / 100.0;
gimp_gradient_segment_set_${side}_color (gradient, seg, &color); gimp_gradient_segment_set_${side}_color (gradient, seg, &color);
@ -119,7 +118,6 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => &_gen_gradient_search_for_segment_code(<<"CODE"), code => &_gen_gradient_search_for_segment_code(<<"CODE"),
gimp_gradient_segment_get_${side}_color (gradient, seg, &color); gimp_gradient_segment_get_${side}_color (gradient, seg, &color);
opacity = color.a * 100.0; opacity = color.a * 100.0;
@ -159,7 +157,6 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => &_gen_gradient_search_for_segment_code(<<"CODE"), code => &_gen_gradient_search_for_segment_code(<<"CODE"),
pos = gimp_gradient_segment_get_${side}_pos (gradient, seg); pos = gimp_gradient_segment_get_${side}_pos (gradient, seg);
CODE CODE
@ -212,7 +209,6 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => &_gen_gradient_search_for_segment_code(<<"CODE"), code => &_gen_gradient_search_for_segment_code(<<"CODE"),
final_pos = final_pos =
gimp_gradient_segment_set_${side}_pos (gradient, seg, pos); gimp_gradient_segment_set_${side}_pos (gradient, seg, pos);
@ -235,19 +231,24 @@ sub gradient_new {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'actual_name', type => 'string', init => 1,
desc => 'The actual new gradient name', desc => 'The actual new gradient name' }
alias => 'g_strdup (GIMP_OBJECT (data)->name)', no_declare => 1 },
); );
%invoke = ( %invoke = (
vars => [ 'GimpData *data = NULL'],
code => <<'CODE' code => <<'CODE'
{ {
if (strlen (name)) if (strlen (name))
data = gimp_data_factory_data_new (gimp->gradient_factory, name); {
GimpData *data = gimp_data_factory_data_new (gimp->gradient_factory, name);
success = (data != NULL); if (data)
actual_name = g_strdup (GIMP_OBJECT (data)->name);
else
success = FALSE;
}
else
success = FALSE;
} }
CODE CODE
); );
@ -265,27 +266,26 @@ sub gradient_duplicate {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'copy_name', type => 'string', init => 1,
desc => "The name of the gradient's copy", desc => "The name of the gradient's copy" }
alias => 'g_strdup (GIMP_OBJECT (gradient_copy)->name)',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL',
'GimpGradient *gradient_copy = NULL' ],
code => <<"CODE" code => <<"CODE"
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
{ {
gradient_copy = (GimpGradient *) GimpGradient *gradient_copy = (GimpGradient *)
gimp_data_factory_data_duplicate (gimp->gradient_factory, gimp_data_factory_data_duplicate (gimp->gradient_factory,
GIMP_DATA (gradient)); GIMP_DATA (gradient));
success = (gradient_copy != NULL); if (gradient_copy)
copy_name = g_strdup (GIMP_OBJECT (gradient_copy)->name);
else
success = FALSE;
} }
else else
success = FALSE; success = FALSE;
@ -306,21 +306,18 @@ sub gradient_is_editable {
); );
@outargs = ( @outargs = (
{ name => 'editable', type => 'boolean', { name => 'editable', type => 'boolean', init => 1,
desc => "True if the gradient can be edited", desc => "True if the gradient can be edited" }
alias => 'GIMP_DATA (gradient)->writable',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
success = TRUE; editable = GIMP_DATA (gradient)->writable;
else else
success = FALSE; success = FALSE;
} }
@ -342,20 +339,21 @@ sub gradient_rename {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'actual_name', type => 'string', init => 1,
desc => "The actual new name of the gradient", desc => "The actual new name of the gradient" }
alias => 'g_strdup (GIMP_OBJECT (gradient)->name)', no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => <<"CODE" code => <<"CODE"
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient && GIMP_DATA (gradient)->writable) if (gradient && GIMP_DATA (gradient)->writable)
gimp_object_set_name (GIMP_OBJECT (gradient), new_name); {
gimp_object_set_name (GIMP_OBJECT (gradient), new_name);
actual_name = g_strdup (GIMP_OBJECT (gradient)->name);
}
else else
success = FALSE; success = FALSE;
} }
@ -375,10 +373,9 @@ sub gradient_delete {
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => <<"CODE" code => <<"CODE"
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient && GIMP_DATA (gradient)->deletable) if (gradient && GIMP_DATA (gradient)->deletable)
@ -443,10 +440,9 @@ HELP
&sample_outargs; &sample_outargs;
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient' ],
code => <<'CODE' code => <<'CODE'
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -510,10 +506,9 @@ HELP
&sample_outargs; &sample_outargs;
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient' ],
code => <<'CODE' code => <<'CODE'
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)
@ -621,7 +616,6 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => &_gen_gradient_search_for_segment_code(<<"CODE"), code => &_gen_gradient_search_for_segment_code(<<"CODE"),
blend_func = blend_func =
gimp_gradient_segment_get_blending_function (gradient, seg); gimp_gradient_segment_get_blending_function (gradient, seg);
@ -654,7 +648,6 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => &_gen_gradient_search_for_segment_code(<<"CODE"), code => &_gen_gradient_search_for_segment_code(<<"CODE"),
coloring_type = coloring_type =
gimp_gradient_segment_get_coloring_type (gradient, seg); gimp_gradient_segment_get_coloring_type (gradient, seg);
@ -693,10 +686,9 @@ sub _gen_gradient_operate_on_segments_range
$action_on_success =~ s/^$indent/' ' x 14/meg; $action_on_success =~ s/^$indent/' ' x 14/meg;
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => <<"CODE", code => <<"CODE",
{ {
gradient = (GimpGradient *) GimpGradient *gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name); gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient) if (gradient)

View File

@ -183,20 +183,19 @@ sub gradients_get_gradient_data {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'actual_name', type => 'string', init => 1,
desc => 'The gradient name', desc => 'The gradient name' },
alias => 'g_strdup (GIMP_OBJECT (gradient)->name)', no_declare => 1 },
{ name => 'grad_data', type => 'floatarray', alias => 'values', { name => 'grad_data', type => 'floatarray', alias => 'values',
desc => 'The gradient sample data', init => 1, desc => 'The gradient sample data', init => 1,
array => { name => 'width', array => { name => 'width', init => 1,
desc => 'The gradient sample width (r,g,b,a)', desc => 'The gradient sample width (r,g,b,a)' } }
alias => 'sample_size * 4', no_declare => 1 } }
); );
%invoke = ( %invoke = (
vars => [ 'GimpGradient *gradient = NULL' ],
code => <<"CODE" code => <<"CODE"
{ {
GimpGradient *gradient;
if (name && strlen (name)) if (name && strlen (name))
{ {
gradient = (GimpGradient *) gradient = (GimpGradient *)
@ -214,15 +213,17 @@ sub gradients_get_gradient_data {
gdouble *pv; gdouble *pv;
gdouble pos, delta; gdouble pos, delta;
GimpRGB color; GimpRGB color;
gint i;
i = sample_size;
pos = 0.0; pos = 0.0;
delta = 1.0 / (i - 1); delta = 1.0 / (sample_size - 1);
pv = values = g_new (gdouble, i * 4); actual_name = g_strdup (GIMP_OBJECT (gradient)->name);
values = g_new (gdouble, sample_size * 4);
width = sample_size * 4;
while (i--) pv = values;
while (sample_size)
{ {
seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color); seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color);

View File

@ -1395,10 +1395,9 @@ CODE2
$outargs[0]->{init} = 1; $outargs[0]->{init} = 1;
%invoke = ( %invoke = (
vars => [ 'gchar *filename' ],
code => <<'CODE2' code => <<'CODE2'
{ {
filename = gimp_image_get_filename (gimage); gchar *filename = gimp_image_get_filename (gimage);
if (filename) if (filename)
name = g_filename_display_basename (filename); name = g_filename_display_basename (filename);

View File

@ -29,19 +29,24 @@ sub palette_new {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'actual_name', type => 'string', init => 1,
desc => 'The actual new palette name', desc => 'The actual new palette name' }
alias => 'g_strdup (GIMP_OBJECT (data)->name)', no_declare => 1 },
); );
%invoke = ( %invoke = (
vars => [ 'GimpData *data = NULL'],
code => <<'CODE' code => <<'CODE'
{ {
if (strlen (name)) if (strlen (name))
data = gimp_data_factory_data_new (gimp->palette_factory, name); {
GimpData *data = gimp_data_factory_data_new (gimp->palette_factory, name);
success = (data != NULL); if (data)
actual_name = g_strdup (GIMP_OBJECT (data)->name);
else
success = FALSE;
}
else
success = FALSE;
} }
CODE CODE
); );
@ -59,21 +64,18 @@ sub palette_is_editable {
); );
@outargs = ( @outargs = (
{ name => 'editable', type => 'boolean', { name => 'editable', type => 'boolean', init => 1,
desc => "True if the palette can be edited", desc => "True if the palette can be edited" }
alias => 'GIMP_DATA (palette)->writable',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette) if (palette)
success = TRUE; editable = GIMP_DATA (palette)->writable;
else else
success = FALSE; success = FALSE;
} }
@ -93,14 +95,11 @@ sub palette_duplicate {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'copy_name', type => 'string', init => 1,
desc => "The name of the palette's copy", desc => "The name of the palette's copy" }
alias => 'g_strdup (GIMP_OBJECT (palette_copy)->name)',
no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette_copy = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
GimpPalette *palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
@ -108,11 +107,14 @@ sub palette_duplicate {
if (palette) if (palette)
{ {
palette_copy = (GimpPalette *) GimpPalette *palette_copy = (GimpPalette *)
gimp_data_factory_data_duplicate (gimp->palette_factory, gimp_data_factory_data_duplicate (gimp->palette_factory,
GIMP_DATA (palette)); GIMP_DATA (palette));
success = (palette_copy != NULL); if (palette_copy)
copy_name = g_strdup (GIMP_OBJECT (palette_copy)->name);
else
success = FALSE;
} }
else else
success = FALSE; success = FALSE;
@ -135,20 +137,21 @@ sub palette_rename {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', { name => 'actual_name', type => 'string', init => 1,
desc => "The actual new name of the palette", desc => "The actual new name of the palette" }
alias => 'g_strdup (GIMP_OBJECT (palette)->name)', no_declare => 1 },
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable) if (palette && GIMP_DATA (palette)->writable)
gimp_object_set_name (GIMP_OBJECT (palette), new_name); {
gimp_object_set_name (GIMP_OBJECT (palette), new_name);
actual_name = g_strdup (GIMP_OBJECT (palette)->name);
}
else else
success = FALSE; success = FALSE;
} }
@ -210,19 +213,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'num_colors', type => 'int32', no_declare => '1', { name => 'num_colors', type => 'int32', void_ret => '1', init => 1,
alias => 'palette->n_colors', void_ret => '1',
desc => "The number of colors in the palette" } desc => "The number of colors in the palette" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
success = (palette != NULL); if (palette)
num_colors = palette->n_colors;
else
success = FALSE;
} }
CODE CODE
); );
@ -243,19 +247,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'num_columns', type => 'int32', no_declare => '0', { name => 'num_columns', type => 'int32', init => 1,
alias => 'palette->n_columns',
desc => "The number of columns used to display this palette" } desc => "The number of columns used to display this palette" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
success = (palette != NULL); if (palette)
num_columns = palette->n_columns;
else
success = FALSE;
} }
CODE CODE
); );
@ -313,20 +318,23 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'entry_num', type => 'int32', void_ret => '1', { name => 'entry_num', type => 'int32', void_ret => '1', init => 1,
alias => 'entry->position', no_declare => '1',
desc => 'The index of the added entry' } desc => 'The index of the added entry' }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPaletteEntry *entry = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
GimpPalette *palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name); gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable) if (palette && GIMP_DATA (palette)->writable)
entry = gimp_palette_add_entry (palette, -1, entry_name, &color); {
GimpPaletteEntry *entry =
gimp_palette_add_entry (palette, -1, entry_name, &color);
entry_num = entry->position;
}
else else
success = FALSE; success = FALSE;
} }
@ -484,13 +492,11 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'entry_name', type => 'string', void_ret => 1, { name => 'entry_name', type => 'string', void_ret => 1, init => 1,
no_declare => '1', alias => 'g_strdup (entry->name)',
desc => 'The name requested' } desc => 'The name requested' }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPaletteEntry *entry = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
GimpPalette *palette = (GimpPalette *) GimpPalette *palette = (GimpPalette *)
@ -499,7 +505,11 @@ HELP
if (palette) if (palette)
{ {
if (entry_num >= 0 && entry_num < palette->n_colors) if (entry_num >= 0 && entry_num < palette->n_colors)
entry = g_list_nth_data (palette->colors, entry_num); {
GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num);
entry_name = g_strdup (entry->name);
}
else else
success = FALSE; success = FALSE;
} }

View File

@ -65,17 +65,26 @@ sub palettes_get_palette {
&std_pdb_deprecated ('gimp-context-get-palette'); &std_pdb_deprecated ('gimp-context-get-palette');
@outargs = ( @outargs = (
{ name => 'name', type => 'string', no_declare => 1, { name => 'name', type => 'string', init => 1,
desc => 'The palette name', null_ok => '1', desc => 'The palette name', null_ok => '1' },
alias => 'g_strdup (GIMP_OBJECT (palette)->name)' }, { name => 'num_colors', type => 'int32', init => 1,
{ name => 'num_colors', type => 'int32', no_declare => 1, desc => 'The palette num_colors' }
desc => 'The palette num_colors',
alias => 'palette->n_colors' }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette' ], code => <<'CODE'
code => 'success = (palette = gimp_context_get_palette (context)) != NULL;' {
GimpPalette *palette = gimp_context_get_palette (context);
if (palette)
{
name = g_strdup (GIMP_OBJECT (palette)->name);
num_colors = palette->n_colors;
}
else
success = FALSE;
}
CODE
); );
} }
@ -91,20 +100,19 @@ sub palettes_get_palette_entry {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', no_declare => 1, { name => 'actual_name', type => 'string', init => 1,
desc => 'The palette name', null_ok => '1', desc => 'The palette name' },
alias => 'g_strdup (GIMP_OBJECT (palette)->name)' }, { name => 'num_colors', type => 'int32', init => 1,
{ name => 'num_colors', type => 'int32', no_declare => 1, desc => 'The palette num_colors' },
desc => 'The palette num_colors',
alias => 'palette->n_colors' },
{ name => 'color', type => 'color', void_ret => 1, { name => 'color', type => 'color', void_ret => 1,
desc => 'The color requested' } desc => 'The color requested' }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<"CODE" code => <<"CODE"
{ {
GimpPalette *palette;
if (name && strlen (name)) if (name && strlen (name))
{ {
palette = (GimpPalette *) palette = (GimpPalette *)
@ -118,19 +126,16 @@ sub palettes_get_palette_entry {
if (palette) if (palette)
{ {
if (entry_num < 0 || entry_num >= palette->n_colors) if (entry_num >= 0 && entry_num < palette->n_colors)
{ {
success = FALSE; GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num);
actual_name = g_strdup (GIMP_OBJECT (palette)->name);
num_colors = palette->n_colors;
color = entry->color;
} }
else else
{ success = FALSE;
GimpPaletteEntry *entry;
entry = (GimpPaletteEntry *)
g_list_nth_data (palette->colors, entry_num);
color = entry->color;
}
} }
else else
success = FALSE; success = FALSE;

View File

@ -80,10 +80,9 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE' code => <<'CODE'
{ {
vectors = gimp_image_get_vectors_by_name (gimage, name); GimpVectors *vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors) if (vectors)
{ {

View File

@ -33,25 +33,28 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'width', type => 'int32', no_declare => '1', { name => 'width', type => 'int32', init => 1, void_ret => '1',
alias => 'pattern->mask->width', void_ret => '1',
desc => "The pattern width" }, desc => "The pattern width" },
{ name => 'height', type => 'int32', no_declare => '1', { name => 'height', type => 'int32', init => 1,
alias => 'pattern->mask->height',
desc => "The pattern height" }, desc => "The pattern height" },
{ name => 'bpp', type => 'int32', no_declare => '1', { name => 'bpp', type => 'int32', init => 1,
alias => 'pattern->mask->bytes',
desc => "The pattern bpp" } desc => "The pattern bpp" }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPattern *pattern = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
pattern = (GimpPattern *) GimpPattern *pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name); gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
success = (pattern != NULL); if (pattern)
{
width = pattern->mask->width;
height = pattern->mask->height;
bpp = pattern->mask->bytes;
}
else
success = FALSE;
} }
CODE CODE
); );
@ -76,14 +79,11 @@ HELP
); );
@outargs = ( @outargs = (
{ name => 'width', type => 'int32', no_declare => '1', { name => 'width', type => 'int32', init => 1, void_ret => '1',
alias => 'pattern->mask->width', void_ret => '1',
desc => "The pattern width" }, desc => "The pattern width" },
{ name => 'height', type => 'int32', no_declare => '1', { name => 'height', type => 'int32', init => 1,
alias => 'pattern->mask->height',
desc => "The pattern height" }, desc => "The pattern height" },
{ name => 'bpp', type => 'int32', no_declare => '1', { name => 'bpp', type => 'int32', init => 1,
alias => 'pattern->mask->bytes',
desc => "The pattern bpp" }, desc => "The pattern bpp" },
{ name => 'color_bytes', type => 'int8array', init => 1, { name => 'color_bytes', type => 'int8array', init => 1,
desc => 'The pattern data.', desc => 'The pattern data.',
@ -92,14 +92,16 @@ HELP
); );
%invoke = ( %invoke = (
vars => [ 'GimpPattern *pattern = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
pattern = (GimpPattern *) GimpPattern *pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name); gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
if (pattern) if (pattern)
{ {
width = pattern->mask->width;
height = pattern->mask->height;
bpp = pattern->mask->bytes;
num_color_bytes = pattern->mask->height * pattern->mask->width * num_color_bytes = pattern->mask->height * pattern->mask->width *
pattern->mask->bytes; pattern->mask->bytes;
color_bytes = g_memdup (temp_buf_data (pattern->mask), color_bytes = g_memdup (temp_buf_data (pattern->mask),

View File

@ -65,20 +65,29 @@ sub patterns_get_pattern {
&std_pdb_deprecated ('gimp-context-get-pattern'); &std_pdb_deprecated ('gimp-context-get-pattern');
@outargs = ( @outargs = (
{ name => 'name', type => 'string', no_declare => 1, { name => 'name', type => 'string', init => 1,
desc => 'The pattern name', desc => 'The pattern name' },
alias =>'g_strdup (GIMP_OBJECT (pattern)->name)' }, { name => 'width', type => 'int32', init => 1,
{ name => 'width', type => 'int32', no_declare => 1, desc => 'The pattern width' },
desc => 'The pattern width', { name => 'height', type => 'int32', init => 1,
alias => 'pattern->mask->width' }, desc => 'The pattern height' }
{ name => 'height', type => 'int32', no_declare => 1,
desc => 'The pattern height',
alias => 'pattern->mask->height' }
); );
%invoke = ( %invoke = (
vars => [ 'GimpPattern *pattern' ], code =><<'CODE'
code => 'success = (pattern = gimp_context_get_pattern (context)) != NULL;' {
GimpPattern *pattern = gimp_context_get_pattern (context);
if (pattern)
{
name = g_strdup (GIMP_OBJECT (pattern)->name);
width = pattern->mask->width;
height = pattern->mask->height;
}
else
success = FALSE;
}
CODE
); );
} }
@ -92,18 +101,14 @@ sub patterns_get_pattern_data {
); );
@outargs = ( @outargs = (
{ name => 'name', type => 'string', no_declare => 1, { name => 'actual_name', type => 'string', init => 1,
desc => 'The pattern name', desc => 'The pattern name' },
alias =>'g_strdup (GIMP_OBJECT (pattern)->name)' }, { name => 'width', type => 'int32', init => 1,
{ name => 'width', type => 'int32', no_declare => 1, desc => 'The pattern width' },
desc => 'The pattern width', { name => 'height', type => 'int32', init => 1,
alias => 'pattern->mask->width' }, desc => 'The pattern height' },
{ name => 'height', type => 'int32', no_declare => 1,
desc => 'The pattern height',
alias => 'pattern->mask->height' },
{ name => 'mask_bpp', type => 'int32', init => 1, { name => 'mask_bpp', type => 'int32', init => 1,
desc => 'Pattern bytes per pixel', desc => 'Pattern bytes per pixel' },
alias => 'pattern->mask->bytes', no_declare => 1 },
{ name => 'mask_data', type => 'int8array', init => 1, { name => 'mask_data', type => 'int8array', init => 1,
desc => 'The pattern mask data', desc => 'The pattern mask data',
array => { name => 'length', init => 1, array => { name => 'length', init => 1,
@ -111,9 +116,10 @@ sub patterns_get_pattern_data {
); );
%invoke = ( %invoke = (
vars => [ 'GimpPattern *pattern = NULL' ],
code => <<'CODE' code => <<'CODE'
{ {
GimpPattern *pattern;
if (name && strlen (name)) if (name && strlen (name))
{ {
pattern = (GimpPattern *) pattern = (GimpPattern *)
@ -127,9 +133,13 @@ sub patterns_get_pattern_data {
if (pattern) if (pattern)
{ {
length = pattern->mask->height * pattern->mask->width * actual_name = g_strdup (GIMP_OBJECT (pattern)->name);
pattern->mask->bytes; width = pattern->mask->width;
mask_data = g_memdup (temp_buf_data (pattern->mask), length); height = pattern->mask->height;
mask_bpp = pattern->mask->bytes;
length = pattern->mask->height * pattern->mask->width *
pattern->mask->bytes;
mask_data = g_memdup (temp_buf_data (pattern->mask), length);
} }
else else
success = FALSE; success = FALSE;

View File

@ -41,22 +41,20 @@ HELP
); );
@outargs = ( @outargs = (
{ name => "${type}_type", type => 'enum GimpPDBArgType (no GIMP_PDB_END)', { name => "${type}_type",
desc => "The type of $long_type { %%desc%% }", void_ret => 1, type => 'enum GimpPDBArgType (no GIMP_PDB_END)', init => 1,
alias => "${type}->arg_type", no_declare => 1 }, desc => "The type of $long_type { %%desc%% }", void_ret => 1 },
{ name => "${type}_name", type => 'string', { name => "${type}_name", type => 'string', init => 1,
desc => "The name of the $long_type", desc => "The name of the $long_type" },
alias => "g_strdup (${type}->name)", no_declare => 1 }, { name => "${type}_desc", type => 'string', init => 1,
{ name => "${type}_desc", type => 'string', desc => "A description of the $long_type" }
desc => "A description of the $long_type",
alias => "g_strdup (${type}->description)", no_declare => 1 }
); );
%invoke = ( %invoke = (
vars => [ 'ProcRecord *proc', "ProcArg *$type = NULL" ],
code => <<CODE code => <<CODE
{ {
gchar *canonical; ProcRecord *proc;
gchar *canonical;
canonical = gimp_canonicalize_identifier (proc_name); canonical = gimp_canonicalize_identifier (proc_name);
@ -75,7 +73,13 @@ HELP
g_free (canonical); g_free (canonical);
if (proc && (${type}_num >= 0 && ${type}_num < proc->num_$real_type)) if (proc && (${type}_num >= 0 && ${type}_num < proc->num_$real_type))
$type = \&proc->${real_type}\[${type}_num]; {
ProcArg *$type = \&proc->${real_type}\[${type}_num];
${type}_type = ${type}->arg_type;
${type}_name = g_strdup (${type}->name);
${type}_desc = g_strdup (${type}->description);
}
else else
success = FALSE; success = FALSE;
} }
@ -161,33 +165,39 @@ HELP
&std_pdb_misc; &std_pdb_misc;
foreach (qw(name blurb help author copyright date proc_type)) { @inargs = (
push @inargs, { name => $_, type => 'string', no_validate => 1, { name => 'name', type => 'string', no_validate => 1,
desc => "The regex for procedure $_" }; desc => 'The regex for procedure name' },
} { name => 'blurb', type => 'string', no_validate => 1,
desc => 'The regex for procedure blurb' },
$inargs[$#inargs]->{desc} =~ { name => 'help', type => 'string', no_validate => 1,
s <proc_type$> desc => 'The regex for procedure help' },
<type: { 'Internal GIMP procedure', 'GIMP Plug-In', { name => 'author', type => 'string', no_validate => 1,
'GIMP Extension', 'Temporary Procedure' }>; desc => 'The regex for procedure author' },
{ name => 'copyright', type => 'string', no_validate => 1,
desc => 'The regex for procedure copyright' },
{ name => 'date', type => 'string', no_validate => 1,
desc => 'The regex for procedure date' },
{ name => 'proc_type', type => 'string', no_validate => 1,
desc => 'The regex for procedure type: { \'Internal GIMP procedure\',
\'GIMP Plug-In\', \'GIMP Extension\',
\'Temporary Procedure\' }' }
);
@outargs = ( @outargs = (
{ name => 'procedure_names', type => 'stringarray', void_ret => 1, { name => 'procedure_names', type => 'stringarray', void_ret => 1,
desc => 'The list of procedure names', desc => 'The list of procedure names', init => 1,
alias => 'procs', no_declare => 1, array => { name => 'num_matches', init => 1,
array => { name => 'num_matches', desc => 'The number of matching procedures' } }
desc => 'The number of matching procedures',
alias => 'num_procs', no_declare => 1 }
}
); );
%invoke = ( %invoke = (
vars => [ 'gint num_procs', 'gchar **procs' ],
code => <<CODE code => <<CODE
{ {
success = procedural_db_query (gimp, success = procedural_db_query (gimp,
name, blurb, help, author, copyright, date, proc_type, name, blurb, help, author,
&num_procs, &procs); copyright, date, proc_type,
&num_matches, &procedure_names);
} }
CODE CODE
); );

View File

@ -66,8 +66,7 @@ sub perspective {
push @inargs, push @inargs,
{ name => "$_$pos", type => 'float', { name => "$_$pos", type => 'float',
desc => "The new $_ coordinate of $where corner of original desc => "The new $_ coordinate of $where corner of original
bounding box", bounding box" }
alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
} }
$pos++; $pos++;
} }
@ -78,7 +77,6 @@ sub perspective {
); );
%invoke = ( %invoke = (
vars => [ 'gdouble trans_info[8]' ],
code => <<'CODE' code => <<'CODE'
{ {
gint x, y, width, height; gint x, y, width, height;
@ -95,10 +93,10 @@ sub perspective {
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_perspective (&matrix, gimp_transform_matrix_perspective (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], trans_info[Y0], x0, y0,
trans_info[X1], trans_info[Y1], x1, y1,
trans_info[X2], trans_info[Y2], x2, y2,
trans_info[X3], trans_info[Y3]); x3, y3);
if (interpolation) if (interpolation)
interpolation_type = gimp->config->interpolation_type; interpolation_type = gimp->config->interpolation_type;
@ -187,20 +185,16 @@ sub scale {
desc => 'Whether to use interpolation' }, desc => 'Whether to use interpolation' },
{ name => 'x0', type => 'float', { name => 'x0', type => 'float',
desc => 'The new x coordinate of the upper-left corner of the desc => 'The new x coordinate of the upper-left corner of the
scaled region', scaled region' },
alias => 'trans_info[X0]', no_declare => 1 },
{ name => 'y0', type => 'float', { name => 'y0', type => 'float',
desc => 'The new y coordinate of the upper-left corner of the desc => 'The new y coordinate of the upper-left corner of the
scaled region', scaled region' },
alias => 'trans_info[Y0]', no_declare => 1 },
{ name => 'x1', type => 'float', { name => 'x1', type => 'float',
desc => 'The new x coordinate of the lower-right corner of the desc => 'The new x coordinate of the lower-right corner of the
scaled region', scaled region' },
alias => 'trans_info[X1]', no_declare => 1 },
{ name => 'y1', type => 'float', { name => 'y1', type => 'float',
desc => 'The new y coordinate of the lower-right corner of the desc => 'The new y coordinate of the lower-right corner of the
scaled region', scaled region' }
alias => 'trans_info[Y1]', no_declare => 1 }
); );
@outargs = ( @outargs = (
@ -209,14 +203,12 @@ sub scale {
); );
%invoke = ( %invoke = (
vars => [ 'gdouble trans_info[4]' ],
code => <<'CODE' code => <<'CODE'
{ {
gint x, y, width, height; gint x, y, width, height;
success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && success = (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
trans_info[X0] < trans_info[X1] && x0 < x1 && y0 < y1);
trans_info[Y0] < trans_info[Y1]);
if (success && if (success &&
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@ -228,10 +220,9 @@ sub scale {
gimp_matrix3_identity (&matrix); gimp_matrix3_identity (&matrix);
gimp_transform_matrix_scale (&matrix, gimp_transform_matrix_scale (&matrix,
x, y, width, height, x, y, width, height,
trans_info[X0], x0, y0,
trans_info[Y0], x1 - x0,
trans_info[X1] - trans_info[X0], y1 - y0);
trans_info[Y1] - trans_info[Y0]);
if (interpolation) if (interpolation)
interpolation_type = gimp->config->interpolation_type; interpolation_type = gimp->config->interpolation_type;