GimpDrawTool

GimpDrawTool

Synopsis




enum                GimpHandleType;
                    GimpDrawTool;
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);
gboolean            gimp_draw_tool_is_drawn             (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);
gboolean            gimp_draw_tool_in_radius            (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gint radius);
void                gimp_draw_tool_draw_line            (GimpDrawTool *draw_tool,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_dashed_line     (GimpDrawTool *draw_tool,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_rectangle       (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_arc             (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height,
                                                         gint angle1,
                                                         gint angle2,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_rectangle_by_anchor
                                                        (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_arc_by_anchor   (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         gint angle1,
                                                         gint angle2,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_cross_by_anchor (GimpDrawTool *draw_tool,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_handle          (GimpDrawTool *draw_tool,
                                                         GimpHandleType type,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_corner          (GimpDrawTool *draw_tool,
                                                         gboolean highlight,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);
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,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);
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);
void                gimp_draw_tool_draw_lines           (GimpDrawTool *draw_tool,
                                                         const gdouble *points,
                                                         gint n_points,
                                                         gboolean filled,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_strokes         (GimpDrawTool *draw_tool,
                                                         const GimpCoords *points,
                                                         gint n_points,
                                                         gboolean filled,
                                                         gboolean use_offsets);
void                gimp_draw_tool_draw_boundary        (GimpDrawTool *draw_tool,
                                                         const BoundSeg *bound_segs,
                                                         gint n_bound_segs,
                                                         gdouble offset_x,
                                                         gdouble offset_y,
                                                         gboolean use_offsets);
void                gimp_draw_tool_set_vectors          (GimpDrawTool *draw_tool,
                                                         GList *vectors);
void                gimp_draw_tool_set_transform        (GimpDrawTool *draw_tool,
                                                         GimpMatrix3 *transform);

Object Hierarchy


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

Known Derived Interfaces

GimpDrawTool is required by GimpRectangleToolInterface.

Description

Details

enum GimpHandleType

typedef enum
{
  GIMP_HANDLE_SQUARE,
  GIMP_HANDLE_FILLED_SQUARE,
  GIMP_HANDLE_CIRCLE,
  GIMP_HANDLE_FILLED_CIRCLE,
  GIMP_HANDLE_CROSS
} GimpHandleType;


GimpDrawTool

typedef struct _GimpDrawTool GimpDrawTool;


gimp_draw_tool_start ()

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

draw_tool :

display :


gimp_draw_tool_stop ()

void                gimp_draw_tool_stop                 (GimpDrawTool *draw_tool);

draw_tool :


gimp_draw_tool_is_active ()

gboolean            gimp_draw_tool_is_active            (GimpDrawTool *draw_tool);

draw_tool :

Returns :


gimp_draw_tool_is_drawn ()

gboolean            gimp_draw_tool_is_drawn             (GimpDrawTool *draw_tool);

draw_tool :

Returns :


gimp_draw_tool_pause ()

void                gimp_draw_tool_pause                (GimpDrawTool *draw_tool);

draw_tool :


gimp_draw_tool_resume ()

void                gimp_draw_tool_resume               (GimpDrawTool *draw_tool);

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_in_radius ()

gboolean            gimp_draw_tool_in_radius            (GimpDrawTool *draw_tool,
                                                         GimpDisplay *display,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gint radius);

The points are in image space coordinates.

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

radius :

distance in screen coordinates, not image coordinates

Returns :

TRUE if the points are within radius of each other, FALSE otherwise

gimp_draw_tool_draw_line ()

void                gimp_draw_tool_draw_line            (GimpDrawTool *draw_tool,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gboolean use_offsets);

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

use_offsets :

whether to use the image pixel offsets of the tool's display

gimp_draw_tool_draw_dashed_line ()

void                gimp_draw_tool_draw_dashed_line     (GimpDrawTool *draw_tool,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gboolean use_offsets);

This function takes image space coordinates and transforms them to screen window coordinates, then draws a dashed 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

use_offsets :

whether to use the image pixel offsets of the tool's display

gimp_draw_tool_draw_rectangle ()

void                gimp_draw_tool_draw_rectangle       (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height,
                                                         gboolean use_offsets);

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

use_offsets :

whether to use the image pixel offsets of the tool's display

gimp_draw_tool_draw_arc ()

void                gimp_draw_tool_draw_arc             (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gdouble width,
                                                         gdouble height,
                                                         gint angle1,
                                                         gint angle2,
                                                         gboolean use_offsets);

draw_tool :

filled :

x :

y :

width :

height :

angle1 :

angle2 :

use_offsets :


gimp_draw_tool_draw_rectangle_by_anchor ()

void                gimp_draw_tool_draw_rectangle_by_anchor
                                                        (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);

draw_tool :

filled :

x :

y :

width :

height :

anchor :

use_offsets :


gimp_draw_tool_draw_arc_by_anchor ()

void                gimp_draw_tool_draw_arc_by_anchor   (GimpDrawTool *draw_tool,
                                                         gboolean filled,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         gint angle1,
                                                         gint angle2,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);

draw_tool :

filled :

x :

y :

width :

height :

angle1 :

angle2 :

anchor :

use_offsets :


gimp_draw_tool_draw_cross_by_anchor ()

void                gimp_draw_tool_draw_cross_by_anchor (GimpDrawTool *draw_tool,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);

draw_tool :

x :

y :

width :

height :

anchor :

use_offsets :


gimp_draw_tool_draw_handle ()

void                gimp_draw_tool_draw_handle          (GimpDrawTool *draw_tool,
                                                         GimpHandleType type,
                                                         gdouble x,
                                                         gdouble y,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);

draw_tool :

type :

x :

y :

width :

height :

anchor :

use_offsets :


gimp_draw_tool_draw_corner ()

void                gimp_draw_tool_draw_corner          (GimpDrawTool *draw_tool,
                                                         gboolean highlight,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         gint width,
                                                         gint height,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);

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

highlight :

x1 :

y1 :

x2 :

y2 :

width :

corner width

height :

corner height

anchor :

which corner to draw

use_offsets :

whether to use the image pixel offsets of the tool's display

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,
                                                         GtkAnchorType anchor,
                                                         gboolean use_offsets);

draw_tool :

display :

x :

y :

type :

handle_x :

handle_y :

width :

height :

anchor :

use_offsets :

Returns :


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);

draw_tool :

display :

coord :

width :

height :

ret_coords :

ret_pos :

ret_segment_start :

ret_segment_end :

ret_stroke :

ret_vectors :

Returns :


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);

draw_tool :

display :

vectors :

coord :

width :

height :

ret_coords :

ret_pos :

ret_segment_start :

ret_segment_end :

ret_stroke :

Returns :


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);

draw_tool :

display :

vectors :

coord :

width :

height :

preferred :

exclusive :

ret_anchor :

ret_stroke :

Returns :


gimp_draw_tool_draw_lines ()

void                gimp_draw_tool_draw_lines           (GimpDrawTool *draw_tool,
                                                         const gdouble *points,
                                                         gint n_points,
                                                         gboolean filled,
                                                         gboolean use_offsets);

draw_tool :

points :

n_points :

filled :

use_offsets :


gimp_draw_tool_draw_strokes ()

void                gimp_draw_tool_draw_strokes         (GimpDrawTool *draw_tool,
                                                         const GimpCoords *points,
                                                         gint n_points,
                                                         gboolean filled,
                                                         gboolean use_offsets);

draw_tool :

points :

n_points :

filled :

use_offsets :


gimp_draw_tool_draw_boundary ()

void                gimp_draw_tool_draw_boundary        (GimpDrawTool *draw_tool,
                                                         const BoundSeg *bound_segs,
                                                         gint n_bound_segs,
                                                         gdouble offset_x,
                                                         gdouble offset_y,
                                                         gboolean use_offsets);

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

use_offsets :

whether to use offsets

gimp_draw_tool_set_vectors ()

void                gimp_draw_tool_set_vectors          (GimpDrawTool *draw_tool,
                                                         GList *vectors);

draw_tool :

vectors :


gimp_draw_tool_set_transform ()

void                gimp_draw_tool_set_transform        (GimpDrawTool *draw_tool,
                                                         GimpMatrix3 *transform);

draw_tool :

transform :