[gimp/soc-2011-warp] gimpwarptool: draw a circle around the cursor to indicate the size of the effect



commit afa5861c6c75a01d69dd3497615c5752e8936982
Author: Michael Muré <batolettre gmail com>
Date:   Fri Jun 3 21:17:08 2011 +0200

    gimpwarptool: draw a circle around the cursor to indicate the size of the effect

 app/tools/gimpwarptool.c |   12 ++++++++++++
 app/tools/gimpwarptool.h |    3 +++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index aed2a85..52563c1 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -334,6 +334,9 @@ gimp_warp_tool_oper_update (GimpTool         *tool,
 
   gimp_draw_tool_pause (draw_tool);
 
+  wt->cursor_x        = coords->x;
+  wt->cursor_y        = coords->y;
+
   gimp_draw_tool_resume (draw_tool);
 }
 
@@ -403,6 +406,15 @@ static void
 gimp_warp_tool_draw (GimpDrawTool *draw_tool)
 {
   GimpWarpTool    *wt        = GIMP_WARP_TOOL (draw_tool);
+  GimpWarpOptions *options   = GIMP_WARP_TOOL_GET_OPTIONS (wt);
+
+  gimp_draw_tool_add_handle (draw_tool,
+                             GIMP_HANDLE_CIRCLE,
+                             wt->cursor_x,
+                             wt->cursor_y,
+                             options->effect_size,
+                             options->effect_size,
+                             GIMP_HANDLE_ANCHOR_CENTER);
 }
 
 static void
diff --git a/app/tools/gimpwarptool.h b/app/tools/gimpwarptool.h
index 5fa48f3..e0d2a8b 100644
--- a/app/tools/gimpwarptool.h
+++ b/app/tools/gimpwarptool.h
@@ -41,6 +41,9 @@ struct _GimpWarpTool
 {
   GimpDrawTool    parent_instance;
 
+  gdouble         cursor_x; /* Hold the cursor x position */
+  gdouble         cursor_y; /* Hold the cursor y position */
+
   GeglBuffer     *coords_buffer; /* Gegl buffer where coordinates are stored */
 
   GeglNode       *coords_node; /* Gegl node that read in the coords buffer */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]