1 /* GIMP - The GNU Image Manipulation Program 2 * 3 * gimpcagetool.h 4 * Copyright (C) 2010 Michael Muré <batolettre@gmail.com> 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __GIMP_CAGE_TOOL_H__ 21 #define __GIMP_CAGE_TOOL_H__ 22 23 24 #include "gimpdrawtool.h" 25 26 27 #define GIMP_TYPE_CAGE_TOOL (gimp_cage_tool_get_type ()) 28 #define GIMP_CAGE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CAGE_TOOL, GimpCageTool)) 29 #define GIMP_CAGE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CAGE_TOOL, GimpCageToolClass)) 30 #define GIMP_IS_CAGE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CAGE_TOOL)) 31 #define GIMP_IS_CAGE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CAGE_TOOL)) 32 #define GIMP_CAGE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CAGE_TOOL, GimpCageToolClass)) 33 34 #define GIMP_CAGE_TOOL_GET_OPTIONS(t) (GIMP_CAGE_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t)))) 35 36 37 typedef struct _GimpCageTool GimpCageTool; 38 typedef struct _GimpCageToolClass GimpCageToolClass; 39 40 struct _GimpCageTool 41 { 42 GimpDrawTool parent_instance; 43 44 GimpCageConfig *config; 45 46 gint offset_x; /* used to convert the cage point coords */ 47 gint offset_y; /* to drawable coords */ 48 49 gdouble cursor_x; /* Hold the cursor x position */ 50 gdouble cursor_y; /* Hold the cursor y position */ 51 52 gdouble movement_start_x; /* Where the movement started */ 53 gdouble movement_start_y; /* Where the movement started */ 54 55 gdouble selection_start_x; /* Where the selection started */ 56 gdouble selection_start_y; /* Where the selection started */ 57 58 gint hovering_handle; /* Handle which the cursor is above */ 59 gint hovering_edge; /* Edge which the cursor is above */ 60 61 GeglBuffer *coef; /* Gegl buffer where the coefficient of the transformation are stored */ 62 gboolean dirty_coef; /* Indicate if the coef are still valid */ 63 64 GeglNode *render_node; /* Gegl node graph to render the transformation */ 65 GeglNode *cage_node; /* Gegl node that compute the cage transform */ 66 GeglNode *coef_node; /* Gegl node that read in the coef buffer */ 67 68 gint tool_state; /* Current state in statemachine */ 69 70 GimpDrawableFilter *filter; /* For preview */ 71 }; 72 73 struct _GimpCageToolClass 74 { 75 GimpDrawToolClass parent_class; 76 }; 77 78 79 void gimp_cage_tool_register (GimpToolRegisterCallback callback, 80 gpointer data); 81 82 GType gimp_cage_tool_get_type (void) G_GNUC_CONST; 83 84 85 #endif /* __GIMP_CAGE_TOOL_H__ */ 86