File: gimpprotocol.h

package info (click to toggle)
gimp 3.0.4-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 210,076 kB
  • sloc: ansic: 842,287; lisp: 10,761; python: 10,318; cpp: 7,238; perl: 4,355; sh: 1,043; xml: 963; yacc: 609; lex: 348; javascript: 150; makefile: 43
file content (423 lines) | stat: -rw-r--r-- 11,092 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <https://www.gnu.org/licenses/>.
 */

#ifndef __GIMP_PROTOCOL_H__
#define __GIMP_PROTOCOL_H__

G_BEGIN_DECLS

/* For information look into the C source or the html documentation */


/* Increment every time the protocol changes
 */
#define GIMP_PROTOCOL_VERSION  0x0115


enum
{
  GP_QUIT,
  GP_CONFIG,
  GP_TILE_REQ,
  GP_TILE_ACK,
  GP_TILE_DATA,
  GP_PROC_RUN,
  GP_PROC_RETURN,
  GP_TEMP_PROC_RUN,
  GP_TEMP_PROC_RETURN,
  GP_PROC_INSTALL,
  GP_PROC_UNINSTALL,
  GP_EXTENSION_ACK,
  GP_HAS_INIT
};

typedef enum
{
  GP_PARAM_DEF_TYPE_DEFAULT,
  GP_PARAM_DEF_TYPE_INT,
  GP_PARAM_DEF_TYPE_UNIT,
  GP_PARAM_DEF_TYPE_ENUM,
  GP_PARAM_DEF_TYPE_CHOICE,
  GP_PARAM_DEF_TYPE_BOOLEAN,
  GP_PARAM_DEF_TYPE_DOUBLE,
  GP_PARAM_DEF_TYPE_STRING,
  GP_PARAM_DEF_TYPE_GEGL_COLOR,
  GP_PARAM_DEF_TYPE_ID,
  GP_PARAM_DEF_TYPE_ID_ARRAY,
  GP_PARAM_DEF_TYPE_EXPORT_OPTIONS,
  GP_PARAM_DEF_TYPE_RESOURCE,
  GP_PARAM_DEF_TYPE_FILE
} GPParamDefType;

typedef enum
{
  GP_PARAM_TYPE_INT,
  GP_PARAM_TYPE_DOUBLE,
  GP_PARAM_TYPE_STRING,
  GP_PARAM_TYPE_STRV,
  GP_PARAM_TYPE_BYTES,
  GP_PARAM_TYPE_FILE,
  GP_PARAM_TYPE_BABL_FORMAT,
  GP_PARAM_TYPE_GEGL_COLOR,
  GP_PARAM_TYPE_COLOR_ARRAY,
  GP_PARAM_TYPE_PARASITE,
  GP_PARAM_TYPE_ARRAY,
  GP_PARAM_TYPE_ID_ARRAY,
  GP_PARAM_TYPE_EXPORT_OPTIONS,
  GP_PARAM_TYPE_PARAM_DEF,
  GP_PARAM_TYPE_VALUE_ARRAY,
} GPParamType;


typedef struct _GPConfig                 GPConfig;
typedef struct _GPTileReq                GPTileReq;
typedef struct _GPTileAck                GPTileAck;
typedef struct _GPTileData               GPTileData;
typedef struct _GPParamDef               GPParamDef;
typedef struct _GPParamDefInt            GPParamDefInt;
typedef struct _GPParamDefUnit           GPParamDefUnit;
typedef struct _GPParamDefEnum           GPParamDefEnum;
typedef struct _GPParamDefBoolean        GPParamDefBoolean;
typedef struct _GPParamDefDouble         GPParamDefDouble;
typedef struct _GPParamDefString         GPParamDefString;
typedef struct _GPParamDefChoice         GPParamDefChoice;
typedef struct _GPParamStrv              GPParamStrv;
typedef struct _GPParamDefGeglColor      GPParamDefGeglColor;
typedef struct _GPParamDefID             GPParamDefID;
typedef struct _GPParamDefIDArray        GPParamDefIDArray;
typedef struct _GPParamDefResource       GPParamDefResource;
typedef struct _GPParamDefFile           GPParamDefFile;
typedef struct _GPParam                  GPParam;
typedef struct _GPParamArray             GPParamArray;
typedef struct _GPParamIDArray           GPParamIDArray;
typedef struct _GPParamFormat            GPParamFormat;
typedef struct _GPParamColor             GPParamColor;
typedef struct _GPParamColorArray        GPParamColorArray;
typedef struct _GPParamExportOptions     GPParamExportOptions;
typedef struct _GPParamValueArray        GPParamValueArray;
typedef struct _GPProcRun                GPProcRun;
typedef struct _GPProcReturn             GPProcReturn;
typedef struct _GPProcInstall            GPProcInstall;
typedef struct _GPProcUninstall          GPProcUninstall;


struct _GPConfig
{
  guint32  tile_width;
  guint32  tile_height;
  gint32   shm_id;
  gint8    check_size;
  gint8    check_type;
  gint8    show_help_button;
  gint8    use_cpu_accel;
  gint8    use_opencl;
  gint8    export_color_profile;
  gint8    export_comment;
  gint8    export_exif;
  gint8    export_xmp;
  gint8    export_iptc;
  gint32   default_display_id;
  gchar   *app_name;
  gchar   *wm_class;
  gchar   *display_name;
  gint32   monitor_number;
  guint32  timestamp;
  gchar   *icon_theme_dir;
  guint64  tile_cache_size;
  gchar   *swap_path;
  gchar   *swap_compression;
  gint32   num_processors;

  /* Since protocol version 0x0111:
   * These values are used to represent 2 GeglColor objects but we avoid
   * initializing GEGL in the wire protocol. This leads to extremely
   * slow startup when initializing every plug-in. So we store them as
   * bytes and encoding string and reconstruct the GeglColor in libgimp.
   */
  GBytes    *check_custom_color1;
  GBytes    *check_custom_icc1;
  gchar     *check_custom_encoding1;
  GBytes    *check_custom_color2;
  GBytes    *check_custom_icc2;
  gchar     *check_custom_encoding2;
};

struct _GPTileReq
{
  gint32   drawable_id;
  guint32  tile_num;
  guint32  shadow;
};

struct _GPTileData
{
  gint32   drawable_id;
  guint32  tile_num;
  guint32  shadow;
  guint32  bpp;
  guint32  width;
  guint32  height;
  guint32  use_shm;
  guchar  *data;
};

struct _GPParamDefInt
{
  gint64 min_val;
  gint64 max_val;
  gint64 default_val;
};

struct _GPParamDefUnit
{
  gint32 allow_pixels;
  gint32 allow_percent;
  gint32 default_val;
};

struct _GPParamDefEnum
{
  gint32 default_val;
};

struct _GPParamDefBoolean
{
  gint32 default_val;
};

struct _GPParamDefDouble
{
  gdouble min_val;
  gdouble max_val;
  gdouble default_val;
};

struct _GPParamDefString
{
  gchar *default_val;
};

struct _GPParamDefGeglColor
{
  gint32        has_alpha;
  GPParamColor *default_val;
};

struct _GPParamDefID
{
  gint32 none_ok;
};

struct _GPParamDefIDArray
{
  gchar *type_name;
};

struct _GPParamDefChoice
{
  GimpChoice *choice;
  gchar      *default_val;
};

struct _GPParamDefResource
{
  gint32 none_ok;
  gint32 default_to_context;
  gint32 default_resource_id;
};

struct _GPParamDefFile
{
  /* action is a GimpFileChooserAction casted to gint32. */
  gint32  action;
  gint32  none_ok;
  gchar  *default_uri;
};

struct _GPParamDef
{
  GPParamDefType  param_def_type;
  gchar          *type_name;
  gchar          *value_type_name;
  gchar          *name;
  gchar          *nick;
  gchar          *blurb;
  guint           flags;

  union
  {
    GPParamDefInt              m_int;
    GPParamDefUnit             m_unit;
    GPParamDefEnum             m_enum;
    GPParamDefBoolean          m_boolean;
    GPParamDefDouble           m_double;
    GPParamDefString           m_string;
    GPParamDefGeglColor        m_gegl_color;
    GPParamDefID               m_id;
    GPParamDefIDArray          m_id_array;
    GPParamDefChoice           m_choice;
    GPParamDefResource         m_resource;
    GPParamDefFile             m_file;
  } meta;
};

struct _GPParamArray
{
  guint32  size;
  guint8  *data;
};

struct _GPParamIDArray
{
  gchar   *type_name;
  guint32  size;
  gint32  *data;
};

struct _GPParamFormat
{
  /* Transferring a BablFormat with the encoding and the ICC data. */
  gchar   *encoding;
  guint32  profile_size;
  guint8  *profile_data;
};

struct _GPParamColor
{
  guint32       size;
  guint8        data[40];

  GPParamFormat format;
};

struct _GPParamColorArray
{
  guint32       size;
  GPParamColor *colors;
};

struct _GPParamExportOptions
{
  /* XXX: this is an empty shell right now, because there are no export
   * options yet. The capabilities property doesn't need to be passed
   * through the wire because it is set by libgimp, not at run call.
   */
};

struct _GPParamValueArray
{
  guint32  n_values;
  GPParam *values;
};

struct _GPParam
{
  GPParamType  param_type;
  gchar       *type_name;

  union
  {
    gint32                 d_int;
    gdouble                d_double;
    gchar                 *d_string;
    gchar                **d_strv;
    GBytes                *d_bytes;
    GPParamFormat          d_format;
    GPParamColor           d_gegl_color;
    GPParamColorArray      d_color_array;
    GimpParasite           d_parasite;
    GPParamArray           d_array;
    GPParamIDArray         d_id_array;
    GPParamExportOptions   d_export_options;
    GPParamDef             d_param_def;
    GPParamValueArray      d_value_array;
  } data;
};

struct _GPProcRun
{
  gchar   *name;
  guint32  n_params;
  GPParam *params;
};

struct _GPProcReturn
{
  gchar   *name;
  guint32  n_params;
  GPParam *params;
};

struct _GPProcInstall
{
  gchar      *name;
  guint32     type;
  guint32     n_params;
  guint32     n_return_vals;
  GPParamDef *params;
  GPParamDef *return_vals;
};

struct _GPProcUninstall
{
  gchar *name;
};


void      gp_init                   (void);

gboolean  gp_quit_write             (GIOChannel      *channel,
                                     gpointer         user_data);
gboolean  gp_config_write           (GIOChannel      *channel,
                                     GPConfig        *config,
                                     gpointer         user_data);
gboolean  gp_tile_req_write         (GIOChannel      *channel,
                                     GPTileReq       *tile_req,
                                     gpointer         user_data);
gboolean  gp_tile_ack_write         (GIOChannel      *channel,
                                     gpointer         user_data);
gboolean  gp_tile_data_write        (GIOChannel      *channel,
                                     GPTileData      *tile_data,
                                     gpointer         user_data);
gboolean  gp_proc_run_write         (GIOChannel      *channel,
                                     GPProcRun       *proc_run,
                                     gpointer         user_data);
gboolean  gp_proc_return_write      (GIOChannel      *channel,
                                     GPProcReturn    *proc_return,
                                     gpointer         user_data);
gboolean  gp_temp_proc_run_write    (GIOChannel      *channel,
                                     GPProcRun       *proc_run,
                                     gpointer         user_data);
gboolean  gp_temp_proc_return_write (GIOChannel      *channel,
                                     GPProcReturn    *proc_return,
                                     gpointer         user_data);
gboolean  gp_proc_install_write     (GIOChannel      *channel,
                                     GPProcInstall   *proc_install,
                                     gpointer         user_data);
gboolean  gp_proc_uninstall_write   (GIOChannel      *channel,
                                     GPProcUninstall *proc_uninstall,
                                     gpointer         user_data);
gboolean  gp_extension_ack_write    (GIOChannel      *channel,
                                     gpointer         user_data);
gboolean  gp_has_init_write         (GIOChannel      *channel,
                                     gpointer         user_data);


G_END_DECLS

#endif /* __GIMP_PROTOCOL_H__ */