mirror of https://github.com/GNOME/gimp.git
app: add gimp_tool_widget_add_polygon() and add_polygon_from_coords()
This commit is contained in:
parent
9d8f94375e
commit
9e2a3c7aee
|
@ -31,6 +31,7 @@
|
|||
#include "gimpcanvashandle.h"
|
||||
#include "gimpcanvasline.h"
|
||||
#include "gimpcanvaspath.h"
|
||||
#include "gimpcanvaspolygon.h"
|
||||
#include "gimpcanvastransformguides.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimptoolwidget.h"
|
||||
|
@ -385,6 +386,50 @@ gimp_tool_widget_add_line (GimpToolWidget *widget,
|
|||
return item;
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
gimp_tool_widget_add_polygon (GimpToolWidget *widget,
|
||||
GimpMatrix3 *transform,
|
||||
const GimpVector2 *points,
|
||||
gint n_points,
|
||||
gboolean filled)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
|
||||
g_return_val_if_fail (points == NULL || n_points > 0, NULL);
|
||||
|
||||
item = gimp_canvas_polygon_new (widget->private->shell,
|
||||
points, n_points,
|
||||
transform, filled);
|
||||
|
||||
gimp_tool_widget_add_item (widget, item);
|
||||
g_object_unref (item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
gimp_tool_widget_add_polygon_from_coords (GimpToolWidget *widget,
|
||||
GimpMatrix3 *transform,
|
||||
const GimpCoords *points,
|
||||
gint n_points,
|
||||
gboolean filled)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
|
||||
g_return_val_if_fail (points == NULL || n_points > 0, NULL);
|
||||
|
||||
item = gimp_canvas_polygon_new_from_coords (widget->private->shell,
|
||||
points, n_points,
|
||||
transform, filled);
|
||||
|
||||
gimp_tool_widget_add_item (widget, item);
|
||||
g_object_unref (item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
gimp_tool_widget_add_handle (GimpToolWidget *widget,
|
||||
GimpHandleType type,
|
||||
|
|
|
@ -132,29 +132,40 @@ 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_handle (GimpToolWidget *widget,
|
||||
GimpHandleType type,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpHandleAnchor anchor);
|
||||
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_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);
|
||||
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);
|
||||
GimpCanvasItem * gimp_tool_widget_add_path (GimpToolWidget *widget,
|
||||
const GimpBezierDesc *desc);
|
||||
|
||||
/* for tools, to be called from the respective GimpTool method
|
||||
* implementations
|
||||
|
|
Loading…
Reference in New Issue