Bill Skaggs <weskaggs@primate.ucdavis.edu>

* tools/pdbgen/pdb/brush.pdb: added api for changing properties
	of generated brushes.

	* tools/pdbgen/pdb/palette.pdb: added palette_is_editable().

	* app/pdb/brush_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/palette_cmds.c
	* libgimp/gimpbrush_pdb.c
	* libgimp/gimpbrush_pdb.h
	* libgimp/gimppalette_pdb.c
	* libgimp/gimppalette_pdb.h: autogenerated.
This commit is contained in:
William Skaggs 2004-12-30 23:28:38 +00:00
parent 610ea3091a
commit 610b26c2f4
10 changed files with 2276 additions and 69 deletions

View File

@ -1,3 +1,18 @@
2004-12-30 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* tools/pdbgen/pdb/brush.pdb: added api for changing properties
of generated brushes.
* tools/pdbgen/pdb/palette.pdb: added palette_is_editable().
* app/pdb/brush_cmds.c
* app/pdb/internal_procs.c
* app/pdb/palette_cmds.c
* libgimp/gimpbrush_pdb.c
* libgimp/gimpbrush_pdb.h
* libgimp/gimppalette_pdb.c
* libgimp/gimppalette_pdb.h: autogenerated.
2004-12-29 Sven Neumann <sven@gimp.org>
* configure.in: bumped version to 2.3.0.

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 433 procedures registered total */
/* 448 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -86,130 +86,130 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (_("Internal Procedures"), _("Brush"), 0.0);
register_brush_procs (gimp);
(* status_callback) (NULL, _("Brush UI"), 0.018);
(* status_callback) (NULL, _("Brush UI"), 0.049);
register_brush_select_procs (gimp);
(* status_callback) (NULL, _("Brushes"), 0.025);
(* status_callback) (NULL, _("Brushes"), 0.056);
register_brushes_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.039);
(* status_callback) (NULL, _("Channel"), 0.069);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.06);
(* status_callback) (NULL, _("Color"), 0.089);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.095);
(* status_callback) (NULL, _("Context"), 0.123);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.145);
(* status_callback) (NULL, _("Convert"), 0.172);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.152);
(* status_callback) (NULL, _("Display procedures"), 0.179);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.162);
(* status_callback) (NULL, _("Drawable procedures"), 0.188);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Transformation procedures"), 0.24);
(* status_callback) (NULL, _("Transformation procedures"), 0.263);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.277);
(* status_callback) (NULL, _("Edit procedures"), 0.299);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.298);
(* status_callback) (NULL, _("File Operations"), 0.319);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.321);
(* status_callback) (NULL, _("Floating selections"), 0.342);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.335);
(* status_callback) (NULL, _("Font UI"), 0.355);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.342);
(* status_callback) (NULL, _("Fonts"), 0.362);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.346);
(* status_callback) (NULL, _("Gimprc procedures"), 0.366);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.36);
(* status_callback) (NULL, _("Gradient"), 0.379);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.427);
(* status_callback) (NULL, _("Gradient UI"), 0.444);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.434);
(* status_callback) (NULL, _("Gradients"), 0.451);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.446);
(* status_callback) (NULL, _("Guide procedures"), 0.462);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.46);
(* status_callback) (NULL, _("Help procedures"), 0.475);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.462);
(* status_callback) (NULL, _("Image"), 0.478);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.605);
(* status_callback) (NULL, _("Layer"), 0.616);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.667);
(* status_callback) (NULL, _("Message procedures"), 0.676);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.674);
(* status_callback) (NULL, _("Miscellaneous"), 0.683);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.679);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.688);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.714);
(* status_callback) (NULL, _("Palette"), 0.721);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.739);
(* status_callback) (NULL, _("Palette UI"), 0.748);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.746);
(* status_callback) (NULL, _("Palettes"), 0.754);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.755);
(* status_callback) (NULL, _("Parasite procedures"), 0.763);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.783);
(* status_callback) (NULL, _("Paths"), 0.79);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.818);
(* status_callback) (NULL, _("Pattern"), 0.824);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.822);
(* status_callback) (NULL, _("Pattern UI"), 0.828);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.829);
(* status_callback) (NULL, _("Patterns"), 0.835);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.838);
(* status_callback) (NULL, _("Plug-in"), 0.844);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.85);
(* status_callback) (NULL, _("Procedural database"), 0.855);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.871);
(* status_callback) (NULL, _("Progress"), 0.875);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.882);
(* status_callback) (NULL, _("Image mask"), 0.886);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.921);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.924);
register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.933);
(* status_callback) (NULL, _("Text procedures"), 0.935);
register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.942);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.944);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.956);
(* status_callback) (NULL, _("Undo"), 0.958);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.972);
(* status_callback) (NULL, _("Units"), 0.973);
register_unit_procs (gimp);
}

View File

@ -39,6 +39,7 @@ static ProcRecord palette_new_proc;
static ProcRecord palette_duplicate_proc;
static ProcRecord palette_rename_proc;
static ProcRecord palette_delete_proc;
static ProcRecord palette_is_editable_proc;
static ProcRecord palette_get_info_proc;
static ProcRecord palette_add_entry_proc;
static ProcRecord palette_delete_entry_proc;
@ -54,6 +55,7 @@ register_palette_procs (Gimp *gimp)
procedural_db_register (gimp, &palette_duplicate_proc);
procedural_db_register (gimp, &palette_rename_proc);
procedural_db_register (gimp, &palette_delete_proc);
procedural_db_register (gimp, &palette_is_editable_proc);
procedural_db_register (gimp, &palette_get_info_proc);
procedural_db_register (gimp, &palette_add_entry_proc);
procedural_db_register (gimp, &palette_delete_entry_proc);
@ -350,6 +352,75 @@ static ProcRecord palette_delete_proc =
{ { palette_delete_invoker } }
};
static Argument *
palette_is_editable_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !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)
success = TRUE;
else
success = FALSE;
}
return_args = procedural_db_return_args (&palette_is_editable_proc, success);
if (success)
return_args[1].value.pdb_int = GIMP_DATA (palette)->writable;
return return_args;
}
static ProcArg palette_is_editable_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The palette name."
}
};
static ProcArg palette_is_editable_outargs[] =
{
{
GIMP_PDB_INT32,
"editable",
"True if the palette can be edited"
}
};
static ProcRecord palette_is_editable_proc =
{
"gimp_palette_is_editable",
"Tests if palette can be edited",
"Returns True if you have permission to change the palette",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004",
NULL,
GIMP_INTERNAL,
1,
palette_is_editable_inargs,
1,
palette_is_editable_outargs,
{ { palette_is_editable_invoker } }
};
static Argument *
palette_get_info_invoker (Gimp *gimp,
GimpContext *context,

View File

@ -91,6 +91,38 @@ gimp_brush_duplicate (const gchar *name)
return ret_name;
}
/**
* gimp_brush_is_generated:
* @name: The brush name.
*
* Tests if generated
*
* Returns True if this brush is parametric, False for other types
*
* Returns: True if the brush is generated.
*
* Since: GIMP 2.2
*/
gboolean
gimp_brush_is_generated (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean generated = FALSE;
return_vals = gimp_run_procedure ("gimp_brush_is_generated",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
generated = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return generated;
}
/**
* gimp_brush_rename:
* @name: The brush name.
@ -157,6 +189,38 @@ gimp_brush_delete (const gchar *name)
return success;
}
/**
* gimp_brush_is_editable:
* @name: The brush name.
*
* Tests if brush can be edited
*
* Returns True if you have permission to change the brush
*
* Returns: True if the brush can be edited.
*
* Since: GIMP 2.2
*/
gboolean
gimp_brush_is_editable (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean editable = FALSE;
return_vals = gimp_run_procedure ("gimp_brush_is_editable",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
editable = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return editable;
}
/**
* gimp_brush_get_info:
* @name: The brush name.
@ -357,3 +421,426 @@ gimp_brush_set_spacing (const gchar *name,
return success;
}
/**
* gimp_brush_get_shape:
* @name: The brush name.
*
* Get the shape of a generated brush.
*
* This procedure gets the shape value for a generated brush. If called
* for any other type of brush, it does not succeed. The current
* possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE), Square
* (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
* (GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be added
* in the future.
*
* Returns: An enumerated value representing the brush shape.
*
* Since: GIMP 2.2
*/
gint
gimp_brush_get_shape (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gint shape = 0;
return_vals = gimp_run_procedure ("gimp_brush_get_shape",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
shape = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return shape;
}
/**
* gimp_brush_get_radius:
* @name: The brush name.
*
* Get the radius of a generated brush.
*
* This procedure gets the radius value for a generated brush. If
* called for any other type of brush, it does not succeed.
*
* Returns: The radius of the brush in pixels.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_get_radius (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble radius = 0;
return_vals = gimp_run_procedure ("gimp_brush_get_radius",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
radius = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return radius;
}
/**
* gimp_brush_get_spikes:
* @name: The brush name.
*
* Get the number of spikes for a generated brush.
*
* This procedure gets the number of spikes for a generated brush. If
* called for any other type of brush, it does not succeed.
*
* Returns: The number of spikes on the brush.
*
* Since: GIMP 2.2
*/
gint
gimp_brush_get_spikes (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gint spikes = 0;
return_vals = gimp_run_procedure ("gimp_brush_get_spikes",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
spikes = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return spikes;
}
/**
* gimp_brush_get_hardness:
* @name: The brush name.
*
* Get the hardness of a generated brush.
*
* This procedure gets the hardness of a generated brush. The hardness
* of a brush is the amount its intensity fades at the outside edge. If
* called for any other type of brush, the function does not succeed.
*
* Returns: The hardness of the brush.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_get_hardness (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble hardness = 0;
return_vals = gimp_run_procedure ("gimp_brush_get_hardness",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
hardness = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return hardness;
}
/**
* gimp_brush_get_aspect_ratio:
* @name: The brush name.
*
* Get the aspect ratio of a generated brush.
*
* This procedure gets the aspect ratio of a generated brush. If called
* for any other type of brush, it does not succeed.
*
* Returns: The aspect ratio of the brush.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_get_aspect_ratio (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble aspect_ratio = 0;
return_vals = gimp_run_procedure ("gimp_brush_get_aspect_ratio",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
aspect_ratio = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return aspect_ratio;
}
/**
* gimp_brush_get_angle:
* @name: The brush name.
*
* Get the rotation angle of a generated brush.
*
* This procedure gets the angle of rotation for a generated brush. If
* called for any other type of brush, it does not succeed.
*
* Returns: The rotation angle of the brush.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_get_angle (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble angle = 0;
return_vals = gimp_run_procedure ("gimp_brush_get_angle",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
angle = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return angle;
}
/**
* gimp_brush_set_shape:
* @name: The brush name.
* @shape_in: An enumerated value representing the desired brush shape.
*
* Set the shape of a generated brush.
*
* This procedure sets the shape value for a generated brush. If called
* for any other type of brush, it does not succeed. The current
* possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE), Square
* (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
* (GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be added
* in the future.
*
* Returns: The brush shape actually assigned.
*
* Since: GIMP 2.2
*/
gint
gimp_brush_set_shape (const gchar *name,
gint shape_in)
{
GimpParam *return_vals;
gint nreturn_vals;
gint shape_out = 0;
return_vals = gimp_run_procedure ("gimp_brush_set_shape",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, shape_in,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
shape_out = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return shape_out;
}
/**
* gimp_brush_set_radius:
* @name: The brush name.
* @radius_in: The desired brush radius.
*
* Set the radius of a generated brush.
*
* This procedure sets the radius for a generated brush. If called for
* any other type of brush, it does not succeed.
*
* Returns: The brush radius actually assigned.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_set_radius (const gchar *name,
gdouble radius_in)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble radius_out = 0;
return_vals = gimp_run_procedure ("gimp_brush_set_radius",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_FLOAT, radius_in,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
radius_out = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return radius_out;
}
/**
* gimp_brush_set_spikes:
* @name: The brush name.
* @spikes_in: The desired number of spikes.
*
* Set the number of spikes for a generated brush.
*
* This procedure sets the number of spikes for a generated brush. If
* called for any other type of brush, it does not succeed.
*
* Returns: The number of spikes actually assigned.
*
* Since: GIMP 2.2
*/
gint
gimp_brush_set_spikes (const gchar *name,
gint spikes_in)
{
GimpParam *return_vals;
gint nreturn_vals;
gint spikes_out = 0;
return_vals = gimp_run_procedure ("gimp_brush_set_spikes",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, spikes_in,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
spikes_out = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return spikes_out;
}
/**
* gimp_brush_set_hardness:
* @name: The brush name.
* @hardness_in: The desired brush hardness.
*
* Set the hardness of a generated brush.
*
* This procedure sets the hardness for a generated brush. If called
* for any other type of brush, it does not succeed.
*
* Returns: The brush hardness actually assigned.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_set_hardness (const gchar *name,
gdouble hardness_in)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble hardness_out = 0;
return_vals = gimp_run_procedure ("gimp_brush_set_hardness",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_FLOAT, hardness_in,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
hardness_out = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return hardness_out;
}
/**
* gimp_brush_set_aspect_ratio:
* @name: The brush name.
* @aspect_ratio_in: The desired brush aspect ratio.
*
* Set the aspect ratio of a generated brush.
*
* This procedure sets the aspect ratio for a generated brush. If
* called for any other type of brush, it does not succeed.
*
* Returns: The brush aspect ratio actually assigned.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_set_aspect_ratio (const gchar *name,
gdouble aspect_ratio_in)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble aspect_ratio_out = 0;
return_vals = gimp_run_procedure ("gimp_brush_set_aspect_ratio",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_FLOAT, aspect_ratio_in,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
aspect_ratio_out = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return aspect_ratio_out;
}
/**
* gimp_brush_set_angle:
* @name: The brush name.
* @angle_in: The desired brush rotation angle.
*
* Set the rotation angle of a generated brush.
*
* This procedure sets the rotation angle for a generated brush. If
* called for any other type of brush, it does not succeed.
*
* Returns: The brush rotation angle actually assigned.
*
* Since: GIMP 2.2
*/
gdouble
gimp_brush_set_angle (const gchar *name,
gdouble angle_in)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble angle_out = 0;
return_vals = gimp_run_procedure ("gimp_brush_set_angle",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_FLOAT, angle_in,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
angle_out = return_vals[1].data.d_float;
gimp_destroy_params (return_vals, nreturn_vals);
return angle_out;
}

View File

@ -29,29 +29,49 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gchar* gimp_brush_new (const gchar *name);
gchar* gimp_brush_duplicate (const gchar *name);
gchar* gimp_brush_rename (const gchar *name,
const gchar *new_name);
gboolean gimp_brush_delete (const gchar *name);
gboolean gimp_brush_get_info (const gchar *name,
gint *width,
gint *height,
gint *mask_bpp,
gint *color_bpp);
gboolean gimp_brush_get_pixels (const gchar *name,
gint *width,
gint *height,
gint *mask_bpp,
gint *num_mask_bytes,
guint8 **mask_bytes,
gint *color_bpp,
gint *num_color_bytes,
guint8 **color_bytes);
gboolean gimp_brush_get_spacing (const gchar *name,
gint *spacing);
gboolean gimp_brush_set_spacing (const gchar *name,
gint spacing);
gchar* gimp_brush_new (const gchar *name);
gchar* gimp_brush_duplicate (const gchar *name);
gboolean gimp_brush_is_generated (const gchar *name);
gchar* gimp_brush_rename (const gchar *name,
const gchar *new_name);
gboolean gimp_brush_delete (const gchar *name);
gboolean gimp_brush_is_editable (const gchar *name);
gboolean gimp_brush_get_info (const gchar *name,
gint *width,
gint *height,
gint *mask_bpp,
gint *color_bpp);
gboolean gimp_brush_get_pixels (const gchar *name,
gint *width,
gint *height,
gint *mask_bpp,
gint *num_mask_bytes,
guint8 **mask_bytes,
gint *color_bpp,
gint *num_color_bytes,
guint8 **color_bytes);
gboolean gimp_brush_get_spacing (const gchar *name,
gint *spacing);
gboolean gimp_brush_set_spacing (const gchar *name,
gint spacing);
gint gimp_brush_get_shape (const gchar *name);
gdouble gimp_brush_get_radius (const gchar *name);
gint gimp_brush_get_spikes (const gchar *name);
gdouble gimp_brush_get_hardness (const gchar *name);
gdouble gimp_brush_get_aspect_ratio (const gchar *name);
gdouble gimp_brush_get_angle (const gchar *name);
gint gimp_brush_set_shape (const gchar *name,
gint shape_in);
gdouble gimp_brush_set_radius (const gchar *name,
gdouble radius_in);
gint gimp_brush_set_spikes (const gchar *name,
gint spikes_in);
gdouble gimp_brush_set_hardness (const gchar *name,
gdouble hardness_in);
gdouble gimp_brush_set_aspect_ratio (const gchar *name,
gdouble aspect_ratio_in);
gdouble gimp_brush_set_angle (const gchar *name,
gdouble angle_in);
G_END_DECLS

View File

@ -155,6 +155,38 @@ gimp_palette_delete (const gchar *name)
return success;
}
/**
* gimp_palette_is_editable:
* @name: The palette name.
*
* Tests if palette can be edited
*
* Returns True if you have permission to change the palette
*
* Returns: True if the palette can be edited.
*
* Since: GIMP 2.2
*/
gboolean
gimp_palette_is_editable (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean editable = FALSE;
return_vals = gimp_run_procedure ("gimp_palette_is_editable",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
editable = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return editable;
}
/**
* gimp_palette_get_info:
* @name: The palette name.

View File

@ -34,6 +34,7 @@ gchar* gimp_palette_duplicate (const gchar *name);
gchar* gimp_palette_rename (const gchar *name,
const gchar *new_name);
gboolean gimp_palette_delete (const gchar *name);
gboolean gimp_palette_is_editable (const gchar *name);
gboolean gimp_palette_get_info (const gchar *name,
gint *num_colors);
gboolean gimp_palette_add_entry (const gchar *name,

View File

@ -109,6 +109,72 @@ CODE
);
}
sub brush_is_generated {
$blurb = "Tests if generated";
$help = "Returns True if this brush is parametric, False for other types";
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'generated', type => 'boolean',
desc => "True if the brush is generated",
alias => 'GIMP_IS_BRUSH_GENERATED (brush)',
no_declare => 1 }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush)
success = TRUE;
else
success = FALSE;
}
CODE
);
}
sub brush_is_editable {
$blurb = "Tests if brush can be edited";
$help = "Returns True if you have permission to change the brush";
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'editable', type => 'boolean',
desc => "True if the brush can be edited",
alias => 'GIMP_DATA (brush)->writable',
no_declare => 1 }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush)
success = TRUE;
else
success = FALSE;
}
CODE
);
}
sub brush_rename {
$blurb = "Rename a brush";
$help = "This procedure renames a brush";
@ -322,6 +388,216 @@ CODE
);
}
sub brush_get_shape {
$blurb = 'Get the shape of a generated brush.';
$help = <<'HELP';
This procedure gets the shape value for a generated brush. If
called for any other type of brush, it does not succeed. The
current possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE),
Square (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
(GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be
added in the future.
HELP
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'shape', type => 'int32', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->shape',
desc => "An enumerated value representing the brush shape" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush));
}
CODE
);
}
sub brush_get_radius {
$blurb = 'Get the radius of a generated brush.';
$help = <<'HELP';
This procedure gets the radius value for a generated brush. If
called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'radius', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->radius',
desc => "The radius of the brush in pixels" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush));
}
CODE
);
}
sub brush_get_spikes {
$blurb = 'Get the number of spikes for a generated brush.';
$help = <<'HELP';
This procedure gets the number of spikes for a generated brush.
If called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'spikes', type => 'int32', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->spikes',
desc => "The number of spikes on the brush." }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush));
}
CODE
);
}
sub brush_get_hardness {
$blurb = 'Get the hardness of a generated brush.';
$help = <<'HELP';
This procedure gets the hardness of a generated brush. The
hardness of a brush is the amount its intensity fades at the
outside edge. If called for any other type of brush, the function
does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'hardness', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->hardness',
desc => "The hardness of the brush." }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush));
}
CODE
);
}
sub brush_get_aspect_ratio {
$blurb = 'Get the aspect ratio of a generated brush.';
$help = <<'HELP';
This procedure gets the aspect ratio of a generated brush.
If called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'aspect_ratio', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->aspect_ratio',
desc => "The aspect ratio of the brush." }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush));
}
CODE
);
}
sub brush_get_angle {
$blurb = 'Get the rotation angle of a generated brush.';
$help = <<'HELP';
This procedure gets the angle of rotation for a generated brush.
If called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg
);
@outargs = (
{ name => 'angle', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->angle',
desc => "The rotation angle of the brush." }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush));
}
CODE
);
}
sub brush_set_spacing {
$blurb = 'Set the brush spacing.';
@ -354,13 +630,259 @@ CODE
}
sub brush_set_shape {
$blurb = 'Set the shape of a generated brush.';
$help = <<'HELP';
This procedure sets the shape value for a generated brush. If
called for any other type of brush, it does not succeed. The
current possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE),
Square (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
(GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be
added in the future.
HELP
&mitch_misc;
@inargs = (
&brush_arg,
{ name => 'shape_in', type => 'int32',
desc => "An enumerated value representing the desired brush shape" }
);
@outargs = (
{ name => 'shape_out', type => 'int32', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->shape',
desc => "The brush shape actually assigned" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush), shape_in);
else
success = FALSE;
}
CODE
);
}
sub brush_set_radius {
$blurb = 'Set the radius of a generated brush.';
$help = <<'HELP';
This procedure sets the radius for a generated brush. If
called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg,
{ name => 'radius_in', type => 'float',
desc => "The desired brush radius" }
);
@outargs = (
{ name => 'radius_out', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->radius',
desc => "The brush radius actually assigned" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush), radius_in);
else
success = FALSE;
}
CODE
);
}
sub brush_set_spikes {
$blurb = 'Set the number of spikes for a generated brush.';
$help = <<'HELP';
This procedure sets the number of spikes for a generated brush. If
called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg,
{ name => 'spikes_in', type => 'int32',
desc => "The desired number of spikes" }
);
@outargs = (
{ name => 'spikes_out', type => 'int32', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->spikes',
desc => "The number of spikes actually assigned" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush), spikes_in);
else
success = FALSE;
}
CODE
);
}
sub brush_set_hardness {
$blurb = 'Set the hardness of a generated brush.';
$help = <<'HELP';
This procedure sets the hardness for a generated brush. If
called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg,
{ name => 'hardness_in', type => 'float',
desc => "The desired brush hardness" }
);
@outargs = (
{ name => 'hardness_out', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->hardness',
desc => "The brush hardness actually assigned" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush), hardness_in);
else
success = FALSE;
}
CODE
);
}
sub brush_set_aspect_ratio {
$blurb = 'Set the aspect ratio of a generated brush.';
$help = <<'HELP';
This procedure sets the aspect ratio for a generated brush. If
called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg,
{ name => 'aspect_ratio_in', type => 'float',
desc => "The desired brush aspect ratio" }
);
@outargs = (
{ name => 'aspect_ratio_out', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->aspect_ratio',
desc => "The brush aspect ratio actually assigned" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush), aspect_ratio_in);
else
success = FALSE;
}
CODE
);
}
sub brush_set_angle {
$blurb = 'Set the rotation angle of a generated brush.';
$help = <<'HELP';
This procedure sets the rotation angle for a generated brush. If
called for any other type of brush, it does not succeed.
HELP
&mitch_misc;
@inargs = (
&brush_arg,
{ name => 'angle_in', type => 'float',
desc => "The desired brush rotation angle" }
);
@outargs = (
{ name => 'angle_out', type => 'float', no_declare => '1',
alias => 'GIMP_BRUSH_GENERATED (brush)->angle',
desc => "The brush rotation angle actually assigned" }
);
%invoke = (
vars => [ 'GimpBrush *brush = NULL' ],
code => <<'CODE'
{
brush = (GimpBrush *)
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush))
gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush), angle_in);
else
success = FALSE;
}
CODE
);
}
@headers = qw(<string.h> "base/temp-buf.h"
"core/gimp.h" "core/gimplist.h" "core/gimpbrush.h"
"core/gimpcontext.h" "core/gimpdatafactory.h");
"core/gimpbrushgenerated.h" "core/gimpcontext.h"
"core/gimpdatafactory.h");
@procs = qw(brush_new brush_duplicate brush_rename brush_delete
@procs = qw(brush_new brush_duplicate brush_is_generated
brush_rename brush_delete brush_is_editable
brush_get_info brush_get_pixels
brush_get_spacing brush_set_spacing);
brush_get_spacing brush_set_spacing
brush_get_shape brush_get_radius
brush_get_spikes brush_get_hardness
brush_get_aspect_ratio brush_get_angle
brush_set_shape brush_set_radius
brush_set_spikes brush_set_hardness
brush_set_aspect_ratio brush_set_angle);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Brush';

View File

@ -76,6 +76,39 @@ CODE
);
}
sub palette_is_editable {
$blurb = "Tests if palette can be edited";
$help = "Returns True if you have permission to change the palette";
&mitch_misc;
@inargs = (
&palette_arg
);
@outargs = (
{ name => 'editable', type => 'boolean',
desc => "True if the palette can be edited",
alias => 'GIMP_DATA (palette)->writable',
no_declare => 1 }
);
%invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE'
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette)
success = TRUE;
else
success = FALSE;
}
CODE
);
}
sub palette_duplicate {
$blurb = "Duplicates a palette";
$help = "This procedure creates an identical palette by a different name";
@ -493,6 +526,7 @@ CODE
"core/gimpdatafactory.h" "core/gimppalette.h");
@procs = qw(palette_new palette_duplicate palette_rename palette_delete
palette_is_editable
palette_get_info palette_add_entry palette_delete_entry
palette_entry_get_color palette_entry_set_color
palette_entry_get_name palette_entry_set_name);