1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995-2001 Spencer Kimball, Peter Mattis, and others 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_TRANSFORM_TOOL_H__ 19 #define __GIMP_TRANSFORM_TOOL_H__ 20 21 22 #include "gimpdrawtool.h" 23 24 25 /* This is not the number of items in the enum above, but the max size 26 * of the enums at the top of each transformation tool, stored in 27 * trans_info and related 28 */ 29 #define TRANS_INFO_SIZE 17 30 31 typedef gdouble TransInfo[TRANS_INFO_SIZE]; 32 33 34 #define GIMP_TYPE_TRANSFORM_TOOL (gimp_transform_tool_get_type ()) 35 #define GIMP_TRANSFORM_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TRANSFORM_TOOL, GimpTransformTool)) 36 #define GIMP_TRANSFORM_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TRANSFORM_TOOL, GimpTransformToolClass)) 37 #define GIMP_IS_TRANSFORM_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TRANSFORM_TOOL)) 38 #define GIMP_IS_TRANSFORM_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TRANSFORM_TOOL)) 39 #define GIMP_TRANSFORM_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TRANSFORM_TOOL, GimpTransformToolClass)) 40 41 #define GIMP_TRANSFORM_TOOL_GET_OPTIONS(t) (GIMP_TRANSFORM_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t)))) 42 43 44 typedef struct _GimpTransformToolClass GimpTransformToolClass; 45 46 struct _GimpTransformTool 47 { 48 GimpDrawTool parent_instance; 49 50 GimpObject *object; 51 52 gint x1, y1; /* upper left hand coordinate */ 53 gint x2, y2; /* lower right hand coords */ 54 55 GimpMatrix3 transform; /* transformation matrix */ 56 gboolean transform_valid; /* whether the matrix is valid */ 57 58 gboolean restore_type; 59 GimpTransformType saved_type; 60 }; 61 62 struct _GimpTransformToolClass 63 { 64 GimpDrawToolClass parent_class; 65 66 /* virtual functions */ 67 void (* recalc_matrix) (GimpTransformTool *tr_tool); 68 gchar * (* get_undo_desc) (GimpTransformTool *tr_tool); 69 GimpTransformDirection (* get_direction) (GimpTransformTool *tr_tool); 70 GeglBuffer * (* transform) (GimpTransformTool *tr_tool, 71 GimpObject *object, 72 GeglBuffer *orig_buffer, 73 gint orig_offset_x, 74 gint orig_offset_y, 75 GimpColorProfile **buffer_profile, 76 gint *new_offset_x, 77 gint *new_offset_y); 78 79 const gchar *undo_desc; 80 const gchar *progress_text; 81 }; 82 83 84 GType gimp_transform_tool_get_type (void) G_GNUC_CONST; 85 86 GimpObject * gimp_transform_tool_get_active_object (GimpTransformTool *tr_tool, 87 GimpDisplay *display); 88 GimpObject * gimp_transform_tool_check_active_object (GimpTransformTool *tr_tool, 89 GimpDisplay *display, 90 GError **error); 91 92 gboolean gimp_transform_tool_bounds (GimpTransformTool *tr_tool, 93 GimpDisplay *display); 94 void gimp_transform_tool_recalc_matrix (GimpTransformTool *tr_tool, 95 GimpDisplay *display); 96 97 gboolean gimp_transform_tool_transform (GimpTransformTool *tr_tool, 98 GimpDisplay *display); 99 100 void gimp_transform_tool_set_type (GimpTransformTool *tr_tool, 101 GimpTransformType type); 102 103 104 #endif /* __GIMP_TRANSFORM_TOOL_H__ */ 105