implemented gimp-vectors-to-selection. deprecated gimp-path-to-selection.

2006-07-28  Simon Budig  <simon@gimp.org>

	* tools/pdbgen/pdb/vectors.pdb: implemented gimp-vectors-to-selection.
	* tools/pdbgen/pdb/paths.pdb: deprecated gimp-path-to-selection.

	* app/pdb/internal_procs.c
	* app/pdb/paths_cmds.c
	* app/pdb/vectors_cmds.c
	* libgimp/gimppaths_pdb.[ch]
	* libgimp/gimpvectors_pdb.[ch]: regenerated.
This commit is contained in:
Simon Budig
2006-07-28 14:54:31 +00:00
committed by Simon Budig
parent 226e7e8222
commit 04c16c08b5
10 changed files with 295 additions and 91 deletions

View File

@ -1,3 +1,14 @@
2006-07-28 Simon Budig <simon@gimp.org>
* tools/pdbgen/pdb/vectors.pdb: implemented gimp-vectors-to-selection.
* tools/pdbgen/pdb/paths.pdb: deprecated gimp-path-to-selection.
* app/pdb/internal_procs.c
* app/pdb/paths_cmds.c
* app/pdb/vectors_cmds.c
* libgimp/gimppaths_pdb.[ch]
* libgimp/gimpvectors_pdb.[ch]: regenerated.
2006-07-27 Raphaël Quinet <raphael@gimp.org>
* HACKING: Clarify how patches can be submitted.

View File

@ -75,7 +75,7 @@ void register_undo_procs (GimpPDB *pdb);
void register_unit_procs (GimpPDB *pdb);
void register_vectors_procs (GimpPDB *pdb);
/* 525 procedures registered total */
/* 526 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)

View File

@ -1147,12 +1147,12 @@ register_paths_procs (GimpPDB *pdb)
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-path-to-selection");
gimp_procedure_set_static_strings (procedure,
"gimp-path-to-selection",
"Transforms the active path into a selection",
"This procedure renders the desired path into the current selection.",
"Jo\xc3\xa3o S. O. Bueno Calligaris",
"Jo\xc3\xa3o S. O. Bueno Calligaris",
"2003",
NULL);
"This procedure is deprecated! Use 'gimp-vectors-to-selection' instead.",
"This procedure is deprecated! Use 'gimp-vectors-to-selection' instead.",
"",
"",
"",
"gimp-vectors-to-selection");
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",

View File

@ -30,6 +30,7 @@
#include "core/gimpparamspecs.h"
#include "core/gimp.h"
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "gimp-intl.h"
@ -827,6 +828,50 @@ vectors_bezier_stroke_new_ellipse_invoker (GimpProcedure *procedure,
return return_vals;
}
static GValueArray *
vectors_to_selection_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args)
{
gboolean success = TRUE;
GimpVectors *vectors;
gint32 op;
gboolean antialias;
gboolean feather;
gdouble feather_radius_x;
gdouble feather_radius_y;
vectors = gimp_value_get_vectors (&args->values[0], gimp);
op = g_value_get_enum (&args->values[1]);
antialias = g_value_get_boolean (&args->values[2]);
feather = g_value_get_boolean (&args->values[3]);
feather_radius_x = g_value_get_double (&args->values[4]);
feather_radius_y = g_value_get_double (&args->values[5]);
if (success)
{
GimpImage *image;
image = gimp_item_get_image (GIMP_ITEM (vectors));
if (image)
gimp_channel_select_vectors (gimp_image_get_mask (image),
_("Path to Selection"),
vectors,
op,
antialias,
feather,
feather_radius_x,
feather_radius_y);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success);
}
void
register_vectors_procs (GimpPDB *pdb)
{
@ -1698,4 +1743,57 @@ register_vectors_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-vectors-to-selection
*/
procedure = gimp_procedure_new (vectors_to_selection_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-vectors-to-selection");
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-to-selection",
"Transforms the specified vectors object into a selection",
"This procedure renders the desired vectors object into the current selection of the image the vectors object belongs to.",
"Simon Budig",
"Simon Budig",
"2006",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_vectors_id ("vectors",
"vectors",
"The vectors object to render to the selection",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("op",
"op",
"The desired operation with current selection",
GIMP_TYPE_CHANNEL_OPS,
GIMP_CHANNEL_OP_ADD,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("antialias",
"antialias",
"Antialias selection.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("feather",
"feather",
"Feather selection.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius-x",
"feather radius x",
"Feather radius x.",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius-y",
"feather radius y",
"Feather radius y.",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}

View File

@ -485,9 +485,8 @@ gimp_path_set_locked (gint32 image_ID,
* @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.
* This procedure is deprecated! Use gimp_vectors_to_selection()
* instead.
*
* Returns: TRUE on success.
*/

View File

@ -66,7 +66,6 @@ gboolean gimp_path_get_locked (gint32 image_ID,
gboolean gimp_path_set_locked (gint32 image_ID,
const gchar *name,
gboolean locked);
#endif /* GIMP_DISABLE_DEPRECATED */
gboolean gimp_path_to_selection (gint32 image_ID,
const gchar *name,
GimpChannelOps op,
@ -74,6 +73,7 @@ gboolean gimp_path_to_selection (gint32 image_ID,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
#endif /* GIMP_DISABLE_DEPRECATED */
gboolean gimp_path_import (gint32 image_ID,
const gchar *filename,
gboolean merge,

View File

@ -920,3 +920,50 @@ gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
return stroke_id;
}
/**
* gimp_vectors_to_selection:
* @vectors_ID: The vectors object to render to the 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 specified vectors object into a selection
*
* This procedure renders the desired vectors object into the current
* selection of the image the vectors object belongs to.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_vectors_to_selection (gint32 vectors_ID,
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-vectors-to-selection",
&nreturn_vals,
GIMP_PDB_VECTORS, vectors_ID,
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

@ -29,77 +29,83 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gint32 gimp_vectors_new (gint32 image_ID,
const gchar *name);
gint32 gimp_vectors_get_image (gint32 vectors_ID);
gchar* gimp_vectors_get_name (gint32 vectors_ID);
gboolean gimp_vectors_set_name (gint32 vectors_ID,
const gchar *name);
gboolean gimp_vectors_get_visible (gint32 vectors_ID);
gboolean gimp_vectors_set_visible (gint32 vectors_ID,
gboolean visible);
gboolean gimp_vectors_get_linked (gint32 vectors_ID);
gboolean gimp_vectors_set_linked (gint32 vectors_ID,
gboolean linked);
gint gimp_vectors_get_tattoo (gint32 vectors_ID);
gboolean gimp_vectors_set_tattoo (gint32 vectors_ID,
gint tattoo);
gint* gimp_vectors_get_strokes (gint32 vectors_ID,
gint *num_strokes);
gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
gint stroke_id,
gdouble prescision);
gdouble gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gint stroke_id,
gdouble dist,
gdouble prescision,
gdouble *y_point,
gdouble *slope,
gboolean *valid);
gboolean gimp_vectors_stroke_remove (gint32 vectors_ID,
gint stroke_id);
gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
gint stroke_id);
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
gint stroke_id,
gint off_x,
gint off_y);
gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
gint stroke_id,
gdouble scale_x,
gdouble scale_y);
gboolean gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gint stroke_id,
gdouble prescision,
gint *num_coords,
gdouble **coords);
gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
gdouble x0,
gdouble y0,
gdouble radius_x,
gdouble radius_y,
gdouble angle);
gint32 gimp_vectors_new (gint32 image_ID,
const gchar *name);
gint32 gimp_vectors_get_image (gint32 vectors_ID);
gchar* gimp_vectors_get_name (gint32 vectors_ID);
gboolean gimp_vectors_set_name (gint32 vectors_ID,
const gchar *name);
gboolean gimp_vectors_get_visible (gint32 vectors_ID);
gboolean gimp_vectors_set_visible (gint32 vectors_ID,
gboolean visible);
gboolean gimp_vectors_get_linked (gint32 vectors_ID);
gboolean gimp_vectors_set_linked (gint32 vectors_ID,
gboolean linked);
gint gimp_vectors_get_tattoo (gint32 vectors_ID);
gboolean gimp_vectors_set_tattoo (gint32 vectors_ID,
gint tattoo);
gint* gimp_vectors_get_strokes (gint32 vectors_ID,
gint *num_strokes);
gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
gint stroke_id,
gdouble prescision);
gdouble gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gint stroke_id,
gdouble dist,
gdouble prescision,
gdouble *y_point,
gdouble *slope,
gboolean *valid);
gboolean gimp_vectors_stroke_remove (gint32 vectors_ID,
gint stroke_id);
gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
gint stroke_id);
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
gint stroke_id,
gint off_x,
gint off_y);
gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
gint stroke_id,
gdouble scale_x,
gdouble scale_y);
gboolean gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gint stroke_id,
gdouble prescision,
gint *num_coords,
gdouble **coords);
gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0);
gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1);
gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
gint stroke_id,
gdouble x0,
gdouble y0,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
gdouble x0,
gdouble y0,
gdouble radius_x,
gdouble radius_y,
gdouble angle);
gboolean gimp_vectors_to_selection (gint32 vectors_ID,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
G_END_DECLS

View File

@ -535,13 +535,7 @@ 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
&joao_pdb_misc('2003');
&std_pdb_deprecated('gimp-vectors-to-selection');
@inargs = (
{ name => 'image', type => 'image',

View File

@ -824,9 +824,57 @@ CODE
);
}
sub vectors_to_selection {
$blurb = 'Transforms the specified vectors object into a selection';
$help = <<'HELP';
This procedure renders the desired vectors object into the current selection
of the image the vectors object belongs to.
HELP
&simon_pdb_misc('2006', '2.4');
@inargs = (
{ name => 'vectors', type => 'vectors',
desc => 'The vectors object to render to the 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 = (
code => <<'CODE'
{
GimpImage *image;
image = gimp_item_get_image (GIMP_ITEM (vectors));
if (image)
gimp_channel_select_vectors (gimp_image_get_mask (image),
_("Path to Selection"),
vectors,
op,
antialias,
feather,
feather_radius_x,
feather_radius_y);
else
success = FALSE;
}
CODE
);
}
@headers = qw(<string.h> "core/gimp.h" "core/gimplist.h" "core/gimpimage.h"
"vectors/gimpanchor.h" "vectors/gimpbezierstroke.h"
"core/gimpchannel-select.h" "vectors/gimpanchor.h" "vectors/gimpbezierstroke.h"
"vectors/gimpvectors.h"
"gimp-intl.h");
@ -848,7 +896,8 @@ CODE
vectors_bezier_stroke_lineto
vectors_bezier_stroke_conicto
vectors_bezier_stroke_cubicto
vectors_bezier_stroke_new_ellipse);
vectors_bezier_stroke_new_ellipse
vectors_to_selection);
%exports = (app => [@procs], lib => [@procs]);