[gimp] app: add gimp_tool_widget_add_rectangle(), _rectangle_guides(), _corner()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_tool_widget_add_rectangle(), _rectangle_guides(), _corner()
- Date: Sun, 25 Jun 2017 19:07:47 +0000 (UTC)
commit d27359cca23a7d43881239330d38309565d6ebe3
Author: Michael Natterer <mitch gimp org>
Date: Sun Jun 25 21:06:27 2017 +0200
app: add gimp_tool_widget_add_rectangle(), _rectangle_guides(), _corner()
app/display/gimptoolwidget.c | 101 +++++++++++++++++++++++++++++++++++------
app/display/gimptoolwidget.h | 88 +++++++++++++++++++++++-------------
2 files changed, 142 insertions(+), 47 deletions(-)
---
diff --git a/app/display/gimptoolwidget.c b/app/display/gimptoolwidget.c
index 1aaca20..95e1371 100644
--- a/app/display/gimptoolwidget.c
+++ b/app/display/gimptoolwidget.c
@@ -27,11 +27,14 @@
#include "core/gimpmarshal.h"
+#include "gimpcanvascorner.h"
#include "gimpcanvasgroup.h"
#include "gimpcanvashandle.h"
#include "gimpcanvasline.h"
#include "gimpcanvaspath.h"
#include "gimpcanvaspolygon.h"
+#include "gimpcanvasrectangle.h"
+#include "gimpcanvasrectangleguides.h"
#include "gimpcanvastransformguides.h"
#include "gimpdisplayshell.h"
#include "gimptoolwidget.h"
@@ -455,6 +458,27 @@ gimp_tool_widget_add_line (GimpToolWidget *widget,
}
GimpCanvasItem *
+gimp_tool_widget_add_rectangle (GimpToolWidget *widget,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gboolean filled)
+{
+ GimpCanvasItem *item;
+
+ g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
+
+ item = gimp_canvas_rectangle_new (widget->private->shell,
+ x, y, width, height, filled);
+
+ gimp_tool_widget_add_item (widget, item);
+ g_object_unref (item);
+
+ return item;
+}
+
+GimpCanvasItem *
gimp_tool_widget_add_polygon (GimpToolWidget *widget,
GimpMatrix3 *transform,
const GimpVector2 *points,
@@ -499,6 +523,23 @@ gimp_tool_widget_add_polygon_from_coords (GimpToolWidget *widget,
}
GimpCanvasItem *
+gimp_tool_widget_add_path (GimpToolWidget *widget,
+ const GimpBezierDesc *desc)
+{
+ GimpCanvasItem *item;
+
+ g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
+
+ item = gimp_canvas_path_new (widget->private->shell,
+ desc, 0, 0, FALSE, GIMP_PATH_STYLE_DEFAULT);
+
+ gimp_tool_widget_add_item (widget, item);
+ g_object_unref (item);
+
+ return item;
+}
+
+GimpCanvasItem *
gimp_tool_widget_add_handle (GimpToolWidget *widget,
GimpHandleType type,
gdouble x,
@@ -521,22 +562,24 @@ gimp_tool_widget_add_handle (GimpToolWidget *widget,
}
GimpCanvasItem *
-gimp_tool_widget_add_transform_guides (GimpToolWidget *widget,
- const GimpMatrix3 *transform,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2,
- GimpGuidesType type,
- gint n_guides)
+gimp_tool_widget_add_corner (GimpToolWidget *widget,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ GimpHandleAnchor anchor,
+ gint width,
+ gint height,
+ gboolean outside)
{
GimpCanvasItem *item;
g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
- item = gimp_canvas_transform_guides_new (widget->private->shell,
- transform, x1, y1, x2, y2,
- type, n_guides);
+ item = gimp_canvas_corner_new (widget->private->shell,
+ x1, y1, x2 - x1, y2 - y1,
+ anchor, width, height,
+ outside);
gimp_tool_widget_add_item (widget, item);
g_object_unref (item);
@@ -545,15 +588,43 @@ gimp_tool_widget_add_transform_guides (GimpToolWidget *widget,
}
GimpCanvasItem *
-gimp_tool_widget_add_path (GimpToolWidget *widget,
- const GimpBezierDesc *desc)
+gimp_tool_widget_add_rectangle_guides (GimpToolWidget *widget,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GimpGuidesType type)
{
GimpCanvasItem *item;
g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
- item = gimp_canvas_path_new (widget->private->shell,
- desc, 0, 0, FALSE, GIMP_PATH_STYLE_DEFAULT);
+ item = gimp_canvas_rectangle_guides_new (widget->private->shell,
+ x, y, width, height, type, 4);
+
+ gimp_tool_widget_add_item (widget, item);
+ g_object_unref (item);
+
+ return item;
+}
+
+GimpCanvasItem *
+gimp_tool_widget_add_transform_guides (GimpToolWidget *widget,
+ const GimpMatrix3 *transform,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ GimpGuidesType type,
+ gint n_guides)
+{
+ GimpCanvasItem *item;
+
+ g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
+
+ item = gimp_canvas_transform_guides_new (widget->private->shell,
+ transform, x1, y1, x2, y2,
+ type, n_guides);
gimp_tool_widget_add_item (widget, item);
g_object_unref (item);
diff --git a/app/display/gimptoolwidget.h b/app/display/gimptoolwidget.h
index b61d625..c9caae2 100644
--- a/app/display/gimptoolwidget.h
+++ b/app/display/gimptoolwidget.h
@@ -150,40 +150,64 @@ void gimp_tool_widget_pop_group (GimpToolWidget *widget);
/* for subclasses, convenience functions to add specific items
*/
-GimpCanvasItem * gimp_tool_widget_add_line (GimpToolWidget *widget,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2);
-GimpCanvasItem * gimp_tool_widget_add_polygon (GimpToolWidget *widget,
- GimpMatrix3 *transform,
- const GimpVector2 *points,
- gint n_points,
- gboolean filled);
+GimpCanvasItem * gimp_tool_widget_add_line (GimpToolWidget *widget,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+GimpCanvasItem * gimp_tool_widget_add_rectangle (GimpToolWidget *widget,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gboolean filled);
+GimpCanvasItem * gimp_tool_widget_add_polygon (GimpToolWidget *widget,
+ GimpMatrix3 *transform,
+ const GimpVector2 *points,
+ gint n_points,
+ gboolean filled);
GimpCanvasItem * gimp_tool_widget_add_polygon_from_coords
- (GimpToolWidget *widget,
- GimpMatrix3 *transform,
- const GimpCoords *points,
- gint n_points,
- gboolean filled);
-GimpCanvasItem * gimp_tool_widget_add_handle (GimpToolWidget *widget,
- GimpHandleType type,
- gdouble x,
- gdouble y,
- gint width,
- gint height,
- GimpHandleAnchor anchor);
+ (GimpToolWidget *widget,
+ GimpMatrix3 *transform,
+ const GimpCoords *points,
+ gint n_points,
+ gboolean filled);
+GimpCanvasItem * gimp_tool_widget_add_path (GimpToolWidget *widget,
+ const GimpBezierDesc *desc);
+
+GimpCanvasItem * gimp_tool_widget_add_handle (GimpToolWidget *widget,
+ GimpHandleType type,
+ gdouble x,
+ gdouble y,
+ gint width,
+ gint height,
+ GimpHandleAnchor anchor);
+GimpCanvasItem * gimp_tool_widget_add_corner (GimpToolWidget *widget,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ GimpHandleAnchor anchor,
+ gint width,
+ gint height,
+ gboolean outside);
+
+GimpCanvasItem * gimp_tool_widget_add_rectangle_guides
+ (GimpToolWidget *widget,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GimpGuidesType type);
GimpCanvasItem * gimp_tool_widget_add_transform_guides
- (GimpToolWidget *widget,
- const GimpMatrix3 *transform,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2,
- GimpGuidesType type,
- gint n_guides);
-GimpCanvasItem * gimp_tool_widget_add_path (GimpToolWidget *widget,
- const GimpBezierDesc *desc);
+ (GimpToolWidget *widget,
+ const GimpMatrix3 *transform,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ GimpGuidesType type,
+ gint n_guides);
/* for tools, to be called from the respective GimpTool method
* implementations
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]