diff --git a/ChangeLog b/ChangeLog index e1f696d2bb..15f007b52c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-03-29 Simon Budig + + * app/tools/gimpvectortool.[ch] + * app/vectors/gimpbezierstroke.c + * app/vectors/gimpstroke.[ch] + * app/vectors/vectors-types.h: More vector tool stuff. Control + handles start to behave... + 2003-03-28 Sven Neumann * app/text/gimptext.[ch] diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index 8f03ba399b..71d81de200 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -211,7 +211,7 @@ gimp_vector_tool_control (GimpTool *tool, break; case HALT: - gimp_tool_pop_status (tool); + /* gimp_tool_pop_status (tool); */ gimp_tool_control_halt (tool->control); break; @@ -241,7 +241,7 @@ gimp_vector_tool_button_press (GimpTool *tool, /* if we are changing displays, pop the statusbar of the old one */ if (gimp_tool_control_is_active (tool->control) && gdisp != tool->gdisp) { - gimp_tool_pop_status (tool); + /* gimp_tool_pop_status (tool); */ } if (vector_tool->vectors && @@ -269,10 +269,24 @@ gimp_vector_tool_button_press (GimpTool *tool, FALSE)) { gimp_draw_tool_pause (GIMP_DRAW_TOOL (vector_tool)); + if (state & GDK_MOD1_MASK) + vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC; + else + vector_tool->restriction = GIMP_ANCHOR_FEATURE_NONE; - if (anchor->type == GIMP_HANDLE_ANCHOR) - gimp_stroke_anchor_select (stroke, anchor, TRUE); + if (anchor->type == GIMP_ANCHOR_ANCHOR) + { + gimp_stroke_anchor_select (stroke, anchor, TRUE); + /* MOD1 pressed? Convert to Edge */ + if (state & GDK_MOD1_MASK) + { + gimp_stroke_anchor_convert (stroke, anchor, + GIMP_ANCHOR_FEATURE_EDGE); + vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC; + } + } + /* doublecheck if there are control handles at this anchor */ anchor = gimp_vectors_anchor_get (vector_tool->vectors, coords, &stroke); @@ -325,8 +339,8 @@ gimp_vector_tool_button_press (GimpTool *tool, if (gimp_tool_control_is_active (tool->control)) { - gimp_tool_pop_status (tool); - gimp_tool_push_status (tool, ""); + /* gimp_tool_pop_status (tool); */ + /* gimp_tool_push_status (tool, ""); */ } /* start drawing the vector tool */ @@ -350,8 +364,8 @@ gimp_vector_tool_button_press (GimpTool *tool, if (gimp_tool_control_is_active (tool->control)) { - gimp_tool_pop_status (tool); - gimp_tool_push_status (tool, ""); + /* gimp_tool_pop_status (tool); */ + /* gimp_tool_push_status (tool, ""); */ } /* start drawing the vector tool */ @@ -361,6 +375,7 @@ gimp_vector_tool_button_press (GimpTool *tool, gimp_tool_control_activate (tool->control); } + static void gimp_vector_tool_button_release (GimpTool *tool, GimpCoords *coords, @@ -403,14 +418,12 @@ gimp_vector_tool_motion (GimpTool *tool, switch (vector_tool->function) { case VECTORS_MOVING: - /* if we are moving the start point and only have two, - * make it the end point */ anchor = vector_tool->cur_anchor; if (anchor) gimp_stroke_anchor_move_absolute (vector_tool->cur_stroke, vector_tool->cur_anchor, - coords, 0); + coords, vector_tool->restriction); default: break; @@ -491,7 +504,7 @@ gimp_vector_tool_draw (GimpDrawTool *draw_tool) { cur_anchor = (GimpAnchor *) ptr->data; - if (cur_anchor->type == GIMP_HANDLE_ANCHOR) + if (cur_anchor->type == GIMP_ANCHOR_ANCHOR) { gimp_draw_tool_draw_handle (draw_tool, cur_anchor->selected ? diff --git a/app/tools/gimpvectortool.h b/app/tools/gimpvectortool.h index 8938473324..5400cfc072 100644 --- a/app/tools/gimpvectortool.h +++ b/app/tools/gimpvectortool.h @@ -50,9 +50,10 @@ struct _GimpVectorTool { GimpSelectionTool parent_instance; - VectorFunction function; /* function we're performing */ - gint last_x; /* last x coordinate */ - gint last_y; /* last y coordinate */ + VectorFunction function; /* function we're performing */ + GimpAnchorFeatureType restriction; /* movement restriction */ + gint last_x; /* last x coordinate */ + gint last_y; /* last y coordinate */ GimpAnchor *cur_anchor; /* The current Anchor */ GimpStroke *cur_stroke; /* The current Stroke */ diff --git a/app/vectors/gimpbezierstroke.c b/app/vectors/gimpbezierstroke.c index 30f2004518..78644519c9 100644 --- a/app/vectors/gimpbezierstroke.c +++ b/app/vectors/gimpbezierstroke.c @@ -41,53 +41,61 @@ static GimpStrokeClass *parent_class = NULL; static void gimp_bezier_stroke_class_init (GimpBezierStrokeClass *klass); static void gimp_bezier_stroke_init (GimpBezierStroke *bezier_stroke); +static void gimp_bezier_stroke_anchor_move_relative (GimpStroke *stroke, + GimpAnchor *anchor, + const GimpCoords *deltacoord, + const GimpAnchorFeatureType feature); +static void gimp_bezier_stroke_anchor_move_absolute (GimpStroke *stroke, + GimpAnchor *anchor, + const GimpCoords *coord, + const GimpAnchorFeatureType feature); + +static void gimp_bezier_stroke_anchor_convert (GimpStroke *stroke, + GimpAnchor *anchor, + GimpAnchorFeatureType feature); static void gimp_bezier_stroke_finalize (GObject *object); -static void gimp_bezier_coords_average (GimpCoords *a, - GimpCoords *b, - GimpCoords *ret_average); - -static void gimp_bezier_coords_subdivide (GimpCoords *beziercoords, - const gdouble precision, - GArray **ret_coords); - -static void gimp_bezier_coords_mix (gdouble amul, - GimpCoords *a, - gdouble bmul, - GimpCoords *b, +static void gimp_bezier_coords_mix (const gdouble amul, + const GimpCoords *a, + const gdouble bmul, + const GimpCoords *b, GimpCoords *ret_val); -static void gimp_bezier_coords_average (GimpCoords *a, - GimpCoords *b, +static void gimp_bezier_coords_average (const GimpCoords *a, + const GimpCoords *b, GimpCoords *ret_average); -static void gimp_bezier_coords_difference (GimpCoords *a, - GimpCoords *b, +static void gimp_bezier_coords_add (const GimpCoords *a, + const GimpCoords *b, + GimpCoords *ret_add); + +static void gimp_bezier_coords_difference (const GimpCoords *a, + const GimpCoords *b, GimpCoords *ret_difference); -static void gimp_bezier_coords_scale (gdouble f, - GimpCoords *a, +static void gimp_bezier_coords_scale (const gdouble f, + const GimpCoords *a, GimpCoords *ret_multiply); -static void gimp_bezier_coords_subdivide (GimpCoords *beziercoords, +static void gimp_bezier_coords_subdivide (const GimpCoords *beziercoords, const gdouble precision, GArray **ret_coords); -static void gimp_bezier_coords_subdivide2 (GimpCoords *beziercoords, +static void gimp_bezier_coords_subdivide2 (const GimpCoords *beziercoords, const gdouble precision, GArray **ret_coords, gint depth); -static gdouble gimp_bezier_coords_scalarprod (GimpCoords *a, - GimpCoords *b); +static gdouble gimp_bezier_coords_scalarprod (const GimpCoords *a, + const GimpCoords *b); -static gdouble gimp_bezier_coords_length (GimpCoords *a); +static gdouble gimp_bezier_coords_length (const GimpCoords *a); -static gdouble gimp_bezier_coords_length2 (GimpCoords *a); +static gdouble gimp_bezier_coords_length2 (const GimpCoords *a); -static gboolean gimp_bezier_coords_is_straight (GimpCoords *beziercoords, - gdouble precision); +static gboolean gimp_bezier_coords_is_straight (const GimpCoords *beziercoords, + const gdouble precision); GType @@ -131,6 +139,9 @@ gimp_bezier_stroke_class_init (GimpBezierStrokeClass *klass) object_class->finalize = gimp_bezier_stroke_finalize; + stroke_class->anchor_move_relative = gimp_bezier_stroke_anchor_move_relative; + stroke_class->anchor_move_absolute = gimp_bezier_stroke_anchor_move_absolute; + stroke_class->anchor_convert = gimp_bezier_stroke_anchor_convert; stroke_class->interpolate = gimp_bezier_stroke_interpolate; } @@ -171,7 +182,7 @@ gimp_bezier_stroke_new (const GimpCoords *start) g_printerr ("Adding at %f, %f\n", start->x, start->y); - anchor->type = GIMP_HANDLE_ANCHOR; + anchor->type = GIMP_ANCHOR_ANCHOR; anchor->selected = TRUE; stroke->anchors = g_list_append (stroke->anchors, anchor); @@ -253,7 +264,7 @@ gimp_bezier_stroke_extend (GimpBezierStroke *bezier_stroke, if (loose_end == 1) { while (listneighbor && - ((GimpAnchor *) listneighbor->data)->type == GIMP_HANDLE_CONTROL) + ((GimpAnchor *) listneighbor->data)->type == GIMP_ANCHOR_CONTROL) { control_count++; listneighbor = listneighbor->prev; @@ -262,7 +273,7 @@ gimp_bezier_stroke_extend (GimpBezierStroke *bezier_stroke, else { while (listneighbor && - ((GimpAnchor *) listneighbor->data)->type == GIMP_HANDLE_CONTROL) + ((GimpAnchor *) listneighbor->data)->type == GIMP_ANCHOR_CONTROL) { control_count++; listneighbor = listneighbor->next; @@ -286,10 +297,10 @@ gimp_bezier_stroke_extend (GimpBezierStroke *bezier_stroke, { case 0: case 1: - anchor->type = GIMP_HANDLE_CONTROL; + anchor->type = GIMP_ANCHOR_CONTROL; break; case 2: - anchor->type = GIMP_HANDLE_ANCHOR; + anchor->type = GIMP_ANCHOR_ANCHOR; break; default: g_printerr ("inconsistent bezier curve: " @@ -345,6 +356,125 @@ gimp_bezier_stroke_extend (GimpBezierStroke *bezier_stroke, } +static void +gimp_bezier_stroke_anchor_move_relative (GimpStroke *stroke, + GimpAnchor *anchor, + const GimpCoords *deltacoord, + const GimpAnchorFeatureType feature) +{ + GimpCoords delta, coord1, coord2; + GList *anchor_list; + + delta = *deltacoord; + delta.pressure = 0; + delta.xtilt = 0; + delta.ytilt = 0; + delta.wheel = 0; + + gimp_bezier_coords_add (&(anchor->position), &delta, &coord1); + anchor->position = coord1; + + anchor_list = g_list_find (stroke->anchors, anchor); + g_return_if_fail (anchor_list != NULL); + + if (anchor->type == GIMP_ANCHOR_ANCHOR) + { + if (g_list_previous (anchor_list)) + { + coord2 = ((GimpAnchor *) g_list_previous (anchor_list)->data)->position; + gimp_bezier_coords_add (&coord2, &delta, &coord1); + ((GimpAnchor *) g_list_previous (anchor_list)->data)->position = + coord1; + } + + if (g_list_next (anchor_list)) + { + coord2 = ((GimpAnchor *) g_list_next (anchor_list)->data)->position; + gimp_bezier_coords_add (&coord2, &delta, &coord1); + ((GimpAnchor *) g_list_next (anchor_list)->data)->position = coord1; + } + } + else + { + if (feature == GIMP_ANCHOR_FEATURE_SYMMETRIC) + { + GList *neighbour = NULL, *opposite = NULL; + + /* search for opposite control point. Sigh. */ + neighbour = g_list_previous (anchor_list); + if (neighbour && + ((GimpAnchor *) neighbour->data)->type == GIMP_ANCHOR_ANCHOR) + { + opposite = g_list_previous (neighbour); + } + else + { + neighbour = g_list_next (anchor_list); + if (neighbour && + ((GimpAnchor *) neighbour->data)->type == GIMP_ANCHOR_ANCHOR) + { + opposite = g_list_next (neighbour); + } + } + if (opposite && + ((GimpAnchor *) opposite->data)->type == GIMP_ANCHOR_CONTROL) + { + gimp_bezier_coords_difference (&(((GimpAnchor *) neighbour->data)->position), + &(anchor->position), &delta); + gimp_bezier_coords_add (&(((GimpAnchor *) neighbour->data)->position), + &delta, &coord1); + ((GimpAnchor *) opposite->data)->position = coord1; + } + } + } +} + + +static void +gimp_bezier_stroke_anchor_move_absolute (GimpStroke *stroke, + GimpAnchor *anchor, + const GimpCoords *coord, + const GimpAnchorFeatureType feature) +{ + GimpCoords deltacoord; + + gimp_bezier_coords_difference (coord, &(anchor->position), &deltacoord); + gimp_bezier_stroke_anchor_move_relative (stroke, anchor, + &deltacoord, feature); +} + +void +gimp_bezier_stroke_anchor_convert (GimpStroke *stroke, + GimpAnchor *anchor, + GimpAnchorFeatureType feature) +{ + GList *anchor_list; + + anchor_list = g_list_find (stroke->anchors, anchor); + + g_return_if_fail (anchor_list != NULL); + + switch (feature) + { + case GIMP_ANCHOR_FEATURE_EDGE: + if (g_list_previous (anchor_list)) + ((GimpAnchor *) g_list_previous (anchor_list)->data)->position = + anchor->position; + + if (g_list_next (anchor_list)) + ((GimpAnchor *) g_list_next (anchor_list)->data)->position = + anchor->position; + + break; + + default: + g_printerr ("gimp_bezier_stroke_anchor_convert: " + "unimplemented anchor conversion %d\n", feature); + + } +} + + GArray * gimp_bezier_stroke_interpolate (const GimpStroke *stroke, gdouble precision, @@ -364,7 +494,7 @@ gimp_bezier_stroke_interpolate (const GimpStroke *stroke, count = 0; for (anchorlist = stroke->anchors; - anchorlist && ((GimpAnchor *) anchorlist->data)->type != GIMP_HANDLE_ANCHOR; + anchorlist && ((GimpAnchor *) anchorlist->data)->type != GIMP_ANCHOR_ANCHOR; anchorlist = g_list_next (anchorlist)); for ( ; anchorlist; anchorlist = g_list_next (anchorlist)) @@ -395,10 +525,10 @@ gimp_bezier_stroke_interpolate (const GimpStroke *stroke, /* amul * a + bmul * b */ static void -gimp_bezier_coords_mix (gdouble amul, - GimpCoords *a, - gdouble bmul, - GimpCoords *b, +gimp_bezier_coords_mix (const gdouble amul, + const GimpCoords *a, + const gdouble bmul, + const GimpCoords *b, GimpCoords *ret_val) { if (b) @@ -425,19 +555,30 @@ gimp_bezier_coords_mix (gdouble amul, /* (a+b)/2 */ static void -gimp_bezier_coords_average (GimpCoords *a, - GimpCoords *b, +gimp_bezier_coords_average (const GimpCoords *a, + const GimpCoords *b, GimpCoords *ret_average) { gimp_bezier_coords_mix (0.5, a, 0.5, b, ret_average); } +/* a + b */ + +static void +gimp_bezier_coords_add (const GimpCoords *a, + const GimpCoords *b, + GimpCoords *ret_add) +{ + gimp_bezier_coords_mix (1.0, a, 1.0, b, ret_add); +} + + /* a - b */ static void -gimp_bezier_coords_difference (GimpCoords *a, - GimpCoords *b, +gimp_bezier_coords_difference (const GimpCoords *a, + const GimpCoords *b, GimpCoords *ret_difference) { gimp_bezier_coords_mix (1.0, a, -1.0, b, ret_difference); @@ -447,8 +588,8 @@ gimp_bezier_coords_difference (GimpCoords *a, /* a * f = ret_product */ static void -gimp_bezier_coords_scale (gdouble f, - GimpCoords *a, +gimp_bezier_coords_scale (const gdouble f, + const GimpCoords *a, GimpCoords *ret_multiply) { gimp_bezier_coords_mix (f, a, 0.0, NULL, ret_multiply); @@ -458,8 +599,8 @@ gimp_bezier_coords_scale (gdouble f, /* local helper for measuring the scalarproduct of two gimpcoords. */ static gdouble -gimp_bezier_coords_scalarprod (GimpCoords *a, - GimpCoords *b) +gimp_bezier_coords_scalarprod (const GimpCoords *a, + const GimpCoords *b) { return (a->x * b->x + a->y * b->y + @@ -477,7 +618,7 @@ gimp_bezier_coords_scalarprod (GimpCoords *a, */ static gdouble -gimp_bezier_coords_length2 (GimpCoords *a) +gimp_bezier_coords_length2 (const GimpCoords *a) { GimpCoords upscaled_a; @@ -492,7 +633,7 @@ gimp_bezier_coords_length2 (GimpCoords *a) static gdouble -gimp_bezier_coords_length (GimpCoords *a) +gimp_bezier_coords_length (const GimpCoords *a) { return (sqrt (gimp_bezier_coords_length2 (a))); } @@ -506,7 +647,7 @@ gimp_bezier_coords_length (GimpCoords *a) */ static gboolean -gimp_bezier_coords_is_straight (GimpCoords *beziercoords, +gimp_bezier_coords_is_straight (const GimpCoords *beziercoords, gdouble precision) { GimpCoords line, tan1, tan2, d1, d2; @@ -573,10 +714,10 @@ gimp_bezier_coords_is_straight (GimpCoords *beziercoords, static void -gimp_bezier_coords_subdivide2 (GimpCoords *beziercoords, - const gdouble precision, - GArray **ret_coords, - gint depth) +gimp_bezier_coords_subdivide2 (const GimpCoords *beziercoords, + const gdouble precision, + GArray **ret_coords, + gint depth) { /* * beziercoords has to contain four GimpCoords with the four control points @@ -645,9 +786,9 @@ gimp_bezier_coords_subdivide2 (GimpCoords *beziercoords, static void -gimp_bezier_coords_subdivide (GimpCoords *beziercoords, - const gdouble precision, - GArray **ret_coords) +gimp_bezier_coords_subdivide (const GimpCoords *beziercoords, + const gdouble precision, + GArray **ret_coords) { gimp_bezier_coords_subdivide2 (beziercoords, precision, ret_coords, 10); } diff --git a/app/vectors/gimpstroke.c b/app/vectors/gimpstroke.c index bd17e43ae3..2640ce83d0 100644 --- a/app/vectors/gimpstroke.c +++ b/app/vectors/gimpstroke.c @@ -45,11 +45,11 @@ static GimpAnchor * gimp_stroke_real_anchor_get_next (const GimpStroke *stroke, static void gimp_stroke_real_anchor_move_relative (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *deltacoord, - const gint type); + const GimpAnchorFeatureType feature); static void gimp_stroke_real_anchor_move_absolute (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *deltacoord, - const gint type); + const GimpAnchorFeatureType feature); /* private variables */ @@ -107,6 +107,7 @@ gimp_stroke_class_init (GimpStrokeClass *klass) klass->anchor_get_next = gimp_stroke_real_anchor_get_next; klass->anchor_move_relative = gimp_stroke_real_anchor_move_relative; klass->anchor_move_absolute = gimp_stroke_real_anchor_move_absolute; + klass->anchor_convert = NULL; klass->anchor_delete = NULL; klass->get_length = NULL; @@ -285,7 +286,7 @@ void gimp_stroke_anchor_move_relative (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *deltacoord, - const gint type) + const GimpAnchorFeatureType feature) { GimpStrokeClass *stroke_class; @@ -293,7 +294,7 @@ gimp_stroke_anchor_move_relative (GimpStroke *stroke, stroke_class = GIMP_STROKE_GET_CLASS (stroke); - stroke_class->anchor_move_relative (stroke, anchor, deltacoord, type); + stroke_class->anchor_move_relative (stroke, anchor, deltacoord, feature); } @@ -301,7 +302,7 @@ static void gimp_stroke_real_anchor_move_relative (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *deltacoord, - const gint type) + const GimpAnchorFeatureType feature) { /* * There should be a test that ensures that the anchor is owned by @@ -318,7 +319,7 @@ void gimp_stroke_anchor_move_absolute (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *coord, - const gint type) + const GimpAnchorFeatureType feature) { GimpStrokeClass *stroke_class; @@ -326,7 +327,7 @@ gimp_stroke_anchor_move_absolute (GimpStroke *stroke, stroke_class = GIMP_STROKE_GET_CLASS (stroke); - stroke_class->anchor_move_absolute (stroke, anchor, coord, type); + stroke_class->anchor_move_absolute (stroke, anchor, coord, feature); } @@ -334,7 +335,7 @@ static void gimp_stroke_real_anchor_move_absolute (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *coord, - const gint type) + const GimpAnchorFeatureType feature) { /* * There should be a test that ensures that the anchor is owned by @@ -347,6 +348,26 @@ gimp_stroke_real_anchor_move_absolute (GimpStroke *stroke, } +void +gimp_stroke_anchor_convert (GimpStroke *stroke, + GimpAnchor *anchor, + GimpAnchorFeatureType feature) +{ + GimpStrokeClass *stroke_class; + + g_return_if_fail (GIMP_IS_STROKE (stroke)); + + stroke_class = GIMP_STROKE_GET_CLASS (stroke); + + if (stroke_class->anchor_convert) + stroke_class->anchor_convert (stroke, anchor, feature); + else + g_printerr ("gimp_stroke_anchor_convert: default implementation\n"); + + return; +} + + void gimp_stroke_anchor_delete (GimpStroke *stroke, GimpAnchor *anchor) @@ -517,7 +538,7 @@ gimp_stroke_get_draw_anchors (const GimpStroke *stroke) while (cur_ptr) { - if (((GimpAnchor *) cur_ptr->data)->type == GIMP_HANDLE_ANCHOR) + if (((GimpAnchor *) cur_ptr->data)->type == GIMP_ANCHOR_ANCHOR) ret_list = g_list_append (ret_list, cur_ptr->data); cur_ptr = g_list_next (cur_ptr); } @@ -547,14 +568,14 @@ gimp_stroke_get_draw_controls (const GimpStroke *stroke) while (cur_ptr) { - if (((GimpAnchor *) cur_ptr->data)->type == GIMP_HANDLE_CONTROL) + if (((GimpAnchor *) cur_ptr->data)->type == GIMP_ANCHOR_CONTROL) { if (cur_ptr->next && - ((GimpAnchor *) cur_ptr->next->data)->type == GIMP_HANDLE_ANCHOR && + ((GimpAnchor *) cur_ptr->next->data)->type == GIMP_ANCHOR_ANCHOR && ((GimpAnchor *) cur_ptr->next->data)->selected) ret_list = g_list_append (ret_list, cur_ptr->data); else if (cur_ptr->prev && - ((GimpAnchor *) cur_ptr->prev->data)->type == GIMP_HANDLE_ANCHOR && + ((GimpAnchor *) cur_ptr->prev->data)->type == GIMP_ANCHOR_ANCHOR && ((GimpAnchor *) cur_ptr->prev->data)->selected) ret_list = g_list_append (ret_list, cur_ptr->data); } @@ -587,7 +608,7 @@ gimp_stroke_get_draw_lines (const GimpStroke *stroke) while (cur_ptr) { - if (((GimpAnchor *) cur_ptr->data)->type == GIMP_HANDLE_ANCHOR && + if (((GimpAnchor *) cur_ptr->data)->type == GIMP_ANCHOR_ANCHOR && ((GimpAnchor *) cur_ptr->data)->selected) { if (cur_ptr->next) diff --git a/app/vectors/gimpstroke.h b/app/vectors/gimpstroke.h index 22e5f499d2..15710ffc57 100644 --- a/app/vectors/gimpstroke.h +++ b/app/vectors/gimpstroke.h @@ -69,12 +69,16 @@ struct _GimpStrokeClass void (* anchor_move_relative) (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *deltacoord, - const gint type); + const GimpAnchorFeatureType feature); void (* anchor_move_absolute) (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *coord, - const gint type); + const GimpAnchorFeatureType feature); + + void (* anchor_convert) (GimpStroke *stroke, + GimpAnchor *anchor, + GimpAnchorFeatureType feature); void (* anchor_delete) (GimpStroke *stroke, GimpAnchor *anchor); @@ -134,15 +138,19 @@ void gimp_stroke_anchor_select (GimpStroke *stroke, void gimp_stroke_anchor_move_relative (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *deltacoord, - const gint type); + const GimpAnchorFeatureType feature); void gimp_stroke_anchor_move_absolute (GimpStroke *stroke, GimpAnchor *anchor, const GimpCoords *coord, - const gint type); + const GimpAnchorFeatureType feature); -void gimp_stroke_anchor_delete (GimpStroke *stroke, - GimpAnchor *anchor); +void gimp_stroke_anchor_convert (GimpStroke *stroke, + GimpAnchor *anchor, + GimpAnchorFeatureType feature); + +void gimp_stroke_anchor_delete (GimpStroke *stroke, + GimpAnchor *anchor); /* accessing the shape of the curve */ diff --git a/app/vectors/vectors-types.h b/app/vectors/vectors-types.h index 28ce7c6e62..1d7da336b9 100644 --- a/app/vectors/vectors-types.h +++ b/app/vectors/vectors-types.h @@ -29,10 +29,18 @@ typedef struct _GimpAnchor GimpAnchor; typedef enum { - GIMP_HANDLE_ANCHOR, - GIMP_HANDLE_CONTROL, + GIMP_ANCHOR_ANCHOR, + GIMP_ANCHOR_CONTROL, } GimpAnchorType; +typedef enum +{ + GIMP_ANCHOR_FEATURE_NONE, + GIMP_ANCHOR_FEATURE_EDGE, + GIMP_ANCHOR_FEATURE_ALIGNED, + GIMP_ANCHOR_FEATURE_SYMMETRIC, +} GimpAnchorFeatureType; + typedef enum { EXTEND_SIMPLE,