mirror of https://github.com/GNOME/gimp.git
new function: image_add_vectors
2005-12-29 Simon Budig <simon@gimp.org> * tools/pdbgen/pdb/image.pdb: new function: image_add_vectors * tools/pdbgen/pdb/vectors.pdb: new functions: vectors_get_strokes vectors_stroke_get_point_at_dist vectors_stroke_close removed nonfunctional undo code (that does not belong here anyways) and fixed a bug in [...]_cubicto. * app/pdb/image_cmds.c * app/pdb/internal_procs.c * app/pdb/vectors_cmds.c * libgimp/gimpimage_pdb.[ch] * libgimp/gimpvectors_pdb.[ch]: regenerated.
This commit is contained in:
parent
8fec4cd8c1
commit
0f0a0f4b63
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
2005-12-29 Simon Budig <simon@gimp.org>
|
||||||
|
|
||||||
|
* tools/pdbgen/pdb/image.pdb: new function:
|
||||||
|
image_add_vectors
|
||||||
|
|
||||||
|
* tools/pdbgen/pdb/vectors.pdb: new functions:
|
||||||
|
vectors_get_strokes
|
||||||
|
vectors_stroke_get_point_at_dist
|
||||||
|
vectors_stroke_close
|
||||||
|
|
||||||
|
removed nonfunctional undo code (that does not belong here anyways)
|
||||||
|
and fixed a bug in [...]_cubicto.
|
||||||
|
|
||||||
|
* app/pdb/image_cmds.c
|
||||||
|
* app/pdb/internal_procs.c
|
||||||
|
* app/pdb/vectors_cmds.c
|
||||||
|
* libgimp/gimpimage_pdb.[ch]
|
||||||
|
* libgimp/gimpvectors_pdb.[ch]: regenerated.
|
||||||
|
|
||||||
2005-12-29 Sven Neumann <sven@gimp.org>
|
2005-12-29 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpdialogfactory.[ch]: split
|
* app/widgets/gimpdialogfactory.[ch]: split
|
||||||
|
|
|
@ -87,6 +87,7 @@ static ProcRecord image_raise_vectors_to_top_proc;
|
||||||
static ProcRecord image_lower_vectors_to_bottom_proc;
|
static ProcRecord image_lower_vectors_to_bottom_proc;
|
||||||
static ProcRecord image_add_channel_proc;
|
static ProcRecord image_add_channel_proc;
|
||||||
static ProcRecord image_remove_channel_proc;
|
static ProcRecord image_remove_channel_proc;
|
||||||
|
static ProcRecord image_add_vectors_proc;
|
||||||
static ProcRecord image_remove_vectors_proc;
|
static ProcRecord image_remove_vectors_proc;
|
||||||
static ProcRecord image_raise_channel_proc;
|
static ProcRecord image_raise_channel_proc;
|
||||||
static ProcRecord image_lower_channel_proc;
|
static ProcRecord image_lower_channel_proc;
|
||||||
|
@ -162,6 +163,7 @@ register_image_procs (Gimp *gimp)
|
||||||
procedural_db_register (gimp, &image_lower_vectors_to_bottom_proc);
|
procedural_db_register (gimp, &image_lower_vectors_to_bottom_proc);
|
||||||
procedural_db_register (gimp, &image_add_channel_proc);
|
procedural_db_register (gimp, &image_add_channel_proc);
|
||||||
procedural_db_register (gimp, &image_remove_channel_proc);
|
procedural_db_register (gimp, &image_remove_channel_proc);
|
||||||
|
procedural_db_register (gimp, &image_add_vectors_proc);
|
||||||
procedural_db_register (gimp, &image_remove_vectors_proc);
|
procedural_db_register (gimp, &image_remove_vectors_proc);
|
||||||
procedural_db_register (gimp, &image_raise_channel_proc);
|
procedural_db_register (gimp, &image_raise_channel_proc);
|
||||||
procedural_db_register (gimp, &image_lower_channel_proc);
|
procedural_db_register (gimp, &image_lower_channel_proc);
|
||||||
|
@ -2507,6 +2509,72 @@ static ProcRecord image_remove_channel_proc =
|
||||||
{ { image_remove_channel_invoker } }
|
{ { image_remove_channel_invoker } }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Argument *
|
||||||
|
image_add_vectors_invoker (Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
Argument *args)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
GimpImage *gimage;
|
||||||
|
GimpVectors *vectors;
|
||||||
|
gint32 position;
|
||||||
|
|
||||||
|
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
|
||||||
|
if (! GIMP_IS_IMAGE (gimage))
|
||||||
|
success = FALSE;
|
||||||
|
|
||||||
|
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
|
||||||
|
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
|
||||||
|
success = FALSE;
|
||||||
|
|
||||||
|
position = args[2].value.pdb_int;
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
success = gimp_image_add_vectors (gimage, vectors, MAX (position, -1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return procedural_db_return_args (&image_add_vectors_proc, success);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ProcArg image_add_vectors_inargs[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GIMP_PDB_IMAGE,
|
||||||
|
"image",
|
||||||
|
"The image"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_VECTORS,
|
||||||
|
"vectors",
|
||||||
|
"The vectors object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"position",
|
||||||
|
"The vectors objects position"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static ProcRecord image_add_vectors_proc =
|
||||||
|
{
|
||||||
|
"gimp-image-add-vectors",
|
||||||
|
"gimp-image-add-vectors",
|
||||||
|
"Add the specified vectors object to the image.",
|
||||||
|
"This procedure adds the specified vectors object to the gimage at the given position. If the position is specified as -1, then the vectors object is inserted at the top of the vectors stack.",
|
||||||
|
"Spencer Kimball & Peter Mattis",
|
||||||
|
"Spencer Kimball & Peter Mattis",
|
||||||
|
"1995-1996",
|
||||||
|
NULL,
|
||||||
|
GIMP_INTERNAL,
|
||||||
|
3,
|
||||||
|
image_add_vectors_inargs,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
{ { image_add_vectors_invoker } }
|
||||||
|
};
|
||||||
|
|
||||||
static Argument *
|
static Argument *
|
||||||
image_remove_vectors_invoker (Gimp *gimp,
|
image_remove_vectors_invoker (Gimp *gimp,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
|
|
|
@ -75,7 +75,7 @@ void register_undo_procs (Gimp *gimp);
|
||||||
void register_unit_procs (Gimp *gimp);
|
void register_unit_procs (Gimp *gimp);
|
||||||
void register_vectors_procs (Gimp *gimp);
|
void register_vectors_procs (Gimp *gimp);
|
||||||
|
|
||||||
/* 517 procedures registered total */
|
/* 521 procedures registered total */
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_procs_init (Gimp *gimp)
|
internal_procs_init (Gimp *gimp)
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "procedural_db.h"
|
#include "procedural_db.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
#include "core/gimpimage-undo.h"
|
|
||||||
#include "core/gimpimage.h"
|
#include "core/gimpimage.h"
|
||||||
#include "core/gimplist.h"
|
#include "core/gimplist.h"
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
@ -37,6 +36,7 @@
|
||||||
#include "vectors/gimpvectors-compat.h"
|
#include "vectors/gimpvectors-compat.h"
|
||||||
#include "vectors/gimpvectors.h"
|
#include "vectors/gimpvectors.h"
|
||||||
|
|
||||||
|
static ProcRecord vectors_new_proc;
|
||||||
static ProcRecord vectors_get_strokes_proc;
|
static ProcRecord vectors_get_strokes_proc;
|
||||||
static ProcRecord vectors_get_image_proc;
|
static ProcRecord vectors_get_image_proc;
|
||||||
static ProcRecord vectors_get_linked_proc;
|
static ProcRecord vectors_get_linked_proc;
|
||||||
|
@ -48,7 +48,9 @@ static ProcRecord vectors_set_name_proc;
|
||||||
static ProcRecord vectors_get_tattoo_proc;
|
static ProcRecord vectors_get_tattoo_proc;
|
||||||
static ProcRecord vectors_set_tattoo_proc;
|
static ProcRecord vectors_set_tattoo_proc;
|
||||||
static ProcRecord vectors_stroke_get_length_proc;
|
static ProcRecord vectors_stroke_get_length_proc;
|
||||||
|
static ProcRecord vectors_stroke_get_point_at_dist_proc;
|
||||||
static ProcRecord vectors_stroke_remove_proc;
|
static ProcRecord vectors_stroke_remove_proc;
|
||||||
|
static ProcRecord vectors_stroke_close_proc;
|
||||||
static ProcRecord vectors_stroke_translate_proc;
|
static ProcRecord vectors_stroke_translate_proc;
|
||||||
static ProcRecord vectors_stroke_scale_proc;
|
static ProcRecord vectors_stroke_scale_proc;
|
||||||
static ProcRecord vectors_stroke_interpolate_proc;
|
static ProcRecord vectors_stroke_interpolate_proc;
|
||||||
|
@ -61,6 +63,7 @@ static ProcRecord vectors_bezier_stroke_new_ellipse_proc;
|
||||||
void
|
void
|
||||||
register_vectors_procs (Gimp *gimp)
|
register_vectors_procs (Gimp *gimp)
|
||||||
{
|
{
|
||||||
|
procedural_db_register (gimp, &vectors_new_proc);
|
||||||
procedural_db_register (gimp, &vectors_get_strokes_proc);
|
procedural_db_register (gimp, &vectors_get_strokes_proc);
|
||||||
procedural_db_register (gimp, &vectors_get_image_proc);
|
procedural_db_register (gimp, &vectors_get_image_proc);
|
||||||
procedural_db_register (gimp, &vectors_get_linked_proc);
|
procedural_db_register (gimp, &vectors_get_linked_proc);
|
||||||
|
@ -72,7 +75,9 @@ register_vectors_procs (Gimp *gimp)
|
||||||
procedural_db_register (gimp, &vectors_get_tattoo_proc);
|
procedural_db_register (gimp, &vectors_get_tattoo_proc);
|
||||||
procedural_db_register (gimp, &vectors_set_tattoo_proc);
|
procedural_db_register (gimp, &vectors_set_tattoo_proc);
|
||||||
procedural_db_register (gimp, &vectors_stroke_get_length_proc);
|
procedural_db_register (gimp, &vectors_stroke_get_length_proc);
|
||||||
|
procedural_db_register (gimp, &vectors_stroke_get_point_at_dist_proc);
|
||||||
procedural_db_register (gimp, &vectors_stroke_remove_proc);
|
procedural_db_register (gimp, &vectors_stroke_remove_proc);
|
||||||
|
procedural_db_register (gimp, &vectors_stroke_close_proc);
|
||||||
procedural_db_register (gimp, &vectors_stroke_translate_proc);
|
procedural_db_register (gimp, &vectors_stroke_translate_proc);
|
||||||
procedural_db_register (gimp, &vectors_stroke_scale_proc);
|
procedural_db_register (gimp, &vectors_stroke_scale_proc);
|
||||||
procedural_db_register (gimp, &vectors_stroke_interpolate_proc);
|
procedural_db_register (gimp, &vectors_stroke_interpolate_proc);
|
||||||
|
@ -83,6 +88,80 @@ register_vectors_procs (Gimp *gimp)
|
||||||
procedural_db_register (gimp, &vectors_bezier_stroke_new_ellipse_proc);
|
procedural_db_register (gimp, &vectors_bezier_stroke_new_ellipse_proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Argument *
|
||||||
|
vectors_new_invoker (Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
Argument *args)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
Argument *return_args;
|
||||||
|
GimpImage *gimage;
|
||||||
|
gchar *name = NULL;
|
||||||
|
GimpVectors *vectors = NULL;
|
||||||
|
|
||||||
|
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 || !g_utf8_validate (name, -1, NULL))
|
||||||
|
success = FALSE;
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
vectors = gimp_vectors_new (gimage, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return_args = procedural_db_return_args (&vectors_new_proc, success);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (vectors));
|
||||||
|
|
||||||
|
return return_args;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ProcArg vectors_new_inargs[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GIMP_PDB_IMAGE,
|
||||||
|
"image",
|
||||||
|
"The image"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_STRING,
|
||||||
|
"name",
|
||||||
|
"the name of the new vector object."
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static ProcArg vectors_new_outargs[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GIMP_PDB_VECTORS,
|
||||||
|
"vectors",
|
||||||
|
"the current vector object, 0 if no vector exists in the image."
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static ProcRecord vectors_new_proc =
|
||||||
|
{
|
||||||
|
"gimp-vectors-new",
|
||||||
|
"gimp-vectors-new",
|
||||||
|
"Creates a new empty vectors object. Needs to be added to an image using gimp_image_add_vectors.",
|
||||||
|
"Creates a new empty vectors object. Needs to be added to an image using gimp_image_add_vectors.",
|
||||||
|
"Simon Budig",
|
||||||
|
"Simon Budig",
|
||||||
|
"2005",
|
||||||
|
NULL,
|
||||||
|
GIMP_INTERNAL,
|
||||||
|
2,
|
||||||
|
vectors_new_inargs,
|
||||||
|
1,
|
||||||
|
vectors_new_outargs,
|
||||||
|
{ { vectors_new_invoker } }
|
||||||
|
};
|
||||||
|
|
||||||
static Argument *
|
static Argument *
|
||||||
vectors_get_strokes_invoker (Gimp *gimp,
|
vectors_get_strokes_invoker (Gimp *gimp,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
|
@ -808,6 +887,131 @@ static ProcRecord vectors_stroke_get_length_proc =
|
||||||
{ { vectors_stroke_get_length_invoker } }
|
{ { vectors_stroke_get_length_invoker } }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Argument *
|
||||||
|
vectors_stroke_get_point_at_dist_invoker (Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
Argument *args)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
Argument *return_args;
|
||||||
|
GimpVectors *vectors;
|
||||||
|
gint32 stroke_id;
|
||||||
|
gdouble dist;
|
||||||
|
gdouble prescision;
|
||||||
|
gdouble x_point = 0;
|
||||||
|
gdouble y_point = 0;
|
||||||
|
gdouble slope = 0;
|
||||||
|
gboolean valid = FALSE;
|
||||||
|
GimpStroke *stroke;
|
||||||
|
GimpCoords coord;
|
||||||
|
|
||||||
|
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
|
||||||
|
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
|
||||||
|
success = FALSE;
|
||||||
|
|
||||||
|
stroke_id = args[1].value.pdb_int;
|
||||||
|
|
||||||
|
dist = args[2].value.pdb_float;
|
||||||
|
|
||||||
|
prescision = args[3].value.pdb_float;
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
|
if (stroke)
|
||||||
|
{
|
||||||
|
valid = gimp_stroke_get_point_at_dist (stroke, dist, prescision,
|
||||||
|
&coord, &slope);
|
||||||
|
x_point = valid ? coord.x : 0;
|
||||||
|
y_point = valid ? coord.y : 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return_args = procedural_db_return_args (&vectors_stroke_get_point_at_dist_proc, success);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
return_args[1].value.pdb_float = x_point;
|
||||||
|
return_args[2].value.pdb_float = y_point;
|
||||||
|
return_args[3].value.pdb_float = slope;
|
||||||
|
return_args[4].value.pdb_int = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return return_args;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ProcArg vectors_stroke_get_point_at_dist_inargs[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GIMP_PDB_VECTORS,
|
||||||
|
"vectors",
|
||||||
|
"The vectors object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"stroke-id",
|
||||||
|
"The stroke ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_FLOAT,
|
||||||
|
"dist",
|
||||||
|
"The given distance."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_FLOAT,
|
||||||
|
"prescision",
|
||||||
|
"The prescision used for the approximation"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static ProcArg vectors_stroke_get_point_at_dist_outargs[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GIMP_PDB_FLOAT,
|
||||||
|
"x-point",
|
||||||
|
"The x position of the point."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_FLOAT,
|
||||||
|
"y-point",
|
||||||
|
"The y position of the point."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_FLOAT,
|
||||||
|
"slope",
|
||||||
|
"The slope (dy / dx) at the specified point."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"valid",
|
||||||
|
"Indicator for the validity of the returned data."
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static ProcRecord vectors_stroke_get_point_at_dist_proc =
|
||||||
|
{
|
||||||
|
"gimp-vectors-stroke-get-point-at-dist",
|
||||||
|
"gimp-vectors-stroke-get-point-at-dist",
|
||||||
|
"Get point at a specified distance along the stroke.",
|
||||||
|
"This will return the x,y position of a point at a given distance along the stroke. The distance will be obtained by first digitizing the curve internally and then walking along the curve. For a closed stroke the start of the path is the first point on the path that was created. This might not be obvious. If the stroke is not long enough, a \"valid\" flag will be FALSE.",
|
||||||
|
"Simon Budig",
|
||||||
|
"Simon Budig",
|
||||||
|
"2005",
|
||||||
|
NULL,
|
||||||
|
GIMP_INTERNAL,
|
||||||
|
4,
|
||||||
|
vectors_stroke_get_point_at_dist_inargs,
|
||||||
|
4,
|
||||||
|
vectors_stroke_get_point_at_dist_outargs,
|
||||||
|
{ { vectors_stroke_get_point_at_dist_invoker } }
|
||||||
|
};
|
||||||
|
|
||||||
static Argument *
|
static Argument *
|
||||||
vectors_stroke_remove_invoker (Gimp *gimp,
|
vectors_stroke_remove_invoker (Gimp *gimp,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
|
@ -870,6 +1074,68 @@ static ProcRecord vectors_stroke_remove_proc =
|
||||||
{ { vectors_stroke_remove_invoker } }
|
{ { vectors_stroke_remove_invoker } }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Argument *
|
||||||
|
vectors_stroke_close_invoker (Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
Argument *args)
|
||||||
|
{
|
||||||
|
gboolean success = TRUE;
|
||||||
|
GimpVectors *vectors;
|
||||||
|
gint32 stroke_id;
|
||||||
|
GimpStroke *stroke;
|
||||||
|
|
||||||
|
vectors = (GimpVectors *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
|
||||||
|
if (! (GIMP_IS_VECTORS (vectors) && ! gimp_item_is_removed (GIMP_ITEM (vectors))))
|
||||||
|
success = FALSE;
|
||||||
|
|
||||||
|
stroke_id = args[1].value.pdb_int;
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
|
if (stroke)
|
||||||
|
gimp_stroke_close (stroke);
|
||||||
|
else
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return procedural_db_return_args (&vectors_stroke_close_proc, success);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ProcArg vectors_stroke_close_inargs[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
GIMP_PDB_VECTORS,
|
||||||
|
"vectors",
|
||||||
|
"The vectors object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"stroke-id",
|
||||||
|
"The stroke ID"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static ProcRecord vectors_stroke_close_proc =
|
||||||
|
{
|
||||||
|
"gimp-vectors-stroke-close",
|
||||||
|
"gimp-vectors-stroke-close",
|
||||||
|
"closes the specified stroke.",
|
||||||
|
"Closes the specified stroke.",
|
||||||
|
"Simon Budig",
|
||||||
|
"Simon Budig",
|
||||||
|
"2005",
|
||||||
|
NULL,
|
||||||
|
GIMP_INTERNAL,
|
||||||
|
2,
|
||||||
|
vectors_stroke_close_inargs,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
{ { vectors_stroke_close_invoker } }
|
||||||
|
};
|
||||||
|
|
||||||
static Argument *
|
static Argument *
|
||||||
vectors_stroke_translate_invoker (Gimp *gimp,
|
vectors_stroke_translate_invoker (Gimp *gimp,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
|
@ -898,21 +1164,10 @@ vectors_stroke_translate_invoker (Gimp *gimp,
|
||||||
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
||||||
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
if (!stroke)
|
if (stroke)
|
||||||
{
|
gimp_stroke_translate (stroke, off_x, off_y);
|
||||||
success = FALSE;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
success = FALSE;
|
||||||
/* need to figure out how undo is supposed to work */
|
|
||||||
|
|
||||||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
|
|
||||||
_("Modify Path"));
|
|
||||||
gimp_vectors_freeze (vectors);
|
|
||||||
gimp_stroke_translate (stroke, off_x, off_y);
|
|
||||||
gimp_vectors_thaw (vectors);
|
|
||||||
gimp_image_undo_group_end (gimage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return procedural_db_return_args (&vectors_stroke_translate_proc, success);
|
return procedural_db_return_args (&vectors_stroke_translate_proc, success);
|
||||||
|
@ -988,21 +1243,10 @@ vectors_stroke_scale_invoker (Gimp *gimp,
|
||||||
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
||||||
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
if (!stroke)
|
if (stroke)
|
||||||
{
|
gimp_stroke_scale (stroke, scale_x, scale_y);
|
||||||
success = FALSE;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
success = FALSE;
|
||||||
/* need to figure out how undo is supposed to work */
|
|
||||||
|
|
||||||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
|
|
||||||
_("Modify Path"));
|
|
||||||
gimp_vectors_freeze (vectors);
|
|
||||||
gimp_stroke_scale (stroke, scale_x, scale_y);
|
|
||||||
gimp_vectors_thaw (vectors);
|
|
||||||
gimp_image_undo_group_end (gimage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return procedural_db_return_args (&vectors_stroke_scale_proc, success);
|
return procedural_db_return_args (&vectors_stroke_scale_proc, success);
|
||||||
|
@ -1506,8 +1750,8 @@ vectors_bezier_stroke_cubicto_invoker (Gimp *gimp,
|
||||||
coord1.y = y1;
|
coord1.y = y1;
|
||||||
|
|
||||||
coord2 = coord0;
|
coord2 = coord0;
|
||||||
coord1.x = x2;
|
coord2.x = x2;
|
||||||
coord1.y = y2;
|
coord2.y = y2;
|
||||||
|
|
||||||
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
if (stroke)
|
if (stroke)
|
||||||
|
|
|
@ -1312,6 +1312,43 @@ gimp_image_remove_channel (gint32 image_ID,
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_image_add_vectors:
|
||||||
|
* @image_ID: The image.
|
||||||
|
* @vectors_ID: The vectors object.
|
||||||
|
* @position: The vectors objects position.
|
||||||
|
*
|
||||||
|
* Add the specified vectors object to the image.
|
||||||
|
*
|
||||||
|
* This procedure adds the specified vectors object to the gimage at
|
||||||
|
* the given position. If the position is specified as -1, then the
|
||||||
|
* vectors object is inserted at the top of the vectors stack.
|
||||||
|
*
|
||||||
|
* Returns: TRUE on success.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gimp_image_add_vectors (gint32 image_ID,
|
||||||
|
gint32 vectors_ID,
|
||||||
|
gint position)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gboolean success = TRUE;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp-image-add-vectors",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_IMAGE, image_ID,
|
||||||
|
GIMP_PDB_VECTORS, vectors_ID,
|
||||||
|
GIMP_PDB_INT32, position,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_image_remove_vectors:
|
* gimp_image_remove_vectors:
|
||||||
* @image_ID: The image.
|
* @image_ID: The image.
|
||||||
|
|
|
@ -104,6 +104,9 @@ gboolean gimp_image_add_channel (gint32 ima
|
||||||
gint position);
|
gint position);
|
||||||
gboolean gimp_image_remove_channel (gint32 image_ID,
|
gboolean gimp_image_remove_channel (gint32 image_ID,
|
||||||
gint32 channel_ID);
|
gint32 channel_ID);
|
||||||
|
gboolean gimp_image_add_vectors (gint32 image_ID,
|
||||||
|
gint32 vectors_ID,
|
||||||
|
gint position);
|
||||||
gboolean gimp_image_remove_vectors (gint32 image_ID,
|
gboolean gimp_image_remove_vectors (gint32 image_ID,
|
||||||
gint32 vectors_ID);
|
gint32 vectors_ID);
|
||||||
gboolean gimp_image_raise_channel (gint32 image_ID,
|
gboolean gimp_image_raise_channel (gint32 image_ID,
|
||||||
|
|
|
@ -27,6 +27,43 @@
|
||||||
|
|
||||||
#include "gimp.h"
|
#include "gimp.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_vectors_new:
|
||||||
|
* @image_ID: The image.
|
||||||
|
* @name: the name of the new vector object.
|
||||||
|
*
|
||||||
|
* Creates a new empty vectors object. Needs to be added to an image
|
||||||
|
* using gimp_image_add_vectors.
|
||||||
|
*
|
||||||
|
* Creates a new empty vectors object. Needs to be added to an image
|
||||||
|
* using gimp_image_add_vectors.
|
||||||
|
*
|
||||||
|
* Returns: the current vector object, 0 if no vector exists in the image.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.4
|
||||||
|
*/
|
||||||
|
gint32
|
||||||
|
gimp_vectors_new (gint32 image_ID,
|
||||||
|
const gchar *name)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gint32 vectors_ID = -1;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp-vectors-new",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_IMAGE, image_ID,
|
||||||
|
GIMP_PDB_STRING, name,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
vectors_ID = return_vals[1].data.d_vectors;
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return vectors_ID;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_vectors_get_strokes:
|
* gimp_vectors_get_strokes:
|
||||||
* @vectors_ID: The vectors object.
|
* @vectors_ID: The vectors object.
|
||||||
|
@ -403,6 +440,63 @@ gimp_vectors_stroke_get_length (gint32 vectors_ID,
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_vectors_stroke_get_point_at_dist:
|
||||||
|
* @vectors_ID: The vectors object.
|
||||||
|
* @stroke_id: The stroke ID.
|
||||||
|
* @dist: The given distance.
|
||||||
|
* @prescision: The prescision used for the approximation.
|
||||||
|
* @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.
|
||||||
|
*
|
||||||
|
* Get point at a specified distance along the stroke.
|
||||||
|
*
|
||||||
|
* This will return the x,y position of a point at a given distance
|
||||||
|
* along the stroke. The distance will be obtained by first digitizing
|
||||||
|
* the curve internally and then walking along the curve. For a closed
|
||||||
|
* stroke the start of the path is the first point on the path that was
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.4
|
||||||
|
*/
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gdouble x_point = 0;
|
||||||
|
|
||||||
|
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_END);
|
||||||
|
|
||||||
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return x_point;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_vectors_stroke_remove:
|
* gimp_vectors_stroke_remove:
|
||||||
* @vectors_ID: The vectors object.
|
* @vectors_ID: The vectors object.
|
||||||
|
@ -437,6 +531,40 @@ gimp_vectors_stroke_remove (gint32 vectors_ID,
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_vectors_stroke_close:
|
||||||
|
* @vectors_ID: The vectors object.
|
||||||
|
* @stroke_id: The stroke ID.
|
||||||
|
*
|
||||||
|
* closes the specified stroke.
|
||||||
|
*
|
||||||
|
* Closes the specified stroke.
|
||||||
|
*
|
||||||
|
* Returns: TRUE on success.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.4
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gimp_vectors_stroke_close (gint32 vectors_ID,
|
||||||
|
gint stroke_id)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
gboolean success = TRUE;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp-vectors-stroke-close",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_VECTORS, vectors_ID,
|
||||||
|
GIMP_PDB_INT32, stroke_id,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_vectors_stroke_translate:
|
* gimp_vectors_stroke_translate:
|
||||||
* @vectors_ID: The vectors object.
|
* @vectors_ID: The vectors object.
|
||||||
|
|
|
@ -29,6 +29,8 @@ G_BEGIN_DECLS
|
||||||
/* For information look into the C source or the html documentation */
|
/* For information look into the C source or the html documentation */
|
||||||
|
|
||||||
|
|
||||||
|
gint32 gimp_vectors_new (gint32 image_ID,
|
||||||
|
const gchar *name);
|
||||||
gint* gimp_vectors_get_strokes (gint32 vectors_ID,
|
gint* gimp_vectors_get_strokes (gint32 vectors_ID,
|
||||||
gint *num_strokes);
|
gint *num_strokes);
|
||||||
gint32 gimp_vectors_get_image (gint32 vectors_ID);
|
gint32 gimp_vectors_get_image (gint32 vectors_ID);
|
||||||
|
@ -47,8 +49,17 @@ gboolean gimp_vectors_set_tattoo (gint32 vectors_ID,
|
||||||
gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
|
gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
|
||||||
gint stroke_id,
|
gint stroke_id,
|
||||||
gdouble prescision);
|
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,
|
gboolean gimp_vectors_stroke_remove (gint32 vectors_ID,
|
||||||
gint stroke_id);
|
gint stroke_id);
|
||||||
|
gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
|
||||||
|
gint stroke_id);
|
||||||
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
|
gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
|
||||||
gint stroke_id,
|
gint stroke_id,
|
||||||
gint off_x,
|
gint off_x,
|
||||||
|
|
|
@ -913,6 +913,31 @@ HELP
|
||||||
%invoke = ( code => 'gimp_image_remove_channel (gimage, channel);' );
|
%invoke = ( code => 'gimp_image_remove_channel (gimage, channel);' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub image_add_vectors {
|
||||||
|
$blurb = 'Add the specified vectors object to the image.';
|
||||||
|
|
||||||
|
$help = <<'HELP';
|
||||||
|
This procedure adds the specified vectors object to the gimage at the given
|
||||||
|
position. If the position is specified as -1, then the vectors object is
|
||||||
|
inserted at the top of the vectors stack.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
&std_pdb_misc;
|
||||||
|
|
||||||
|
@inargs = (
|
||||||
|
&std_image_arg,
|
||||||
|
&vectors_arg,
|
||||||
|
{ name => 'position', type => 'int32',
|
||||||
|
desc => 'The vectors objects position' }
|
||||||
|
);
|
||||||
|
|
||||||
|
$invoke{code} = <<'CODE';
|
||||||
|
{
|
||||||
|
success = gimp_image_add_vectors (gimage, vectors, MAX (position, -1));
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
}
|
||||||
|
|
||||||
sub image_remove_vectors {
|
sub image_remove_vectors {
|
||||||
$blurb = 'Remove the specified path from the image.';
|
$blurb = 'Remove the specified path from the image.';
|
||||||
|
|
||||||
|
@ -1649,29 +1674,30 @@ CODE
|
||||||
unshift @procs, qw(image_list image_new image_duplicate image_delete
|
unshift @procs, qw(image_list image_new image_duplicate image_delete
|
||||||
image_base_type
|
image_base_type
|
||||||
image_width image_height
|
image_width image_height
|
||||||
image_free_shadow
|
image_free_shadow
|
||||||
image_resize image_resize_to_layers image_scale
|
image_resize image_resize_to_layers image_scale
|
||||||
image_crop image_flip image_rotate
|
image_crop image_flip image_rotate
|
||||||
image_get_layers image_get_channels
|
image_get_layers image_get_channels
|
||||||
image_get_vectors
|
image_get_vectors
|
||||||
image_get_active_drawable
|
image_get_active_drawable
|
||||||
image_unset_active_channel
|
image_unset_active_channel
|
||||||
image_get_floating_sel image_floating_sel_attached_to
|
image_get_floating_sel image_floating_sel_attached_to
|
||||||
image_pick_color image_pick_correlate_layer
|
image_pick_color image_pick_correlate_layer
|
||||||
image_add_layer image_remove_layer
|
image_add_layer image_remove_layer
|
||||||
image_raise_layer image_lower_layer
|
image_raise_layer image_lower_layer
|
||||||
image_raise_layer_to_top image_lower_layer_to_bottom
|
image_raise_layer_to_top image_lower_layer_to_bottom
|
||||||
image_raise_vectors image_lower_vectors
|
image_raise_vectors image_lower_vectors
|
||||||
image_raise_vectors_to_top image_lower_vectors_to_bottom
|
image_raise_vectors_to_top image_lower_vectors_to_bottom
|
||||||
image_add_channel image_remove_channel
|
image_add_channel image_remove_channel
|
||||||
image_remove_vectors
|
image_add_vectors
|
||||||
|
image_remove_vectors
|
||||||
image_raise_channel image_lower_channel
|
image_raise_channel image_lower_channel
|
||||||
image_flatten image_merge_visible_layers image_merge_down
|
image_flatten image_merge_visible_layers image_merge_down
|
||||||
image_add_layer_mask image_remove_layer_mask
|
image_add_layer_mask image_remove_layer_mask
|
||||||
image_get_colormap image_set_colormap
|
image_get_colormap image_set_colormap
|
||||||
image_clean_all image_is_dirty
|
image_clean_all image_is_dirty
|
||||||
image_thumbnail);
|
image_thumbnail);
|
||||||
%exports = (app => [@procs], lib => [@procs[0..40,43..69]]);
|
%exports = (app => [@procs], lib => [@procs[0..41,44..70]]);
|
||||||
|
|
||||||
$desc = 'Image';
|
$desc = 'Image';
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,37 @@ sub stroke_arg () {
|
||||||
desc => 'The stroke ID'
|
desc => 'The stroke ID'
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
sub vectors_new {
|
||||||
|
$blurb = 'Creates a new empty vectors object. Needs to be added to an image using gimp_image_add_vectors.';
|
||||||
|
|
||||||
|
$help = <<'HELP';
|
||||||
|
Creates a new empty vectors object. Needs to be added to an image using gimp_image_add_vectors.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
&pdb_misc;
|
||||||
|
|
||||||
|
@inargs = ( &std_image_arg,
|
||||||
|
{ name => 'name', type => 'string',
|
||||||
|
desc => 'the name of the new vector object.',
|
||||||
|
init => 1 }
|
||||||
|
);
|
||||||
|
|
||||||
|
@outargs = (
|
||||||
|
{ name => 'vectors', type => 'vectors',
|
||||||
|
desc => 'the current vector object, 0 if no vector exists in the image.',
|
||||||
|
init => 1 }
|
||||||
|
);
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
code => <<"CODE"
|
||||||
|
{
|
||||||
|
vectors = gimp_vectors_new (gimage, name);
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub vectors_get_current {
|
sub vectors_get_current {
|
||||||
$blurb = 'Gets the current path in the given image.';
|
$blurb = 'Gets the current path in the given image.';
|
||||||
|
|
||||||
|
@ -381,6 +412,61 @@ CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub vectors_stroke_get_point_at_dist {
|
||||||
|
$blurb = 'Get point at a specified distance along the stroke.';
|
||||||
|
|
||||||
|
$help = <<'HELP';
|
||||||
|
This will return the x,y position of a point at a given distance along the
|
||||||
|
stroke. The distance will be obtained by first digitizing the
|
||||||
|
curve internally and then walking along the curve. For a closed stroke the
|
||||||
|
start of the path is the first point on the path that was created. This might
|
||||||
|
not be obvious. If the stroke is not long enough, a "valid" flag will be FALSE.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
&pdb_misc;
|
||||||
|
|
||||||
|
@inargs = ( &stroke_arg,
|
||||||
|
{ name => 'dist', type => 'float',
|
||||||
|
desc => 'The given distance.' },
|
||||||
|
{ name => 'prescision', type => 'float',
|
||||||
|
desc => 'The prescision used for the approximation' } );
|
||||||
|
|
||||||
|
@outargs = (
|
||||||
|
{ name => 'x_point', type => 'float',
|
||||||
|
desc => 'The x position of the point.', init => 1 },
|
||||||
|
{ name => 'y_point', type => 'float',
|
||||||
|
desc => 'The y position of the point.', init => 1 },
|
||||||
|
{ name => 'slope', type => 'float',
|
||||||
|
desc => 'The slope (dy / dx) at the specified point.', init => 1 },
|
||||||
|
{ name => 'valid', type => 'boolean',
|
||||||
|
desc => 'Indicator for the validity of the returned data.',
|
||||||
|
init => 1 }
|
||||||
|
);
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
vars => [ 'GimpStroke *stroke',
|
||||||
|
'GimpCoords coord'],
|
||||||
|
code => <<"CODE"
|
||||||
|
{
|
||||||
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
|
if (stroke)
|
||||||
|
{
|
||||||
|
valid = gimp_stroke_get_point_at_dist (stroke, dist, prescision,
|
||||||
|
&coord, &slope);
|
||||||
|
x_point = valid ? coord.x : 0;
|
||||||
|
y_point = valid ? coord.y : 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub vectors_stroke_remove {
|
sub vectors_stroke_remove {
|
||||||
$blurb = 'remove the stroke from a vectors object.';
|
$blurb = 'remove the stroke from a vectors object.';
|
||||||
|
|
||||||
|
@ -408,6 +494,33 @@ CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub vectors_stroke_close {
|
||||||
|
$blurb = 'closes the specified stroke.';
|
||||||
|
|
||||||
|
$help = <<'HELP';
|
||||||
|
Closes the specified stroke.
|
||||||
|
HELP
|
||||||
|
|
||||||
|
&pdb_misc;
|
||||||
|
|
||||||
|
@inargs = ( &stroke_arg );
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
vars => [ 'GimpStroke *stroke' ],
|
||||||
|
code => <<"CODE"
|
||||||
|
{
|
||||||
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
|
if (stroke)
|
||||||
|
gimp_stroke_close (stroke);
|
||||||
|
else
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub vectors_stroke_translate {
|
sub vectors_stroke_translate {
|
||||||
$blurb = 'translate the given stroke.';
|
$blurb = 'translate the given stroke.';
|
||||||
|
|
||||||
|
@ -430,21 +543,10 @@ HELP
|
||||||
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
||||||
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
if (!stroke)
|
if (stroke)
|
||||||
{
|
gimp_stroke_translate (stroke, off_x, off_y);
|
||||||
success = FALSE;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
success = FALSE;
|
||||||
/* need to figure out how undo is supposed to work */
|
|
||||||
|
|
||||||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
|
|
||||||
_("Modify Path"));
|
|
||||||
gimp_vectors_freeze (vectors);
|
|
||||||
gimp_stroke_translate (stroke, off_x, off_y);
|
|
||||||
gimp_vectors_thaw (vectors);
|
|
||||||
gimp_image_undo_group_end (gimage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
);
|
);
|
||||||
|
@ -472,21 +574,10 @@ HELP
|
||||||
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (vectors));
|
||||||
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
|
|
||||||
if (!stroke)
|
if (stroke)
|
||||||
{
|
gimp_stroke_scale (stroke, scale_x, scale_y);
|
||||||
success = FALSE;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
success = FALSE;
|
||||||
/* need to figure out how undo is supposed to work */
|
|
||||||
|
|
||||||
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
|
|
||||||
_("Modify Path"));
|
|
||||||
gimp_vectors_freeze (vectors);
|
|
||||||
gimp_stroke_scale (stroke, scale_x, scale_y);
|
|
||||||
gimp_vectors_thaw (vectors);
|
|
||||||
gimp_image_undo_group_end (gimage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
);
|
);
|
||||||
|
@ -738,8 +829,8 @@ HELP
|
||||||
coord1.y = y1;
|
coord1.y = y1;
|
||||||
|
|
||||||
coord2 = coord0;
|
coord2 = coord0;
|
||||||
coord1.x = x2;
|
coord2.x = x2;
|
||||||
coord1.y = y2;
|
coord2.y = y2;
|
||||||
|
|
||||||
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||||
if (stroke)
|
if (stroke)
|
||||||
|
@ -807,12 +898,13 @@ CODE
|
||||||
|
|
||||||
|
|
||||||
@headers = qw(<string.h> "core/gimp.h" "core/gimplist.h"
|
@headers = qw(<string.h> "core/gimp.h" "core/gimplist.h"
|
||||||
"core/gimpimage.h" "core/gimpimage-undo.h"
|
"core/gimpimage.h"
|
||||||
"vectors/gimpanchor.h" "vectors/gimpbezierstroke.h"
|
"vectors/gimpanchor.h" "vectors/gimpbezierstroke.h"
|
||||||
"vectors/gimpvectors.h" "vectors/gimpvectors-compat.h"
|
"vectors/gimpvectors.h" "vectors/gimpvectors-compat.h"
|
||||||
"gimp-intl.h");
|
"gimp-intl.h");
|
||||||
|
|
||||||
@procs = qw(vectors_get_strokes
|
@procs = qw(vectors_new
|
||||||
|
vectors_get_strokes
|
||||||
vectors_get_image
|
vectors_get_image
|
||||||
vectors_get_linked
|
vectors_get_linked
|
||||||
vectors_set_linked
|
vectors_set_linked
|
||||||
|
@ -823,7 +915,9 @@ CODE
|
||||||
vectors_get_tattoo
|
vectors_get_tattoo
|
||||||
vectors_set_tattoo
|
vectors_set_tattoo
|
||||||
vectors_stroke_get_length
|
vectors_stroke_get_length
|
||||||
|
vectors_stroke_get_point_at_dist
|
||||||
vectors_stroke_remove
|
vectors_stroke_remove
|
||||||
|
vectors_stroke_close
|
||||||
vectors_stroke_translate
|
vectors_stroke_translate
|
||||||
vectors_stroke_scale
|
vectors_stroke_scale
|
||||||
vectors_stroke_interpolate
|
vectors_stroke_interpolate
|
||||||
|
|
Loading…
Reference in New Issue