From 10cb43d2fb6099530994bd14b5e20502ec299edc Mon Sep 17 00:00:00 2001 From: Simon Budig Date: Sun, 3 Aug 2003 01:26:05 +0000 Subject: [PATCH] implemented gimp_stroke_close. 2003-08-02 Simon Budig * app/vectors/gimpstroke.[ch]: implemented gimp_stroke_close. * app/vectors/gimpbezierstroke.c: only extend a stroke if it is not closed. * app/tools/gimpvectortool.c: ALT-Click on an anchor now closes the stroke. Will evolve to the ability to connect two strokes. --- ChangeLog | 11 +++++++++++ app/tools/gimpvectortool.c | 5 +++++ app/vectors/gimpbezierstroke.c | 2 ++ app/vectors/gimpstroke.c | 6 ++++++ app/vectors/gimpstroke.h | 4 +++- 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 82139a27aa..6dc8375d46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-08-02 Simon Budig + + * app/vectors/gimpstroke.[ch]: implemented gimp_stroke_close. + + * app/vectors/gimpbezierstroke.c: only extend a stroke if + it is not closed. + + * app/tools/gimpvectortool.c: ALT-Click on an anchor now + closes the stroke. Will evolve to the ability to connect + two strokes. + 2003-08-01 Henrik Brix Andersen * plug-ins/rcm/rcm.c diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index b85c582811..b50c0bfda3 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -241,6 +241,8 @@ gimp_vector_tool_button_press (GimpTool *tool, * (SHFT) -> multiple selection * (CTRL) -> Drag out control point * (CTRL+SHFT) -> Convert to corner + * (ALT) -> close this stroke (really should be able to connect + * two strokes) * * Handle: (NONE) -> Regular Movement * (SHFT) -> (Handle) Move opposite handle symmetrically @@ -357,6 +359,9 @@ gimp_vector_tool_button_press (GimpTool *tool, if (state & GDK_CONTROL_MASK) gimp_vector_tool_on_handle (tool, coords, GIMP_ANCHOR_CONTROL, gdisp, &anchor, &stroke); + + if (state & GDK_MOD1_MASK) + gimp_stroke_close (stroke); } else { diff --git a/app/vectors/gimpbezierstroke.c b/app/vectors/gimpbezierstroke.c index 8027c7ad52..1d94f6cc58 100644 --- a/app/vectors/gimpbezierstroke.c +++ b/app/vectors/gimpbezierstroke.c @@ -220,6 +220,8 @@ gimp_bezier_stroke_extend (GimpBezierStroke *bezier_stroke, stroke = GIMP_STROKE (bezier_stroke); + g_return_val_if_fail (!stroke->closed, NULL); + if (stroke->anchors == NULL) { /* assure that there is no neighbor specified */ diff --git a/app/vectors/gimpstroke.c b/app/vectors/gimpstroke.c index 223195cb44..9e62c2c35c 100644 --- a/app/vectors/gimpstroke.c +++ b/app/vectors/gimpstroke.c @@ -366,6 +366,12 @@ gimp_stroke_real_anchor_move_absolute (GimpStroke *stroke, anchor->position.y = coord->y; } +void +gimp_stroke_close (GimpStroke *stroke) +{ + stroke->closed = TRUE; +} + void gimp_stroke_anchor_convert (GimpStroke *stroke, diff --git a/app/vectors/gimpstroke.h b/app/vectors/gimpstroke.h index 111705bfb0..3e6c1a9aee 100644 --- a/app/vectors/gimpstroke.h +++ b/app/vectors/gimpstroke.h @@ -124,6 +124,8 @@ void gimp_stroke_anchor_move_absolute (GimpStroke *stroke, const GimpCoords *coord, GimpAnchorFeatureType feature); +void gimp_stroke_close (GimpStroke *stroke); + void gimp_stroke_anchor_convert (GimpStroke *stroke, GimpAnchor *anchor, GimpAnchorFeatureType feature); @@ -138,7 +140,7 @@ gdouble gimp_stroke_get_length (const GimpStroke *stroke); gdouble gimp_stroke_get_distance (const GimpStroke *stroke, const GimpCoords *coord); -/* returns the number of valid coordinates */ +/* returns an array of valid coordinates */ GArray * gimp_stroke_interpolate (const GimpStroke *stroke, gdouble precision, gboolean *closed);