GimpDrawTool

GimpDrawTool

Synopsis

                    GimpDrawTool;
#define             GIMP_TOOL_HANDLE_SIZE_CIRCLE
#define             GIMP_TOOL_HANDLE_SIZE_CROSS
#define             GIMP_TOOL_HANDLE_SIZE_LARGE
#define             GIMP_TOOL_HANDLE_SIZE_SMALL
void                gimp_draw_tool_start                (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display);
void                gimp_draw_tool_stop                 (GimpDrawTool *draw_tool);
gboolean            gimp_draw_tool_is_active            (GimpDrawTool *draw_tool);
void                gimp_draw_tool_pause                (GimpDrawTool *draw_tool);
void                gimp_draw_tool_resume               (GimpDrawTool *draw_tool);
gdouble             gimp_draw_tool_calc_distance        (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);
gdouble             gimp_draw_tool_calc_distance_square (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);
void                gimp_draw_tool_add_preview          (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);
void                gimp_draw_tool_remove_preview       (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);
void                gimp_draw_tool_add_item             (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);
void                gimp_draw_tool_remove_item          (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);
GimpCanvasGroup *   gimp_draw_tool_add_stroke_group     (GimpDrawTool *draw_tool);
GimpCanvasGroup *   gimp_draw_tool_add_fill_group       (GimpDrawTool *draw_tool);
void                gimp_draw_tool_push_group           (GimpDrawTool *draw_tool,
                                                         GimpCanvasGroup *group);
void                gimp_draw_tool_pop_group            (GimpDrawTool *draw_tool);
GimpCanvasItem *    gimp_draw_tool_add_line             (GimpDrawTool *draw_tool,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);
GimpCanvasItem *    gimp_draw_tool_add_guide            (GimpDrawTool *draw_tool,
                                                         GimpOrientationType orientation,
                                                         gint position,
                                                         gboolean guide_style);
GimpCanvasItem *    gimp_draw_tool_add_crosshair        (GimpDrawTool *draw_tool,
                                                         gint position_x,
                                                         gint position_y);
GimpCanvasItem *    gimp_draw_tool_add_sample_point     (GimpDrawTool *draw_tool,
                                                         gint x,
                                                         gint y,
                                                         gint index);
GimpCanvasItem *    gimp_draw_tool_add_rectangle        (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height);
GimpCanvasItem *    gimp_draw_tool_add_rectangle_guides (GimpDrawTool *draw_tool,
                                                         GimpGuidesType type,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height);
GimpCanvasItem *    gimp_draw_tool_add_arc              (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height,
                                                         gdouble start_angle,
                                                         gdouble slice_angle);
GimpCanvasItem *    gimp_draw_tool_add_transform_guides (GimpDrawTool *draw_tool,
                                                         const GimpMatrix3 *transform,
                                                         GimpGuidesType type,
                                                         gint n_guides,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);
GimpCanvasItem *    gimp_draw_tool_add_transform_preview
                                                        (GimpDrawTool *draw_tool,
                                                         GimpDrawable *drawable,
                                                         const GimpMatrix3 *transform,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gboolean perspective,
                                                         gdouble opacity);
GimpCanvasItem *    gimp_draw_tool_add_handle           (GimpDrawTool *draw_tool,
                                                         GimpHandleType type,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GimpHandleAnchor anchor);
GimpCanvasItem *    gimp_draw_tool_add_corner           (GimpDrawTool *draw_tool,
                                                         gboolean highlight,
                                                         gboolean put_outside,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gint width,
                                                         gint height,
                                                         GimpHandleAnchor anchor);
GimpCanvasItem *    gimp_draw_tool_add_lines            (GimpDrawTool *draw_tool,
                                                         const GimpVector2 *points,
                                                         gint n_points,
                                                         gboolean filled);
GimpCanvasItem *    gimp_draw_tool_add_strokes          (GimpDrawTool *draw_tool,
                                                         const GimpCoords *points,
                                                         gint n_points,
                                                         gboolean filled);
GimpCanvasItem *    gimp_draw_tool_add_path             (GimpDrawTool *draw_tool,
                                                         const GimpBezierDesc *desc,
                                                         gdouble x,
                                                         gdouble y);
GimpCanvasItem *    gimp_draw_tool_add_pen              (GimpDrawTool *draw_tool,
                                                         const GimpVector2 *points,
                                                         gint n_points,
                                                         GimpContext *context,
                                                         GimpActiveColor color,
                                                         gint width);
GimpCanvasItem *    gimp_draw_tool_add_boundary         (GimpDrawTool *draw_tool,
                                                         const BoundSeg *bound_segs,
                                                         gint n_bound_segs,
                                                         GimpMatrix3 *transform,
                                                         gdouble offset_x,
                                                         gdouble offset_y);
GimpCanvasItem *    gimp_draw_tool_add_text_cursor      (GimpDrawTool *draw_tool,
                                                         PangoRectangle *cursor,
                                                         gboolean overwrite);
gboolean            gimp_draw_tool_on_handle            (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x,
                                                         gdouble y,
                                                         GimpHandleType type,
                                                         gdouble handle_x,
                                                         gdouble handle_y,
                                                         gint width,
                                                         gint height,
                                                         GimpHandleAnchor anchor);
gboolean            gimp_draw_tool_on_vectors           (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         const GimpCoords *coord,
                                                         gint width,
                                                         gint height,
                                                         GimpCoords *ret_coords,
                                                         gdouble *ret_pos,
                                                         GimpAnchor **ret_segment_start,
                                                         GimpAnchor **ret_segment_end,
                                                         GimpStroke **ret_stroke,
                                                         GimpVectors **ret_vectors);
gboolean            gimp_draw_tool_on_vectors_curve     (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         GimpVectors *vectors,
                                                         const GimpCoords *coord,
                                                         gint width,
                                                         gint height,
                                                         GimpCoords *ret_coords,
                                                         gdouble *ret_pos,
                                                         GimpAnchor **ret_segment_start,
                                                         GimpAnchor **ret_segment_end,
                                                         GimpStroke **ret_stroke);
gboolean            gimp_draw_tool_on_vectors_handle    (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         GimpVectors *vectors,
                                                         const GimpCoords *coord,
                                                         gint width,
                                                         gint height,
                                                         GimpAnchorType preferred,
                                                         gboolean exclusive,
                                                         GimpAnchor **ret_anchor,
                                                         GimpStroke **ret_stroke);

Object Hierarchy

  GObject
   +----GimpObject
         +----GimpTool
               +----GimpDrawTool
                     +----GimpColorTool
                     +----GimpAlignTool
                     +----GimpBlendTool
                     +----GimpSelectionTool
                     +----GimpCageTool
                     +----GimpCropTool
                     +----GimpTransformTool
                     +----GimpMagnifyTool
                     +----GimpMeasureTool
                     +----GimpMoveTool
                     +----GimpTextTool
                     +----GimpVectorTool

Known Derived Interfaces

GimpDrawTool is required by GimpRectangleToolInterface.

Implemented Interfaces

GimpDrawTool implements GimpProgressInterface.

Description

Details

GimpDrawTool

typedef struct _GimpDrawTool GimpDrawTool;


GIMP_TOOL_HANDLE_SIZE_CIRCLE

#define GIMP_TOOL_HANDLE_SIZE_CIRCLE 13


GIMP_TOOL_HANDLE_SIZE_CROSS

#define GIMP_TOOL_HANDLE_SIZE_CROSS  15


GIMP_TOOL_HANDLE_SIZE_LARGE

#define GIMP_TOOL_HANDLE_SIZE_LARGE  25


GIMP_TOOL_HANDLE_SIZE_SMALL

#define GIMP_TOOL_HANDLE_SIZE_SMALL   7


gimp_draw_tool_start ()

void                gimp_draw_tool_start                (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display);


gimp_draw_tool_stop ()

void                gimp_draw_tool_stop                 (GimpDrawTool *draw_tool);


gimp_draw_tool_is_active ()

gboolean            gimp_draw_tool_is_active            (GimpDrawTool *draw_tool);


gimp_draw_tool_pause ()

void                gimp_draw_tool_pause                (GimpDrawTool *draw_tool);


gimp_draw_tool_resume ()

void                gimp_draw_tool_resume               (GimpDrawTool *draw_tool);


gimp_draw_tool_calc_distance ()

gdouble             gimp_draw_tool_calc_distance        (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);

If you just need to compare distances, consider to use gimp_draw_tool_calc_distance_square() instead.

draw_tool :

a GimpDrawTool

display :

a GimpDisplay

x1 :

start point X in image coordinates

y1 :

start point Y in image coordinates

x2 :

end point X in image coordinates

y2 :

end point Y in image coordinates

Returns :

the distance between the given points in display coordinates

gimp_draw_tool_calc_distance_square ()

gdouble             gimp_draw_tool_calc_distance_square (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);

This function is more effective than gimp_draw_tool_calc_distance() as it doesn't perform a sqrt(). Use this if you just need to compare distances.

draw_tool :

a GimpDrawTool

display :

a GimpDisplay

x1 :

start point X in image coordinates

y1 :

start point Y in image coordinates

x2 :

end point X in image coordinates

y2 :

end point Y in image coordinates

Returns :

the square of the distance between the given points in display coordinates

gimp_draw_tool_add_preview ()

void                gimp_draw_tool_add_preview          (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);


gimp_draw_tool_remove_preview ()

void                gimp_draw_tool_remove_preview       (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);


gimp_draw_tool_add_item ()

void                gimp_draw_tool_add_item             (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);


gimp_draw_tool_remove_item ()

void                gimp_draw_tool_remove_item          (GimpDrawTool *draw_tool,
                                                         GimpCanvasItem *item);


gimp_draw_tool_add_stroke_group ()

GimpCanvasGroup *   gimp_draw_tool_add_stroke_group     (GimpDrawTool *draw_tool);


gimp_draw_tool_add_fill_group ()

GimpCanvasGroup *   gimp_draw_tool_add_fill_group       (GimpDrawTool *draw_tool);


gimp_draw_tool_push_group ()

void                gimp_draw_tool_push_group           (GimpDrawTool *draw_tool,
                                                         GimpCanvasGroup *group);


gimp_draw_tool_pop_group ()

void                gimp_draw_tool_pop_group            (GimpDrawTool *draw_tool);


gimp_draw_tool_add_line ()

GimpCanvasItem *    gimp_draw_tool_add_line             (GimpDrawTool *draw_tool,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);

This function takes image space coordinates and transforms them to screen window coordinates, then draws a line between the resulting coordindates.

draw_tool :

the GimpDrawTool

x1 :

start point X in image coordinates

y1 :

start point Y in image coordinates

x2 :

end point X in image coordinates

y2 :

end point Y in image coordinates

gimp_draw_tool_add_guide ()

GimpCanvasItem *    gimp_draw_tool_add_guide            (GimpDrawTool *draw_tool,
                                                         GimpOrientationType orientation,
                                                         gint position,
                                                         gboolean guide_style);

This function draws a guide line across the canvas.

draw_tool :

the GimpDrawTool

orientation :

the orientation of the guide line

position :

the position of the guide line in image coordinates

gimp_draw_tool_add_crosshair ()

GimpCanvasItem *    gimp_draw_tool_add_crosshair        (GimpDrawTool *draw_tool,
                                                         gint position_x,
                                                         gint position_y);

This function draws two crossing guide lines across the canvas.

draw_tool :

the GimpDrawTool

position_x :

the position of the vertical guide line in image coordinates

position_y :

the position of the horizontal guide line in image coordinates

gimp_draw_tool_add_sample_point ()

GimpCanvasItem *    gimp_draw_tool_add_sample_point     (GimpDrawTool *draw_tool,
                                                         gint x,
                                                         gint y,
                                                         gint index);

This function draws a sample point

draw_tool :

the GimpDrawTool

x :

X position of the sample point

y :

Y position of the sample point

index :

Index of the sample point

gimp_draw_tool_add_rectangle ()

GimpCanvasItem *    gimp_draw_tool_add_rectangle        (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height);

This function takes image space coordinates and transforms them to screen window coordinates, then draws the resulting rectangle.

draw_tool :

the GimpDrawTool

filled :

whether to fill the rectangle

x :

horizontal image coordinate

y :

vertical image coordinate

width :

width in image coordinates

height :

height in image coordinates

gimp_draw_tool_add_rectangle_guides ()

GimpCanvasItem *    gimp_draw_tool_add_rectangle_guides (GimpDrawTool *draw_tool,
                                                         GimpGuidesType type,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height);


gimp_draw_tool_add_arc ()

GimpCanvasItem *    gimp_draw_tool_add_arc              (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height,
                                                         gdouble start_angle,
                                                         gdouble slice_angle);


gimp_draw_tool_add_transform_guides ()

GimpCanvasItem *    gimp_draw_tool_add_transform_guides (GimpDrawTool *draw_tool,
                                                         const GimpMatrix3 *transform,
                                                         GimpGuidesType type,
                                                         gint n_guides,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2);


gimp_draw_tool_add_transform_preview ()

GimpCanvasItem *    gimp_draw_tool_add_transform_preview
                                                        (GimpDrawTool *draw_tool,
                                                         GimpDrawable *drawable,
                                                         const GimpMatrix3 *transform,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gboolean perspective,
                                                         gdouble opacity);


gimp_draw_tool_add_handle ()

GimpCanvasItem *    gimp_draw_tool_add_handle           (GimpDrawTool *draw_tool,
                                                         GimpHandleType type,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GimpHandleAnchor anchor);


gimp_draw_tool_add_corner ()

GimpCanvasItem *    gimp_draw_tool_add_corner           (GimpDrawTool *draw_tool,
                                                         gboolean highlight,
                                                         gboolean put_outside,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gint width,
                                                         gint height,
                                                         GimpHandleAnchor anchor);

This function takes image space coordinates and transforms them to screen window coordinates. It draws a corner into an already drawn rectangle outline, taking care of not drawing over an already drawn line.

draw_tool :

the GimpDrawTool

put_outside :

whether to put the handles on the outside of the rectangle

width :

corner width

height :

corner height

anchor :

which corner to draw

gimp_draw_tool_add_lines ()

GimpCanvasItem *    gimp_draw_tool_add_lines            (GimpDrawTool *draw_tool,
                                                         const GimpVector2 *points,
                                                         gint n_points,
                                                         gboolean filled);


gimp_draw_tool_add_strokes ()

GimpCanvasItem *    gimp_draw_tool_add_strokes          (GimpDrawTool *draw_tool,
                                                         const GimpCoords *points,
                                                         gint n_points,
                                                         gboolean filled);


gimp_draw_tool_add_path ()

GimpCanvasItem *    gimp_draw_tool_add_path             (GimpDrawTool *draw_tool,
                                                         const GimpBezierDesc *desc,
                                                         gdouble x,
                                                         gdouble y);


gimp_draw_tool_add_pen ()

GimpCanvasItem *    gimp_draw_tool_add_pen              (GimpDrawTool *draw_tool,
                                                         const GimpVector2 *points,
                                                         gint n_points,
                                                         GimpContext *context,
                                                         GimpActiveColor color,
                                                         gint width);


gimp_draw_tool_add_boundary ()

GimpCanvasItem *    gimp_draw_tool_add_boundary         (GimpDrawTool *draw_tool,
                                                         const BoundSeg *bound_segs,
                                                         gint n_bound_segs,
                                                         GimpMatrix3 *transform,
                                                         gdouble offset_x,
                                                         gdouble offset_y);

Draw the boundary of the brush that draw_tool uses. The boundary should be sorted with sort_boundary(), and n_bound_segs should include the sentinel segments inserted by sort_boundary() that indicate the end of connected segment sequences (groups) .

draw_tool :

a GimpDrawTool

bound_segs :

the sorted brush outline

n_bound_segs :

the number of segments in bound_segs

offset_x :

x offset

offset_y :

y offset

gimp_draw_tool_add_text_cursor ()

GimpCanvasItem *    gimp_draw_tool_add_text_cursor      (GimpDrawTool *draw_tool,
                                                         PangoRectangle *cursor,
                                                         gboolean overwrite);


gimp_draw_tool_on_handle ()

gboolean            gimp_draw_tool_on_handle            (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x,
                                                         gdouble y,
                                                         GimpHandleType type,
                                                         gdouble handle_x,
                                                         gdouble handle_y,
                                                         gint width,
                                                         gint height,
                                                         GimpHandleAnchor anchor);


gimp_draw_tool_on_vectors ()

gboolean            gimp_draw_tool_on_vectors           (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         const GimpCoords *coord,
                                                         gint width,
                                                         gint height,
                                                         GimpCoords *ret_coords,
                                                         gdouble *ret_pos,
                                                         GimpAnchor **ret_segment_start,
                                                         GimpAnchor **ret_segment_end,
                                                         GimpStroke **ret_stroke,
                                                         GimpVectors **ret_vectors);


gimp_draw_tool_on_vectors_curve ()

gboolean            gimp_draw_tool_on_vectors_curve     (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         GimpVectors *vectors,
                                                         const GimpCoords *coord,
                                                         gint width,
                                                         gint height,
                                                         GimpCoords *ret_coords,
                                                         gdouble *ret_pos,
                                                         GimpAnchor **ret_segment_start,
                                                         GimpAnchor **ret_segment_end,
                                                         GimpStroke **ret_stroke);


gimp_draw_tool_on_vectors_handle ()

gboolean            gimp_draw_tool_on_vectors_handle    (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         GimpVectors *vectors,
                                                         const GimpCoords *coord,
                                                         gint width,
                                                         gint height,
                                                         GimpAnchorType preferred,
                                                         gboolean exclusive,
                                                         GimpAnchor **ret_anchor,
                                                         GimpStroke **ret_stroke);