1 /* LIBGIMP - The GIMP Library 2 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball 3 * 4 * This library is free software: you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 3 of the License, or (at your option) any later version. 8 * 9 * This library 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 GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library. If not, see 16 * <https://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef __GIMP_PROTOCOL_H__ 20 #define __GIMP_PROTOCOL_H__ 21 22 G_BEGIN_DECLS 23 24 /* For information look into the C source or the html documentation */ 25 26 27 /* Increment every time the protocol changes 28 */ 29 #define GIMP_PROTOCOL_VERSION 0x001A 30 31 32 enum 33 { 34 GP_QUIT, 35 GP_CONFIG, 36 GP_TILE_REQ, 37 GP_TILE_ACK, 38 GP_TILE_DATA, 39 GP_PROC_RUN, 40 GP_PROC_RETURN, 41 GP_TEMP_PROC_RUN, 42 GP_TEMP_PROC_RETURN, 43 GP_PROC_INSTALL, 44 GP_PROC_UNINSTALL, 45 GP_EXTENSION_ACK, 46 GP_HAS_INIT 47 }; 48 49 50 typedef struct _GPConfig GPConfig; 51 typedef struct _GPTileReq GPTileReq; 52 typedef struct _GPTileAck GPTileAck; 53 typedef struct _GPTileData GPTileData; 54 typedef struct _GPParam GPParam; 55 typedef struct _GPParamDef GPParamDef; 56 typedef struct _GPProcRun GPProcRun; 57 typedef struct _GPProcReturn GPProcReturn; 58 typedef struct _GPProcInstall GPProcInstall; 59 typedef struct _GPProcUninstall GPProcUninstall; 60 61 62 struct _GPConfig 63 { 64 guint32 version; 65 guint32 tile_width; 66 guint32 tile_height; 67 gint32 shm_ID; 68 gint8 check_size; 69 gint8 check_type; 70 gint8 show_help_button; 71 gint8 use_cpu_accel; 72 gint8 use_opencl; 73 gint8 export_exif; 74 gint8 export_xmp; 75 gint8 export_iptc; 76 gint8 export_profile; 77 gint8 show_tooltips; 78 gint32 min_colors; 79 gint32 gdisp_ID; 80 gchar *app_name; 81 gchar *wm_class; 82 gchar *display_name; 83 gint32 monitor_number; 84 guint32 timestamp; 85 86 /* since protocol version 0x0017: */ 87 gchar *icon_theme_dir; 88 89 /* since protocol version 0x0019: */ 90 guint64 tile_cache_size; 91 gchar *swap_path; 92 gint32 num_processors; 93 94 /* since protocol version 0x001a: */ 95 gchar *swap_compression; 96 }; 97 98 struct _GPTileReq 99 { 100 gint32 drawable_ID; 101 guint32 tile_num; 102 guint32 shadow; 103 }; 104 105 struct _GPTileData 106 { 107 gint32 drawable_ID; 108 guint32 tile_num; 109 guint32 shadow; 110 guint32 bpp; 111 guint32 width; 112 guint32 height; 113 guint32 use_shm; 114 guchar *data; 115 }; 116 117 struct _GPParam 118 { 119 guint32 type; 120 121 union 122 { 123 gint32 d_int32; 124 gint16 d_int16; 125 guint8 d_int8; 126 gdouble d_float; 127 gchar *d_string; 128 gint32 *d_int32array; 129 gint16 *d_int16array; 130 guint8 *d_int8array; 131 gdouble *d_floatarray; 132 gchar **d_stringarray; 133 GimpRGB *d_colorarray; 134 GimpRGB d_color; 135 struct 136 { 137 gint32 x; 138 gint32 y; 139 gint32 width; 140 gint32 height; 141 } d_region; /* deprecated */ 142 gint32 d_display; 143 gint32 d_image; 144 gint32 d_item; 145 gint32 d_layer; 146 gint32 d_channel; 147 gint32 d_drawable; 148 gint32 d_selection; 149 gint32 d_boundary; 150 gint32 d_path; /* deprecated */ 151 gint32 d_vectors; 152 gint32 d_status; 153 GimpParasite d_parasite; 154 } data; 155 }; 156 157 struct _GPParamDef 158 { 159 guint32 type; 160 gchar *name; 161 gchar *description; 162 }; 163 164 struct _GPProcRun 165 { 166 gchar *name; 167 guint32 nparams; 168 GPParam *params; 169 }; 170 171 struct _GPProcReturn 172 { 173 gchar *name; 174 guint32 nparams; 175 GPParam *params; 176 }; 177 178 struct _GPProcInstall 179 { 180 gchar *name; 181 gchar *blurb; 182 gchar *help; 183 gchar *author; 184 gchar *copyright; 185 gchar *date; 186 gchar *menu_path; 187 gchar *image_types; 188 guint32 type; 189 guint32 nparams; 190 guint32 nreturn_vals; 191 GPParamDef *params; 192 GPParamDef *return_vals; 193 }; 194 195 struct _GPProcUninstall 196 { 197 gchar *name; 198 }; 199 200 201 void gp_init (void); 202 203 gboolean gp_quit_write (GIOChannel *channel, 204 gpointer user_data); 205 gboolean gp_config_write (GIOChannel *channel, 206 GPConfig *config, 207 gpointer user_data); 208 gboolean gp_tile_req_write (GIOChannel *channel, 209 GPTileReq *tile_req, 210 gpointer user_data); 211 gboolean gp_tile_ack_write (GIOChannel *channel, 212 gpointer user_data); 213 gboolean gp_tile_data_write (GIOChannel *channel, 214 GPTileData *tile_data, 215 gpointer user_data); 216 gboolean gp_proc_run_write (GIOChannel *channel, 217 GPProcRun *proc_run, 218 gpointer user_data); 219 gboolean gp_proc_return_write (GIOChannel *channel, 220 GPProcReturn *proc_return, 221 gpointer user_data); 222 gboolean gp_temp_proc_run_write (GIOChannel *channel, 223 GPProcRun *proc_run, 224 gpointer user_data); 225 gboolean gp_temp_proc_return_write (GIOChannel *channel, 226 GPProcReturn *proc_return, 227 gpointer user_data); 228 gboolean gp_proc_install_write (GIOChannel *channel, 229 GPProcInstall *proc_install, 230 gpointer user_data); 231 gboolean gp_proc_uninstall_write (GIOChannel *channel, 232 GPProcUninstall *proc_uninstall, 233 gpointer user_data); 234 gboolean gp_extension_ack_write (GIOChannel *channel, 235 gpointer user_data); 236 gboolean gp_has_init_write (GIOChannel *channel, 237 gpointer user_data); 238 239 void gp_params_destroy (GPParam *params, 240 gint nparams); 241 242 243 G_END_DECLS 244 245 #endif /* __GIMP_PROTOCOL_H__ */ 246