1 /* LIBGIMP - The GIMP Library 2 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball 3 * 4 * gimp.h 5 * 6 * This library is free software: you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 3 of the License, or (at your option) any later version. 10 * 11 * This library 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 GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library. If not, see 18 * <https://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef __GIMP_H__ 22 #define __GIMP_H__ 23 24 #include <cairo.h> 25 #include <gegl.h> 26 #include <gdk-pixbuf/gdk-pixbuf.h> 27 28 #include <libgimpbase/gimpbase.h> 29 #include <libgimpcolor/gimpcolor.h> 30 #include <libgimpconfig/gimpconfig.h> 31 #include <libgimpmath/gimpmath.h> 32 33 #define __GIMP_H_INSIDE__ 34 35 #include <libgimp/gimpenums.h> 36 #include <libgimp/gimptypes.h> 37 38 #include <libgimp/gimpbrushes.h> 39 #include <libgimp/gimpbrushselect.h> 40 #include <libgimp/gimpchannel.h> 41 #include <libgimp/gimpdrawable.h> 42 #include <libgimp/gimpedit.h> 43 #include <libgimp/gimpfontselect.h> 44 #include <libgimp/gimpgimprc.h> 45 #include <libgimp/gimpgradients.h> 46 #include <libgimp/gimpgradientselect.h> 47 #include <libgimp/gimpimage.h> 48 #include <libgimp/gimpimagecolorprofile.h> 49 #include <libgimp/gimplayer.h> 50 #include <libgimp/gimppalette.h> 51 #include <libgimp/gimppalettes.h> 52 #include <libgimp/gimppaletteselect.h> 53 #include <libgimp/gimppatterns.h> 54 #include <libgimp/gimppatternselect.h> 55 #include <libgimp/gimppixbuf.h> 56 #include <libgimp/gimppixelfetcher.h> 57 #include <libgimp/gimppixelrgn.h> 58 #include <libgimp/gimpplugin.h> 59 #include <libgimp/gimpproceduraldb.h> 60 #include <libgimp/gimpprogress.h> 61 #include <libgimp/gimpregioniterator.h> 62 #include <libgimp/gimpselection.h> 63 #include <libgimp/gimptile.h> 64 #include <libgimp/gimpvectors.h> 65 66 #include <libgimp/gimp_pdb_headers.h> 67 68 #undef __GIMP_H_INSIDE__ 69 70 #ifdef G_OS_WIN32 71 #include <stdlib.h> /* For __argc and __argv */ 72 #endif 73 74 G_BEGIN_DECLS 75 76 77 #define gimp_get_data gimp_procedural_db_get_data 78 #define gimp_get_data_size gimp_procedural_db_get_data_size 79 #define gimp_set_data gimp_procedural_db_set_data 80 81 82 typedef void (* GimpInitProc) (void); 83 typedef void (* GimpQuitProc) (void); 84 typedef void (* GimpQueryProc) (void); 85 typedef void (* GimpRunProc) (const gchar *name, 86 gint n_params, 87 const GimpParam *param, 88 gint *n_return_vals, 89 GimpParam **return_vals); 90 91 92 /** 93 * GimpPlugInInfo: 94 * @init_proc: called when the gimp application initially starts up 95 * @quit_proc: called when the gimp application exits 96 * @query_proc: called by gimp so that the plug-in can inform the 97 * gimp of what it does. (ie. installing a procedure database 98 * procedure). 99 * @run_proc: called to run a procedure the plug-in installed in the 100 * procedure database. 101 **/ 102 struct _GimpPlugInInfo 103 { 104 GimpInitProc init_proc; 105 GimpQuitProc quit_proc; 106 GimpQueryProc query_proc; 107 GimpRunProc run_proc; 108 }; 109 110 struct _GimpParamDef 111 { 112 GimpPDBArgType type; 113 gchar *name; 114 gchar *description; 115 }; 116 117 struct _GimpParamRegion 118 { 119 gint32 x; 120 gint32 y; 121 gint32 width; 122 gint32 height; 123 }; 124 125 union _GimpParamData 126 { 127 gint32 d_int32; 128 gint16 d_int16; 129 guint8 d_int8; 130 gdouble d_float; 131 gchar *d_string; 132 gint32 *d_int32array; 133 gint16 *d_int16array; 134 guint8 *d_int8array; 135 gdouble *d_floatarray; 136 gchar **d_stringarray; 137 GimpRGB *d_colorarray; 138 GimpRGB d_color; 139 GimpParamRegion d_region; /* deprecated */ 140 gint32 d_display; 141 gint32 d_image; 142 gint32 d_item; 143 gint32 d_layer; 144 gint32 d_layer_mask; 145 gint32 d_channel; 146 gint32 d_drawable; 147 gint32 d_selection; 148 gint32 d_boundary; 149 gint32 d_path; /* deprecated */ 150 gint32 d_vectors; 151 gint32 d_unit; 152 GimpParasite d_parasite; 153 gint32 d_tattoo; 154 GimpPDBStatusType d_status; 155 }; 156 157 struct _GimpParam 158 { 159 GimpPDBArgType type; 160 GimpParamData data; 161 }; 162 163 164 165 /** 166 * MAIN: 167 * 168 * A macro that expands to the appropriate main() function for the 169 * platform being compiled for. 170 * 171 * To use this macro, simply place a line that contains just the code 172 * MAIN() at the toplevel of your file. No semicolon should be used. 173 **/ 174 175 #ifdef G_OS_WIN32 176 177 /* Define WinMain() because plug-ins are built as GUI applications. Also 178 * define a main() in case some plug-in still is built as a console 179 * application. 180 */ 181 # ifdef __GNUC__ 182 # ifndef _stdcall 183 # define _stdcall __attribute__((stdcall)) 184 # endif 185 # endif 186 187 # define MAIN() \ 188 struct HINSTANCE__; \ 189 \ 190 int _stdcall \ 191 WinMain (struct HINSTANCE__ *hInstance, \ 192 struct HINSTANCE__ *hPrevInstance, \ 193 char *lpszCmdLine, \ 194 int nCmdShow); \ 195 \ 196 int _stdcall \ 197 WinMain (struct HINSTANCE__ *hInstance, \ 198 struct HINSTANCE__ *hPrevInstance, \ 199 char *lpszCmdLine, \ 200 int nCmdShow) \ 201 { \ 202 return gimp_main (&PLUG_IN_INFO, __argc, __argv); \ 203 } \ 204 \ 205 int \ 206 main (int argc, char *argv[]) \ 207 { \ 208 /* Use __argc and __argv here, too, as they work \ 209 * better with mingw-w64. \ 210 */ \ 211 return gimp_main (&PLUG_IN_INFO, __argc, __argv); \ 212 } 213 #else 214 # define MAIN() \ 215 int \ 216 main (int argc, char *argv[]) \ 217 { \ 218 return gimp_main (&PLUG_IN_INFO, argc, argv); \ 219 } 220 #endif 221 222 223 /* The main procedure that must be called with the PLUG_IN_INFO structure 224 * and the 'argc' and 'argv' that are passed to "main". 225 */ 226 gint gimp_main (const GimpPlugInInfo *info, 227 gint argc, 228 gchar *argv[]); 229 230 /* Forcefully causes the gimp library to exit and 231 * close down its connection to main gimp application. 232 */ 233 void gimp_quit (void) G_GNUC_NORETURN; 234 235 236 /* Install a procedure in the procedure database. 237 */ 238 void gimp_install_procedure (const gchar *name, 239 const gchar *blurb, 240 const gchar *help, 241 const gchar *author, 242 const gchar *copyright, 243 const gchar *date, 244 const gchar *menu_label, 245 const gchar *image_types, 246 GimpPDBProcType type, 247 gint n_params, 248 gint n_return_vals, 249 const GimpParamDef *params, 250 const GimpParamDef *return_vals); 251 252 /* Install a temporary procedure in the procedure database. 253 */ 254 void gimp_install_temp_proc (const gchar *name, 255 const gchar *blurb, 256 const gchar *help, 257 const gchar *author, 258 const gchar *copyright, 259 const gchar *date, 260 const gchar *menu_label, 261 const gchar *image_types, 262 GimpPDBProcType type, 263 gint n_params, 264 gint n_return_vals, 265 const GimpParamDef *params, 266 const GimpParamDef *return_vals, 267 GimpRunProc run_proc); 268 269 /* Uninstall a temporary procedure 270 */ 271 void gimp_uninstall_temp_proc (const gchar *name); 272 273 /* Notify the main GIMP application that the extension is ready to run 274 */ 275 void gimp_extension_ack (void); 276 277 /* Enable asynchronous processing of temp_procs 278 */ 279 void gimp_extension_enable (void); 280 281 /* Process one temp_proc and return 282 */ 283 void gimp_extension_process (guint timeout); 284 285 /* Run a procedure in the procedure database. The parameters are 286 * specified via the variable length argument list. The return 287 * values are returned in the 'GimpParam*' array. 288 */ 289 GimpParam * gimp_run_procedure (const gchar *name, 290 gint *n_return_vals, 291 ...); 292 293 /* Run a procedure in the procedure database. The parameters are 294 * specified as an array of GimpParam. The return 295 * values are returned in the 'GimpParam*' array. 296 */ 297 GimpParam * gimp_run_procedure2 (const gchar *name, 298 gint *n_return_vals, 299 gint n_params, 300 const GimpParam *params); 301 302 /* Destroy the an array of parameters. This is useful for 303 * destroying the return values returned by a call to 304 * 'gimp_run_procedure'. 305 */ 306 void gimp_destroy_params (GimpParam *params, 307 gint n_params); 308 309 /* Destroy the an array of GimpParamDef's. This is useful for 310 * destroying the return values returned by a call to 311 * 'gimp_procedural_db_proc_info'. 312 */ 313 void gimp_destroy_paramdefs (GimpParamDef *paramdefs, 314 gint n_params); 315 316 /* Retrieve the error message for the last procedure call. 317 */ 318 const gchar * gimp_get_pdb_error (void); 319 320 /* Retrieve the return status for the last procedure call. 321 */ 322 GimpPDBStatusType gimp_get_pdb_status (void); 323 324 /* Return various constants given by the GIMP core at plug-in config time. 325 */ 326 guint gimp_tile_width (void) G_GNUC_CONST; 327 guint gimp_tile_height (void) G_GNUC_CONST; 328 gint gimp_shm_ID (void) G_GNUC_CONST; 329 guchar * gimp_shm_addr (void) G_GNUC_CONST; 330 gboolean gimp_show_tool_tips (void) G_GNUC_CONST; 331 gboolean gimp_show_help_button (void) G_GNUC_CONST; 332 gboolean gimp_export_color_profile (void) G_GNUC_CONST; 333 gboolean gimp_export_exif (void) G_GNUC_CONST; 334 gboolean gimp_export_xmp (void) G_GNUC_CONST; 335 gboolean gimp_export_iptc (void) G_GNUC_CONST; 336 GimpCheckSize gimp_check_size (void) G_GNUC_CONST; 337 GimpCheckType gimp_check_type (void) G_GNUC_CONST; 338 gint32 gimp_default_display (void) G_GNUC_CONST; 339 const gchar * gimp_wm_class (void) G_GNUC_CONST; 340 const gchar * gimp_display_name (void) G_GNUC_CONST; 341 gint gimp_monitor_number (void) G_GNUC_CONST; 342 guint32 gimp_user_time (void) G_GNUC_CONST; 343 const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST; 344 345 const gchar * gimp_get_progname (void) G_GNUC_CONST; 346 347 GIMP_DEPRECATED 348 gdouble gimp_gamma (void) G_GNUC_CONST; 349 GIMP_DEPRECATED 350 gboolean gimp_install_cmap (void) G_GNUC_CONST; 351 GIMP_DEPRECATED 352 gint gimp_min_colors (void) G_GNUC_CONST; 353 354 GIMP_DEPRECATED_FOR(gimp_get_parasite) 355 GimpParasite * gimp_parasite_find (const gchar *name); 356 GIMP_DEPRECATED_FOR(gimp_attach_parasite) 357 gboolean gimp_parasite_attach (const GimpParasite *parasite); 358 GIMP_DEPRECATED_FOR(gimp_detach_parasite) 359 gboolean gimp_parasite_detach (const gchar *name); 360 GIMP_DEPRECATED_FOR(gimp_get_parasite_list) 361 gboolean gimp_parasite_list (gint *num_parasites, 362 gchar ***parasites); 363 GIMP_DEPRECATED_FOR(gimp_attach_parasite) 364 gboolean gimp_attach_new_parasite (const gchar *name, 365 gint flags, 366 gint size, 367 gconstpointer data); 368 369 370 G_END_DECLS 371 372 #endif /* __GIMP_H__ */ 373