Commit 96c0a5eb authored by Manish Singh's avatar Manish Singh Committed by Manish Singh

fix spelling of "precision", and tweak some outargs around to the libgimp

2006-10-24  Manish Singh  <yosh@gimp.org>

        * tools/pdbgen/pdb/vectors.pdb: fix spelling of "precision", and
        tweak some outargs around to the libgimp api is a bit friendlier.

        * app/pdb/vectors_cmds.c
        * libgimp/gimpvectors_pdb.[ch]: regenerated.
parent da50dcaa
2006-10-24 Manish Singh <yosh@gimp.org>
* tools/pdbgen/pdb/vectors.pdb: fix spelling of "precision", and
tweak some outargs around to the libgimp api is a bit friendlier.
* app/pdb/vectors_cmds.c
* libgimp/gimpvectors_pdb.[ch]: regenerated.
2006-10-24 Michael Natterer <mitch@gimp.org>
* app/tools/gimprotatetool.c (gimp_rotate_tool_dialog): show two
......
......@@ -349,19 +349,19 @@ vectors_stroke_get_length_invoker (GimpProcedure *procedure,
GValueArray *return_vals;
GimpVectors *vectors;
gint32 stroke_id;
gdouble prescision;
gdouble precision;
gdouble length = 0.0;
vectors = gimp_value_get_vectors (&args->values[0], gimp);
stroke_id = g_value_get_int (&args->values[1]);
prescision = g_value_get_double (&args->values[2]);
precision = g_value_get_double (&args->values[2]);
if (success)
{
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
if (stroke)
length = gimp_stroke_get_length (stroke, prescision);
length = gimp_stroke_get_length (stroke, precision);
else
success = FALSE;
}
......@@ -386,7 +386,7 @@ vectors_stroke_get_point_at_dist_invoker (GimpProcedure *procedure,
GimpVectors *vectors;
gint32 stroke_id;
gdouble dist;
gdouble prescision;
gdouble precision;
gdouble x_point = 0.0;
gdouble y_point = 0.0;
gdouble slope = 0.0;
......@@ -395,7 +395,7 @@ vectors_stroke_get_point_at_dist_invoker (GimpProcedure *procedure,
vectors = gimp_value_get_vectors (&args->values[0], gimp);
stroke_id = g_value_get_int (&args->values[1]);
dist = g_value_get_double (&args->values[2]);
prescision = g_value_get_double (&args->values[3]);
precision = g_value_get_double (&args->values[3]);
if (success)
{
......@@ -405,7 +405,7 @@ vectors_stroke_get_point_at_dist_invoker (GimpProcedure *procedure,
{
GimpCoords coord;
valid = gimp_stroke_get_point_at_dist (stroke, dist, prescision,
valid = gimp_stroke_get_point_at_dist (stroke, dist, precision,
&coord, &slope);
x_point = valid ? coord.x : 0;
y_point = valid ? coord.y : 0;
......@@ -554,14 +554,14 @@ vectors_stroke_interpolate_invoker (GimpProcedure *procedure,
GValueArray *return_vals;
GimpVectors *vectors;
gint32 stroke_id;
gdouble prescision;
gboolean closed = FALSE;
gdouble precision;
gint32 num_coords = 0;
gdouble *coords = NULL;
gboolean closed = FALSE;
vectors = gimp_value_get_vectors (&args->values[0], gimp);
stroke_id = g_value_get_int (&args->values[1]);
prescision = g_value_get_double (&args->values[2]);
precision = g_value_get_double (&args->values[2]);
if (success)
{
......@@ -572,7 +572,7 @@ vectors_stroke_interpolate_invoker (GimpProcedure *procedure,
GArray *coords_array;
gint i;
coords_array = gimp_stroke_interpolate (stroke, prescision, &closed);
coords_array = gimp_stroke_interpolate (stroke, precision, &closed);
if (coords_array)
{
......@@ -598,9 +598,9 @@ vectors_stroke_interpolate_invoker (GimpProcedure *procedure,
if (success)
{
g_value_set_boolean (&return_vals->values[1], closed);
g_value_set_int (&return_vals->values[2], num_coords);
gimp_value_take_floatarray (&return_vals->values[3], coords, num_coords);
g_value_set_int (&return_vals->values[1], num_coords);
gimp_value_take_floatarray (&return_vals->values[2], coords, num_coords);
g_value_set_boolean (&return_vals->values[3], closed);
}
return return_vals;
......@@ -1226,9 +1226,9 @@ register_vectors_procs (GimpPDB *pdb)
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("prescision",
"prescision",
"The prescision used for the approximation",
g_param_spec_double ("precision",
"precision",
"The precision used for the approximation",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
......@@ -1272,9 +1272,9 @@ register_vectors_procs (GimpPDB *pdb)
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("prescision",
"prescision",
"The prescision used for the approximation",
g_param_spec_double ("precision",
"precision",
"The precision used for the approximation",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
......@@ -1466,17 +1466,11 @@ register_vectors_procs (GimpPDB *pdb)
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("prescision",
"prescision",
"The prescision used for the approximation",
g_param_spec_double ("precision",
"precision",
"The precision used for the approximation",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("closed",
"closed",
"List of the strokes belonging to the path.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_int32 ("num-coords",
"num coords",
......@@ -1488,6 +1482,12 @@ register_vectors_procs (GimpPDB *pdb)
"coords",
"List of the coords along the path (x0, y0, x1, y1, ...).",
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_boolean ("closed",
"closed",
"Whether the stroke is closed or not.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
......
......@@ -406,7 +406,7 @@ gimp_vectors_get_strokes (gint32 vectors_ID,
* gimp_vectors_stroke_get_length:
* @vectors_ID: The vectors object.
* @stroke_id: The stroke ID.
* @prescision: The prescision used for the approximation.
* @precision: The precision used for the approximation.
*
* Measure the length of the given stroke.
*
......@@ -419,7 +419,7 @@ gimp_vectors_get_strokes (gint32 vectors_ID,
gdouble
gimp_vectors_stroke_get_length (gint32 vectors_ID,
gint stroke_id,
gdouble prescision)
gdouble precision)
{
GimpParam *return_vals;
gint nreturn_vals;
......@@ -429,7 +429,7 @@ gimp_vectors_stroke_get_length (gint32 vectors_ID,
&nreturn_vals,
GIMP_PDB_VECTORS, vectors_ID,
GIMP_PDB_INT32, stroke_id,
GIMP_PDB_FLOAT, prescision,
GIMP_PDB_FLOAT, precision,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
......@@ -445,7 +445,8 @@ gimp_vectors_stroke_get_length (gint32 vectors_ID,
* @vectors_ID: The vectors object.
* @stroke_id: The stroke ID.
* @dist: The given distance.
* @prescision: The prescision used for the approximation.
* @precision: The precision used for the approximation.
* @x_point: The x position of the point.
* @y_point: The y position of the point.
* @slope: The slope (dy / dx) at the specified point.
* @valid: Indicator for the validity of the returned data.
......@@ -459,34 +460,42 @@ gimp_vectors_stroke_get_length (gint32 vectors_ID,
* created. This might not be obvious. If the stroke is not long
* enough, a \"valid\" flag will be FALSE.
*
* Returns: The x position of the point.
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gdouble
gboolean
gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gint stroke_id,
gdouble dist,
gdouble prescision,
gdouble precision,
gdouble *x_point,
gdouble *y_point,
gdouble *slope,
gboolean *valid)
{
GimpParam *return_vals;
gint nreturn_vals;
gdouble x_point = 0.0;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-vectors-stroke-get-point-at-dist",
&nreturn_vals,
GIMP_PDB_VECTORS, vectors_ID,
GIMP_PDB_INT32, stroke_id,
GIMP_PDB_FLOAT, dist,
GIMP_PDB_FLOAT, prescision,
GIMP_PDB_FLOAT, precision,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
*x_point = 0.0;
*y_point = 0.0;
*slope = 0.0;
*valid = FALSE;
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
if (success)
{
x_point = return_vals[1].data.d_float;
*x_point = return_vals[1].data.d_float;
*y_point = return_vals[2].data.d_float;
*slope = return_vals[3].data.d_float;
*valid = return_vals[4].data.d_int32;
......@@ -494,7 +503,7 @@ gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gimp_destroy_params (return_vals, nreturn_vals);
return x_point;
return success;
}
/**
......@@ -649,51 +658,51 @@ gimp_vectors_stroke_scale (gint32 vectors_ID,
* gimp_vectors_stroke_interpolate:
* @vectors_ID: The vectors object.
* @stroke_id: The stroke ID.
* @prescision: The prescision used for the approximation.
* @precision: The precision used for the approximation.
* @num_coords: The number of floats returned.
* @coords: List of the coords along the path (x0, y0, x1, y1, ...).
* @closed: Whether the stroke is closed or not.
*
* returns polygonal approximation of the stroke.
*
* returns polygonal approximation of the stroke.
*
* Returns: List of the strokes belonging to the path.
* Returns: List of the coords along the path (x0, y0, x1, y1, ...).
*
* Since: GIMP 2.4
*/
gboolean
gdouble *
gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gint stroke_id,
gdouble prescision,
gdouble precision,
gint *num_coords,
gdouble **coords)
gboolean *closed)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean closed = FALSE;
gdouble *coords = NULL;
return_vals = gimp_run_procedure ("gimp-vectors-stroke-interpolate",
&nreturn_vals,
GIMP_PDB_VECTORS, vectors_ID,
GIMP_PDB_INT32, stroke_id,
GIMP_PDB_FLOAT, prescision,
GIMP_PDB_FLOAT, precision,
GIMP_PDB_END);
*num_coords = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
closed = return_vals[1].data.d_int32;
*num_coords = return_vals[2].data.d_int32;
*coords = g_new (gdouble, *num_coords);
memcpy (*coords,
return_vals[3].data.d_floatarray,
*num_coords = return_vals[1].data.d_int32;
coords = g_new (gdouble, *num_coords);
memcpy (coords,
return_vals[2].data.d_floatarray,
*num_coords * sizeof (gdouble));
*closed = return_vals[3].data.d_int32;
}
gimp_destroy_params (return_vals, nreturn_vals);
return closed;
return coords;
}
/**
......
......@@ -29,83 +29,84 @@ 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);
gboolean gimp_vectors_to_selection (gint32 vectors_ID,
GimpChannelOps operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
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 precision);
gboolean gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
gint stroke_id,
gdouble dist,
gdouble precision,
gdouble *x_point,
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);
gdouble* gimp_vectors_stroke_interpolate (gint32 vectors_ID,
gint stroke_id,
gdouble precision,
gint *num_coords,
gboolean *closed);
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 operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
G_END_DECLS
......
......@@ -317,8 +317,8 @@ sub vectors_stroke_get_length {
desc => 'The vectors object' },
{ name => 'stroke_id', type => 'int32',
desc => 'The stroke ID' },
{ name => 'prescision', type => 'float',
desc => 'The prescision used for the approximation' }
{ name => 'precision', type => 'float',
desc => 'The precision used for the approximation' }
);
@outargs = (
......@@ -332,7 +332,7 @@ sub vectors_stroke_get_length {
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
if (stroke)
length = gimp_stroke_get_length (stroke, prescision);
length = gimp_stroke_get_length (stroke, precision);
else
success = FALSE;
}
......@@ -360,12 +360,12 @@ HELP
desc => 'The stroke ID' },
{ name => 'dist', type => 'float',
desc => 'The given distance.' },
{ name => 'prescision', type => 'float',
desc => 'The prescision used for the approximation' }
{ name => 'precision', type => 'float',
desc => 'The precision used for the approximation' }
);
@outargs = (
{ name => 'x_point', type => 'float',
{ name => 'x_point', type => 'float', void_ret => 1,
desc => 'The x position of the point.' },
{ name => 'y_point', type => 'float',
desc => 'The y position of the point.' },
......@@ -384,7 +384,7 @@ HELP
{
GimpCoords coord;
valid = gimp_stroke_get_point_at_dist (stroke, dist, prescision,
valid = gimp_stroke_get_point_at_dist (stroke, dist, precision,
&coord, &slope);
x_point = valid ? coord.x : 0;
y_point = valid ? coord.y : 0;
......@@ -539,17 +539,17 @@ HELP
desc => 'The vectors object' },
{ name => 'stroke_id', type => 'int32',
desc => 'The stroke ID' },
{ name => 'prescision', type => 'float',
desc => 'The prescision used for the approximation' }
{ name => 'precision', type => 'float',
desc => 'The precision used for the approximation' }
);
@outargs = (
{ name => 'closed', type => 'boolean',
desc => 'List of the strokes belonging to the path.' },
{ name => 'coords', type => 'floatarray',
desc => 'List of the coords along the path (x0, y0, x1, y1, ...).',
array => { name => 'num_coords',
desc => 'The number of floats returned.' } }
desc => 'The number of floats returned.' } },
{ name => 'closed', type => 'boolean',
desc => 'Whether the stroke is closed or not.' }
);
%invoke = (
......@@ -562,7 +562,7 @@ HELP
GArray *coords_array;
gint i;
coords_array = gimp_stroke_interpolate (stroke, prescision, &closed);
coords_array = gimp_stroke_interpolate (stroke, precision, &closed);
if (coords_array)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment