summaryrefslogtreecommitdiffstats
path: root/libgimpbase/gimpprotocol.h
blob: 991abedd0a445e112ccde0c64bf9d29ef9d2fb31 (plain)
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
/* 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  0x001A


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 struct _GPConfig        GPConfig;
typedef struct _GPTileReq       GPTileReq;
typedef struct _GPTileAck       GPTileAck;
typedef struct _GPTileData      GPTileData;
typedef struct _GPParam         GPParam;
typedef struct _GPParamDef      GPParamDef;
typedef struct _GPProcRun       GPProcRun;
typedef struct _GPProcReturn    GPProcReturn;
typedef struct _GPProcInstall   GPProcInstall;
typedef struct _GPProcUninstall GPProcUninstall;


struct _GPConfig
{
  guint32  version;
  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_exif;
  gint8    export_xmp;
  gint8    export_iptc;
  gint8    export_profile;
  gint8    show_tooltips;
  gint32   min_colors;
  gint32   gdisp_ID;
  gchar   *app_name;
  gchar   *wm_class;
  gchar   *display_name;
  gint32   monitor_number;
  guint32  timestamp;

  /* since protocol version 0x0017: */
  gchar   *icon_theme_dir;

  /* since protocol version 0x0019: */
  guint64  tile_cache_size;
  gchar   *swap_path;
  gint32   num_processors;

  /* since protocol version 0x001a: */
  gchar   *swap_compression;
};

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 _GPParam
{
  guint32 type;

  union
  {
    gint32        d_int32;
    gint16        d_int16;
    guint8        d_int8;
    gdouble       d_float;
    gchar        *d_string;
    gint32       *d_int32array;
    gint16       *d_int16array;
    guint8       *d_int8array;
    gdouble      *d_floatarray;
    gchar       **d_stringarray;
    GimpRGB      *d_colorarray;
    GimpRGB       d_color;
    struct
    {
      gint32 x;
      gint32 y;
      gint32 width;
      gint32 height;
    } d_region; /* deprecated */
    gint32        d_display;
    gint32        d_image;
    gint32        d_item;
    gint32        d_layer;
    gint32        d_channel;
    gint32        d_drawable;
    gint32        d_selection;
    gint32        d_boundary;
    gint32        d_path; /* deprecated */
    gint32        d_vectors;
    gint32        d_status;
    GimpParasite  d_parasite;
  } data;
};

struct _GPParamDef
{
  guint32  type;
  gchar   *name;
  gchar   *description;
};

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

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

struct _GPProcInstall
{
  gchar      *name;
  gchar      *blurb;
  gchar      *help;
  gchar      *author;
  gchar      *copyright;
  gchar      *date;
  gchar      *menu_path;
  gchar      *image_types;
  guint32     type;
  guint32     nparams;
  guint32     nreturn_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);

void      gp_params_destroy         (GPParam         *params,
                                     gint             nparams);


G_END_DECLS

#endif /* __GIMP_PROTOCOL_H__ */