Commit d27359cc authored by Michael Natterer's avatar Michael Natterer 😴

app: add gimp_tool_widget_add_rectangle(), _rectangle_guides(), _corner()

parent ff35d35e
......@@ -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"
......@@ -454,6 +457,27 @@ gimp_tool_widget_add_line (GimpToolWidget *widget,
return item;
}
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,
......@@ -498,6 +522,23 @@ gimp_tool_widget_add_polygon_from_coords (GimpToolWidget *widget,
return item;
}
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,
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment