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_GRADIENT_TOOL_H__
19 #define  __GIMP_GRADIENT_TOOL_H__
20 
21 
22 #include "gimpdrawtool.h"
23 
24 
25 #define GIMP_TYPE_GRADIENT_TOOL            (gimp_gradient_tool_get_type ())
26 #define GIMP_GRADIENT_TOOL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_GRADIENT_TOOL, GimpGradientTool))
27 #define GIMP_GRADIENT_TOOL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_GRADIENT_TOOL, GimpGradientToolClass))
28 #define GIMP_IS_GRADIENT_TOOL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_GRADIENT_TOOL))
29 #define GIMP_IS_GRADIENT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_GRADIENT_TOOL))
30 #define GIMP_GRADIENT_TOOL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_GRADIENT_TOOL, GimpGradientToolClass))
31 
32 #define GIMP_GRADIENT_TOOL_GET_OPTIONS(t)  (GIMP_GRADIENT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
33 
34 
35 typedef struct _GimpGradientTool      GimpGradientTool;
36 typedef struct _GimpGradientToolClass GimpGradientToolClass;
37 
38 struct _GimpGradientTool
39 {
40   GimpDrawTool        parent_instance;
41 
42   GimpGradient       *gradient;
43   GimpGradient       *tentative_gradient;
44 
45   gdouble             start_x;    /*  starting x coord  */
46   gdouble             start_y;    /*  starting y coord  */
47   gdouble             end_x;      /*  ending x coord    */
48   gdouble             end_y;      /*  ending y coord    */
49 
50   GimpToolWidget     *widget;
51   GimpToolWidget     *grab_widget;
52 
53   GeglNode           *graph;
54   GeglNode           *render_node;
55 #if 0
56   GeglNode           *subtract_node;
57   GeglNode           *divide_node;
58 #endif
59   GeglNode           *dist_node;
60   GeglBuffer         *dist_buffer;
61   GimpDrawableFilter *filter;
62 
63   /*  editor  */
64 
65   gint                block_handlers_count;
66 
67   gint                edit_count;
68   GSList             *undo_stack;
69   GSList             *redo_stack;
70 
71   guint               flush_idle_id;
72 
73   GimpToolGui        *gui;
74   GtkWidget          *endpoint_editor;
75   GtkWidget          *endpoint_se;
76   GtkWidget          *endpoint_color_panel;
77   GtkWidget          *endpoint_type_combo;
78   GtkWidget          *stop_editor;
79   GtkWidget          *stop_se;
80   GtkWidget          *stop_left_color_panel;
81   GtkWidget          *stop_left_type_combo;
82   GtkWidget          *stop_right_color_panel;
83   GtkWidget          *stop_right_type_combo;
84   GtkWidget          *stop_chain_button;
85   GtkWidget          *midpoint_editor;
86   GtkWidget          *midpoint_se;
87   GtkWidget          *midpoint_type_combo;
88   GtkWidget          *midpoint_color_combo;
89   GtkWidget          *midpoint_new_stop_button;
90   GtkWidget          *midpoint_center_button;
91 };
92 
93 struct _GimpGradientToolClass
94 {
95   GimpDrawToolClass  parent_class;
96 };
97 
98 
99 void    gimp_gradient_tool_register               (GimpToolRegisterCallback  callback,
100                                                    gpointer                  data);
101 
102 GType   gimp_gradient_tool_get_type               (void) G_GNUC_CONST;
103 
104 
105 /*  protected functions  */
106 
107 void    gimp_gradient_tool_set_tentative_gradient (GimpGradientTool         *gradient_tool,
108                                                    GimpGradient             *gradient);
109 
110 
111 #endif  /*  __GIMP_GRADIENT_TOOL_H__  */
112