applied a modified patch from Joao S. O. Bueno <gwidion@mpc.com.br> that

2003-07-09  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/paths.pdb: applied a modified patch from Joao
	S. O. Bueno <gwidion@mpc.com.br> that adds the new PDB function
	gimp_path_to_selection().

	* app/pdb/internal_procs.c
	* app/pdb/paths_cmds.c
	* libgimp/gimppaths_pdb.[ch]: regenerated.
This commit is contained in:
Sven Neumann 2003-07-09 13:18:56 +00:00 committed by Sven Neumann
parent 9bad7d216b
commit 3cfa4dc931
9 changed files with 443 additions and 184 deletions

View File

@ -1,3 +1,13 @@
2003-07-09 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/paths.pdb: applied a modified patch from Joao
S. O. Bueno <gwidion@mpc.com.br> that adds the new PDB function
gimp_path_to_selection().
* app/pdb/internal_procs.c
* app/pdb/paths_cmds.c
* libgimp/gimppaths_pdb.[ch]: regenerated.
2003-07-09 Sven Neumann <sven@gimp.org>
* app/composite/tester.c: removed ...

View File

@ -68,7 +68,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 343 procedures registered total */
/* 344 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -95,67 +95,67 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Display procedures"), 0.131);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.143);
(* status_callback) (NULL, _("Drawable procedures"), 0.142);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.21);
(* status_callback) (NULL, _("Edit procedures"), 0.209);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.227);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.251);
(* status_callback) (NULL, _("Floating selections"), 0.25);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.268);
(* status_callback) (NULL, _("Font UI"), 0.267);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.277);
(* status_callback) (NULL, _("Gimprc procedures"), 0.276);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.289);
(* status_callback) (NULL, _("Gradient UI"), 0.288);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.297);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.318);
(* status_callback) (NULL, _("Guide procedures"), 0.317);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.335);
(* status_callback) (NULL, _("Help procedures"), 0.334);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.338);
(* status_callback) (NULL, _("Image"), 0.337);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.525);
(* status_callback) (NULL, _("Layer"), 0.523);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.618);
(* status_callback) (NULL, _("Message procedures"), 0.616);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.627);
(* status_callback) (NULL, _("Miscellaneous"), 0.625);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.633);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.631);
register_misc_tools_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.641);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.64);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.685);
(* status_callback) (NULL, _("Palette"), 0.683);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.703);
(* status_callback) (NULL, _("Palette UI"), 0.701);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.711);
(* status_callback) (NULL, _("Palettes"), 0.709);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.726);
(* status_callback) (NULL, _("Parasite procedures"), 0.724);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.761);
(* status_callback) (NULL, _("Paths"), 0.759);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.799);
@ -164,7 +164,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Patterns"), 0.808);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.822);
(* status_callback) (NULL, _("Plug-in"), 0.823);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.84);
@ -173,7 +173,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Image mask"), 0.863);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.915);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.916);
register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.93);

View File

@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage-mask-select.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "core/gimppaintinfo.h"
@ -55,6 +56,7 @@ static ProcRecord path_set_tattoo_proc;
static ProcRecord get_path_by_tattoo_proc;
static ProcRecord path_get_locked_proc;
static ProcRecord path_set_locked_proc;
static ProcRecord path_to_selection_proc;
void
register_paths_procs (Gimp *gimp)
@ -72,6 +74,7 @@ register_paths_procs (Gimp *gimp)
procedural_db_register (gimp, &get_path_by_tattoo_proc);
procedural_db_register (gimp, &path_get_locked_proc);
procedural_db_register (gimp, &path_set_locked_proc);
procedural_db_register (gimp, &path_to_selection_proc);
}
static Argument *
@ -166,7 +169,7 @@ path_get_current_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gchar *pname = NULL;
gchar *name = NULL;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
@ -178,7 +181,7 @@ path_get_current_invoker (Gimp *gimp,
vectors = gimp_image_get_active_vectors (gimage);
if (vectors)
pname = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
else
success = FALSE;
}
@ -186,7 +189,7 @@ path_get_current_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&path_get_current_proc, success);
if (success)
return_args[1].value.pdb_pointer = pname;
return_args[1].value.pdb_pointer = name;
return return_args;
}
@ -204,7 +207,7 @@ static ProcArg path_get_current_outargs[] =
{
{
GIMP_PDB_STRING,
"current_path_name",
"name",
"The name of the current path"
}
};
@ -231,20 +234,20 @@ path_set_current_invoker (Gimp *gimp,
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *pname;
gchar *name;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
if (success)
{
vectors = gimp_image_get_vectors_by_name (gimage, pname);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_image_set_active_vectors (gimage, vectors);
@ -264,7 +267,7 @@ static ProcArg path_set_current_inargs[] =
},
{
GIMP_PDB_STRING,
"set_current_path_name",
"name",
"The name of the path to set the current path to"
}
};
@ -291,21 +294,21 @@ path_delete_invoker (Gimp *gimp,
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *pname;
gchar *name;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_image_remove_vectors (gimage, vectors);
@ -325,7 +328,7 @@ static ProcArg path_delete_inargs[] =
},
{
GIMP_PDB_STRING,
"path_name_to_del",
"name",
"The name of the path to delete"
}
};
@ -353,7 +356,7 @@ path_get_points_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gchar *pname;
gchar *name;
gint32 path_type = 0;
gint32 path_closed = 0;
gint32 num_points = 0;
@ -364,8 +367,8 @@ path_get_points_invoker (Gimp *gimp,
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
if (success)
@ -428,7 +431,7 @@ static ProcArg path_get_points_inargs[] =
},
{
GIMP_PDB_STRING,
"pathname",
"name",
"the name of the path whose points should be listed"
}
};
@ -453,7 +456,7 @@ static ProcArg path_get_points_outargs[] =
{
GIMP_PDB_FLOATARRAY,
"points_pairs",
"The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL). Note all points are returned in pixel resolution"
"The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL, 3.0 = BEZIER_MOVE). Note all points are returned in pixel resolution"
}
};
@ -479,7 +482,7 @@ path_set_points_invoker (Gimp *gimp,
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *pname = NULL;
gchar *name = NULL;
gint32 ptype;
gint32 num_path_points = 0;
gdouble *points_pairs;
@ -489,8 +492,8 @@ path_set_points_invoker (Gimp *gimp,
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
ptype = args[2].value.pdb_int;
@ -529,7 +532,7 @@ path_set_points_invoker (Gimp *gimp,
points[i].type = curr_point_pair[2];
}
vectors = gimp_vectors_compat_new (gimage, pname, points, n_points,
vectors = gimp_vectors_compat_new (gimage, name, points, n_points,
closed);
g_free (points);
@ -553,7 +556,7 @@ static ProcArg path_set_points_inargs[] =
},
{
GIMP_PDB_STRING,
"pathname",
"name",
"The name of the path to create (if it exists then a unique name will be created - query the list of paths if you want to make sure that the name of the path you create is unique. This will be set as the current path."
},
{
@ -569,7 +572,7 @@ static ProcArg path_set_points_inargs[] =
{
GIMP_PDB_FLOATARRAY,
"points_pairs",
"The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL). Note all points are returned in pixel resolution"
"The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL, 3.0= BEZIER_MOVE). Note all points are returned in pixel resolution"
}
};
@ -762,7 +765,7 @@ path_get_tattoo_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gchar *pname;
gchar *name;
gint32 tattoo = 0;
GimpVectors *vectors;
@ -770,14 +773,14 @@ path_get_tattoo_invoker (Gimp *gimp,
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
tattoo = gimp_item_get_tattoo (GIMP_ITEM (vectors));
@ -802,7 +805,7 @@ static ProcArg path_get_tattoo_inargs[] =
},
{
GIMP_PDB_STRING,
"pathname",
"name",
"the name of the path whose tattoo should be obtained"
}
};
@ -838,7 +841,7 @@ path_set_tattoo_invoker (Gimp *gimp,
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *pname;
gchar *name;
gint32 tattovalue = 0;
GimpVectors *vectors;
@ -846,8 +849,8 @@ path_set_tattoo_invoker (Gimp *gimp,
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
tattovalue = args[2].value.pdb_int;
@ -855,7 +858,7 @@ path_set_tattoo_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_item_set_tattoo (GIMP_ITEM (vectors), tattovalue);
@ -875,7 +878,7 @@ static ProcArg path_set_tattoo_inargs[] =
},
{
GIMP_PDB_STRING,
"pathname",
"name",
"the name of the path whose tattoo should be set"
},
{
@ -909,7 +912,7 @@ get_path_by_tattoo_invoker (Gimp *gimp,
Argument *return_args;
GimpImage *gimage;
gint32 tattoo;
gchar *path_name = NULL;
gchar *name = NULL;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
@ -923,7 +926,7 @@ get_path_by_tattoo_invoker (Gimp *gimp,
vectors = gimp_image_get_vectors_by_tattoo (gimage, tattoo);
if (vectors)
path_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
else
success = FALSE;
}
@ -931,7 +934,7 @@ get_path_by_tattoo_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&get_path_by_tattoo_proc, success);
if (success)
return_args[1].value.pdb_pointer = path_name;
return_args[1].value.pdb_pointer = name;
return return_args;
}
@ -954,7 +957,7 @@ static ProcArg get_path_by_tattoo_outargs[] =
{
{
GIMP_PDB_STRING,
"path_name",
"name",
"The name of the path with the specified tattoo"
}
};
@ -982,7 +985,7 @@ path_get_locked_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gchar *pname;
gchar *name;
gint32 lockstatus = 0;
GimpVectors *vectors;
@ -990,14 +993,14 @@ path_get_locked_invoker (Gimp *gimp,
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
lockstatus = gimp_item_get_linked (GIMP_ITEM (vectors));
@ -1022,7 +1025,7 @@ static ProcArg path_get_locked_inargs[] =
},
{
GIMP_PDB_STRING,
"pathname",
"name",
"the name of the path whose locked status should be obtained"
}
};
@ -1058,7 +1061,7 @@ path_set_locked_invoker (Gimp *gimp,
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *pname;
gchar *name;
gint32 lockstatus = 0;
GimpVectors *vectors;
@ -1066,8 +1069,8 @@ path_set_locked_invoker (Gimp *gimp,
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
lockstatus = args[2].value.pdb_int;
@ -1075,7 +1078,7 @@ path_set_locked_invoker (Gimp *gimp,
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_item_set_linked (GIMP_ITEM (vectors), lockstatus, TRUE);
@ -1095,7 +1098,7 @@ static ProcArg path_set_locked_inargs[] =
},
{
GIMP_PDB_STRING,
"pathname",
"name",
"the name of the path whose locked status should be set"
},
{
@ -1120,3 +1123,112 @@ static ProcRecord path_set_locked_proc =
NULL,
{ { path_set_locked_invoker } }
};
static Argument *
path_to_selection_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *name;
gint32 op;
gboolean antialias;
gboolean feather;
gdouble feather_radius_x;
gdouble feather_radius_y;
GimpVectors *vectors;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
name = (gchar *) args[1].value.pdb_pointer;
if (name == NULL)
success = FALSE;
op = args[2].value.pdb_int;
if (op < GIMP_CHANNEL_OP_ADD || op > GIMP_CHANNEL_OP_INTERSECT)
success = FALSE;
antialias = args[3].value.pdb_int ? TRUE : FALSE;
feather = args[4].value.pdb_int ? TRUE : FALSE;
feather_radius_x = args[5].value.pdb_float;
feather_radius_y = args[6].value.pdb_float;
if (success)
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_image_mask_select_vectors (gimage,
vectors,
op,
antialias,
feather,
feather_radius_x,
feather_radius_y);
else
success = FALSE;
}
return procedural_db_return_args (&path_to_selection_proc, success);
}
static ProcArg path_to_selection_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
},
{
GIMP_PDB_STRING,
"name",
"The name of the path which should be made into selection"
},
{
GIMP_PDB_INT32,
"op",
"The desired operation with current selection"
},
{
GIMP_PDB_INT32,
"antialias",
"Antialias selection"
},
{
GIMP_PDB_INT32,
"feather",
"Feather selection"
},
{
GIMP_PDB_FLOAT,
"feather_radius_x",
"Feather radius x"
},
{
GIMP_PDB_FLOAT,
"feather_radius_y",
"Feather radius y"
}
};
static ProcRecord path_to_selection_proc =
{
"gimp_path_to_selection",
"Transforms the active path into a selection",
"This procedure renders the desired path into the current selection.",
"Joao S. O. Bueno",
"Joao S. O. Bueno",
"2003",
GIMP_INTERNAL,
7,
path_to_selection_inargs,
0,
NULL,
{ { path_to_selection_invoker } }
};

View File

@ -1,3 +1,8 @@
2003-07-09 Sven Neumann <sven@gimp.org>
* libgimp/libgimp-sections.txt
* libgimp/tmpl/libgimp-paths.sgml: updated.
2003-07-07 Sven Neumann <sven@gimp.org>
* libgimpmath/libgimpmath-sections.txt

View File

@ -457,6 +457,7 @@ gimp_path_delete
gimp_path_get_locked
gimp_path_set_locked
gimp_path_set_tattoo
gimp_path_to_selection
</SECTION>
<SECTION>

View File

@ -30,11 +30,13 @@ gimppaths
</para>
@image_ID:
@pathname:
@name:
@path_closed:
@num_path_point_details:
@points_pairs:
@Returns:
<!-- # Unused Parameters # -->
@pathname:
<!-- ##### FUNCTION gimp_path_get_current ##### -->
@ -52,8 +54,10 @@ gimppaths
</para>
@image_ID:
@set_current_path_name:
@name:
@Returns:
<!-- # Unused Parameters # -->
@set_current_path_name:
<!-- ##### FUNCTION gimp_path_set_points ##### -->
@ -62,11 +66,13 @@ gimppaths
</para>
@image_ID:
@pathname:
@name:
@ptype:
@num_path_points:
@points_pairs:
@Returns:
<!-- # Unused Parameters # -->
@pathname:
<!-- ##### FUNCTION gimp_path_stroke_current ##### -->
@ -96,8 +102,10 @@ gimppaths
</para>
@image_ID:
@pathname:
@name:
@Returns:
<!-- # Unused Parameters # -->
@pathname:
<!-- ##### FUNCTION gimp_get_path_by_tattoo ##### -->
@ -116,8 +124,10 @@ gimppaths
</para>
@image_ID:
@path_name_to_del:
@name:
@Returns:
<!-- # Unused Parameters # -->
@path_name_to_del:
<!-- ##### FUNCTION gimp_path_get_locked ##### -->
@ -126,8 +136,10 @@ gimppaths
</para>
@image_ID:
@pathname:
@name:
@Returns:
<!-- # Unused Parameters # -->
@pathname:
<!-- ##### FUNCTION gimp_path_set_locked ##### -->
@ -136,9 +148,11 @@ gimppaths
</para>
@image_ID:
@pathname:
@name:
@lockstatus:
@Returns:
<!-- # Unused Parameters # -->
@pathname:
<!-- ##### FUNCTION gimp_path_set_tattoo ##### -->
@ -147,8 +161,27 @@ gimppaths
</para>
@image_ID:
@pathname:
@name:
@tattovalue:
@Returns:
<!-- # Unused Parameters # -->
@pathname:
<!-- ##### FUNCTION gimp_path_to_selection ##### -->
<para>
</para>
@image_ID:
@name:
@op:
@antialias:
@feather:
@feather_radius_x:
@feather_radius_y:
@Returns:
<!-- # Unused Parameters # -->
@pathname:

View File

@ -82,7 +82,7 @@ gimp_path_get_current (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *current_path_name = NULL;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp_path_get_current",
&nreturn_vals,
@ -90,17 +90,17 @@ gimp_path_get_current (gint32 image_ID)
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
current_path_name = g_strdup (return_vals[1].data.d_string);
name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return current_path_name;
return name;
}
/**
* gimp_path_set_current:
* @image_ID: The ID of the image to list set the paths in.
* @set_current_path_name: The name of the path to set the current path to.
* @name: The name of the path to set the current path to.
*
* List the paths associated with the passed image.
*
@ -110,7 +110,7 @@ gimp_path_get_current (gint32 image_ID)
*/
gboolean
gimp_path_set_current (gint32 image_ID,
const gchar *set_current_path_name)
const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
@ -119,7 +119,7 @@ gimp_path_set_current (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_set_current",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, set_current_path_name,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@ -132,7 +132,7 @@ gimp_path_set_current (gint32 image_ID,
/**
* gimp_path_delete:
* @image_ID: The ID of the image to list delete the paths from.
* @path_name_to_del: The name of the path to delete.
* @name: The name of the path to delete.
*
* Delete the named paths associated with the passed image.
*
@ -142,7 +142,7 @@ gimp_path_set_current (gint32 image_ID,
*/
gboolean
gimp_path_delete (gint32 image_ID,
const gchar *path_name_to_del)
const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
@ -151,7 +151,7 @@ gimp_path_delete (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_delete",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, path_name_to_del,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@ -164,10 +164,10 @@ gimp_path_delete (gint32 image_ID,
/**
* gimp_path_get_points:
* @image_ID: The ID of the image to list the paths from.
* @pathname: the name of the path whose points should be listed.
* @name: the name of the path whose points should be listed.
* @path_closed: Return if the path is closed. (0 = path open, 1 = path closed).
* @num_path_point_details: The number of points returned. Each point is made up of (x, y, pnt_type) of floats.
* @points_pairs: The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL). Note all points are returned in pixel resolution.
* @points_pairs: The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL, 3.0 = BEZIER_MOVE). Note all points are returned in pixel resolution.
*
* List the points associated with the named path.
*
@ -177,7 +177,7 @@ gimp_path_delete (gint32 image_ID,
*/
gint
gimp_path_get_points (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint *path_closed,
gint *num_path_point_details,
gdouble **points_pairs)
@ -189,7 +189,7 @@ gimp_path_get_points (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_get_points",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, pathname,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
*num_path_point_details = 0;
@ -212,10 +212,10 @@ gimp_path_get_points (gint32 image_ID,
/**
* gimp_path_set_points:
* @image_ID: The ID of the image to set the paths in.
* @pathname: The name of the path to create (if it exists then a unique name will be created - query the list of paths if you want to make sure that the name of the path you create is unique. This will be set as the current path.
* @name: The name of the path to create (if it exists then a unique name will be created - query the list of paths if you want to make sure that the name of the path you create is unique. This will be set as the current path.
* @ptype: The type of the path. Currently only one type (1 = Bezier) is supported.
* @num_path_points: The number of points in the path. Each point is made up of (x, y, type) of floats. Currently only the creation of bezier curves is allowed. The type parameter must be set to (1) to indicate a BEZIER type curve. For BEZIERS. Note the that points must be given in the following order... ACCACCAC ... If the path is not closed the last control point is missed off. Points consist of three control points (control/anchor/control) so for a curve that is not closed there must be at least two points passed (2 x,y pairs). If num_path_pnts % 3 = 0 then the path is assumed to be closed and the points are ACCACCACCACC.
* @points_pairs: The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL). Note all points are returned in pixel resolution.
* @points_pairs: The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependant on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL, 3.0= BEZIER_MOVE). Note all points are returned in pixel resolution.
*
* Set the points associated with the named path.
*
@ -225,7 +225,7 @@ gimp_path_get_points (gint32 image_ID,
*/
gboolean
gimp_path_set_points (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint ptype,
gint num_path_points,
const gdouble *points_pairs)
@ -237,7 +237,7 @@ gimp_path_set_points (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_set_points",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, pathname,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, ptype,
GIMP_PDB_INT32, num_path_points,
GIMP_PDB_FLOATARRAY, points_pairs,
@ -328,7 +328,7 @@ gimp_path_get_point_at_dist (gint32 image_ID,
/**
* gimp_path_get_tattoo:
* @image_ID: The image.
* @pathname: the name of the path whose tattoo should be obtained.
* @name: the name of the path whose tattoo should be obtained.
*
* Returns the tattoo associated with the name path.
*
@ -341,7 +341,7 @@ gimp_path_get_point_at_dist (gint32 image_ID,
*/
gint
gimp_path_get_tattoo (gint32 image_ID,
const gchar *pathname)
const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
@ -350,7 +350,7 @@ gimp_path_get_tattoo (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_get_tattoo",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, pathname,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
@ -364,7 +364,7 @@ gimp_path_get_tattoo (gint32 image_ID,
/**
* gimp_path_set_tattoo:
* @image_ID: The image.
* @pathname: the name of the path whose tattoo should be set.
* @name: the name of the path whose tattoo should be set.
* @tattovalue: The tattoo associated with the name path. Only values returned from 'path_get_tattoo' should be used here.
*
* Sets the tattoo associated with the name path.
@ -379,7 +379,7 @@ gimp_path_get_tattoo (gint32 image_ID,
*/
gboolean
gimp_path_set_tattoo (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint tattovalue)
{
GimpParam *return_vals;
@ -389,7 +389,7 @@ gimp_path_set_tattoo (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_set_tattoo",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, pathname,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, tattovalue,
GIMP_PDB_END);
@ -421,7 +421,7 @@ gimp_get_path_by_tattoo (gint32 image_ID,
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *path_name = NULL;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp_get_path_by_tattoo",
&nreturn_vals,
@ -430,17 +430,17 @@ gimp_get_path_by_tattoo (gint32 image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
path_name = g_strdup (return_vals[1].data.d_string);
name = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return path_name;
return name;
}
/**
* gimp_path_get_locked:
* @image_ID: The image.
* @pathname: the name of the path whose locked status should be obtained.
* @name: the name of the path whose locked status should be obtained.
*
* Returns the locked status associated with the name path.
*
@ -452,7 +452,7 @@ gimp_get_path_by_tattoo (gint32 image_ID,
*/
gint
gimp_path_get_locked (gint32 image_ID,
const gchar *pathname)
const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
@ -461,7 +461,7 @@ gimp_path_get_locked (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_get_locked",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, pathname,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
@ -475,7 +475,7 @@ gimp_path_get_locked (gint32 image_ID,
/**
* gimp_path_set_locked:
* @image_ID: The image.
* @pathname: the name of the path whose locked status should be set.
* @name: the name of the path whose locked status should be set.
* @lockstatus: The lock status associated with the name path. 0 if the path is not locked. 1 if the path is to be locked.
*
* Set the locked status associated with the name path.
@ -488,7 +488,7 @@ gimp_path_get_locked (gint32 image_ID,
*/
gboolean
gimp_path_set_locked (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint lockstatus)
{
GimpParam *return_vals;
@ -498,7 +498,7 @@ gimp_path_set_locked (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_path_set_locked",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, pathname,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, lockstatus,
GIMP_PDB_END);
@ -508,3 +508,50 @@ gimp_path_set_locked (gint32 image_ID,
return success;
}
/**
* gimp_path_to_selection:
* @image_ID: The image.
* @name: The name of the path which should be made into selection.
* @op: The desired operation with current selection.
* @antialias: Antialias selection.
* @feather: Feather selection.
* @feather_radius_x: Feather radius x.
* @feather_radius_y: Feather radius y.
*
* Transforms the active path into a selection
*
* This procedure renders the desired path into the current selection.
*
* Returns: TRUE on success.
*/
gboolean
gimp_path_to_selection (gint32 image_ID,
const gchar *name,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_path_to_selection",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, op,
GIMP_PDB_INT32, antialias,
GIMP_PDB_INT32, feather,
GIMP_PDB_FLOAT, feather_radius_x,
GIMP_PDB_FLOAT, feather_radius_y,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}

View File

@ -33,16 +33,16 @@ gchar** gimp_path_list (gint32 image_ID,
gint *num_paths);
gchar* gimp_path_get_current (gint32 image_ID);
gboolean gimp_path_set_current (gint32 image_ID,
const gchar *set_current_path_name);
const gchar *name);
gboolean gimp_path_delete (gint32 image_ID,
const gchar *path_name_to_del);
const gchar *name);
gint gimp_path_get_points (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint *path_closed,
gint *num_path_point_details,
gdouble **points_pairs);
gboolean gimp_path_set_points (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint ptype,
gint num_path_points,
const gdouble *points_pairs);
@ -52,17 +52,24 @@ gint gimp_path_get_point_at_dist (gint32 image_ID,
gint *y_point,
gdouble *gradient);
gint gimp_path_get_tattoo (gint32 image_ID,
const gchar *pathname);
const gchar *name);
gboolean gimp_path_set_tattoo (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint tattovalue);
gchar* gimp_get_path_by_tattoo (gint32 image_ID,
gint tattoo);
gint gimp_path_get_locked (gint32 image_ID,
const gchar *pathname);
const gchar *name);
gboolean gimp_path_set_locked (gint32 image_ID,
const gchar *pathname,
const gchar *name,
gint lockstatus);
gboolean gimp_path_to_selection (gint32 image_ID,
const gchar *name,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
G_END_DECLS

View File

@ -79,9 +79,8 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose points should be listed',
alias => 'pname' }
{ name => 'name', type => 'string',
desc => 'the name of the path whose points should be listed' }
);
$inargs[0]->{desc} = 'The ID of the image to list the paths from';
@ -97,7 +96,7 @@ HELP
the x pos, next is the y pos, last is the type of the pnt.
The type field is dependant on the path type. For beziers
(type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR,
2.0 = BEZIER_CONTROL). Note all points are returned in pixel
2.0 = BEZIER_CONTROL, 3.0 = BEZIER_MOVE). Note all points are returned in pixel
resolution',
init => 1,
array => { name => 'num_path_point_details',
@ -162,9 +161,9 @@ HELP
$inargs[0]->{desc} = 'The ID of the image to get the current paths from';
@outargs = (
{ name => 'current_path_name', type => 'string',
{ name => 'name', type => 'string',
desc => 'The name of the current path',
alias => 'pname', init => 1 }
init => 1 }
);
%invoke = (
@ -174,7 +173,7 @@ HELP
vectors = gimp_image_get_active_vectors (gimage);
if (vectors)
pname = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
else
success = FALSE;
}
@ -193,9 +192,8 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'set_current_path_name', type => 'string',
desc => 'The name of the path to set the current path to',
alias => 'pname' }
{ name => 'name', type => 'string',
desc => 'The name of the path to set the current path to' }
);
$inargs[0]->{desc} = 'The ID of the image to list set the paths in';
@ -203,7 +201,7 @@ HELP
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = gimp_image_get_vectors_by_name (gimage, pname);
vectors = gimp_image_get_vectors_by_name (gimage, name);
if (vectors)
gimp_image_set_active_vectors (gimage, vectors);
@ -225,12 +223,12 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
{ name => 'name', type => 'string',
desc => 'The name of the path to create (if it exists then a unique
name will be created - query the list of paths if you want
to make sure that the name of the path you create is
unique. This will be set as the current path.',
alias => 'pname', init => 1 },
init => 1 },
{ name => 'ptype', type => 'int32',
desc => 'The type of the path. Currently only one type (1 = Bezier)
is supported' },
@ -239,7 +237,7 @@ HELP
the x pos, next is the y pos, last is the type of the pnt.
The type field is dependant on the path type. For beziers
(type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR,
2.0 = BEZIER_CONTROL). Note all points are returned in pixel
2.0 = BEZIER_CONTROL, 3.0= BEZIER_MOVE). Note all points are returned in pixel
resolution',
array => { name => 'num_path_points',
desc => 'The number of points in the path. Each point is
@ -289,7 +287,7 @@ HELP
points[i].type = curr_point_pair[2];
}
vectors = gimp_vectors_compat_new (gimage, pname, points, n_points,
vectors = gimp_vectors_compat_new (gimage, name, points, n_points,
closed);
g_free (points);
@ -412,9 +410,8 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose tattoo should be obtained',
alias => 'pname' }
{ name => 'name', type => 'string',
desc => 'the name of the path whose tattoo should be obtained' }
);
@outargs = (
@ -427,7 +424,7 @@ HELP
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
tattoo = gimp_item_get_tattoo (GIMP_ITEM (vectors));
@ -449,9 +446,8 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose tattoo should be set',
alias => 'pname' },
{ name => 'name', type => 'string',
desc => 'the name of the path whose tattoo should be set' },
{ name => 'tattovalue', type => 'int32',
desc => 'The tattoo associated with the name path. Only values returned from \'path_get_tattoo\' should be used here', init => 1 }
);
@ -461,7 +457,7 @@ HELP
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_item_set_tattoo (GIMP_ITEM (vectors), tattovalue);
@ -489,7 +485,7 @@ HELP
);
@outargs = (
{ name => 'path_name', type => 'string', init => 1,
{ name => 'name', type => 'string', init => 1,
desc => 'The name of the path with the specified tattoo' }
);
@ -500,7 +496,7 @@ HELP
vectors = gimp_image_get_vectors_by_tattoo (gimage, tattoo);
if (vectors)
path_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
else
success = FALSE;
}
@ -519,9 +515,8 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'path_name_to_del', type => 'string',
desc => 'The name of the path to delete',
alias => 'pname' }
{ name => 'name', type => 'string',
desc => 'The name of the path to delete' }
);
$inargs[0]->{desc} = 'The ID of the image to list delete the paths from';
@ -530,7 +525,7 @@ HELP
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_image_remove_vectors (gimage, vectors);
@ -552,9 +547,8 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose locked status should be obtained',
alias => 'pname' }
{ name => 'name', type => 'string',
desc => 'the name of the path whose locked status should be obtained'}
);
@outargs = (
@ -567,7 +561,7 @@ HELP
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
lockstatus = gimp_item_get_linked (GIMP_ITEM (vectors));
@ -589,9 +583,8 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose locked status should be set',
alias => 'pname' },
{ name => 'name', type => 'string',
desc => 'the name of the path whose locked status should be set' },
{ name => 'lockstatus', type => 'int32',
desc => 'The lock status associated with the name path. 0 if the path is not locked. 1 if the path is to be locked', init => 1 }
);
@ -601,7 +594,7 @@ HELP
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, pname);
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_item_set_linked (GIMP_ITEM (vectors), lockstatus, TRUE);
@ -612,8 +605,59 @@ CODE
);
}
sub path_to_selection {
$blurb = 'Transforms the active path into a selection';
$help = <<'HELP';
This procedure renders the desired path into the current selection.
HELP
$author = $copyright = 'Joao S. O. Bueno';
$date = '2003';
@inargs = (
&std_image_arg,
{ name => 'name', type => 'string',
desc => 'The name of the path which should be made into selection' },
{ name => 'op', type => 'enum GimpChannelOps',
desc => 'The desired operation with current selection' },
{ name => 'antialias', type => 'boolean',
desc => 'Antialias selection' },
{ name => 'feather', type => 'boolean',
desc => 'Feather selection' },
{ name => 'feather_radius_x', type => 'float',
desc => 'Feather radius x' },
{ name => 'feather_radius_y', type => 'float',
desc => 'Feather radius y' }
);
%invoke = (
vars => [ 'GimpVectors *vectors' ],
code => <<'CODE'
{
vectors = (GimpVectors *)
gimp_container_get_child_by_name (gimage->vectors, name);
if (vectors)
gimp_image_mask_select_vectors (gimage,
vectors,
op,
antialias,
feather,
feather_radius_x,
feather_radius_y);
else
success = FALSE;
}
CODE
);
}
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h" "core/gimplist.h"
"core/gimppaintinfo.h" "core/gimptoolinfo.h"
"core/gimpimage-mask-select.h"
"paint/gimppaintcore-stroke.h" "paint/gimppaintoptions.h"
"vectors/gimpanchor.h" "vectors/gimpbezierstroke.h"
"vectors/gimpvectors.h" "vectors/gimpvectors-compat.h");
@ -622,7 +666,7 @@ CODE
path_get_points path_set_points
path_stroke_current path_get_point_at_dist
path_get_tattoo path_set_tattoo get_path_by_tattoo
path_get_locked path_set_locked);
path_get_locked path_set_locked path_to_selection);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Paths';