mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
app/vectors/gimpstroke.[ch] tools/pdbgen/pdb/vectors.pdb Applied patch
2006-11-20 Simon Budig <simon@gimp.org> * app/vectors/gimpstroke.[ch] * tools/pdbgen/pdb/vectors.pdb * plug-ins/pygimp/pygimp-vectors.c: Applied patch from Joao S. O. Bueno Calligaris that adds some missing transformations to the PDB-API for strokes. Fixes bug #129598. * app/pdb/internal_procs.c * app/pdb/vectors_cmds.c * libgimp/gimpvectors_pdb.[ch]: regenerated.
This commit is contained in:
parent
f50adb011a
commit
73b1863a28
14 changed files with 757 additions and 4 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-11-20 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/vectors/gimpstroke.[ch]
|
||||
* tools/pdbgen/pdb/vectors.pdb
|
||||
* plug-ins/pygimp/pygimp-vectors.c: Applied patch from
|
||||
Joao S. O. Bueno Calligaris that adds some missing transformations
|
||||
to the PDB-API for strokes. Fixes bug #129598.
|
||||
|
||||
* app/pdb/internal_procs.c
|
||||
* app/pdb/vectors_cmds.c
|
||||
* libgimp/gimpvectors_pdb.[ch]: regenerated.
|
||||
|
||||
2006-11-18 Kevin Cozens <kcozens@cvs.gnome.org>
|
||||
|
||||
* plug-ins/script-fu/scheme-wrapper.c (marshall_proc_db_call): Set
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "internal_procs.h"
|
||||
|
||||
|
||||
/* 538 procedures registered total */
|
||||
/* 541 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -547,6 +547,105 @@ vectors_stroke_scale_invoker (GimpProcedure *procedure,
|
|||
return gimp_procedure_get_return_values (procedure, success);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
vectors_stroke_rotate_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpVectors *vectors;
|
||||
gint32 stroke_id;
|
||||
gdouble center_x;
|
||||
gdouble center_y;
|
||||
gdouble angle;
|
||||
|
||||
vectors = gimp_value_get_vectors (&args->values[0], gimp);
|
||||
stroke_id = g_value_get_int (&args->values[1]);
|
||||
center_x = g_value_get_double (&args->values[2]);
|
||||
center_y = g_value_get_double (&args->values[3]);
|
||||
angle = g_value_get_double (&args->values[4]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||
|
||||
if (stroke)
|
||||
gimp_stroke_rotate (stroke, center_x, center_y, angle);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
vectors_stroke_flip_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpVectors *vectors;
|
||||
gint32 stroke_id;
|
||||
gint32 flip_type;
|
||||
gdouble axis;
|
||||
|
||||
vectors = gimp_value_get_vectors (&args->values[0], gimp);
|
||||
stroke_id = g_value_get_int (&args->values[1]);
|
||||
flip_type = g_value_get_enum (&args->values[2]);
|
||||
axis = g_value_get_double (&args->values[3]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||
|
||||
if (stroke)
|
||||
gimp_stroke_flip (stroke, flip_type, axis);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
vectors_stroke_flip_free_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpVectors *vectors;
|
||||
gint32 stroke_id;
|
||||
gdouble x1;
|
||||
gdouble y1;
|
||||
gdouble x2;
|
||||
gdouble y2;
|
||||
|
||||
vectors = gimp_value_get_vectors (&args->values[0], gimp);
|
||||
stroke_id = g_value_get_int (&args->values[1]);
|
||||
x1 = g_value_get_double (&args->values[2]);
|
||||
y1 = g_value_get_double (&args->values[3]);
|
||||
x2 = g_value_get_double (&args->values[4]);
|
||||
y2 = g_value_get_double (&args->values[5]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||
|
||||
if (stroke)
|
||||
gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
vectors_stroke_get_points_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
|
@ -1691,6 +1790,147 @@ register_vectors_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-vectors-stroke-rotate
|
||||
*/
|
||||
procedure = gimp_procedure_new (vectors_stroke_rotate_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-vectors-stroke-rotate");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-vectors-stroke-rotate",
|
||||
"rotates the given stroke.",
|
||||
"Rotates the given stroke around given center by angle (in degrees).",
|
||||
"Jo\xc3\xa3o S. O. Bueno Calligaris",
|
||||
"Jo\xc3\xa3o S. O. Bueno Calligaris",
|
||||
"2006",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_vectors_id ("vectors",
|
||||
"vectors",
|
||||
"The vectors object",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_int32 ("stroke-id",
|
||||
"stroke id",
|
||||
"The stroke ID",
|
||||
G_MININT32, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("center-x",
|
||||
"center x",
|
||||
"X coordinate of the rotation center",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("center-y",
|
||||
"center y",
|
||||
"Y coordinate of the rotation center",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("angle",
|
||||
"angle",
|
||||
"angle to rotate about",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-vectors-stroke-flip
|
||||
*/
|
||||
procedure = gimp_procedure_new (vectors_stroke_flip_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-vectors-stroke-flip");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-vectors-stroke-flip",
|
||||
"flips the given stroke.",
|
||||
"Rotates the given stroke around given center by angle (in degrees).",
|
||||
"Jo\xc3\xa3o S. O. Bueno Calligaris",
|
||||
"Jo\xc3\xa3o S. O. Bueno Calligaris",
|
||||
"2006",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_vectors_id ("vectors",
|
||||
"vectors",
|
||||
"The vectors object",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_int32 ("stroke-id",
|
||||
"stroke id",
|
||||
"The stroke ID",
|
||||
G_MININT32, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_enum ("flip-type",
|
||||
"flip type",
|
||||
"Flip orientation, either vertical or horizontal",
|
||||
GIMP_TYPE_ORIENTATION_TYPE,
|
||||
GIMP_ORIENTATION_HORIZONTAL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[2]),
|
||||
GIMP_ORIENTATION_UNKNOWN);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("axis",
|
||||
"axis",
|
||||
"axis coordinate about which to flip, in pixels",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-vectors-stroke-flip-free
|
||||
*/
|
||||
procedure = gimp_procedure_new (vectors_stroke_flip_free_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-vectors-stroke-flip-free");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-vectors-stroke-flip-free",
|
||||
"flips the given stroke about an arbitrary axis.",
|
||||
"Flips the given stroke about an arbitrary axis. Axis is defined by two coordinates in the image (in pixels), through which the flipping axis passes.",
|
||||
"Jo\xc3\xa3o S. O. Bueno Calligaris",
|
||||
"Jo\xc3\xa3o S. O. Bueno Calligaris",
|
||||
"2006",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_vectors_id ("vectors",
|
||||
"vectors",
|
||||
"The vectors object",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_int32 ("stroke-id",
|
||||
"stroke id",
|
||||
"The stroke ID",
|
||||
G_MININT32, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("x1",
|
||||
"x1",
|
||||
"X coordinate of the first point of the flipping axis",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("y1",
|
||||
"y1",
|
||||
"Y coordinate of the first point of the flipping axis",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("x2",
|
||||
"x2",
|
||||
"X coordinate of the second point of the flipping axis",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("y2",
|
||||
"y2",
|
||||
"Y coordinate of the second point of the flipping axis",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-vectors-stroke-get-points
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "core/gimp-utils.h"
|
||||
#include "core/gimpcoords.h"
|
||||
#include "core/gimp-transform-utils.h"
|
||||
|
||||
#include "gimpanchor.h"
|
||||
#include "gimpstroke.h"
|
||||
|
@ -134,6 +135,18 @@ static void gimp_stroke_real_translate (GimpStroke *stroke,
|
|||
static void gimp_stroke_real_scale (GimpStroke *stroke,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y);
|
||||
static void gimp_stroke_real_rotate (GimpStroke *stroke,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble angle);
|
||||
static void gimp_stroke_real_flip (GimpStroke *stroke,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis);
|
||||
static void gimp_stroke_real_flip_free (GimpStroke *stroke,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2);
|
||||
static void gimp_stroke_real_transform (GimpStroke *stroke,
|
||||
const GimpMatrix3 *matrix);
|
||||
|
||||
|
@ -204,8 +217,12 @@ gimp_stroke_class_init (GimpStrokeClass *klass)
|
|||
|
||||
klass->translate = gimp_stroke_real_translate;
|
||||
klass->scale = gimp_stroke_real_scale;
|
||||
klass->rotate = gimp_stroke_real_rotate;
|
||||
klass->flip = gimp_stroke_real_flip;
|
||||
klass->flip_free = gimp_stroke_real_flip_free;
|
||||
klass->transform = gimp_stroke_real_transform;
|
||||
|
||||
|
||||
klass->get_draw_anchors = gimp_stroke_real_get_draw_anchors;
|
||||
klass->get_draw_controls = gimp_stroke_real_get_draw_controls;
|
||||
klass->get_draw_lines = gimp_stroke_real_get_draw_lines;
|
||||
|
@ -1057,6 +1074,82 @@ gimp_stroke_real_scale (GimpStroke *stroke,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_rotate (GimpStroke *stroke,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble angle)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE (stroke));
|
||||
|
||||
GIMP_STROKE_GET_CLASS (stroke)->rotate (stroke, center_x, center_y, angle);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_real_rotate (GimpStroke *stroke,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble angle)
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
|
||||
angle = angle / 180.0 * G_PI;
|
||||
gimp_matrix3_identity (&matrix);
|
||||
gimp_transform_matrix_rotate_center (&matrix, center_x, center_y, angle);
|
||||
|
||||
gimp_stroke_transform (stroke, &matrix);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_flip (GimpStroke *stroke,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE (stroke));
|
||||
|
||||
GIMP_STROKE_GET_CLASS (stroke)->flip (stroke, flip_type, axis);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_real_flip (GimpStroke *stroke,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis)
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
|
||||
gimp_matrix3_identity (&matrix);
|
||||
gimp_transform_matrix_flip (&matrix, flip_type, axis);
|
||||
gimp_stroke_transform (stroke, &matrix);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_flip_free (GimpStroke *stroke,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_STROKE (stroke));
|
||||
|
||||
GIMP_STROKE_GET_CLASS (stroke)->flip_free (stroke, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_stroke_real_flip_free (GimpStroke *stroke,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2)
|
||||
{
|
||||
/* x, y, width and height parameter in gimp_transform_matrix_flip_free are unused */
|
||||
GimpMatrix3 matrix;
|
||||
|
||||
gimp_matrix3_identity (&matrix);
|
||||
gimp_transform_matrix_flip_free (&matrix, x1, y1, x2, y2);
|
||||
|
||||
gimp_stroke_transform (stroke, &matrix);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_stroke_transform (GimpStroke *stroke,
|
||||
const GimpMatrix3 *matrix)
|
||||
|
|
|
@ -157,6 +157,18 @@ struct _GimpStrokeClass
|
|||
void (* scale) (GimpStroke *stroke,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y);
|
||||
void (* rotate) (GimpStroke *stroke,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble angle);
|
||||
void (* flip) (GimpStroke *stroke,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis);
|
||||
void (* flip_free) (GimpStroke *stroke,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2);
|
||||
void (* transform) (GimpStroke *stroke,
|
||||
const GimpMatrix3 *matrix);
|
||||
|
||||
|
@ -308,6 +320,18 @@ void gimp_stroke_translate (GimpStroke *stroke,
|
|||
void gimp_stroke_scale (GimpStroke *stroke,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y);
|
||||
void gimp_stroke_rotate (GimpStroke *stroke,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble angle);
|
||||
void gimp_stroke_flip (GimpStroke *stroke,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis);
|
||||
void gimp_stroke_flip_free (GimpStroke *stroke,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2);
|
||||
void gimp_stroke_transform (GimpStroke *stroke,
|
||||
const GimpMatrix3 *matrix);
|
||||
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
2006-11-20 Simon Budig <simon@gimp.org>
|
||||
|
||||
* devel-docs/libgimp/libgimp-sections.txt: moved new symbols
|
||||
to their resp. sections.
|
||||
|
||||
* devel-docs/libgimp/tmpl/gimpfontselectbutton.sgml
|
||||
* devel-docs/libgimp/tmpl/gimptools.sgml
|
||||
* devel-docs/libgimp/tmpl/gimpvectors.sgml: regenerated
|
||||
|
||||
2006-11-16 Simon Budig <simon@gimp.org>
|
||||
|
||||
* libgimp/libgimp.types: removed double entry for
|
||||
|
|
|
@ -863,6 +863,7 @@ gimp_paintbrush_default
|
|||
gimp_pencil
|
||||
gimp_perspective
|
||||
gimp_rect_select
|
||||
gimp_round_rect_select
|
||||
gimp_rotate
|
||||
gimp_scale
|
||||
gimp_shear
|
||||
|
@ -911,6 +912,9 @@ gimp_vectors_stroke_get_point_at_dist
|
|||
gimp_vectors_stroke_interpolate
|
||||
gimp_vectors_stroke_scale
|
||||
gimp_vectors_stroke_translate
|
||||
gimp_vectors_stroke_flip
|
||||
gimp_vectors_stroke_flip_free
|
||||
gimp_vectors_stroke_rotate
|
||||
gimp_vectors_bezier_stroke_conicto
|
||||
gimp_vectors_bezier_stroke_cubicto
|
||||
gimp_vectors_bezier_stroke_lineto
|
||||
|
|
|
@ -28,9 +28,6 @@ GimpFontSelectButton
|
|||
|
||||
</para>
|
||||
|
||||
@:
|
||||
@:
|
||||
|
||||
@gimpfontselectbutton: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
|
|
|
@ -367,6 +367,26 @@ Functions giving access to common toolbox tools.
|
|||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_round_rect_select ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@image_ID:
|
||||
@x:
|
||||
@y:
|
||||
@width:
|
||||
@height:
|
||||
@corner_radius_x:
|
||||
@corner_radius_y:
|
||||
@operation:
|
||||
@antialias:
|
||||
@feather:
|
||||
@feather_radius_x:
|
||||
@feather_radius_y:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_rotate ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -316,6 +316,45 @@ gimpvectors
|
|||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_vectors_stroke_flip ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@vectors_ID:
|
||||
@stroke_id:
|
||||
@flip_type:
|
||||
@axis:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_vectors_stroke_flip_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@vectors_ID:
|
||||
@stroke_id:
|
||||
@x1:
|
||||
@y1:
|
||||
@x2:
|
||||
@y2:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_vectors_stroke_rotate ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@vectors_ID:
|
||||
@stroke_id:
|
||||
@center_x:
|
||||
@center_y:
|
||||
@angle:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_vectors_bezier_stroke_conicto ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -654,6 +654,137 @@ gimp_vectors_stroke_scale (gint32 vectors_ID,
|
|||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_vectors_stroke_rotate:
|
||||
* @vectors_ID: The vectors object.
|
||||
* @stroke_id: The stroke ID.
|
||||
* @center_x: X coordinate of the rotation center.
|
||||
* @center_y: Y coordinate of the rotation center.
|
||||
* @angle: angle to rotate about.
|
||||
*
|
||||
* rotates the given stroke.
|
||||
*
|
||||
* Rotates the given stroke around given center by angle (in degrees).
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
*/
|
||||
gboolean
|
||||
gimp_vectors_stroke_rotate (gint32 vectors_ID,
|
||||
gint stroke_id,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble angle)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-vectors-stroke-rotate",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_VECTORS, vectors_ID,
|
||||
GIMP_PDB_INT32, stroke_id,
|
||||
GIMP_PDB_FLOAT, center_x,
|
||||
GIMP_PDB_FLOAT, center_y,
|
||||
GIMP_PDB_FLOAT, angle,
|
||||
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_flip:
|
||||
* @vectors_ID: The vectors object.
|
||||
* @stroke_id: The stroke ID.
|
||||
* @flip_type: Flip orientation, either vertical or horizontal.
|
||||
* @axis: axis coordinate about which to flip, in pixels.
|
||||
*
|
||||
* flips the given stroke.
|
||||
*
|
||||
* Rotates the given stroke around given center by angle (in degrees).
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
*/
|
||||
gboolean
|
||||
gimp_vectors_stroke_flip (gint32 vectors_ID,
|
||||
gint stroke_id,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-vectors-stroke-flip",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_VECTORS, vectors_ID,
|
||||
GIMP_PDB_INT32, stroke_id,
|
||||
GIMP_PDB_INT32, flip_type,
|
||||
GIMP_PDB_FLOAT, axis,
|
||||
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_flip_free:
|
||||
* @vectors_ID: The vectors object.
|
||||
* @stroke_id: The stroke ID.
|
||||
* @x1: X coordinate of the first point of the flipping axis.
|
||||
* @y1: Y coordinate of the first point of the flipping axis.
|
||||
* @x2: X coordinate of the second point of the flipping axis.
|
||||
* @y2: Y coordinate of the second point of the flipping axis.
|
||||
*
|
||||
* flips the given stroke about an arbitrary axis.
|
||||
*
|
||||
* Flips the given stroke about an arbitrary axis. Axis is defined by
|
||||
* two coordinates in the image (in pixels), through which the flipping
|
||||
* axis passes.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
*/
|
||||
gboolean
|
||||
gimp_vectors_stroke_flip_free (gint32 vectors_ID,
|
||||
gint stroke_id,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-vectors-stroke-flip-free",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_VECTORS, vectors_ID,
|
||||
GIMP_PDB_INT32, stroke_id,
|
||||
GIMP_PDB_FLOAT, x1,
|
||||
GIMP_PDB_FLOAT, y1,
|
||||
GIMP_PDB_FLOAT, x2,
|
||||
GIMP_PDB_FLOAT, y2,
|
||||
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_get_points:
|
||||
* @vectors_ID: The vectors object.
|
||||
|
|
|
@ -69,6 +69,21 @@ gboolean gimp_vectors_stroke_scale (gint32
|
|||
gint stroke_id,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y);
|
||||
gboolean gimp_vectors_stroke_rotate (gint32 vectors_ID,
|
||||
gint stroke_id,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble angle);
|
||||
gboolean gimp_vectors_stroke_flip (gint32 vectors_ID,
|
||||
gint stroke_id,
|
||||
GimpOrientationType flip_type,
|
||||
gdouble axis);
|
||||
gboolean gimp_vectors_stroke_flip_free (gint32 vectors_ID,
|
||||
gint stroke_id,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2);
|
||||
GimpVectorsStrokeType gimp_vectors_stroke_get_points (gint32 vectors_ID,
|
||||
gint stroke_id,
|
||||
gint *num_points,
|
||||
|
|
|
@ -123,6 +123,61 @@ vs_scale(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
|
|||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
vs_rotate(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
double center_x, center_y, angle;
|
||||
|
||||
static char *kwlist[] = { "center_x", "center_y", "angle", NULL };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ddd:rotate", kwlist,
|
||||
¢er_x, ¢er_y, &angle))
|
||||
return NULL;
|
||||
|
||||
gimp_vectors_stroke_rotate(self->vectors_ID, self->stroke, center_x,
|
||||
center_y, angle);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
vs_flip(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
int flip_type;
|
||||
double axis;
|
||||
|
||||
static char *kwlist[] = { "flip_type", "axis", NULL };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "id:rotate", kwlist,
|
||||
&flip_type, &axis))
|
||||
return NULL;
|
||||
|
||||
gimp_vectors_stroke_flip(self->vectors_ID, self->stroke, flip_type, axis);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
vs_flip_free(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
double x1,y1,x2,y2;
|
||||
|
||||
static char *kwlist[] = { "x1", "y1", "x2", "y2", NULL };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dddd:rotate", kwlist,
|
||||
&x1, &y1, &x2, &y2))
|
||||
return NULL;
|
||||
|
||||
gimp_vectors_stroke_flip_free(self->vectors_ID, self->stroke,
|
||||
x1, y1, x2, y2);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PyObject *
|
||||
vs_interpolate(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
|
@ -166,6 +221,9 @@ static PyMethodDef vs_methods[] = {
|
|||
{ "close", (PyCFunction)vs_close, METH_NOARGS },
|
||||
{ "translate", (PyCFunction)vs_translate, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "scale", (PyCFunction)vs_scale, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "rotate", (PyCFunction)vs_rotate, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "flip", (PyCFunction)vs_flip, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "flip_free", (PyCFunction)vs_flip_free, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "interpolate", (PyCFunction)vs_interpolate, METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
|
|
@ -525,6 +525,114 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub vectors_stroke_rotate {
|
||||
$blurb = 'rotates the given stroke.';
|
||||
|
||||
$help = <<'HELP';
|
||||
Rotates the given stroke around given center by angle (in degrees).
|
||||
HELP
|
||||
|
||||
&joao_pdb_misc('2006', '2.4');
|
||||
@inargs = (
|
||||
{ name => 'vectors', type => 'vectors',
|
||||
desc => 'The vectors object' },
|
||||
{ name => 'stroke_id', type => 'int32',
|
||||
desc => 'The stroke ID' },
|
||||
{ name => "center_x", type => 'float',
|
||||
desc => "X coordinate of the rotation center" },
|
||||
{ name => "center_y", type => 'float',
|
||||
desc => "Y coordinate of the rotation center" },
|
||||
{ name => "angle", type => 'float',
|
||||
desc => "angle to rotate about" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<"CODE"
|
||||
{
|
||||
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||
|
||||
if (stroke)
|
||||
gimp_stroke_rotate (stroke, center_x, center_y, angle);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub vectors_stroke_flip {
|
||||
$blurb = 'flips the given stroke.';
|
||||
|
||||
$help = <<'HELP';
|
||||
Rotates the given stroke around given center by angle (in degrees).
|
||||
HELP
|
||||
|
||||
&joao_pdb_misc('2006', '2.4');
|
||||
@inargs = (
|
||||
{ name => 'vectors', type => 'vectors',
|
||||
desc => 'The vectors object' },
|
||||
{ name => 'stroke_id', type => 'int32',
|
||||
desc => 'The stroke ID' },
|
||||
{ name => "flip_type",
|
||||
type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
|
||||
desc => "Flip orientation, either vertical or horizontal" },
|
||||
{ name => "axis", type => 'float',
|
||||
desc => "axis coordinate about which to flip, in pixels" }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<"CODE"
|
||||
{
|
||||
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||
|
||||
if (stroke)
|
||||
gimp_stroke_flip (stroke, flip_type, axis);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub vectors_stroke_flip_free {
|
||||
$blurb = 'flips the given stroke about an arbitrary axis.';
|
||||
|
||||
$help = <<'HELP';
|
||||
Flips the given stroke about an arbitrary axis. Axis is defined by two coordinates
|
||||
in the image (in pixels), through which the flipping axis passes.
|
||||
HELP
|
||||
|
||||
&joao_pdb_misc('2006', '2.4');
|
||||
@inargs = (
|
||||
{ name => 'vectors', type => 'vectors',
|
||||
desc => 'The vectors object' },
|
||||
{ name => 'stroke_id', type => 'int32',
|
||||
desc => 'The stroke ID' },
|
||||
{ name => "x1", type => 'float',
|
||||
desc => "X coordinate of the first point of the flipping axis" },
|
||||
{ name => "y1", type => 'float',
|
||||
desc => "Y coordinate of the first point of the flipping axis" },
|
||||
{ name => "x2", type => 'float',
|
||||
desc => "X coordinate of the second point of the flipping axis" },
|
||||
{ name => "y2", type => 'float',
|
||||
desc => "Y coordinate of the second point of the flipping axis" },
|
||||
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<"CODE"
|
||||
{
|
||||
GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
|
||||
|
||||
if (stroke)
|
||||
gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub vectors_stroke_get_points {
|
||||
$blurb = 'returns the control points of a stroke.';
|
||||
|
||||
|
@ -1158,6 +1266,9 @@ CODE
|
|||
vectors_stroke_close
|
||||
vectors_stroke_translate
|
||||
vectors_stroke_scale
|
||||
vectors_stroke_rotate
|
||||
vectors_stroke_flip
|
||||
vectors_stroke_flip_free
|
||||
vectors_stroke_get_points
|
||||
vectors_stroke_new_from_points
|
||||
vectors_stroke_interpolate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue