[gimp] app: draw the free select tool's line in one stroke()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: draw the free select tool's line in one stroke()
- Date: Sun, 26 Sep 2010 12:17:56 +0000 (UTC)
commit 4b89850a2e1f8edba34e9873d7bfe8854f39e67a
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 26 14:17:04 2010 +0200
app: draw the free select tool's line in one stroke()
This is clearly too complicated for general use, but it's only a test
case for the new APIs.
app/tools/gimpfreeselecttool.c | 41 ++++++++++++++++++++++++++++++++-------
1 files changed, 33 insertions(+), 8 deletions(-)
---
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index 2669541..3c2b7bb 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -39,6 +39,7 @@
#include "widgets/gimphelp-ids.h"
+#include "display/gimpcanvasgroup.h"
#include "display/gimpdisplay.h"
#include "gimpfreeselecttool.h"
@@ -1528,6 +1529,8 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
GimpFreeSelectTool *fst = GIMP_FREE_SELECT_TOOL (draw_tool);
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
GimpTool *tool = GIMP_TOOL (draw_tool);
+ GimpCanvasItem *lines;
+ GimpCanvasItem *last_line = NULL;
gboolean hovering_first_point = FALSE;
gboolean handles_wants_to_show = FALSE;
GimpCoords coords = { priv->last_coords.x,
@@ -1541,9 +1544,10 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
tool->display,
NO_CLICK_TIME_AVAILABLE,
&coords);
- gimp_draw_tool_add_lines (draw_tool,
- priv->points, priv->n_points,
- FALSE);
+
+ lines = gimp_draw_tool_add_lines (draw_tool,
+ priv->points, priv->n_points,
+ FALSE);
/* We always show the handle for the first point, even with button1
* down, since releasing the button on the first point will close
@@ -1604,11 +1608,32 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
{
GimpVector2 last = priv->points[priv->n_points - 1];
- gimp_draw_tool_add_line (draw_tool,
- last.x,
- last.y,
- priv->pending_point.x,
- priv->pending_point.y);
+ last_line = gimp_draw_tool_add_line (draw_tool,
+ last.x,
+ last.y,
+ priv->pending_point.x,
+ priv->pending_point.y);
+ }
+
+ if (last_line)
+ {
+ GimpCanvasItem *stroke_group;
+
+ stroke_group = gimp_canvas_group_new ();
+ gimp_canvas_group_set_group_stroking (GIMP_CANVAS_GROUP (stroke_group),
+ TRUE);
+ gimp_draw_tool_add_item (draw_tool, stroke_group);
+ g_object_unref (stroke_group);
+
+ g_object_ref (lines);
+ gimp_draw_tool_remove_item (draw_tool, lines);
+ gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (stroke_group), lines);
+ g_object_ref (lines);
+
+ g_object_ref (last_line);
+ gimp_draw_tool_remove_item (draw_tool, last_line);
+ gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (stroke_group), last_line);
+ g_object_ref (last_line);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]