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



commit 7bc094a443a2b6ad40ce02847a0b20b9b82eff13
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 |   16 +++++++++++++++-
 app/tools/gimpwarptool.h |    3 +++
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 67e3f27..c063c5a 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -332,6 +332,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);
 }
 
@@ -344,7 +347,6 @@ gimp_warp_tool_button_press (GimpTool            *tool,
                              GimpDisplay         *display)
 {
   GimpWarpTool    *wt        = GIMP_WARP_TOOL (tool);
-  GimpDrawTool    *draw_tool = GIMP_DRAW_TOOL (tool);
 
   if (display != tool->display)
     gimp_warp_tool_start (wt, display);
@@ -401,6 +403,18 @@ static void
 gimp_warp_tool_draw (GimpDrawTool *draw_tool)
 {
   GimpWarpTool    *wt        = GIMP_WARP_TOOL (draw_tool);
+  GimpWarpOptions *options   = GIMP_WARP_TOOL_GET_OPTIONS (wt);
+
+  if (options->effect_size >= 3.0)
+    {
+      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]