1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis 3 * 4 * gimptooltransformgrid.h 5 * Copyright (C) 2017 Michael Natterer <mitch@gimp.org> 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <https://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef __GIMP_TOOL_TRANSFORM_GRID_H__ 22 #define __GIMP_TOOL_TRANSFORM_GRID_H__ 23 24 25 #include "gimpcanvashandle.h" 26 #include "gimptoolwidget.h" 27 28 29 #define GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE \ 30 (1.5 * GIMP_CANVAS_HANDLE_SIZE_LARGE) 31 32 33 typedef enum 34 { 35 GIMP_TRANSFORM_HANDLE_NONE, 36 GIMP_TRANSFORM_HANDLE_NW_P, /* north west perspective */ 37 GIMP_TRANSFORM_HANDLE_NE_P, /* north east perspective */ 38 GIMP_TRANSFORM_HANDLE_SW_P, /* south west perspective */ 39 GIMP_TRANSFORM_HANDLE_SE_P, /* south east perspective */ 40 GIMP_TRANSFORM_HANDLE_NW, /* north west */ 41 GIMP_TRANSFORM_HANDLE_NE, /* north east */ 42 GIMP_TRANSFORM_HANDLE_SW, /* south west */ 43 GIMP_TRANSFORM_HANDLE_SE, /* south east */ 44 GIMP_TRANSFORM_HANDLE_N, /* north */ 45 GIMP_TRANSFORM_HANDLE_S, /* south */ 46 GIMP_TRANSFORM_HANDLE_E, /* east */ 47 GIMP_TRANSFORM_HANDLE_W, /* west */ 48 GIMP_TRANSFORM_HANDLE_CENTER, /* center for moving */ 49 GIMP_TRANSFORM_HANDLE_PIVOT, /* pivot for rotation and scaling */ 50 GIMP_TRANSFORM_HANDLE_N_S, /* north shearing */ 51 GIMP_TRANSFORM_HANDLE_S_S, /* south shearing */ 52 GIMP_TRANSFORM_HANDLE_E_S, /* east shearing */ 53 GIMP_TRANSFORM_HANDLE_W_S, /* west shearing */ 54 GIMP_TRANSFORM_HANDLE_ROTATION, /* rotation */ 55 56 GIMP_N_TRANSFORM_HANDLES /* keep this last so *handles[] is the right size */ 57 } GimpTransformHandle; 58 59 60 #define GIMP_TYPE_TOOL_TRANSFORM_GRID (gimp_tool_transform_grid_get_type ()) 61 #define GIMP_TOOL_TRANSFORM_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TOOL_TRANSFORM_GRID, GimpToolTransformGrid)) 62 #define GIMP_TOOL_TRANSFORM_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL_TRANSFORM_GRID, GimpToolTransformGridClass)) 63 #define GIMP_IS_TOOL_TRANSFORM_GRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TOOL_TRANSFORM_GRID)) 64 #define GIMP_IS_TOOL_TRANSFORM_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL_TRANSFORM_GRID)) 65 #define GIMP_TOOL_TRANSFORM_GRID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TOOL_TRANSFORM_GRID, GimpToolTransformGridClass)) 66 67 68 typedef struct _GimpToolTransformGrid GimpToolTransformGrid; 69 typedef struct _GimpToolTransformGridPrivate GimpToolTransformGridPrivate; 70 typedef struct _GimpToolTransformGridClass GimpToolTransformGridClass; 71 72 struct _GimpToolTransformGrid 73 { 74 GimpToolWidget parent_instance; 75 76 GimpToolTransformGridPrivate *private; 77 }; 78 79 struct _GimpToolTransformGridClass 80 { 81 GimpToolWidgetClass parent_class; 82 }; 83 84 85 GType gimp_tool_transform_grid_get_type (void) G_GNUC_CONST; 86 87 GimpToolWidget * gimp_tool_transform_grid_new (GimpDisplayShell *shell, 88 const GimpMatrix3 *transform, 89 gdouble x1, 90 gdouble y1, 91 gdouble x2, 92 gdouble y2); 93 94 /* protected functions */ 95 96 GimpTransformHandle gimp_tool_transform_grid_get_handle (GimpToolTransformGrid *grid); 97 98 99 #endif /* __GIMP_TOOL_TRANSFORM_GRID_H__ */ 100