1 /* GIMP - The GNU Image Manipulation Program 2 * 3 * gimpcageconfig.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_CONFIG_H__ 21 #define __GIMP_CAGE_CONFIG_H__ 22 23 24 #include "gimpoperationsettings.h" 25 26 27 struct _GimpCagePoint 28 { 29 GimpVector2 src_point; 30 GimpVector2 dest_point; 31 GimpVector2 edge_normal; 32 gdouble edge_scaling_factor; 33 gboolean selected; 34 }; 35 36 37 #define GIMP_TYPE_CAGE_CONFIG (gimp_cage_config_get_type ()) 38 #define GIMP_CAGE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CAGE_CONFIG, GimpCageConfig)) 39 #define GIMP_CAGE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CAGE_CONFIG, GimpCageConfigClass)) 40 #define GIMP_IS_CAGE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CAGE_CONFIG)) 41 #define GIMP_IS_CAGE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CAGE_CONFIG)) 42 #define GIMP_CAGE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CAGE_CONFIG, GimpCageConfigClass)) 43 44 45 typedef struct _GimpCageConfigClass GimpCageConfigClass; 46 47 struct _GimpCageConfig 48 { 49 GimpOperationSettings parent_instance; 50 51 GArray *cage_points; 52 53 gdouble displacement_x; 54 gdouble displacement_y; 55 GimpCageMode cage_mode; /* Cage mode, used to commit displacement */ 56 }; 57 58 struct _GimpCageConfigClass 59 { 60 GimpOperationSettingsClass parent_class; 61 }; 62 63 64 GType gimp_cage_config_get_type (void) G_GNUC_CONST; 65 66 guint gimp_cage_config_get_n_points (GimpCageConfig *gcc); 67 void gimp_cage_config_add_cage_point (GimpCageConfig *gcc, 68 gdouble x, 69 gdouble y); 70 void gimp_cage_config_insert_cage_point (GimpCageConfig *gcc, 71 gint point_number, 72 gdouble x, 73 gdouble y); 74 void gimp_cage_config_remove_last_cage_point (GimpCageConfig *gcc); 75 void gimp_cage_config_remove_cage_point (GimpCageConfig *gcc, 76 gint point_number); 77 void gimp_cage_config_remove_selected_points (GimpCageConfig *gcc); 78 GimpVector2 gimp_cage_config_get_point_coordinate (GimpCageConfig *gcc, 79 GimpCageMode mode, 80 gint point_number); 81 void gimp_cage_config_add_displacement (GimpCageConfig *gcc, 82 GimpCageMode mode, 83 gdouble x, 84 gdouble y); 85 void gimp_cage_config_commit_displacement (GimpCageConfig *gcc); 86 void gimp_cage_config_reset_displacement (GimpCageConfig *gcc); 87 GeglRectangle gimp_cage_config_get_bounding_box (GimpCageConfig *gcc); 88 void gimp_cage_config_reverse_cage_if_needed (GimpCageConfig *gcc); 89 void gimp_cage_config_reverse_cage (GimpCageConfig *gcc); 90 gboolean gimp_cage_config_point_inside (GimpCageConfig *gcc, 91 gfloat x, 92 gfloat y); 93 void gimp_cage_config_select_point (GimpCageConfig *gcc, 94 gint point_number); 95 void gimp_cage_config_select_area (GimpCageConfig *gcc, 96 GimpCageMode mode, 97 GeglRectangle area); 98 void gimp_cage_config_select_add_area (GimpCageConfig *gcc, 99 GimpCageMode mode, 100 GeglRectangle area); 101 void gimp_cage_config_toggle_point_selection (GimpCageConfig *gcc, 102 gint point_number); 103 void gimp_cage_config_deselect_points (GimpCageConfig *gcc); 104 gboolean gimp_cage_config_point_is_selected (GimpCageConfig *gcc, 105 gint point_number); 106 107 108 #endif /* __GIMP_CAGE_CONFIG_H__ */ 109