tools/pdbgen/pdb/brushes.pdb tools/pdbgen/pdb/gradients.pdb

2004-09-23  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/palettes.pdb
	* tools/pdbgen/pdb/patterns.pdb: removed the foos_set_foo()
	procedures and marked the foos_set_foo() ones as deprecated. For
	brushes, patterns and palettes, added foos_get_foo_info()
	procedures which work like foos_get_foo_data() but return just the
	properties, not the actual data. Allow NULL or "" to be passed
	as name to all functions (use the current brush, pattern etc.
	in this case).

	* tools/pdbgen/pdb/fonts.pdb: cleanup.

	* app/pdb/procedural_db.c: added the removed ones to the compat
	hash table.

	* libgimp/Makefile.am
	* libgimp/gimpbrushes.[ch]
	* libgimp/gimpgradients.[ch]
	* libgimp/gimppalettes.[ch]
	* libgimp/gimppatterns.[ch]: new files with compat functions
	wich call the resp. gimp_context_*() functions.

	* libgimp/gimp.h: changed accordingly.

	* app/pdb/brushes_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/palettes_cmds.c
	* app/pdb/patterns_cmds.c
	* libgimp/gimpbrushes_pdb.[ch]
	* libgimp/gimpgradients_pdb.[ch]
	* libgimp/gimppalettes_pdb.[ch]
	* libgimp/gimppatterns_pdb.[ch]: regenerated.

	* plug-ins/FractalExplorer/Dialogs.c
	* plug-ins/gfig/gfig-dialog.c
	* plug-ins/gfig/gfig-style.[ch]
	* plug-ins/gflare/gflare.c: changed accordingly.
This commit is contained in:
Michael Natterer 2004-09-23 15:05:48 +00:00 committed by Michael Natterer
parent 4009cb1a6e
commit 46989bc717
38 changed files with 966 additions and 681 deletions

View File

@ -1,3 +1,45 @@
2004-09-23 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/patterns.pdb: removed the foos_set_foo()
procedures and marked the foos_set_foo() ones as deprecated. For
brushes, patterns and palettes, added foos_get_foo_info()
procedures which work like foos_get_foo_data() but return just the
properties, not the actual data. Allow NULL or "" to be passed
as name to all functions (use the current brush, pattern etc.
in this case).
* tools/pdbgen/pdb/fonts.pdb: cleanup.
* app/pdb/procedural_db.c: added the removed ones to the compat
hash table.
* libgimp/Makefile.am
* libgimp/gimpbrushes.[ch]
* libgimp/gimpgradients.[ch]
* libgimp/gimppalettes.[ch]
* libgimp/gimppatterns.[ch]: new files with compat functions
wich call the resp. gimp_context_*() functions.
* libgimp/gimp.h: changed accordingly.
* app/pdb/brushes_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/internal_procs.c
* app/pdb/palettes_cmds.c
* app/pdb/patterns_cmds.c
* libgimp/gimpbrushes_pdb.[ch]
* libgimp/gimpgradients_pdb.[ch]
* libgimp/gimppalettes_pdb.[ch]
* libgimp/gimppatterns_pdb.[ch]: regenerated.
* plug-ins/FractalExplorer/Dialogs.c
* plug-ins/gfig/gfig-dialog.c
* plug-ins/gfig/gfig-style.[ch]
* plug-ins/gflare/gflare.c: changed accordingly.
2004-09-23 Michael Natterer <mitch@gimp.org>
* plug-ins/common/bumpmap.c (bumpmap_dialog): added a GtkPaned for

View File

@ -38,9 +38,9 @@
static ProcRecord brushes_refresh_proc;
static ProcRecord brushes_get_list_proc;
static ProcRecord brushes_get_brush_proc;
static ProcRecord brushes_set_brush_proc;
static ProcRecord brushes_get_spacing_proc;
static ProcRecord brushes_set_spacing_proc;
static ProcRecord brushes_get_brush_info_proc;
static ProcRecord brushes_get_brush_data_proc;
void
@ -49,9 +49,9 @@ register_brushes_procs (Gimp *gimp)
procedural_db_register (gimp, &brushes_refresh_proc);
procedural_db_register (gimp, &brushes_get_list_proc);
procedural_db_register (gimp, &brushes_get_brush_proc);
procedural_db_register (gimp, &brushes_set_brush_proc);
procedural_db_register (gimp, &brushes_get_spacing_proc);
procedural_db_register (gimp, &brushes_set_spacing_proc);
procedural_db_register (gimp, &brushes_get_brush_info_proc);
procedural_db_register (gimp, &brushes_get_brush_data_proc);
}
@ -70,7 +70,7 @@ static ProcRecord brushes_refresh_proc =
{
"gimp_brushes_refresh",
"Refresh current brushes. This function always succeeds.",
"This procedure retrieves all brushes currently in the user's brush path and updates the brush dialog accordingly.",
"This procedure retrieves all brushes currently in the user's brush path and updates the brush dialogs accordingly.",
"Seth Burgess",
"Seth Burgess",
"1997",
@ -139,7 +139,7 @@ static ProcRecord brushes_get_list_proc =
{
"gimp_brushes_get_list",
"Retrieve a complete listing of the available brushes.",
"This procedure returns a complete listing of available GIMP brushes. Each name returned can be used as input to the 'gimp_brushes_set_brush'.",
"This procedure returns a complete listing of available GIMP brushes. Each name returned can be used as input to the 'gimp_context_set_brush' procedure.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -216,59 +216,6 @@ static ProcRecord brushes_get_brush_proc =
{ { brushes_get_brush_invoker } }
};
static Argument *
brushes_set_brush_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
GimpBrush *brush;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush)
gimp_context_set_brush (context, brush);
else
success = FALSE;
}
return procedural_db_return_args (&brushes_set_brush_proc, success);
}
static ProcArg brushes_set_brush_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The brush name"
}
};
static ProcRecord brushes_set_brush_proc =
{
"gimp_brushes_set_brush",
"Set the specified brush as the active brush.",
"This procedure allows the active brush mask to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed brushes. If there is no matching brush found, this procedure will return an error. Otherwise, the specified brush becomes active and will be used in all subsequent paint operations.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
1,
brushes_set_brush_inargs,
0,
NULL,
{ { brushes_set_brush_invoker } }
};
static Argument *
brushes_get_spacing_invoker (Gimp *gimp,
GimpContext *context,
@ -352,6 +299,99 @@ static ProcRecord brushes_set_spacing_proc =
{ { brushes_set_spacing_invoker } }
};
static Argument *
brushes_get_brush_info_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name && !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
}
else
{
brush = gimp_context_get_brush (context);
}
if (! brush)
success = FALSE;
}
return_args = procedural_db_return_args (&brushes_get_brush_info_proc, success);
if (success)
{
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name);
return_args[2].value.pdb_int = brush->mask->width;
return_args[3].value.pdb_int = brush->mask->height;
return_args[4].value.pdb_int = brush->spacing;
}
return return_args;
}
static ProcArg brushes_get_brush_info_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The brush name (\"\" means current active brush)"
}
};
static ProcArg brushes_get_brush_info_outargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The brush name"
},
{
GIMP_PDB_INT32,
"width",
"The brush width"
},
{
GIMP_PDB_INT32,
"height",
"The brush height"
},
{
GIMP_PDB_INT32,
"spacing",
"The brush spacing: 0 <= spacing <= 1000"
}
};
static ProcRecord brushes_get_brush_info_proc =
{
"gimp_brushes_get_brush_info",
"Retrieve information about the specified brush.",
"This procedure retrieves information about the specified brush. This includes the brush name, and the brush extents (width and height).",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer <mitch@gimp.org>",
"2004",
GIMP_INTERNAL,
1,
brushes_get_brush_info_inargs,
4,
brushes_get_brush_info_outargs,
{ { brushes_get_brush_info_invoker } }
};
static Argument *
brushes_get_brush_data_invoker (Gimp *gimp,
GimpContext *context,
@ -366,12 +406,12 @@ brushes_get_brush_data_invoker (Gimp *gimp,
GimpBrush *brush = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
if (name && !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (strlen (name))
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);

View File

@ -103,6 +103,7 @@ procedural_db_init_procs (Gimp *gimp,
compat_procs[] =
{
{ "gimp_blend", "gimp_edit_blend" },
{ "gimp_brushes_set_brush", "gimp_context_set_brush" },
{ "gimp_brushes_get_opacity", "gimp_context_get_opacity" },
{ "gimp_brushes_set_opacity", "gimp_context_set_opacity" },
{ "gimp_brushes_get_paint_mode", "gimp_context_get_paint_mode" },
@ -123,8 +124,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_crop", "gimp_image_crop" },
{ "gimp_drawable_bytes", "gimp_drawable_bpp" },
{ "gimp_drawable_image", "gimp_drawable_get_image" },
{ "gimp_gradients_get_active", "gimp_gradients_get_gradient" },
{ "gimp_gradients_set_active", "gimp_gradients_set_gradient" },
{ "gimp_gradients_get_active", "gimp_context_get_gradient" },
{ "gimp_gradients_set_active", "gimp_context_set_gradient" },
{ "gimp_gradients_get_gradient", "gimp_context_get_gradient" },
{ "gimp_gradients_set_gradient", "gimp_context_set_gradient" },
{ "gimp_image_active_drawable", "gimp_image_get_active_drawable" },
{ "gimp_image_floating_selection", "gimp_image_get_floating_sel" },
{ "gimp_layer_delete", "gimp_drawable_delete" },
@ -144,7 +147,9 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_palette_set_default_colors", "gimp_context_set_default_colors" },
{ "gimp_palette_swap_colors", "gimp_context_swap_colors" },
{ "gimp_palette_refresh", "gimp_palettes_refresh" },
{ "gimp_palettes_set_palette", "gimp_context_set_palette" },
{ "gimp_patterns_list", "gimp_patterns_get_list" },
{ "gimp_patterns_set_pattern", "gimp_context_set_pattern" },
{ "gimp_temp_PDB_name", "gimp_procedural_db_temp_name" },
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },

View File

@ -103,6 +103,7 @@ procedural_db_init_procs (Gimp *gimp,
compat_procs[] =
{
{ "gimp_blend", "gimp_edit_blend" },
{ "gimp_brushes_set_brush", "gimp_context_set_brush" },
{ "gimp_brushes_get_opacity", "gimp_context_get_opacity" },
{ "gimp_brushes_set_opacity", "gimp_context_set_opacity" },
{ "gimp_brushes_get_paint_mode", "gimp_context_get_paint_mode" },
@ -123,8 +124,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_crop", "gimp_image_crop" },
{ "gimp_drawable_bytes", "gimp_drawable_bpp" },
{ "gimp_drawable_image", "gimp_drawable_get_image" },
{ "gimp_gradients_get_active", "gimp_gradients_get_gradient" },
{ "gimp_gradients_set_active", "gimp_gradients_set_gradient" },
{ "gimp_gradients_get_active", "gimp_context_get_gradient" },
{ "gimp_gradients_set_active", "gimp_context_set_gradient" },
{ "gimp_gradients_get_gradient", "gimp_context_get_gradient" },
{ "gimp_gradients_set_gradient", "gimp_context_set_gradient" },
{ "gimp_image_active_drawable", "gimp_image_get_active_drawable" },
{ "gimp_image_floating_selection", "gimp_image_get_floating_sel" },
{ "gimp_layer_delete", "gimp_drawable_delete" },
@ -144,7 +147,9 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_palette_set_default_colors", "gimp_context_set_default_colors" },
{ "gimp_palette_swap_colors", "gimp_context_swap_colors" },
{ "gimp_palette_refresh", "gimp_palettes_refresh" },
{ "gimp_palettes_set_palette", "gimp_context_set_palette" },
{ "gimp_patterns_list", "gimp_patterns_get_list" },
{ "gimp_patterns_set_pattern", "gimp_context_set_pattern" },
{ "gimp_temp_PDB_name", "gimp_procedural_db_temp_name" },
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },

View File

@ -103,6 +103,7 @@ procedural_db_init_procs (Gimp *gimp,
compat_procs[] =
{
{ "gimp_blend", "gimp_edit_blend" },
{ "gimp_brushes_set_brush", "gimp_context_set_brush" },
{ "gimp_brushes_get_opacity", "gimp_context_get_opacity" },
{ "gimp_brushes_set_opacity", "gimp_context_set_opacity" },
{ "gimp_brushes_get_paint_mode", "gimp_context_get_paint_mode" },
@ -123,8 +124,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_crop", "gimp_image_crop" },
{ "gimp_drawable_bytes", "gimp_drawable_bpp" },
{ "gimp_drawable_image", "gimp_drawable_get_image" },
{ "gimp_gradients_get_active", "gimp_gradients_get_gradient" },
{ "gimp_gradients_set_active", "gimp_gradients_set_gradient" },
{ "gimp_gradients_get_active", "gimp_context_get_gradient" },
{ "gimp_gradients_set_active", "gimp_context_set_gradient" },
{ "gimp_gradients_get_gradient", "gimp_context_get_gradient" },
{ "gimp_gradients_set_gradient", "gimp_context_set_gradient" },
{ "gimp_image_active_drawable", "gimp_image_get_active_drawable" },
{ "gimp_image_floating_selection", "gimp_image_get_floating_sel" },
{ "gimp_layer_delete", "gimp_drawable_delete" },
@ -144,7 +147,9 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_palette_set_default_colors", "gimp_context_set_default_colors" },
{ "gimp_palette_swap_colors", "gimp_context_swap_colors" },
{ "gimp_palette_refresh", "gimp_palettes_refresh" },
{ "gimp_palettes_set_palette", "gimp_context_set_palette" },
{ "gimp_patterns_list", "gimp_patterns_get_list" },
{ "gimp_patterns_set_pattern", "gimp_context_set_pattern" },
{ "gimp_temp_PDB_name", "gimp_procedural_db_temp_name" },
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },

View File

@ -36,8 +36,6 @@
static ProcRecord gradients_refresh_proc;
static ProcRecord gradients_get_list_proc;
static ProcRecord gradients_get_gradient_proc;
static ProcRecord gradients_set_gradient_proc;
static ProcRecord gradients_sample_uniform_proc;
static ProcRecord gradients_sample_custom_proc;
static ProcRecord gradients_get_gradient_data_proc;
@ -51,8 +49,6 @@ register_gradients_procs (Gimp *gimp)
{
procedural_db_register (gimp, &gradients_refresh_proc);
procedural_db_register (gimp, &gradients_get_list_proc);
procedural_db_register (gimp, &gradients_get_gradient_proc);
procedural_db_register (gimp, &gradients_set_gradient_proc);
procedural_db_register (gimp, &gradients_sample_uniform_proc);
procedural_db_register (gimp, &gradients_sample_custom_proc);
procedural_db_register (gimp, &gradients_get_gradient_data_proc);
@ -146,7 +142,7 @@ static ProcRecord gradients_get_list_proc =
{
"gimp_gradients_get_list",
"Retrieve the list of loaded gradients.",
"This procedure returns a list of the gradients that are currently loaded in the gradient editor. You can later use the gimp_gradients_set_active function to set the active gradient.",
"This procedure returns a list of the gradients that are currently loaded. You can later use the 'gimp_context_set_gradient' function to set the active gradient.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
@ -158,103 +154,6 @@ static ProcRecord gradients_get_list_proc =
{ { gradients_get_list_invoker } }
};
static Argument *
gradients_get_gradient_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
success = gimp_context_get_gradient (context) != NULL;
return_args = procedural_db_return_args (&gradients_get_gradient_proc, success);
if (success)
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gimp_context_get_gradient (context))->name);
return return_args;
}
static ProcArg gradients_get_gradient_outargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The name of the active gradient"
}
};
static ProcRecord gradients_get_gradient_proc =
{
"gimp_gradients_get_gradient",
"Retrieve the name of the active gradient.",
"This procedure returns the name of the active gradient in the gradient editor.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
GIMP_INTERNAL,
0,
NULL,
1,
gradients_get_gradient_outargs,
{ { gradients_get_gradient_invoker } }
};
static Argument *
gradients_set_gradient_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
GimpGradient *gradient;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient)
gimp_context_set_gradient (context, gradient);
else
success = FALSE;
}
return procedural_db_return_args (&gradients_set_gradient_proc, success);
}
static ProcArg gradients_set_gradient_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The name of the gradient to set"
}
};
static ProcRecord gradients_set_gradient_proc =
{
"gimp_gradients_set_gradient",
"Sets the specified gradient as the active gradient.",
"This procedure lets you set the specified gradient as the active or \"current\" one. The name is simply a string which corresponds to one of the loaded gradients in the gradient editor. If no matching gradient is found, this procedure will return an error. Otherwise, the specified gradient will become active and will be used for subsequent custom gradient operations.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
GIMP_INTERNAL,
1,
gradients_set_gradient_inargs,
0,
NULL,
{ { gradients_set_gradient_invoker } }
};
static Argument *
gradients_sample_uniform_invoker (Gimp *gimp,
GimpContext *context,
@ -280,7 +179,7 @@ gradients_sample_uniform_invoker (Gimp *gimp,
if (success)
{
pos = 0.0;
pos = 0.0;
delta = 1.0 / (i - 1);
array_length = i * 4;
@ -345,7 +244,7 @@ static ProcRecord gradients_sample_uniform_proc =
{
"gimp_gradients_sample_uniform",
"Sample the active gradient in uniform parts.",
"This procedure samples the active gradient from the gradient editor in the specified number of uniform parts. It returns a list of floating-point values which correspond to the RGBA values for each sample. The minimum number of samples to take is 2, in which case the returned colors will correspond to the { 0.0, 1.0 } positions in the gradient. For example, if the number of samples is 3, the procedure will return the colors at positions { 0.0, 0.5, 1.0 }.",
"This procedure samples the active gradient in the specified number of uniform parts. It returns a list of floating-point values which correspond to the RGBA values for each sample. The minimum number of samples to take is 2, in which case the returned colors will correspond to the { 0.0, 1.0 } positions in the gradient. For example, if the number of samples is 3, the procedure will return the colors at positions { 0.0, 0.5, 1.0 }.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
@ -451,7 +350,7 @@ static ProcRecord gradients_sample_custom_proc =
{
"gimp_gradients_sample_custom",
"Sample the active gradient in custom positions.",
"This procedure samples the active gradient from the gradient editor in the specified number of points. The procedure will sample the gradient in the specified positions from the list. The left endpoint of the gradient corresponds to position 0.0, and the right endpoint corresponds to 1.0. The procedure returns a list of floating-point values which correspond to the RGBA values for each sample.",
"This procedure samples the active gradient in the specified number of points. The procedure will sample the gradient in the specified positions from the list. The left endpoint of the gradient corresponds to position 0.0, and the right endpoint corresponds to 1.0. The procedure returns a list of floating-point values which correspond to the RGBA values for each sample.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
@ -478,7 +377,7 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
if (name && !g_utf8_validate (name, -1, NULL))
success = FALSE;
sample_size = args[1].value.pdb_int;
@ -489,7 +388,7 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
if (success)
{
if (strlen (name))
if (name && strlen (name))
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,

View File

@ -70,7 +70,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 393 procedures registered total */
/* 391 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -85,100 +85,100 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Brushes"), 0.008);
register_brushes_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.025);
(* status_callback) (NULL, _("Channel"), 0.026);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.048);
(* status_callback) (NULL, _("Color"), 0.049);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.081);
(* status_callback) (NULL, _("Context"), 0.082);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.137);
(* status_callback) (NULL, _("Convert"), 0.138);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.145);
(* status_callback) (NULL, _("Display procedures"), 0.146);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.155);
(* status_callback) (NULL, _("Drawable procedures"), 0.156);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.237);
(* status_callback) (NULL, _("Edit procedures"), 0.238);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.257);
(* status_callback) (NULL, _("File Operations"), 0.258);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.28);
(* status_callback) (NULL, _("Floating selections"), 0.281);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.295);
(* status_callback) (NULL, _("Font UI"), 0.297);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.303);
(* status_callback) (NULL, _("Fonts"), 0.304);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.308);
(* status_callback) (NULL, _("Gimprc procedures"), 0.309);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.323);
(* status_callback) (NULL, _("Gradient"), 0.325);
register_gradient_edit_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.382);
(* status_callback) (NULL, _("Gradient UI"), 0.384);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.389);
(* status_callback) (NULL, _("Gradients"), 0.391);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.417);
(* status_callback) (NULL, _("Guide procedures"), 0.414);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.433);
(* status_callback) (NULL, _("Help procedures"), 0.43);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.435);
(* status_callback) (NULL, _("Image"), 0.432);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.593);
(* status_callback) (NULL, _("Layer"), 0.591);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.659);
(* status_callback) (NULL, _("Message procedures"), 0.657);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.667);
(* status_callback) (NULL, _("Miscellaneous"), 0.665);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.672);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.67);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.71);
(* status_callback) (NULL, _("Palette UI"), 0.708);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.718);
(* status_callback) (NULL, _("Palettes"), 0.716);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.73);
(* status_callback) (NULL, _("Parasite procedures"), 0.729);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.761);
(* status_callback) (NULL, _("Paths"), 0.76);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.799);
(* status_callback) (NULL, _("Pattern UI"), 0.798);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.807);
(* status_callback) (NULL, _("Patterns"), 0.806);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.819);
(* status_callback) (NULL, _("Plug-in"), 0.818);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.832);
(* status_callback) (NULL, _("Procedural database"), 0.831);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.855);
(* status_callback) (NULL, _("Progress"), 0.854);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.868);
(* status_callback) (NULL, _("Image mask"), 0.867);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.913);
@ -190,7 +190,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Transform Tool procedures"), 0.936);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.952);
(* status_callback) (NULL, _("Undo"), 0.951);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.969);

View File

@ -39,7 +39,7 @@
static ProcRecord palettes_refresh_proc;
static ProcRecord palettes_get_list_proc;
static ProcRecord palettes_get_palette_proc;
static ProcRecord palettes_set_palette_proc;
static ProcRecord palettes_get_palette_info_proc;
static ProcRecord palettes_get_palette_entry_proc;
void
@ -48,7 +48,7 @@ register_palettes_procs (Gimp *gimp)
procedural_db_register (gimp, &palettes_refresh_proc);
procedural_db_register (gimp, &palettes_get_list_proc);
procedural_db_register (gimp, &palettes_get_palette_proc);
procedural_db_register (gimp, &palettes_set_palette_proc);
procedural_db_register (gimp, &palettes_get_palette_info_proc);
procedural_db_register (gimp, &palettes_get_palette_entry_proc);
}
@ -67,7 +67,7 @@ static ProcRecord palettes_refresh_proc =
{
"gimp_palettes_refresh",
"Refreshes current palettes. This function always succeeds.",
"This procedure incorporates all palettes currently in the users palette path.",
"This procedure retrieves all palettes currently in the user's palette path and updates the palette dialogs accordingly.",
"Adrian Likins <adrian@gimp.org>",
"Adrian Likins",
"1998",
@ -136,7 +136,7 @@ static ProcRecord palettes_get_list_proc =
{
"gimp_palettes_get_list",
"Retrieves a list of all of the available palettes",
"This procedure returns a complete listing of available palettes. Each name returned can be used as input to the command 'gimp_palette_set_palette'.",
"This procedure returns a complete listing of available palettes. Each name returned can be used as input to the command 'gimp_context_set_palette'.",
"Nathan Summers <rock@gimp.org>",
"Nathan Summers",
"2001",
@ -202,56 +202,85 @@ static ProcRecord palettes_get_palette_proc =
};
static Argument *
palettes_set_palette_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
palettes_get_palette_info_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
GimpPalette *palette;
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
if (name && !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette)
gimp_context_set_palette (context, palette);
if (name && strlen (name))
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
name);
}
else
{
palette = gimp_context_get_palette (context);
}
if (! palette)
success = FALSE;
}
return procedural_db_return_args (&palettes_set_palette_proc, success);
return_args = procedural_db_return_args (&palettes_get_palette_info_proc, success);
if (success)
{
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette)->name);
return_args[2].value.pdb_int = palette->n_colors;
}
return return_args;
}
static ProcArg palettes_set_palette_inargs[] =
static ProcArg palettes_get_palette_info_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The palette name (\"\" means currently active palette)"
}
};
static ProcArg palettes_get_palette_info_outargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The palette name"
},
{
GIMP_PDB_INT32,
"num_colors",
"The palette num_colors"
}
};
static ProcRecord palettes_set_palette_proc =
static ProcRecord palettes_get_palette_info_proc =
{
"gimp_palettes_set_palette",
"Set the specified palette as the active palette.",
"This procedure allows the active palette to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed palettes. If no matching palette is found, this procedure will return an error. Otherwise, the specified palette becomes active and will be used in all subsequent palette operations.",
"Nathan Summers <rock@gimp.org>",
"Nathan Summers",
"2001",
"gimp_palettes_get_palette_info",
"Retrieve information about the specified palette.",
"This procedure retrieves information about the specified palette. This includes the name, and the number of colors.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004",
GIMP_INTERNAL,
1,
palettes_set_palette_inargs,
0,
NULL,
{ { palettes_set_palette_invoker } }
palettes_get_palette_info_inargs,
2,
palettes_get_palette_info_outargs,
{ { palettes_get_palette_info_invoker } }
};
static Argument *
@ -268,14 +297,14 @@ palettes_get_palette_entry_invoker (Gimp *gimp,
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
if (name && !g_utf8_validate (name, -1, NULL))
success = FALSE;
entry_num = args[1].value.pdb_int;
if (success)
{
if (strlen (name))
if (name && strlen (name))
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
@ -323,7 +352,7 @@ static ProcArg palettes_get_palette_entry_inargs[] =
{
GIMP_PDB_STRING,
"name",
"the palette name (\"\" means currently active palette)"
"The palette name (\"\" means currently active palette)"
},
{
GIMP_PDB_INT32,
@ -354,8 +383,8 @@ static ProcArg palettes_get_palette_entry_outargs[] =
static ProcRecord palettes_get_palette_entry_proc =
{
"gimp_palettes_get_palette_entry",
"Gets the specified palette entry from the currently active palette.",
"This procedure retrieves the color of the zero-based entry specifed for the current palette. It returns an error if the entry does not exist.",
"Gets the specified palette entry from the specified palette.",
"This procedure retrieves the color of the zero-based entry specifed for the specified palette. It returns an error if the entry does not exist.",
"Nathan Summers <rock@gimp.org>",
"Nathan Summers",
"2001",

View File

@ -38,7 +38,7 @@
static ProcRecord patterns_refresh_proc;
static ProcRecord patterns_get_list_proc;
static ProcRecord patterns_get_pattern_proc;
static ProcRecord patterns_set_pattern_proc;
static ProcRecord patterns_get_pattern_info_proc;
static ProcRecord patterns_get_pattern_data_proc;
void
@ -47,7 +47,7 @@ register_patterns_procs (Gimp *gimp)
procedural_db_register (gimp, &patterns_refresh_proc);
procedural_db_register (gimp, &patterns_get_list_proc);
procedural_db_register (gimp, &patterns_get_pattern_proc);
procedural_db_register (gimp, &patterns_set_pattern_proc);
procedural_db_register (gimp, &patterns_get_pattern_info_proc);
procedural_db_register (gimp, &patterns_get_pattern_data_proc);
}
@ -66,7 +66,7 @@ static ProcRecord patterns_refresh_proc =
{
"gimp_patterns_refresh",
"Refresh current patterns. This function always succeeds.",
"This procedure retrieves all patterns currently in the user's pattern path and updates the pattern dialogs accordingly.",
"This procedure retrieves all patterns currently in the user's pattern path and updates all pattern dialogs accordingly.",
"Michael Natterer",
"Michael Natterer",
"2002",
@ -135,7 +135,7 @@ static ProcRecord patterns_get_list_proc =
{
"gimp_patterns_get_list",
"Retrieve a complete listing of the available patterns.",
"This procedure returns a complete listing of available GIMP patterns. Each name returned can be used as input to the 'gimp_patterns_set_pattern'.",
"This procedure returns a complete listing of available GIMP patterns. Each name returned can be used as input to the 'gimp_context_set_pattern'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -207,56 +207,91 @@ static ProcRecord patterns_get_pattern_proc =
};
static Argument *
patterns_set_pattern_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
patterns_get_pattern_info_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
GimpPattern *pattern;
GimpPattern *pattern = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
if (name && !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
if (pattern)
gimp_context_set_pattern (context, pattern);
if (name && strlen (name))
{
pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,
name);
}
else
{
pattern = gimp_context_get_pattern (context);
}
if (! pattern)
success = FALSE;
}
return procedural_db_return_args (&patterns_set_pattern_proc, success);
return_args = procedural_db_return_args (&patterns_get_pattern_info_proc, success);
if (success)
{
return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (pattern)->name);
return_args[2].value.pdb_int = pattern->mask->width;
return_args[3].value.pdb_int = pattern->mask->height;
}
return return_args;
}
static ProcArg patterns_set_pattern_inargs[] =
static ProcArg patterns_get_pattern_info_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The pattern name (\"\" means currently active pattern)"
}
};
static ProcArg patterns_get_pattern_info_outargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The pattern name"
},
{
GIMP_PDB_INT32,
"width",
"The pattern width"
},
{
GIMP_PDB_INT32,
"height",
"The pattern height"
}
};
static ProcRecord patterns_set_pattern_proc =
static ProcRecord patterns_get_pattern_info_proc =
{
"gimp_patterns_set_pattern",
"Set the specified pattern as the active pattern.",
"This procedure allows the active pattern mask to be set by specifying its name. The name is simply a string which corresponds to one of the names of the installed patterns. If there is no matching pattern found, this procedure will return an error. Otherwise, the specified pattern becomes active and will be used in all subsequent paint operations.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
"gimp_patterns_get_pattern_info",
"Retrieve information about the specified pattern.",
"This procedure retrieves information about the specified pattern. This includes the pattern extents (width and height).",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer <mitch@gimp.org>",
"2004",
GIMP_INTERNAL,
1,
patterns_set_pattern_inargs,
0,
NULL,
{ { patterns_set_pattern_invoker } }
patterns_get_pattern_info_inargs,
3,
patterns_get_pattern_info_outargs,
{ { patterns_get_pattern_info_invoker } }
};
static Argument *
@ -273,12 +308,12 @@ patterns_get_pattern_data_invoker (Gimp *gimp,
GimpPattern *pattern = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
if (name && !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
if (strlen (name))
if (name && strlen (name))
{
pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,

View File

@ -103,6 +103,7 @@ procedural_db_init_procs (Gimp *gimp,
compat_procs[] =
{
{ "gimp_blend", "gimp_edit_blend" },
{ "gimp_brushes_set_brush", "gimp_context_set_brush" },
{ "gimp_brushes_get_opacity", "gimp_context_get_opacity" },
{ "gimp_brushes_set_opacity", "gimp_context_set_opacity" },
{ "gimp_brushes_get_paint_mode", "gimp_context_get_paint_mode" },
@ -123,8 +124,10 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_crop", "gimp_image_crop" },
{ "gimp_drawable_bytes", "gimp_drawable_bpp" },
{ "gimp_drawable_image", "gimp_drawable_get_image" },
{ "gimp_gradients_get_active", "gimp_gradients_get_gradient" },
{ "gimp_gradients_set_active", "gimp_gradients_set_gradient" },
{ "gimp_gradients_get_active", "gimp_context_get_gradient" },
{ "gimp_gradients_set_active", "gimp_context_set_gradient" },
{ "gimp_gradients_get_gradient", "gimp_context_get_gradient" },
{ "gimp_gradients_set_gradient", "gimp_context_set_gradient" },
{ "gimp_image_active_drawable", "gimp_image_get_active_drawable" },
{ "gimp_image_floating_selection", "gimp_image_get_floating_sel" },
{ "gimp_layer_delete", "gimp_drawable_delete" },
@ -144,7 +147,9 @@ procedural_db_init_procs (Gimp *gimp,
{ "gimp_palette_set_default_colors", "gimp_context_set_default_colors" },
{ "gimp_palette_swap_colors", "gimp_context_swap_colors" },
{ "gimp_palette_refresh", "gimp_palettes_refresh" },
{ "gimp_palettes_set_palette", "gimp_context_set_palette" },
{ "gimp_patterns_list", "gimp_patterns_get_list" },
{ "gimp_patterns_set_pattern", "gimp_context_set_pattern" },
{ "gimp_temp_PDB_name", "gimp_procedural_db_temp_name" },
{ "gimp_undo_push_group_start", "gimp_image_undo_group_start" },
{ "gimp_undo_push_group_end", "gimp_image_undo_group_end" },

View File

@ -173,6 +173,8 @@ libgimp_2_0_la_SOURCES = \
gimpdrawable.h \
gimpfontselect.c \
gimpfontselect.h \
gimpgradients.c \
gimpgradients.h \
gimpgradientselect.c \
gimpgradientselect.h \
gimpimage.c \
@ -181,8 +183,12 @@ libgimp_2_0_la_SOURCES = \
gimplayer.h \
gimppalette.c \
gimppalette.h \
gimppalettes.c \
gimppalettes.h \
gimppaletteselect.c \
gimppaletteselect.h \
gimppatterns.c \
gimppatterns.h \
gimppatternselect.c \
gimppatternselect.h \
gimppixelfetcher.c \
@ -246,11 +252,14 @@ gimpinclude_HEADERS = \
gimpdrawable.h \
gimpenums.h \
gimpfontselect.h \
gimpgradients.h \
gimpgradientselect.h \
gimpimage.h \
gimplayer.h \
gimppalette.h \
gimppalettes.h \
gimppaletteselect.h \
gimppatterns.h \
gimppatternselect.h \
gimppixelfetcher.h \
gimppixelrgn.h \

View File

@ -36,11 +36,14 @@
#include <libgimp/gimpchannel.h>
#include <libgimp/gimpdrawable.h>
#include <libgimp/gimpfontselect.h>
#include <libgimp/gimpgradients.h>
#include <libgimp/gimpgradientselect.h>
#include <libgimp/gimpimage.h>
#include <libgimp/gimplayer.h>
#include <libgimp/gimppalette.h>
#include <libgimp/gimppalettes.h>
#include <libgimp/gimppaletteselect.h>
#include <libgimp/gimppatterns.h>
#include <libgimp/gimppatternselect.h>
#include <libgimp/gimppixelfetcher.h>
#include <libgimp/gimppixelrgn.h>

View File

@ -30,10 +30,7 @@
*
* Get the brush opacity.
*
* This procedure returns the opacity setting for brushes. This value
* is set globally and will remain the same even if the brush mask is
* changed. The return value is a floating point number between 0 and
* 100.
* This procedure is deprecated! Use 'gimp_context_get_opacity' instead.
*
* Returns: The brush opacity.
*/
@ -49,10 +46,7 @@ gimp_brushes_get_opacity (void)
*
* Set the brush opacity.
*
* This procedure modifies the opacity setting for brushes. This value
* is set globally and will remain the same even if the brush mask is
* changed. The value should be a floating point number between 0 and
* 100.
* This procedure is deprecated! Use 'gimp_context_set_opacity' instead.
*
* Returns: TRUE on success.
*/
@ -67,10 +61,7 @@ gimp_brushes_set_opacity (gdouble opacity)
*
* Get the brush paint mode.
*
* This procedure returns the paint-mode setting for brushes. This
* value is set globally and will not change if a different brush is
* selected. The return value is an integer which corresponds to the
* values listed in the argument description.
* This procedure isdeprecated! Use 'gimp_context_get_paint_mode' instead.
*
* Returns: The paint mode.
*/
@ -86,9 +77,7 @@ gimp_brushes_get_paint_mode (void)
*
* Set the brush paint mode.
*
* This procedure modifies the paint_mode setting for the current
* brush. This value is set globally and will not change if a different
* brush mask is selected.
* This procedure is deprecated! Use 'gimp_context_set_paint_mode' instead.
*
* Returns: TRUE on success.
*/
@ -97,3 +86,19 @@ gimp_brushes_set_paint_mode (GimpLayerModeEffects paint_mode)
{
return gimp_context_set_paint_mode (paint_mode);
}
/**
* gimp_brushes_set_brush:
* @name: The brush name.
*
* Set the specified brush as the active brush.
*
* This procedure is deprecated! Use 'gimp_context_set_brush' instead.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brushes_set_brush (const gchar *name)
{
return gimp_context_set_brush (name);
}

View File

@ -29,9 +29,10 @@ G_BEGIN_DECLS
#ifndef GIMP_DISABLE_DEPRECATED
gdouble gimp_brushes_get_opacity (void);
gboolean gimp_brushes_set_opacity (gdouble opacity);
gboolean gimp_brushes_set_opacity (gdouble opacity);
GimpLayerModeEffects gimp_brushes_get_paint_mode (void);
gboolean gimp_brushes_set_paint_mode (GimpLayerModeEffects paint_mode);
gboolean gimp_brushes_set_paint_mode (GimpLayerModeEffects paint_mode);
gboolean gimp_brushes_set_brush (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */

View File

@ -33,7 +33,7 @@
* Refresh current brushes. This function always succeeds.
*
* This procedure retrieves all brushes currently in the user's brush
* path and updates the brush dialog accordingly.
* path and updates the brush dialogs accordingly.
*
* Returns: TRUE on success.
*/
@ -64,7 +64,7 @@ gimp_brushes_refresh (void)
*
* This procedure returns a complete listing of available GIMP brushes.
* Each name returned can be used as input to the
* 'gimp_brushes_set_brush'.
* 'gimp_context_set_brush' procedure.
*
* Returns: The list of brush names.
*/
@ -139,40 +139,6 @@ gimp_brushes_get_brush (gint *width,
return name;
}
/**
* gimp_brushes_set_brush:
* @name: The brush name.
*
* Set the specified brush as the active brush.
*
* This procedure allows the active brush mask to be set by specifying
* its name. The name is simply a string which corresponds to one of
* the names of the installed brushes. If there is no matching brush
* found, this procedure will return an error. Otherwise, the specified
* brush becomes active and will be used in all subsequent paint
* operations.
*
* Returns: TRUE on success.
*/
gboolean
gimp_brushes_set_brush (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_brushes_set_brush",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_get_spacing:
*
@ -236,6 +202,48 @@ gimp_brushes_set_spacing (gint spacing)
return success;
}
/**
* gimp_brushes_get_brush_info:
* @name: The brush name (\"\" means current active brush).
* @width: The brush width.
* @height: The brush height.
* @spacing: The brush spacing.
*
* Retrieve information about the specified brush.
*
* This procedure retrieves information about the specified brush. This
* includes the brush name, and the brush extents (width and height).
*
* Returns: The brush name.
*/
gchar *
gimp_brushes_get_brush_info (const gchar *name,
gint *width,
gint *height,
gint *spacing)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *ret_name = NULL;
return_vals = gimp_run_procedure ("gimp_brushes_get_brush_info",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
ret_name = g_strdup (return_vals[1].data.d_string);
*width = return_vals[2].data.d_int32;
*height = return_vals[3].data.d_int32;
*spacing = return_vals[4].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return ret_name;
}
/**
* gimp_brushes_get_brush_data:
* @name: The brush name (\"\" means current active brush).

View File

@ -32,12 +32,17 @@ G_BEGIN_DECLS
gboolean gimp_brushes_refresh (void);
gchar** gimp_brushes_get_list (const gchar *filter,
gint *num_brushes);
#ifndef GIMP_DISABLE_DEPRECATED
gchar* gimp_brushes_get_brush (gint *width,
gint *height,
gint *spacing);
gboolean gimp_brushes_set_brush (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */
gint gimp_brushes_get_spacing (void);
gboolean gimp_brushes_set_spacing (gint spacing);
gchar* gimp_brushes_get_brush_info (const gchar *name,
gint *width,
gint *height,
gint *spacing);
gchar* gimp_brushes_get_brush_data (const gchar *name,
gdouble *opacity,
gint *spacing,

57
libgimp/gimpgradients.c Normal file
View File

@ -0,0 +1,57 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpgradients.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include "gimp.h"
/**
* gimp_gradients_get_gradient:
*
* Retrieve the name of the active gradient.
*
* This procedure is deprecated! Use 'gimp_context_get_gradient' instead.
*
* Returns: The name of the active gradient.
*/
gchar *
gimp_gradients_get_gradient (void)
{
return gimp_context_get_gradient ();
}
/**
* gimp_gradients_set_gradient:
* @name: The name of the gradient to set.
*
* Sets the specified gradient as the active gradient.
*
* This procedure is deprecated! Use 'gimp_context_set_gradient' instead.
*
* Returns: TRUE on success.
*/
gboolean
gimp_gradients_set_gradient (const gchar *name)
{
return gimp_context_set_gradient (name);
}

38
libgimp/gimpgradients.h Normal file
View File

@ -0,0 +1,38 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpgradients.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_GRADIENTS_H__
#define __GIMP_GRADIENTS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#ifndef GIMP_DISABLE_DEPRECATED
gchar * gimp_gradients_get_gradient (void);
gboolean gimp_gradients_set_gradient (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GIMP_GRADIENTS_H__ */

View File

@ -63,8 +63,8 @@ gimp_gradients_refresh (void)
* Retrieve the list of loaded gradients.
*
* This procedure returns a list of the gradients that are currently
* loaded in the gradient editor. You can later use the
* gimp_gradients_set_active function to set the active gradient.
* loaded. You can later use the 'gimp_context_set_gradient' function
* to set the active gradient.
*
* Returns: The list of gradient names.
*/
@ -97,69 +97,6 @@ gimp_gradients_get_list (const gchar *filter,
return gradient_list;
}
/**
* gimp_gradients_get_gradient:
*
* Retrieve the name of the active gradient.
*
* This procedure returns the name of the active gradient in the
* gradient editor.
*
* Returns: The name of the active gradient.
*/
gchar *
gimp_gradients_get_gradient (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp_gradients_get_gradient",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return name;
}
/**
* gimp_gradients_set_gradient:
* @name: The name of the gradient to set.
*
* Sets the specified gradient as the active gradient.
*
* This procedure lets you set the specified gradient as the active or
* \"current\" one. The name is simply a string which corresponds to
* one of the loaded gradients in the gradient editor. If no matching
* gradient is found, this procedure will return an error. Otherwise,
* the specified gradient will become active and will be used for
* subsequent custom gradient operations.
*
* Returns: TRUE on success.
*/
gboolean
gimp_gradients_set_gradient (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_gradients_set_gradient",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_gradients_sample_uniform:
* @num_samples: The number of samples to take.
@ -167,13 +104,13 @@ gimp_gradients_set_gradient (const gchar *name)
*
* Sample the active gradient in uniform parts.
*
* This procedure samples the active gradient from the gradient editor
* in the specified number of uniform parts. It returns a list of
* floating-point values which correspond to the RGBA values for each
* sample. The minimum number of samples to take is 2, in which case
* the returned colors will correspond to the { 0.0, 1.0 } positions in
* the gradient. For example, if the number of samples is 3, the
* procedure will return the colors at positions { 0.0, 0.5, 1.0 }.
* This procedure samples the active gradient in the specified number
* of uniform parts. It returns a list of floating-point values which
* correspond to the RGBA values for each sample. The minimum number of
* samples to take is 2, in which case the returned colors will
* correspond to the { 0.0, 1.0 } positions in the gradient. For
* example, if the number of samples is 3, the procedure will return
* the colors at positions { 0.0, 0.5, 1.0 }.
*
* Returns: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
*/
@ -213,12 +150,12 @@ gimp_gradients_sample_uniform (gint num_samples,
*
* Sample the active gradient in custom positions.
*
* This procedure samples the active gradient from the gradient editor
* in the specified number of points. The procedure will sample the
* gradient in the specified positions from the list. The left endpoint
* of the gradient corresponds to position 0.0, and the right endpoint
* corresponds to 1.0. The procedure returns a list of floating-point
* values which correspond to the RGBA values for each sample.
* This procedure samples the active gradient in the specified number
* of points. The procedure will sample the gradient in the specified
* positions from the list. The left endpoint of the gradient
* corresponds to position 0.0, and the right endpoint corresponds to
* 1.0. The procedure returns a list of floating-point values which
* correspond to the RGBA values for each sample.
*
* Returns: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
*/

View File

@ -32,8 +32,6 @@ G_BEGIN_DECLS
gboolean gimp_gradients_refresh (void);
gchar** gimp_gradients_get_list (const gchar *filter,
gint *num_gradients);
gchar* gimp_gradients_get_gradient (void);
gboolean gimp_gradients_set_gradient (const gchar *name);
gdouble* gimp_gradients_sample_uniform (gint num_samples,
gboolean reverse);
gdouble* gimp_gradients_sample_custom (gint num_samples,

40
libgimp/gimppalettes.c Normal file
View File

@ -0,0 +1,40 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimppalettes.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "gimp.h"
/**
* gimp_palettes_set_palette:
* @name: The palette name.
*
* Set the specified palette as the active palette.
*
* This procedure is deprecated! Use 'gimp_context_set_palette' instead.
*
* Returns: TRUE on success.
*/
gboolean
gimp_palettes_set_palette (const gchar *name)
{
return gimp_context_set_palette (name);
}

37
libgimp/gimppalettes.h Normal file
View File

@ -0,0 +1,37 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimppalettes.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_PALETTES_H__
#define __GIMP_PALETTES_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_palettes_set_palette (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GIMP_PALETTES_H__ */

View File

@ -30,8 +30,8 @@
*
* Refreshes current palettes. This function always succeeds.
*
* This procedure incorporates all palettes currently in the users
* palette path.
* This procedure retrieves all palettes currently in the user's
* palette path and updates the palette dialogs accordingly.
*
* Returns: TRUE on success.
*/
@ -62,7 +62,7 @@ gimp_palettes_refresh (void)
*
* This procedure returns a complete listing of available palettes.
* Each name returned can be used as input to the command
* 'gimp_palette_set_palette'.
* 'gimp_context_set_palette'.
*
* Returns: The list of palette names.
*/
@ -129,50 +129,52 @@ gimp_palettes_get_palette (gint *num_colors)
}
/**
* gimp_palettes_set_palette:
* @name: The palette name.
* gimp_palettes_get_palette_info:
* @name: The palette name (\"\" means currently active palette).
* @num_colors: The palette num_colors.
*
* Set the specified palette as the active palette.
* Retrieve information about the specified palette.
*
* This procedure allows the active palette to be set by specifying its
* name. The name is simply a string which corresponds to one of the
* names of the installed palettes. If no matching palette is found,
* this procedure will return an error. Otherwise, the specified
* palette becomes active and will be used in all subsequent palette
* operations.
* This procedure retrieves information about the specified palette.
* This includes the name, and the number of colors.
*
* Returns: TRUE on success.
* Returns: The palette name.
*/
gboolean
gimp_palettes_set_palette (const gchar *name)
gchar *
gimp_palettes_get_palette_info (const gchar *name,
gint *num_colors)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
gchar *ret_name = NULL;
return_vals = gimp_run_procedure ("gimp_palettes_set_palette",
return_vals = gimp_run_procedure ("gimp_palettes_get_palette_info",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = 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);
*num_colors = return_vals[2].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return success;
return ret_name;
}
/**
* gimp_palettes_get_palette_entry:
* @name: the palette name (\"\" means currently active palette).
* @name: The palette name (\"\" means currently active palette).
* @entry_num: The entry to retrieve.
* @num_colors: The palette num_colors.
* @color: The color requested.
*
* Gets the specified palette entry from the currently active palette.
* Gets the specified palette entry from the specified palette.
*
* This procedure retrieves the color of the zero-based entry specifed
* for the current palette. It returns an error if the entry does not
* for the specified palette. It returns an error if the entry does not
* exist.
*
* Returns: The palette name.

View File

@ -32,8 +32,11 @@ G_BEGIN_DECLS
gboolean gimp_palettes_refresh (void);
gchar** gimp_palettes_get_list (const gchar *filter,
gint *num_palettes);
#ifndef GIMP_DISABLE_DEPRECATED
gchar* gimp_palettes_get_palette (gint *num_colors);
gboolean gimp_palettes_set_palette (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */
gchar* gimp_palettes_get_palette_info (const gchar *name,
gint *num_colors);
gchar* gimp_palettes_get_palette_entry (const gchar *name,
gint entry_num,
gint *num_colors,

42
libgimp/gimppatterns.c Normal file
View File

@ -0,0 +1,42 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimppatterns.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include "gimp.h"
/**
* gimp_patterns_set_pattern:
* @name: The pattern name.
*
* Set the specified pattern as the active pattern.
*
* This procedure is deprecated! Use 'gimp_context_set_pattern' instead.
*
* Returns: TRUE on success.
*/
gboolean
gimp_patterns_set_pattern (const gchar *name)
{
return gimp_context_set_pattern (name);
}

37
libgimp/gimppatterns.h Normal file
View File

@ -0,0 +1,37 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimppatterns.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_PATTERNS_H__
#define __GIMP_PATTERNS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_patterns_set_pattern (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GIMP_PATTERNS_H__ */

View File

@ -33,7 +33,7 @@
* Refresh current patterns. This function always succeeds.
*
* This procedure retrieves all patterns currently in the user's
* pattern path and updates the pattern dialogs accordingly.
* pattern path and updates all pattern dialogs accordingly.
*
* Returns: TRUE on success.
*/
@ -64,7 +64,7 @@ gimp_patterns_refresh (void)
*
* This procedure returns a complete listing of available GIMP
* patterns. Each name returned can be used as input to the
* 'gimp_patterns_set_pattern'.
* 'gimp_context_set_pattern'.
*
* Returns: The list of pattern names.
*/
@ -137,37 +137,42 @@ gimp_patterns_get_pattern (gint *width,
}
/**
* gimp_patterns_set_pattern:
* @name: The pattern name.
* gimp_patterns_get_pattern_info:
* @name: The pattern name (\"\" means currently active pattern).
* @width: The pattern width.
* @height: The pattern height.
*
* Set the specified pattern as the active pattern.
* Retrieve information about the specified pattern.
*
* This procedure allows the active pattern mask to be set by
* specifying its name. The name is simply a string which corresponds
* to one of the names of the installed patterns. If there is no
* matching pattern found, this procedure will return an error.
* Otherwise, the specified pattern becomes active and will be used in
* all subsequent paint operations.
* This procedure retrieves information about the specified pattern.
* This includes the pattern extents (width and height).
*
* Returns: TRUE on success.
* Returns: The pattern name.
*/
gboolean
gimp_patterns_set_pattern (const gchar *name)
gchar *
gimp_patterns_get_pattern_info (const gchar *name,
gint *width,
gint *height)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
gchar *ret_name = NULL;
return_vals = gimp_run_procedure ("gimp_patterns_set_pattern",
return_vals = gimp_run_procedure ("gimp_patterns_get_pattern_info",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = 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);
*width = return_vals[2].data.d_int32;
*height = return_vals[3].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return success;
return ret_name;
}
/**

View File

@ -32,9 +32,13 @@ G_BEGIN_DECLS
gboolean gimp_patterns_refresh (void);
gchar** gimp_patterns_get_list (const gchar *filter,
gint *num_patterns);
#ifndef GIMP_DISABLE_DEPRECATED
gchar* gimp_patterns_get_pattern (gint *width,
gint *height);
gboolean gimp_patterns_set_pattern (const gchar *name);
#endif /* GIMP_DISABLE_DEPRECATED */
gchar* gimp_patterns_get_pattern_info (const gchar *name,
gint *width,
gint *height);
gchar* gimp_patterns_get_pattern_data (const gchar *name,
gint *width,
gint *height,

View File

@ -263,7 +263,7 @@ explorer_number_of_colors_callback (GtkAdjustment *adjustment,
g_free (gradient_samples);
if (! gradient_name)
gradient_name = gimp_gradients_get_gradient ();
gradient_name = gimp_context_get_gradient ();
gimp_gradients_get_gradient_data (gradient_name,
wvals.ncolors,
@ -1134,7 +1134,7 @@ explorer_dialog (void)
_("Create a color-map using a gradient from "
"the gradient editor"), NULL);
gradient_name = gimp_gradients_get_gradient ();
gradient_name = gimp_context_get_gradient ();
gradient_samples = gimp_gradients_sample_uniform (wvals.ncolors,
wvals.gradinvert);
gradient = gimp_gradient_select_widget_new (_("FractalExplorer Gradient"),

View File

@ -522,7 +522,7 @@ gfig_dialog (void)
gfig_list_load_all (gfig_path);
/* Setup initial brush settings */
gfig_context->bdesc.name = mygimp_brush_get ();
gfig_context->bdesc.name = gimp_context_get_brush ();
mygimp_brush_info (&gfig_context->bdesc.width, &gfig_context->bdesc.height);
gtk_widget_show (main_hbox);

View File

@ -176,7 +176,7 @@ gfig_read_parameter_gimp_rgb (gchar **text,
gboolean
gboolean
gfig_load_style (Style *style,
FILE *fp)
{
@ -231,7 +231,7 @@ gfig_load_style (Style *style,
gfig_read_parameter_gimp_rgb (style_text, nitems, "Foreground", &style->foreground);
gfig_read_parameter_gimp_rgb (style_text, nitems, "Background", &style->background);
gfig_read_parameter_int (style_text, nitems, "FillType", (gint *)&style->fill_type);
gfig_read_parameter_double (style_text, nitems, "FillOpacity",
gfig_read_parameter_double (style_text, nitems, "FillOpacity",
(gdouble *)&style->fill_opacity);
for (k = 0; k < nitems; k++)
@ -246,7 +246,7 @@ gfig_load_style (Style *style,
}
gboolean
gboolean
gfig_skip_style (Style *style,
FILE *fp)
{
@ -298,8 +298,8 @@ gfig_load_styles (GFigObj *gfig,
return FALSE;
}
void
gfig_save_style (Style *style,
void
gfig_save_style (Style *style,
GString *string)
{
gchar buffer[G_ASCII_DTOSTR_BUF_SIZE];
@ -319,23 +319,23 @@ gfig_save_style (Style *style,
g_string_append_printf (string, "FillType: %d\n", style->fill_type);
g_string_append_printf (string, "FillOpacity: %s\n",
g_string_append_printf (string, "FillOpacity: %s\n",
g_ascii_dtostr (buffer, blen, style->fill_opacity));
g_string_append_printf (string, "Pattern: %s\n", style->pattern);
g_string_append_printf (string, "Gradient: %s\n", style->gradient);
g_string_append_printf (string, "Foreground: %s %s %s %s\n",
g_string_append_printf (string, "Foreground: %s %s %s %s\n",
g_ascii_dtostr (buffer_r, blen, style->foreground.r),
g_ascii_dtostr (buffer_g, blen, style->foreground.g),
g_ascii_dtostr (buffer_b, blen, style->foreground.b),
g_ascii_dtostr (buffer_g, blen, style->foreground.g),
g_ascii_dtostr (buffer_b, blen, style->foreground.b),
g_ascii_dtostr (buffer_a, blen, style->foreground.a));
g_string_append_printf (string, "Background: %s %s %s %s\n",
g_string_append_printf (string, "Background: %s %s %s %s\n",
g_ascii_dtostr (buffer_r, blen, style->background.r),
g_ascii_dtostr (buffer_g, blen, style->background.g),
g_ascii_dtostr (buffer_b, blen, style->background.b),
g_ascii_dtostr (buffer_g, blen, style->background.g),
g_ascii_dtostr (buffer_b, blen, style->background.b),
g_ascii_dtostr (buffer_a, blen, style->background.a));
g_string_append_printf (string, "</Style>\n");
@ -356,21 +356,21 @@ gfig_style_save_as_attributes (Style *style,
fprintf (stderr, "Saving style %s as attributes\n", style->name);
g_string_append_printf (string, "BrushName=\"%s\" ", style->brush_name);
g_string_append_printf (string, "Foreground=\"%s %s %s %s\" ",
g_string_append_printf (string, "Foreground=\"%s %s %s %s\" ",
g_ascii_dtostr (buffer_r, blen, style->foreground.r),
g_ascii_dtostr (buffer_g, blen, style->foreground.g),
g_ascii_dtostr (buffer_b, blen, style->foreground.b),
g_ascii_dtostr (buffer_g, blen, style->foreground.g),
g_ascii_dtostr (buffer_b, blen, style->foreground.b),
g_ascii_dtostr (buffer_a, blen, style->foreground.a));
g_string_append_printf (string, "Background=\"%s %s %s %s\" ",
g_string_append_printf (string, "Background=\"%s %s %s %s\" ",
g_ascii_dtostr (buffer_r, blen, style->background.r),
g_ascii_dtostr (buffer_g, blen, style->background.g),
g_ascii_dtostr (buffer_b, blen, style->background.b),
g_ascii_dtostr (buffer_g, blen, style->background.g),
g_ascii_dtostr (buffer_b, blen, style->background.b),
g_ascii_dtostr (buffer_a, blen, style->background.a));
g_string_append_printf (string, "FillType=%d ", style->fill_type);
g_string_append_printf (string, "FillOpacity=%s ",
g_string_append_printf (string, "FillOpacity=%s ",
g_ascii_dtostr (buffer, blen, style->fill_opacity));
@ -386,7 +386,7 @@ gfig_save_styles (GString *string)
gfig_style_copy (&gfig_context->default_style, gfig_context->current_style, "object");
for (k = 1; k < gfig_context->num_styles; k++)
for (k = 1; k < gfig_context->num_styles; k++)
gfig_save_style (gfig_context->style[k], string);
}
@ -439,7 +439,7 @@ set_background_callback (GimpColorButton *button,
* repaint (which will be suppressed if gfig_context->enable_repaint is
* FALSE).
*/
void
void
gfig_brush_changed_callback (const gchar *brush_name,
gdouble opacity,
gint spacing,
@ -460,12 +460,12 @@ gfig_brush_changed_callback (const gchar *brush_name,
gfig_context->bdesc.name = (gchar *) brush_name;
gfig_context->bdesc.width = width;
gfig_context->bdesc.height = height;
gimp_brushes_set_brush (brush_name);
gimp_context_set_brush (brush_name);
gfig_paint_callback ();
}
void
void
gfig_pattern_changed_callback (const gchar *pattern_name,
gint width,
gint height,
@ -480,7 +480,7 @@ gfig_pattern_changed_callback (const gchar *pattern_name,
gfig_paint_callback ();
}
void
void
gfig_gradient_changed_callback (const gchar *gradient_name,
gint width,
const gdouble *grad_data,
@ -503,8 +503,8 @@ gfig_rgba_copy (GimpRGB *color1,
color1->a = color2->a;
}
void
gfig_style_copy (Style *style1,
void
gfig_style_copy (Style *style1,
Style *style0,
const gchar *name)
{
@ -544,13 +544,13 @@ gfig_style_apply (Style *style)
gimp_context_set_background (&style->background);
if (!gimp_brushes_set_brush (style->brush_name))
g_message ("Style apply: Failed to set brush to '%s' in style '%s'",
if (!gimp_context_set_brush (style->brush_name))
g_message ("Style apply: Failed to set brush to '%s' in style '%s'",
style->brush_name, style->name);
gimp_patterns_set_pattern (style->pattern);
gimp_context_set_pattern (style->pattern);
gimp_gradients_set_gradient (style->gradient);
gimp_context_set_gradient (style->gradient);
gfig_context->current_style = style;
@ -575,8 +575,6 @@ void
gfig_read_gimp_style (Style *style,
const gchar *name)
{
gint w, h;
if (!name)
g_message ("Error: name is NULL in gfig_read_gimp_style.");
@ -586,16 +584,18 @@ gfig_read_gimp_style (Style *style,
gimp_context_get_foreground (&style->foreground);
gimp_context_get_background (&style->background);
style->brush_name = (gchar *) gimp_brushes_get_brush (&style->brush_width,
&style->brush_height,
&style->brush_spacing);
style->gradient = gimp_gradients_get_gradient ();
style->pattern = gimp_patterns_get_pattern (&w, &h);
style->brush_name = gimp_brushes_get_brush_info (NULL,
&style->brush_width,
&style->brush_height,
&style->brush_spacing);
style->gradient = gimp_context_get_gradient ();
style->pattern = gimp_context_get_pattern ();
style->fill_opacity = 100.;
gfig_context->bdesc.name = style->brush_name;
gfig_context->bdesc.width = style->brush_width;
gfig_context->bdesc.name = style->brush_name;
gfig_context->bdesc.width = style->brush_width;
gfig_context->bdesc.height = style->brush_height;
}
@ -623,8 +623,9 @@ gfig_style_set_context_from_style (Style *style)
&style->foreground);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (gfig_context->bg_color_button),
&style->background);
if (!gimp_brushes_set_brush (style->brush_name))
g_message ("Style from context: Failed to set brush to '%s'", style->brush_name);
if (!gimp_context_set_brush (style->brush_name))
g_message ("Style from context: Failed to set brush to '%s'",
style->brush_name);
gimp_brush_select_widget_set (gfig_context->brush_select,
style->brush_name,
@ -683,14 +684,6 @@ gfig_style_set_style_from_context (Style *style)
style->fill_opacity = 100.;
}
char *
mygimp_brush_get (void)
{
gint width, height, spacing;
return gimp_brushes_get_brush (&width, &height, &spacing);
}
void
mygimp_brush_info (gint *width,
gint *height)
@ -698,7 +691,7 @@ mygimp_brush_info (gint *width,
char *name;
gint spacing;
name = gimp_brushes_get_brush (width, height, &spacing);
name = gimp_brushes_get_brush_info (NULL, width, height, &spacing);
if (name)
{
*width = MAX (*width, 32);

View File

@ -61,8 +61,6 @@ void gfig_gradient_changed_callback (const gchar *gradient_name,
void mygimp_brush_info (gint *width,
gint *height);
gchar *mygimp_brush_get (void);
void gfig_read_gimp_style (Style *style,
const gchar *name);
@ -70,14 +68,14 @@ void gfig_style_append (Style *style);
void gfig_style_apply (Style *style);
void gfig_style_copy (Style *style1,
void gfig_style_copy (Style *style1,
Style *style0,
const gchar *name);
void gfig_rgba_copy (GimpRGB *color1,
GimpRGB *color2);
void gfig_style_copy (Style *style1,
void gfig_style_copy (Style *style1,
Style *style0,
const gchar *name);
@ -90,7 +88,7 @@ gboolean gfig_skip_style (Style *style,
gboolean gfig_load_styles (GFigObj *gfig,
FILE *fp);
void gfig_save_style (Style *style,
void gfig_save_style (Style *style,
GString *string);
void gfig_style_save_as_attributes (Style *style,

View File

@ -4799,16 +4799,16 @@ gradient_get_values_real_external (const gchar *gradient_name,
gint i;
gint j;
old_name = gimp_gradients_get_gradient ();
old_name = gimp_context_get_gradient ();
gimp_gradients_set_gradient (gradient_name);
gimp_context_set_gradient (gradient_name);
tmp_values = gimp_gradients_sample_uniform (nvalues, reverse);
for (i = 0; i < nvalues; i++)
for (j = 0; j < 4; j++)
values[4*i+j] = (guchar) (tmp_values[4*i+j] * 255);
gimp_gradients_set_gradient (old_name);
gimp_context_set_gradient (old_name);
g_free (tmp_values);
g_free (old_name);

View File

@ -20,7 +20,8 @@
sub brush_arg () {{
name => 'name',
type => 'string',
desc => 'The brush name'
desc => 'The brush name',
null_ok => '1'
}}
sub dim_args () {
@ -67,7 +68,7 @@ sub brushes_refresh {
$help = <<'HELP';
This procedure retrieves all brushes currently in the user's brush path
and updates the brush dialog accordingly.
and updates the brush dialogs accordingly.
HELP
$author = $copyright = 'Seth Burgess';
@ -87,15 +88,15 @@ sub brushes_get_list {
$blurb = 'Retrieve a complete listing of the available brushes.';
$help = <<'HELP';
This procedure returns a complete listing of available GIMP brushes. Each name
returned can be used as input to the 'gimp_brushes_set_brush'.
This procedure returns a complete listing of available GIMP
brushes. Each name returned can be used as input to the
'gimp_context_set_brush' procedure.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'filter',
type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', null_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);
@ -123,6 +124,8 @@ paramter. All paint operations and stroke operations use this mask to control
the application of paint to the image.
HELP
$deprecated = 1;
&std_pdb_misc;
@outargs = (
@ -139,37 +142,6 @@ HELP
);
}
sub brushes_set_brush {
$blurb = 'Set the specified brush as the active brush.';
$help = <<'HELP';
This procedure allows the active brush mask to be set by specifying its name.
The name is simply a string which corresponds to one of the names of the
installed brushes. If there is no matching brush found, this procedure will
return an error. Otherwise, the specified brush becomes active and will be
used in all subsequent paint operations.
HELP
&std_pdb_misc;
@inargs = ( &brush_arg );
%invoke = (
vars => [ 'GimpBrush *brush' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush)
gimp_context_set_brush (context, brush);
else
success = FALSE;
}
CODE
);
}
sub brushes_get_spacing {
$blurb = 'Get the brush spacing.';
@ -205,6 +177,53 @@ HELP
);
}
sub brushes_get_brush_info {
$blurb = <<'BLURB';
Retrieve information about the specified brush.
BLURB
$help = <<'HELP';
This procedure retrieves information about the specified brush. This
includes the brush name, and the brush extents (width and height).
HELP
$author = $copyright = 'Michael Natterer <mitch@gimp.org>';
$date = '2004';
@inargs = (
&brush_arg
);
$inargs[0]->{desc} = 'The brush name ("" means current active brush)';
@outargs = (
&brush_arg,
&dim_args,
&spacing_arg
);
&brush_outargs;
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
}
else
{
brush = gimp_context_get_brush (context);
}
if (! brush)
success = FALSE;
}
CODE
);
}
sub brushes_get_brush_data {
$blurb = <<'BLURB';
Retrieve information about the currently active brush (including data).
@ -219,7 +238,9 @@ HELP
$author = $copyright = 'Andy Thomas';
$date = '1998';
@inargs = ( &brush_arg );
@inargs = (
&brush_arg
);
$inargs[0]->{desc} = 'The brush name ("" means current active brush)';
@outargs = (
@ -241,11 +262,10 @@ HELP
desc => 'Length of brush mask data' } };
%invoke = (
headers => [ qw(<string.h>) ],
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
if (strlen (name))
if (name && strlen (name))
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
@ -267,13 +287,13 @@ CODE
);
}
@headers = qw("core/gimp.h" "core/gimplist.h" "core/gimpbrush.h"
"core/gimpcontext.h" "core/gimpdatafactory.h" "base/temp-buf.h");
@headers = qw(<string.h> "base/temp-buf.h"
"core/gimp.h" "core/gimplist.h" "core/gimpbrush.h"
"core/gimpcontext.h" "core/gimpdatafactory.h");
@procs = qw(brushes_refresh brushes_get_list
brushes_get_brush brushes_set_brush
@procs = qw(brushes_refresh brushes_get_list brushes_get_brush
brushes_get_spacing brushes_set_spacing
brushes_get_brush_data);
brushes_get_brush_info brushes_get_brush_data);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Brushes';

View File

@ -49,8 +49,7 @@ HELP
&pdb_misc;
@inargs = (
{ name => 'filter',
type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', null_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);

View File

@ -54,16 +54,15 @@ sub gradients_get_list {
$blurb = 'Retrieve the list of loaded gradients.';
$help = <<'HELP';
This procedure returns a list of the gradients that are currently loaded in the
gradient editor. You can later use the gimp_gradients_set_active function to
This procedure returns a list of the gradients that are currently loaded.
You can later use the 'gimp_context_set_gradient' function to
set the active gradient.
HELP
&federico_misc;
@inargs = (
{ name => 'filter',
type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', null_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);
@ -81,59 +80,6 @@ HELP
);
}
sub gradients_get_gradient {
$blurb = 'Retrieve the name of the active gradient.';
$help = <<'HELP';
This procedure returns the name of the active gradient in the gradient editor.
HELP
&federico_misc;
@outargs = (
{ name => 'name', type => 'string',
desc => 'The name of the active gradient',
alias => 'g_strdup (GIMP_OBJECT (gimp_context_get_gradient (context))->name)',
no_declare => 1 }
);
%invoke = ( code => 'success = gimp_context_get_gradient (context) != NULL;' );
}
sub gradients_set_gradient {
$blurb = 'Sets the specified gradient as the active gradient.';
$help = <<'HELP';
This procedure lets you set the specified gradient as the active or "current"
one. The name is simply a string which corresponds to one of the loaded
gradients in the gradient editor. If no matching gradient is found, this
procedure will return an error. Otherwise, the specified gradient will become
active and will be used for subsequent custom gradient operations.
HELP
&federico_misc;
@inargs = (
{ name => 'name', type => 'string',
desc => 'The name of the gradient to set' }
);
%invoke = (
vars => [ 'GimpGradient *gradient' ],
code => <<'CODE'
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
if (gradient)
gimp_context_set_gradient (context, gradient);
else
success = FALSE;
}
CODE
);
}
sub sample_num_arg {
{ name => 'num_samples', type => $_[0] . 'int32',
desc => 'The number of samples to take', alias => 'i' }
@ -158,7 +104,7 @@ sub gradients_sample_uniform {
$blurb = 'Sample the active gradient in uniform parts.';
$help = <<'HELP';
This procedure samples the active gradient from the gradient editor in the
This procedure samples the active gradient in the
specified number of uniform parts. It returns a list of floating-point values
which correspond to the RGBA values for each sample. The minimum number of
samples to take is 2, in which case the returned colors will correspond to the
@ -178,7 +124,7 @@ HELP
vars => [ 'GimpGradient *gradient', 'gdouble pos, delta', 'GimpRGB color', 'gdouble *pv' ],
code => <<'CODE'
{
pos = 0.0;
pos = 0.0;
delta = 1.0 / (i - 1);
array_length = i * 4;
@ -207,12 +153,12 @@ sub gradients_sample_custom {
$blurb = 'Sample the active gradient in custom positions.';
$help = <<'HELP';
This procedure samples the active gradient from the gradient editor in the
specified number of points. The procedure will sample the gradient in the
specified positions from the list. The left endpoint of the gradient
corresponds to position 0.0, and the right endpoint corresponds to 1.0. The
procedure returns a list of floating-point values which correspond to the RGBA
values for each sample.
This procedure samples the active gradient in the specified number of
points. The procedure will sample the gradient in the specified
positions from the list. The left endpoint of the gradient corresponds
to position 0.0, and the right endpoint corresponds to 1.0. The
procedure returns a list of floating-point values which correspond to
the RGBA values for each sample.
HELP
&federico_misc;
@ -277,7 +223,8 @@ HELP
@inargs = (
{ name => 'name', type => 'string',
desc => 'The gradient name ("" means current active gradient)' },
desc => 'The gradient name ("" means current active gradient)',
null_ok => '1' },
&sample_size_arg,
&reverse_arg
);
@ -297,7 +244,7 @@ HELP
vars => [ 'GimpGradient *gradient = NULL' ],
code => <<'CODE'
{
if (strlen (name))
if (name && strlen (name))
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
@ -340,8 +287,7 @@ CODE
);
}
sub gradients_new
{
sub gradients_new {
$blurb = "Creates a new gradient";
$help = "This procedure creates a new, uninitialized gradient";
$since = '2.2';
@ -384,8 +330,7 @@ else
CODE
sub gradients_duplicate
{
sub gradients_duplicate {
$blurb = "Duplicates a gradient";
$help = "This procedure creates an identical gradient by a different name";
$since = '2.2';
@ -429,8 +374,7 @@ CODE
}
sub gradients_delete
{
sub gradients_delete {
$blurb = "Deletes a gradient";
$help = "This procedure deletes a gradient";
$since = '2.2';
@ -470,8 +414,7 @@ CODE
}
sub gradients_rename
{
sub gradients_rename {
$blurb = "Rename a gradient";
$help = "This procedure renames a gradient";
$since = '2.2';
@ -511,7 +454,6 @@ CODE
"core/gimpdatafactory.h" "core/gimpgradient.h");
@procs = qw(gradients_refresh gradients_get_list
gradients_get_gradient gradients_set_gradient
gradients_sample_uniform gradients_sample_custom
gradients_get_gradient_data
gradients_new gradients_duplicate

View File

@ -29,10 +29,17 @@ sub adrian_pdb_misc {
$date = '1998';
}
sub mitch_pdb_misc {
$author = 'Michael Natterer <mitch@gimp.org>';
$copyright = 'Michael Natterer';
$date = '2004';
}
sub palette_arg () {{
name => 'name',
type => 'string',
desc => 'The palette name'
desc => 'The palette name',
null_ok => '1'
}}
sub dim_args () {
@ -64,7 +71,8 @@ sub palettes_refresh {
$blurb = 'Refreshes current palettes. This function always succeeds.';
$help = <<'HELP';
This procedure incorporates all palettes currently in the users palette path.
This procedure retrieves all palettes currently in the user's palette path
and updates the palette dialogs accordingly.
HELP
&adrian_pdb_misc;
@ -84,14 +92,13 @@ sub palettes_get_list {
$help = <<'HELP';
This procedure returns a complete listing of available palettes. Each name
returned can be used as input to the command 'gimp_palette_set_palette'.
returned can be used as input to the command 'gimp_context_set_palette'.
HELP
&rock_pdb_misc;
@inargs = (
{ name => 'filter',
type => 'string', null_ok => 1,
{ name => 'filter', type => 'string', null_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);
@ -117,6 +124,8 @@ This procedure retrieves information about the currently active palette. This
includes the name, and the number of colors.
HELP
$deprecated = 1;
&rock_pdb_misc;
@outargs = (
@ -132,31 +141,44 @@ HELP
);
}
sub palettes_set_palette {
$blurb = 'Set the specified palette as the active palette.';
sub palettes_get_palette_info {
$blurb = 'Retrieve information about the specified palette.';
$help = <<'HELP';
This procedure allows the active palette to be set by specifying its name.
The name is simply a string which corresponds to one of the names of the
installed palettes. If no matching palette is found, this procedure will
return an error. Otherwise, the specified palette becomes active and will be
used in all subsequent palette operations.
This procedure retrieves information about the specified palette. This
includes the name, and the number of colors.
HELP
&rock_pdb_misc;
&mitch_pdb_misc;
@inargs = ( &palette_arg );
@inargs = (
&palette_arg
);
$inargs[0]->{desc} = 'The palette name ("" means currently active palette)';
@outargs = (
&palette_arg,
&dim_args
);
&palette_outargs;
%invoke = (
vars => [ 'GimpPalette *palette' ],
code => <<'CODE'
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE'
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette)
gimp_context_set_palette (context, palette);
if (name && strlen (name))
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
name);
}
else
{
palette = gimp_context_get_palette (context);
}
if (! palette)
success = FALSE;
}
CODE
@ -164,11 +186,11 @@ CODE
}
sub palettes_get_palette_entry {
$blurb = 'Gets the specified palette entry from the currently active palette.';
$blurb = 'Gets the specified palette entry from the specified palette.';
$help = <<'HELP';
This procedure retrieves the color of the zero-based entry specifed for the current palette.
It returns an error if the entry does not exist.
This procedure retrieves the color of the zero-based entry specifed for the
specified palette. It returns an error if the entry does not exist.
HELP
&rock_pdb_misc;
@ -178,7 +200,7 @@ HELP
{ name => 'entry_num', type => 'int32',
desc => 'The entry to retrieve' }
);
$inargs[0]->{desc} = 'the palette name ("" means currently active palette)';
$inargs[0]->{desc} = 'The palette name ("" means currently active palette)';
@outargs = (
&palette_arg,
@ -194,7 +216,7 @@ HELP
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE'
{
if (strlen (name))
if (name && strlen (name))
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container,
@ -231,9 +253,8 @@ CODE
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h" "core/gimplist.h"
"core/gimpdatafactory.h" "core/gimppalette.h");
@procs = qw(palettes_refresh palettes_get_list
palettes_get_palette palettes_set_palette
palettes_get_palette_entry);
@procs = qw(palettes_refresh palettes_get_list palettes_get_palette
palettes_get_palette_info palettes_get_palette_entry);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Palettes';

View File

@ -20,7 +20,8 @@
sub pattern_arg () {{
name => 'name',
type => 'string',
desc => 'The pattern name'
desc => 'The pattern name',
null_ok => '1'
}}
sub dim_args () {
@ -53,7 +54,7 @@ sub patterns_refresh {
$help = <<'HELP';
This procedure retrieves all patterns currently in the user's pattern path
and updates the pattern dialogs accordingly.
and updates all pattern dialogs accordingly.
HELP
$author = $copyright = 'Michael Natterer';
@ -74,7 +75,7 @@ sub patterns_get_list {
$help = <<'HELP';
This procedure returns a complete listing of available GIMP patterns. Each name
returned can be used as input to the 'gimp_patterns_set_pattern'.
returned can be used as input to the 'gimp_context_set_pattern'.
HELP
&std_pdb_misc;
@ -109,6 +110,8 @@ clone and bucket-fill operations with patterns will use this pattern to control
the application of paint to the image.
HELP
$deprecated = 1;
&std_pdb_misc;
@outargs = (
@ -124,31 +127,45 @@ HELP
);
}
sub patterns_set_pattern {
$blurb = 'Set the specified pattern as the active pattern.';
sub patterns_get_pattern_info {
$blurb = <<'BLURB';
Retrieve information about the specified pattern.
BLURB
$help = <<'HELP';
This procedure allows the active pattern mask to be set by specifying its name.
The name is simply a string which corresponds to one of the names of the
installed patterns. If there is no matching pattern found, this procedure will
return an error. Otherwise, the specified pattern becomes active and will be
used in all subsequent paint operations.
This procedure retrieves information about the specified pattern.
This includes the pattern extents (width and height).
HELP
&std_pdb_misc;
$author = $copyright = 'Michael Natterer <mitch@gimp.org>';
$date = '2004';
@inargs = ( &pattern_arg );
$inargs[0]->{desc} = 'The pattern name ("" means currently active pattern)';
@outargs = (
&pattern_arg,
&dim_args,
);
&pattern_outargs;
%invoke = (
vars => [ 'GimpPattern *pattern' ],
vars => [ 'GimpPattern *pattern = NULL' ],
code => <<'CODE'
{
pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
if (pattern)
gimp_context_set_pattern (context, pattern);
if (name && strlen (name))
{
pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,
name);
}
else
{
pattern = gimp_context_get_pattern (context);
}
if (! pattern)
success = FALSE;
}
CODE
@ -191,7 +208,7 @@ HELP
vars => [ 'GimpPattern *pattern = NULL' ],
code => <<'CODE'
{
if (strlen (name))
if (name && strlen (name))
{
pattern = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,
@ -218,9 +235,8 @@ CODE
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h" "core/gimplist.h"
"core/gimpdatafactory.h" "core/gimppattern.h" "base/temp-buf.h");
@procs = qw(patterns_refresh patterns_get_list
patterns_get_pattern patterns_set_pattern
patterns_get_pattern_data);
@procs = qw(patterns_refresh patterns_get_list patterns_get_pattern
patterns_get_pattern_info patterns_get_pattern_data);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Patterns';