1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GIMP_PAINT_TOOL_H__
19 #define __GIMP_PAINT_TOOL_H__
20 
21 
22 #include "gimpcolortool.h"
23 
24 
25 #define GIMP_PAINT_TOOL_LINE_MASK (gimp_get_extend_selection_mask ())
26 
27 
28 #define GIMP_TYPE_PAINT_TOOL            (gimp_paint_tool_get_type ())
29 #define GIMP_PAINT_TOOL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_TOOL, GimpPaintTool))
30 #define GIMP_PAINT_TOOL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PAINT_TOOL, GimpPaintToolClass))
31 #define GIMP_IS_PAINT_TOOL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PAINT_TOOL))
32 #define GIMP_IS_PAINT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PAINT_TOOL))
33 #define GIMP_PAINT_TOOL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PAINT_TOOL, GimpPaintToolClass))
34 
35 #define GIMP_PAINT_TOOL_GET_OPTIONS(t)  (GIMP_PAINT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
36 
37 
38 typedef struct _GimpPaintToolClass GimpPaintToolClass;
39 
40 struct _GimpPaintTool
41 {
42   GimpColorTool  parent_instance;
43 
44   gboolean       active;
45   gboolean       pick_colors;  /*  pick color if ctrl is pressed   */
46   gboolean       draw_line;
47 
48   gboolean       show_cursor;
49   gboolean       draw_brush;
50   gboolean       snap_brush;
51   gboolean       draw_fallback;
52   gint           fallback_size;
53   gboolean       draw_circle;
54   gint           circle_size;
55 
56   const gchar   *status;       /* status message */
57   const gchar   *status_line;  /* status message when drawing a line */
58   const gchar   *status_ctrl;  /* additional message for the ctrl modifier */
59 
60   GimpPaintCore *core;
61 
62   GimpDisplay   *display;
63   GimpDrawable  *drawable;
64 
65   gdouble        cursor_x;
66   gdouble        cursor_y;
67 
68   gdouble        paint_x;
69   gdouble        paint_y;
70 };
71 
72 struct _GimpPaintToolClass
73 {
74   GimpColorToolClass  parent_class;
75 
76   void             (* paint_prepare) (GimpPaintTool *paint_tool,
77                                       GimpDisplay   *display);
78   void             (* paint_start)   (GimpPaintTool *paint_tool);
79   void             (* paint_end)     (GimpPaintTool *paint_tool);
80   void             (* paint_flush)   (GimpPaintTool *paint_tool);
81 
82   GimpCanvasItem * (* get_outline)   (GimpPaintTool *paint_tool,
83                                       GimpDisplay   *display,
84                                       gdouble        x,
85                                       gdouble        y);
86 
87   gboolean         (* is_alpha_only) (GimpPaintTool *paint_tool,
88                                       GimpDrawable  *drawable);
89 };
90 
91 
92 GType   gimp_paint_tool_get_type            (void) G_GNUC_CONST;
93 
94 void    gimp_paint_tool_set_active          (GimpPaintTool       *tool,
95                                              gboolean             active);
96 
97 void    gimp_paint_tool_enable_color_picker (GimpPaintTool       *tool,
98                                              GimpColorPickTarget  target);
99 
100 void    gimp_paint_tool_set_draw_fallback   (GimpPaintTool       *tool,
101                                              gboolean             draw_fallback,
102                                              gint                 fallback_size);
103 
104 void    gimp_paint_tool_set_draw_circle     (GimpPaintTool       *tool,
105                                              gboolean             draw_circle,
106                                              gint                 circle_size);
107 
108 
109 #endif  /*  __GIMP_PAINT_TOOL_H__  */
110