~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/pdb/channel_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
26
26
#include "libgimpcolor/gimpcolor.h"
27
27
 
28
28
#include "pdb-types.h"
29
 
#include "procedural_db.h"
 
29
#include "gimppdb.h"
 
30
#include "gimpprocedure.h"
 
31
#include "core/gimpparamspecs.h"
30
32
 
31
33
#include "core/gimpchannel-combine.h"
32
34
#include "core/gimpchannel.h"
33
35
#include "core/gimpimage.h"
34
 
 
35
 
static ProcRecord channel_new_proc;
36
 
static ProcRecord channel_copy_proc;
37
 
static ProcRecord channel_combine_masks_proc;
38
 
static ProcRecord channel_get_show_masked_proc;
39
 
static ProcRecord channel_set_show_masked_proc;
40
 
static ProcRecord channel_get_opacity_proc;
41
 
static ProcRecord channel_set_opacity_proc;
42
 
static ProcRecord channel_get_color_proc;
43
 
static ProcRecord channel_set_color_proc;
44
 
 
45
 
void
46
 
register_channel_procs (Gimp *gimp)
47
 
{
48
 
  procedural_db_register (gimp, &channel_new_proc);
49
 
  procedural_db_register (gimp, &channel_copy_proc);
50
 
  procedural_db_register (gimp, &channel_combine_masks_proc);
51
 
  procedural_db_register (gimp, &channel_get_show_masked_proc);
52
 
  procedural_db_register (gimp, &channel_set_show_masked_proc);
53
 
  procedural_db_register (gimp, &channel_get_opacity_proc);
54
 
  procedural_db_register (gimp, &channel_set_opacity_proc);
55
 
  procedural_db_register (gimp, &channel_get_color_proc);
56
 
  procedural_db_register (gimp, &channel_set_color_proc);
57
 
}
58
 
 
59
 
static Argument *
60
 
channel_new_invoker (Gimp         *gimp,
61
 
                     GimpContext  *context,
62
 
                     GimpProgress *progress,
63
 
                     Argument     *args)
 
36
#include "gimp-intl.h"
 
37
 
 
38
#include "internal_procs.h"
 
39
 
 
40
 
 
41
static GValueArray *
 
42
channel_new_invoker (GimpProcedure     *procedure,
 
43
                     Gimp              *gimp,
 
44
                     GimpContext       *context,
 
45
                     GimpProgress      *progress,
 
46
                     const GValueArray *args)
64
47
{
65
48
  gboolean success = TRUE;
66
 
  Argument *return_args;
67
 
  GimpImage *gimage;
 
49
  GValueArray *return_vals;
 
50
  GimpImage *image;
68
51
  gint32 width;
69
52
  gint32 height;
70
 
  gchar *name;
 
53
  const gchar *name;
71
54
  gdouble opacity;
72
55
  GimpRGB color;
73
56
  GimpChannel *channel = NULL;
74
57
 
75
 
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
76
 
  if (! GIMP_IS_IMAGE (gimage))
77
 
    success = FALSE;
78
 
 
79
 
  width = args[1].value.pdb_int;
80
 
  if (width <= 0)
81
 
    success = FALSE;
82
 
 
83
 
  height = args[2].value.pdb_int;
84
 
  if (height <= 0)
85
 
    success = FALSE;
86
 
 
87
 
  name = (gchar *) args[3].value.pdb_pointer;
88
 
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
89
 
    success = FALSE;
90
 
 
91
 
  opacity = args[4].value.pdb_float;
92
 
  if (opacity < 0.0 || opacity > 100.0)
93
 
    success = FALSE;
94
 
 
95
 
  color = args[5].value.pdb_color;
 
58
  image = gimp_value_get_image (&args->values[0], gimp);
 
59
  width = g_value_get_int (&args->values[1]);
 
60
  height = g_value_get_int (&args->values[2]);
 
61
  name = g_value_get_string (&args->values[3]);
 
62
  opacity = g_value_get_double (&args->values[4]);
 
63
  gimp_value_get_rgb (&args->values[5], &color);
96
64
 
97
65
  if (success)
98
66
    {
99
67
      GimpRGB rgb_color = color;
100
68
 
101
69
      rgb_color.a = opacity / 100.0;
102
 
      channel = gimp_channel_new (gimage, width, height, name, &rgb_color);
103
 
      success = channel != NULL;
104
 
    }
105
 
 
106
 
  return_args = procedural_db_return_args (&channel_new_proc, success);
107
 
 
108
 
  if (success)
109
 
    return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (channel));
110
 
 
111
 
  return return_args;
112
 
}
113
 
 
114
 
static ProcArg channel_new_inargs[] =
115
 
{
116
 
  {
117
 
    GIMP_PDB_IMAGE,
118
 
    "image",
119
 
    "The image to which to add the channel"
120
 
  },
121
 
  {
122
 
    GIMP_PDB_INT32,
123
 
    "width",
124
 
    "The channel width: (0 < width)"
125
 
  },
126
 
  {
127
 
    GIMP_PDB_INT32,
128
 
    "height",
129
 
    "The channel height: (0 < height)"
130
 
  },
131
 
  {
132
 
    GIMP_PDB_STRING,
133
 
    "name",
134
 
    "The channel name"
135
 
  },
136
 
  {
137
 
    GIMP_PDB_FLOAT,
138
 
    "opacity",
139
 
    "The channel opacity: (0 <= opacity <= 100)"
140
 
  },
141
 
  {
142
 
    GIMP_PDB_COLOR,
143
 
    "color",
144
 
    "The channel compositing color"
145
 
  }
146
 
};
147
 
 
148
 
static ProcArg channel_new_outargs[] =
149
 
{
150
 
  {
151
 
    GIMP_PDB_CHANNEL,
152
 
    "channel",
153
 
    "The newly created channel"
154
 
  }
155
 
};
156
 
 
157
 
static ProcRecord channel_new_proc =
158
 
{
159
 
  "gimp_channel_new",
160
 
  "Create a new channel.",
161
 
  "This procedure creates a new channel with the specified width and height. Name, opacity, and color are also supplied parameters. The new channel still needs to be added to the image, as this is not automatic. Add the new channel with the 'gimp_image_add_channel' command. Other attributes such as channel show masked, should be set with explicit procedure calls. The channel's contents are undefined initially.",
162
 
  "Spencer Kimball & Peter Mattis",
163
 
  "Spencer Kimball & Peter Mattis",
164
 
  "1995-1996",
165
 
  NULL,
166
 
  GIMP_INTERNAL,
167
 
  6,
168
 
  channel_new_inargs,
169
 
  1,
170
 
  channel_new_outargs,
171
 
  { { channel_new_invoker } }
172
 
};
173
 
 
174
 
static Argument *
175
 
channel_copy_invoker (Gimp         *gimp,
176
 
                      GimpContext  *context,
177
 
                      GimpProgress *progress,
178
 
                      Argument     *args)
179
 
{
180
 
  gboolean success = TRUE;
181
 
  Argument *return_args;
 
70
      channel = gimp_channel_new (image, width, height, name, &rgb_color);
 
71
 
 
72
      if (! channel)
 
73
        success = FALSE;
 
74
    }
 
75
 
 
76
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
77
 
 
78
  if (success)
 
79
    gimp_value_set_channel (&return_vals->values[1], channel);
 
80
 
 
81
  return return_vals;
 
82
}
 
83
 
 
84
static GValueArray *
 
85
channel_new_from_component_invoker (GimpProcedure     *procedure,
 
86
                                    Gimp              *gimp,
 
87
                                    GimpContext       *context,
 
88
                                    GimpProgress      *progress,
 
89
                                    const GValueArray *args)
 
90
{
 
91
  gboolean success = TRUE;
 
92
  GValueArray *return_vals;
 
93
  GimpImage *image;
 
94
  gint32 component;
 
95
  const gchar *name;
 
96
  GimpChannel *channel = NULL;
 
97
 
 
98
  image = gimp_value_get_image (&args->values[0], gimp);
 
99
  component = g_value_get_enum (&args->values[1]);
 
100
  name = g_value_get_string (&args->values[2]);
 
101
 
 
102
  if (success)
 
103
    {
 
104
      if (gimp_image_get_component_index (image, component) != -1)
 
105
        channel = gimp_channel_new_from_component (image,
 
106
                                                   component, name, NULL);
 
107
 
 
108
      if (channel)
 
109
        gimp_item_set_visible (GIMP_ITEM (channel), FALSE, FALSE);
 
110
      else
 
111
        success = FALSE;
 
112
    }
 
113
 
 
114
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
115
 
 
116
  if (success)
 
117
    gimp_value_set_channel (&return_vals->values[1], channel);
 
118
 
 
119
  return return_vals;
 
120
}
 
121
 
 
122
static GValueArray *
 
123
channel_copy_invoker (GimpProcedure     *procedure,
 
124
                      Gimp              *gimp,
 
125
                      GimpContext       *context,
 
126
                      GimpProgress      *progress,
 
127
                      const GValueArray *args)
 
128
{
 
129
  gboolean success = TRUE;
 
130
  GValueArray *return_vals;
182
131
  GimpChannel *channel;
183
132
  GimpChannel *channel_copy = NULL;
184
133
 
185
 
  channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
186
 
  if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
187
 
    success = FALSE;
 
134
  channel = gimp_value_get_channel (&args->values[0], gimp);
188
135
 
189
136
  if (success)
190
137
    {
191
138
      channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
192
139
                                   G_TYPE_FROM_INSTANCE (channel), FALSE));
193
 
      success = (channel_copy != NULL);
 
140
 
 
141
      if (! channel_copy)
 
142
        success = FALSE;
194
143
    }
195
144
 
196
 
  return_args = procedural_db_return_args (&channel_copy_proc, success);
 
145
  return_vals = gimp_procedure_get_return_values (procedure, success);
197
146
 
198
147
  if (success)
199
 
    return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (channel_copy));
 
148
    gimp_value_set_channel (&return_vals->values[1], channel_copy);
200
149
 
201
 
  return return_args;
 
150
  return return_vals;
202
151
}
203
152
 
204
 
static ProcArg channel_copy_inargs[] =
205
 
{
206
 
  {
207
 
    GIMP_PDB_CHANNEL,
208
 
    "channel",
209
 
    "The channel to copy"
210
 
  }
211
 
};
212
 
 
213
 
static ProcArg channel_copy_outargs[] =
214
 
{
215
 
  {
216
 
    GIMP_PDB_CHANNEL,
217
 
    "channel_copy",
218
 
    "The newly copied channel"
219
 
  }
220
 
};
221
 
 
222
 
static ProcRecord channel_copy_proc =
223
 
{
224
 
  "gimp_channel_copy",
225
 
  "Copy a channel.",
226
 
  "This procedure copies the specified channel and returns the copy.",
227
 
  "Spencer Kimball & Peter Mattis",
228
 
  "Spencer Kimball & Peter Mattis",
229
 
  "1995-1996",
230
 
  NULL,
231
 
  GIMP_INTERNAL,
232
 
  1,
233
 
  channel_copy_inargs,
234
 
  1,
235
 
  channel_copy_outargs,
236
 
  { { channel_copy_invoker } }
237
 
};
238
 
 
239
 
static Argument *
240
 
channel_combine_masks_invoker (Gimp         *gimp,
241
 
                               GimpContext  *context,
242
 
                               GimpProgress *progress,
243
 
                               Argument     *args)
 
153
static GValueArray *
 
154
channel_combine_masks_invoker (GimpProcedure     *procedure,
 
155
                               Gimp              *gimp,
 
156
                               GimpContext       *context,
 
157
                               GimpProgress      *progress,
 
158
                               const GValueArray *args)
244
159
{
245
160
  gboolean success = TRUE;
246
161
  GimpChannel *channel1;
249
164
  gint32 offx;
250
165
  gint32 offy;
251
166
 
252
 
  channel1 = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
253
 
  if (! (GIMP_IS_CHANNEL (channel1) && ! gimp_item_is_removed (GIMP_ITEM (channel1))))
254
 
    success = FALSE;
255
 
 
256
 
  channel2 = (GimpChannel *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
257
 
  if (! (GIMP_IS_CHANNEL (channel2) && ! gimp_item_is_removed (GIMP_ITEM (channel2))))
258
 
    success = FALSE;
259
 
 
260
 
  operation = args[2].value.pdb_int;
261
 
  if (operation < GIMP_CHANNEL_OP_ADD || operation > GIMP_CHANNEL_OP_INTERSECT)
262
 
    success = FALSE;
263
 
 
264
 
  offx = args[3].value.pdb_int;
265
 
 
266
 
  offy = args[4].value.pdb_int;
 
167
  channel1 = gimp_value_get_channel (&args->values[0], gimp);
 
168
  channel2 = gimp_value_get_channel (&args->values[1], gimp);
 
169
  operation = g_value_get_enum (&args->values[2]);
 
170
  offx = g_value_get_int (&args->values[3]);
 
171
  offy = g_value_get_int (&args->values[4]);
267
172
 
268
173
  if (success)
269
174
    {
 
175
      gimp_channel_push_undo (channel1, _("Combine Masks"));
270
176
      gimp_channel_combine_mask (channel1, channel2, operation, offx, offy);
271
177
    }
272
178
 
273
 
  return procedural_db_return_args (&channel_combine_masks_proc, success);
 
179
  return gimp_procedure_get_return_values (procedure, success);
274
180
}
275
181
 
276
 
static ProcArg channel_combine_masks_inargs[] =
277
 
{
278
 
  {
279
 
    GIMP_PDB_CHANNEL,
280
 
    "channel1",
281
 
    "The channel1"
282
 
  },
283
 
  {
284
 
    GIMP_PDB_CHANNEL,
285
 
    "channel2",
286
 
    "The channel2"
287
 
  },
288
 
  {
289
 
    GIMP_PDB_INT32,
290
 
    "operation",
291
 
    "The selection operation: { GIMP_CHANNEL_OP_ADD (0), GIMP_CHANNEL_OP_SUBTRACT (1), GIMP_CHANNEL_OP_REPLACE (2), GIMP_CHANNEL_OP_INTERSECT (3) }"
292
 
  },
293
 
  {
294
 
    GIMP_PDB_INT32,
295
 
    "offx",
296
 
    "x offset between upper left corner of channels: (second - first)"
297
 
  },
298
 
  {
299
 
    GIMP_PDB_INT32,
300
 
    "offy",
301
 
    "y offset between upper left corner of channels: (second - first)"
302
 
  }
303
 
};
304
 
 
305
 
static ProcRecord channel_combine_masks_proc =
306
 
{
307
 
  "gimp_channel_combine_masks",
308
 
  "Combine two channel masks.",
309
 
  "This procedure combines two channel masks. The result is stored in the first channel.",
310
 
  "Spencer Kimball & Peter Mattis",
311
 
  "Spencer Kimball & Peter Mattis",
312
 
  "1995-1996",
313
 
  NULL,
314
 
  GIMP_INTERNAL,
315
 
  5,
316
 
  channel_combine_masks_inargs,
317
 
  0,
318
 
  NULL,
319
 
  { { channel_combine_masks_invoker } }
320
 
};
321
 
 
322
 
static Argument *
323
 
channel_get_show_masked_invoker (Gimp         *gimp,
324
 
                                 GimpContext  *context,
325
 
                                 GimpProgress *progress,
326
 
                                 Argument     *args)
 
182
static GValueArray *
 
183
channel_get_show_masked_invoker (GimpProcedure     *procedure,
 
184
                                 Gimp              *gimp,
 
185
                                 GimpContext       *context,
 
186
                                 GimpProgress      *progress,
 
187
                                 const GValueArray *args)
327
188
{
328
189
  gboolean success = TRUE;
329
 
  Argument *return_args;
 
190
  GValueArray *return_vals;
330
191
  GimpChannel *channel;
331
 
 
332
 
  channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
333
 
  if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
334
 
    success = FALSE;
335
 
 
336
 
  return_args = procedural_db_return_args (&channel_get_show_masked_proc, success);
337
 
 
338
 
  if (success)
339
 
    return_args[1].value.pdb_int = gimp_channel_get_show_masked (channel);
340
 
 
341
 
  return return_args;
 
192
  gboolean show_masked = FALSE;
 
193
 
 
194
  channel = gimp_value_get_channel (&args->values[0], gimp);
 
195
 
 
196
  if (success)
 
197
    {
 
198
      show_masked = gimp_channel_get_show_masked (channel);
 
199
    }
 
200
 
 
201
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
202
 
 
203
  if (success)
 
204
    g_value_set_boolean (&return_vals->values[1], show_masked);
 
205
 
 
206
  return return_vals;
342
207
}
343
208
 
344
 
static ProcArg channel_get_show_masked_inargs[] =
345
 
{
346
 
  {
347
 
    GIMP_PDB_CHANNEL,
348
 
    "channel",
349
 
    "The channel"
350
 
  }
351
 
};
352
 
 
353
 
static ProcArg channel_get_show_masked_outargs[] =
354
 
{
355
 
  {
356
 
    GIMP_PDB_INT32,
357
 
    "show_masked",
358
 
    "The channel composite method"
359
 
  }
360
 
};
361
 
 
362
 
static ProcRecord channel_get_show_masked_proc =
363
 
{
364
 
  "gimp_channel_get_show_masked",
365
 
  "Get the composite method of the specified channel.",
366
 
  "This procedure returns the specified channel's composite method. If it is non-zero, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.",
367
 
  "Spencer Kimball & Peter Mattis",
368
 
  "Spencer Kimball & Peter Mattis",
369
 
  "1995-1996",
370
 
  NULL,
371
 
  GIMP_INTERNAL,
372
 
  1,
373
 
  channel_get_show_masked_inargs,
374
 
  1,
375
 
  channel_get_show_masked_outargs,
376
 
  { { channel_get_show_masked_invoker } }
377
 
};
378
 
 
379
 
static Argument *
380
 
channel_set_show_masked_invoker (Gimp         *gimp,
381
 
                                 GimpContext  *context,
382
 
                                 GimpProgress *progress,
383
 
                                 Argument     *args)
 
209
static GValueArray *
 
210
channel_set_show_masked_invoker (GimpProcedure     *procedure,
 
211
                                 Gimp              *gimp,
 
212
                                 GimpContext       *context,
 
213
                                 GimpProgress      *progress,
 
214
                                 const GValueArray *args)
384
215
{
385
216
  gboolean success = TRUE;
386
217
  GimpChannel *channel;
387
218
  gboolean show_masked;
388
219
 
389
 
  channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
390
 
  if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
391
 
    success = FALSE;
392
 
 
393
 
  show_masked = args[1].value.pdb_int ? TRUE : FALSE;
 
220
  channel = gimp_value_get_channel (&args->values[0], gimp);
 
221
  show_masked = g_value_get_boolean (&args->values[1]);
394
222
 
395
223
  if (success)
396
 
    gimp_channel_set_show_masked (channel, show_masked);
 
224
    {
 
225
      gimp_channel_set_show_masked (channel, show_masked);
 
226
    }
397
227
 
398
 
  return procedural_db_return_args (&channel_set_show_masked_proc, success);
 
228
  return gimp_procedure_get_return_values (procedure, success);
399
229
}
400
230
 
401
 
static ProcArg channel_set_show_masked_inargs[] =
402
 
{
403
 
  {
404
 
    GIMP_PDB_CHANNEL,
405
 
    "channel",
406
 
    "The channel"
407
 
  },
408
 
  {
409
 
    GIMP_PDB_INT32,
410
 
    "show_masked",
411
 
    "The new channel composite method"
412
 
  }
413
 
};
414
 
 
415
 
static ProcRecord channel_set_show_masked_proc =
416
 
{
417
 
  "gimp_channel_set_show_masked",
418
 
  "Set the composite method of the specified channel.",
419
 
  "This procedure sets the specified channel's composite method. If it is non-zero, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.",
420
 
  "Spencer Kimball & Peter Mattis",
421
 
  "Spencer Kimball & Peter Mattis",
422
 
  "1995-1996",
423
 
  NULL,
424
 
  GIMP_INTERNAL,
425
 
  2,
426
 
  channel_set_show_masked_inargs,
427
 
  0,
428
 
  NULL,
429
 
  { { channel_set_show_masked_invoker } }
430
 
};
431
 
 
432
 
static Argument *
433
 
channel_get_opacity_invoker (Gimp         *gimp,
434
 
                             GimpContext  *context,
435
 
                             GimpProgress *progress,
436
 
                             Argument     *args)
 
231
static GValueArray *
 
232
channel_get_opacity_invoker (GimpProcedure     *procedure,
 
233
                             Gimp              *gimp,
 
234
                             GimpContext       *context,
 
235
                             GimpProgress      *progress,
 
236
                             const GValueArray *args)
437
237
{
438
238
  gboolean success = TRUE;
439
 
  Argument *return_args;
 
239
  GValueArray *return_vals;
440
240
  GimpChannel *channel;
441
 
 
442
 
  channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
443
 
  if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
444
 
    success = FALSE;
445
 
 
446
 
  return_args = procedural_db_return_args (&channel_get_opacity_proc, success);
447
 
 
448
 
  if (success)
449
 
    return_args[1].value.pdb_float = gimp_channel_get_opacity (channel) * 100.0;
450
 
 
451
 
  return return_args;
 
241
  gdouble opacity = 0.0;
 
242
 
 
243
  channel = gimp_value_get_channel (&args->values[0], gimp);
 
244
 
 
245
  if (success)
 
246
    {
 
247
      opacity = gimp_channel_get_opacity (channel) * 100;
 
248
    }
 
249
 
 
250
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
251
 
 
252
  if (success)
 
253
    g_value_set_double (&return_vals->values[1], opacity);
 
254
 
 
255
  return return_vals;
452
256
}
453
257
 
454
 
static ProcArg channel_get_opacity_inargs[] =
455
 
{
456
 
  {
457
 
    GIMP_PDB_CHANNEL,
458
 
    "channel",
459
 
    "The channel"
460
 
  }
461
 
};
462
 
 
463
 
static ProcArg channel_get_opacity_outargs[] =
464
 
{
465
 
  {
466
 
    GIMP_PDB_FLOAT,
467
 
    "opacity",
468
 
    "The channel opacity"
469
 
  }
470
 
};
471
 
 
472
 
static ProcRecord channel_get_opacity_proc =
473
 
{
474
 
  "gimp_channel_get_opacity",
475
 
  "Get the opacity of the specified channel.",
476
 
  "This procedure returns the specified channel's opacity.",
477
 
  "Spencer Kimball & Peter Mattis",
478
 
  "Spencer Kimball & Peter Mattis",
479
 
  "1995-1996",
480
 
  NULL,
481
 
  GIMP_INTERNAL,
482
 
  1,
483
 
  channel_get_opacity_inargs,
484
 
  1,
485
 
  channel_get_opacity_outargs,
486
 
  { { channel_get_opacity_invoker } }
487
 
};
488
 
 
489
 
static Argument *
490
 
channel_set_opacity_invoker (Gimp         *gimp,
491
 
                             GimpContext  *context,
492
 
                             GimpProgress *progress,
493
 
                             Argument     *args)
 
258
static GValueArray *
 
259
channel_set_opacity_invoker (GimpProcedure     *procedure,
 
260
                             Gimp              *gimp,
 
261
                             GimpContext       *context,
 
262
                             GimpProgress      *progress,
 
263
                             const GValueArray *args)
494
264
{
495
265
  gboolean success = TRUE;
496
266
  GimpChannel *channel;
497
267
  gdouble opacity;
498
268
 
499
 
  channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
500
 
  if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
501
 
    success = FALSE;
502
 
 
503
 
  opacity = args[1].value.pdb_float;
504
 
  if (opacity < 0.0 || opacity > 100.0)
505
 
    success = FALSE;
506
 
 
507
 
  if (success)
508
 
    gimp_channel_set_opacity (channel, opacity / 100.0, TRUE);
509
 
 
510
 
  return procedural_db_return_args (&channel_set_opacity_proc, success);
511
 
}
512
 
 
513
 
static ProcArg channel_set_opacity_inargs[] =
514
 
{
515
 
  {
516
 
    GIMP_PDB_CHANNEL,
517
 
    "channel",
518
 
    "The channel"
519
 
  },
520
 
  {
521
 
    GIMP_PDB_FLOAT,
522
 
    "opacity",
523
 
    "The new channel opacity (0 <= opacity <= 100)"
524
 
  }
525
 
};
526
 
 
527
 
static ProcRecord channel_set_opacity_proc =
528
 
{
529
 
  "gimp_channel_set_opacity",
530
 
  "Set the opacity of the specified channel.",
531
 
  "This procedure sets the specified channel's opacity.",
532
 
  "Spencer Kimball & Peter Mattis",
533
 
  "Spencer Kimball & Peter Mattis",
534
 
  "1995-1996",
535
 
  NULL,
536
 
  GIMP_INTERNAL,
537
 
  2,
538
 
  channel_set_opacity_inargs,
539
 
  0,
540
 
  NULL,
541
 
  { { channel_set_opacity_invoker } }
542
 
};
543
 
 
544
 
static Argument *
545
 
channel_get_color_invoker (Gimp         *gimp,
546
 
                           GimpContext  *context,
547
 
                           GimpProgress *progress,
548
 
                           Argument     *args)
549
 
{
550
 
  gboolean success = TRUE;
551
 
  Argument *return_args;
552
 
  GimpChannel *channel;
553
 
  GimpRGB color;
554
 
 
555
 
  channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
556
 
  if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
557
 
    success = FALSE;
558
 
 
559
 
  if (success)
560
 
    gimp_channel_get_color (channel, &color);
561
 
 
562
 
  return_args = procedural_db_return_args (&channel_get_color_proc, success);
563
 
 
564
 
  if (success)
565
 
    return_args[1].value.pdb_color = color;
566
 
 
567
 
  return return_args;
568
 
}
569
 
 
570
 
static ProcArg channel_get_color_inargs[] =
571
 
{
572
 
  {
573
 
    GIMP_PDB_CHANNEL,
574
 
    "channel",
575
 
    "The channel"
576
 
  }
577
 
};
578
 
 
579
 
static ProcArg channel_get_color_outargs[] =
580
 
{
581
 
  {
582
 
    GIMP_PDB_COLOR,
583
 
    "color",
584
 
    "The channel compositing color"
585
 
  }
586
 
};
587
 
 
588
 
static ProcRecord channel_get_color_proc =
589
 
{
590
 
  "gimp_channel_get_color",
591
 
  "Get the compositing color of the specified channel.",
592
 
  "This procedure returns the specified channel's compositing color.",
593
 
  "Spencer Kimball & Peter Mattis",
594
 
  "Spencer Kimball & Peter Mattis",
595
 
  "1995-1996",
596
 
  NULL,
597
 
  GIMP_INTERNAL,
598
 
  1,
599
 
  channel_get_color_inargs,
600
 
  1,
601
 
  channel_get_color_outargs,
602
 
  { { channel_get_color_invoker } }
603
 
};
604
 
 
605
 
static Argument *
606
 
channel_set_color_invoker (Gimp         *gimp,
607
 
                           GimpContext  *context,
608
 
                           GimpProgress *progress,
609
 
                           Argument     *args)
610
 
{
611
 
  gboolean success = TRUE;
612
 
  GimpChannel *channel;
613
 
  GimpRGB color;
614
 
 
615
 
  channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
616
 
  if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
617
 
    success = FALSE;
618
 
 
619
 
  color = args[1].value.pdb_color;
 
269
  channel = gimp_value_get_channel (&args->values[0], gimp);
 
270
  opacity = g_value_get_double (&args->values[1]);
 
271
 
 
272
  if (success)
 
273
    {
 
274
      gimp_channel_set_opacity (channel, opacity / 100.0, TRUE);
 
275
    }
 
276
 
 
277
  return gimp_procedure_get_return_values (procedure, success);
 
278
}
 
279
 
 
280
static GValueArray *
 
281
channel_get_color_invoker (GimpProcedure     *procedure,
 
282
                           Gimp              *gimp,
 
283
                           GimpContext       *context,
 
284
                           GimpProgress      *progress,
 
285
                           const GValueArray *args)
 
286
{
 
287
  gboolean success = TRUE;
 
288
  GValueArray *return_vals;
 
289
  GimpChannel *channel;
 
290
  GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
 
291
 
 
292
  channel = gimp_value_get_channel (&args->values[0], gimp);
 
293
 
 
294
  if (success)
 
295
    {
 
296
      gimp_channel_get_color (channel, &color);
 
297
      gimp_rgb_set_alpha (&color, 1.0);
 
298
    }
 
299
 
 
300
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
301
 
 
302
  if (success)
 
303
    gimp_value_set_rgb (&return_vals->values[1], &color);
 
304
 
 
305
  return return_vals;
 
306
}
 
307
 
 
308
static GValueArray *
 
309
channel_set_color_invoker (GimpProcedure     *procedure,
 
310
                           Gimp              *gimp,
 
311
                           GimpContext       *context,
 
312
                           GimpProgress      *progress,
 
313
                           const GValueArray *args)
 
314
{
 
315
  gboolean success = TRUE;
 
316
  GimpChannel *channel;
 
317
  GimpRGB color;
 
318
 
 
319
  channel = gimp_value_get_channel (&args->values[0], gimp);
 
320
  gimp_value_get_rgb (&args->values[1], &color);
620
321
 
621
322
  if (success)
622
323
    {
626
327
      gimp_channel_set_color (channel, &rgb_color, TRUE);
627
328
    }
628
329
 
629
 
  return procedural_db_return_args (&channel_set_color_proc, success);
630
 
}
631
 
 
632
 
static ProcArg channel_set_color_inargs[] =
633
 
{
634
 
  {
635
 
    GIMP_PDB_CHANNEL,
636
 
    "channel",
637
 
    "The channel"
638
 
  },
639
 
  {
640
 
    GIMP_PDB_COLOR,
641
 
    "color",
642
 
    "The new channel compositing color"
643
 
  }
644
 
};
645
 
 
646
 
static ProcRecord channel_set_color_proc =
647
 
{
648
 
  "gimp_channel_set_color",
649
 
  "Set the compositing color of the specified channel.",
650
 
  "This procedure sets the specified channel's compositing color.",
651
 
  "Spencer Kimball & Peter Mattis",
652
 
  "Spencer Kimball & Peter Mattis",
653
 
  "1995-1996",
654
 
  NULL,
655
 
  GIMP_INTERNAL,
656
 
  2,
657
 
  channel_set_color_inargs,
658
 
  0,
659
 
  NULL,
660
 
  { { channel_set_color_invoker } }
661
 
};
 
330
  return gimp_procedure_get_return_values (procedure, success);
 
331
}
 
332
 
 
333
void
 
334
register_channel_procs (GimpPDB *pdb)
 
335
{
 
336
  GimpProcedure *procedure;
 
337
 
 
338
  /*
 
339
   * gimp-channel-new
 
340
   */
 
341
  procedure = gimp_procedure_new (channel_new_invoker);
 
342
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-new");
 
343
  gimp_procedure_set_static_strings (procedure,
 
344
                                     "gimp-channel-new",
 
345
                                     "Create a new channel.",
 
346
                                     "This procedure creates a new channel with the specified width and height. Name, opacity, and color are also supplied parameters. The new channel still needs to be added to the image, as this is not automatic. Add the new channel with the 'gimp-image-add-channel' command. Other attributes such as channel show masked, should be set with explicit procedure calls. The channel's contents are undefined initially.",
 
347
                                     "Spencer Kimball & Peter Mattis",
 
348
                                     "Spencer Kimball & Peter Mattis",
 
349
                                     "1995-1996",
 
350
                                     NULL);
 
351
  gimp_procedure_add_argument (procedure,
 
352
                               gimp_param_spec_image_id ("image",
 
353
                                                         "image",
 
354
                                                         "The image to which to add the channel",
 
355
                                                         pdb->gimp, FALSE,
 
356
                                                         GIMP_PARAM_READWRITE));
 
357
  gimp_procedure_add_argument (procedure,
 
358
                               gimp_param_spec_int32 ("width",
 
359
                                                      "width",
 
360
                                                      "The channel width",
 
361
                                                      1, G_MAXINT32, 1,
 
362
                                                      GIMP_PARAM_READWRITE));
 
363
  gimp_procedure_add_argument (procedure,
 
364
                               gimp_param_spec_int32 ("height",
 
365
                                                      "height",
 
366
                                                      "The channel height",
 
367
                                                      1, G_MAXINT32, 1,
 
368
                                                      GIMP_PARAM_READWRITE));
 
369
  gimp_procedure_add_argument (procedure,
 
370
                               gimp_param_spec_string ("name",
 
371
                                                       "name",
 
372
                                                       "The channel name",
 
373
                                                       FALSE, FALSE,
 
374
                                                       NULL,
 
375
                                                       GIMP_PARAM_READWRITE));
 
376
  gimp_procedure_add_argument (procedure,
 
377
                               g_param_spec_double ("opacity",
 
378
                                                    "opacity",
 
379
                                                    "The channel opacity",
 
380
                                                    0, 100, 0,
 
381
                                                    GIMP_PARAM_READWRITE));
 
382
  gimp_procedure_add_argument (procedure,
 
383
                               gimp_param_spec_rgb ("color",
 
384
                                                    "color",
 
385
                                                    "The channel compositing color",
 
386
                                                    FALSE,
 
387
                                                    NULL,
 
388
                                                    GIMP_PARAM_READWRITE));
 
389
  gimp_procedure_add_return_value (procedure,
 
390
                                   gimp_param_spec_channel_id ("channel",
 
391
                                                               "channel",
 
392
                                                               "The newly created channel",
 
393
                                                               pdb->gimp, FALSE,
 
394
                                                               GIMP_PARAM_READWRITE));
 
395
  gimp_pdb_register_procedure (pdb, procedure);
 
396
  g_object_unref (procedure);
 
397
 
 
398
  /*
 
399
   * gimp-channel-new-from-component
 
400
   */
 
401
  procedure = gimp_procedure_new (channel_new_from_component_invoker);
 
402
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-new-from-component");
 
403
  gimp_procedure_set_static_strings (procedure,
 
404
                                     "gimp-channel-new-from-component",
 
405
                                     "Create a new channel from a color component",
 
406
                                     "This procedure creates a new channel from a color component.",
 
407
                                     "Shlomi Fish <shlomif@iglu.org.il>",
 
408
                                     "Shlomi Fish",
 
409
                                     "2005",
 
410
                                     NULL);
 
411
  gimp_procedure_add_argument (procedure,
 
412
                               gimp_param_spec_image_id ("image",
 
413
                                                         "image",
 
414
                                                         "The image to which to add the channel",
 
415
                                                         pdb->gimp, FALSE,
 
416
                                                         GIMP_PARAM_READWRITE));
 
417
  gimp_procedure_add_argument (procedure,
 
418
                               g_param_spec_enum ("component",
 
419
                                                  "component",
 
420
                                                  "The image component",
 
421
                                                  GIMP_TYPE_CHANNEL_TYPE,
 
422
                                                  GIMP_RED_CHANNEL,
 
423
                                                  GIMP_PARAM_READWRITE));
 
424
  gimp_procedure_add_argument (procedure,
 
425
                               gimp_param_spec_string ("name",
 
426
                                                       "name",
 
427
                                                       "The channel name",
 
428
                                                       FALSE, FALSE,
 
429
                                                       NULL,
 
430
                                                       GIMP_PARAM_READWRITE));
 
431
  gimp_procedure_add_return_value (procedure,
 
432
                                   gimp_param_spec_channel_id ("channel",
 
433
                                                               "channel",
 
434
                                                               "The newly created channel",
 
435
                                                               pdb->gimp, FALSE,
 
436
                                                               GIMP_PARAM_READWRITE));
 
437
  gimp_pdb_register_procedure (pdb, procedure);
 
438
  g_object_unref (procedure);
 
439
 
 
440
  /*
 
441
   * gimp-channel-copy
 
442
   */
 
443
  procedure = gimp_procedure_new (channel_copy_invoker);
 
444
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-copy");
 
445
  gimp_procedure_set_static_strings (procedure,
 
446
                                     "gimp-channel-copy",
 
447
                                     "Copy a channel.",
 
448
                                     "This procedure copies the specified channel and returns the copy.",
 
449
                                     "Spencer Kimball & Peter Mattis",
 
450
                                     "Spencer Kimball & Peter Mattis",
 
451
                                     "1995-1996",
 
452
                                     NULL);
 
453
  gimp_procedure_add_argument (procedure,
 
454
                               gimp_param_spec_channel_id ("channel",
 
455
                                                           "channel",
 
456
                                                           "The channel to copy",
 
457
                                                           pdb->gimp, FALSE,
 
458
                                                           GIMP_PARAM_READWRITE));
 
459
  gimp_procedure_add_return_value (procedure,
 
460
                                   gimp_param_spec_channel_id ("channel-copy",
 
461
                                                               "channel copy",
 
462
                                                               "The newly copied channel",
 
463
                                                               pdb->gimp, FALSE,
 
464
                                                               GIMP_PARAM_READWRITE));
 
465
  gimp_pdb_register_procedure (pdb, procedure);
 
466
  g_object_unref (procedure);
 
467
 
 
468
  /*
 
469
   * gimp-channel-combine-masks
 
470
   */
 
471
  procedure = gimp_procedure_new (channel_combine_masks_invoker);
 
472
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-combine-masks");
 
473
  gimp_procedure_set_static_strings (procedure,
 
474
                                     "gimp-channel-combine-masks",
 
475
                                     "Combine two channel masks.",
 
476
                                     "This procedure combines two channel masks. The result is stored in the first channel.",
 
477
                                     "Spencer Kimball & Peter Mattis",
 
478
                                     "Spencer Kimball & Peter Mattis",
 
479
                                     "1995-1996",
 
480
                                     NULL);
 
481
  gimp_procedure_add_argument (procedure,
 
482
                               gimp_param_spec_channel_id ("channel1",
 
483
                                                           "channel1",
 
484
                                                           "The channel1",
 
485
                                                           pdb->gimp, FALSE,
 
486
                                                           GIMP_PARAM_READWRITE));
 
487
  gimp_procedure_add_argument (procedure,
 
488
                               gimp_param_spec_channel_id ("channel2",
 
489
                                                           "channel2",
 
490
                                                           "The channel2",
 
491
                                                           pdb->gimp, FALSE,
 
492
                                                           GIMP_PARAM_READWRITE));
 
493
  gimp_procedure_add_argument (procedure,
 
494
                               g_param_spec_enum ("operation",
 
495
                                                  "operation",
 
496
                                                  "The selection operation",
 
497
                                                  GIMP_TYPE_CHANNEL_OPS,
 
498
                                                  GIMP_CHANNEL_OP_ADD,
 
499
                                                  GIMP_PARAM_READWRITE));
 
500
  gimp_procedure_add_argument (procedure,
 
501
                               gimp_param_spec_int32 ("offx",
 
502
                                                      "offx",
 
503
                                                      "x offset between upper left corner of channels: (second - first)",
 
504
                                                      G_MININT32, G_MAXINT32, 0,
 
505
                                                      GIMP_PARAM_READWRITE));
 
506
  gimp_procedure_add_argument (procedure,
 
507
                               gimp_param_spec_int32 ("offy",
 
508
                                                      "offy",
 
509
                                                      "y offset between upper left corner of channels: (second - first)",
 
510
                                                      G_MININT32, G_MAXINT32, 0,
 
511
                                                      GIMP_PARAM_READWRITE));
 
512
  gimp_pdb_register_procedure (pdb, procedure);
 
513
  g_object_unref (procedure);
 
514
 
 
515
  /*
 
516
   * gimp-channel-get-show-masked
 
517
   */
 
518
  procedure = gimp_procedure_new (channel_get_show_masked_invoker);
 
519
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-get-show-masked");
 
520
  gimp_procedure_set_static_strings (procedure,
 
521
                                     "gimp-channel-get-show-masked",
 
522
                                     "Get the composite method of the specified channel.",
 
523
                                     "This procedure returns the specified channel's composite method. If it is TRUE, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.",
 
524
                                     "Spencer Kimball & Peter Mattis",
 
525
                                     "Spencer Kimball & Peter Mattis",
 
526
                                     "1995-1996",
 
527
                                     NULL);
 
528
  gimp_procedure_add_argument (procedure,
 
529
                               gimp_param_spec_channel_id ("channel",
 
530
                                                           "channel",
 
531
                                                           "The channel",
 
532
                                                           pdb->gimp, FALSE,
 
533
                                                           GIMP_PARAM_READWRITE));
 
534
  gimp_procedure_add_return_value (procedure,
 
535
                                   g_param_spec_boolean ("show-masked",
 
536
                                                         "show masked",
 
537
                                                         "The channel composite method",
 
538
                                                         FALSE,
 
539
                                                         GIMP_PARAM_READWRITE));
 
540
  gimp_pdb_register_procedure (pdb, procedure);
 
541
  g_object_unref (procedure);
 
542
 
 
543
  /*
 
544
   * gimp-channel-set-show-masked
 
545
   */
 
546
  procedure = gimp_procedure_new (channel_set_show_masked_invoker);
 
547
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-set-show-masked");
 
548
  gimp_procedure_set_static_strings (procedure,
 
549
                                     "gimp-channel-set-show-masked",
 
550
                                     "Set the composite method of the specified channel.",
 
551
                                     "This procedure sets the specified channel's composite method. If it is TRUE, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.",
 
552
                                     "Spencer Kimball & Peter Mattis",
 
553
                                     "Spencer Kimball & Peter Mattis",
 
554
                                     "1995-1996",
 
555
                                     NULL);
 
556
  gimp_procedure_add_argument (procedure,
 
557
                               gimp_param_spec_channel_id ("channel",
 
558
                                                           "channel",
 
559
                                                           "The channel",
 
560
                                                           pdb->gimp, FALSE,
 
561
                                                           GIMP_PARAM_READWRITE));
 
562
  gimp_procedure_add_argument (procedure,
 
563
                               g_param_spec_boolean ("show-masked",
 
564
                                                     "show masked",
 
565
                                                     "The new channel composite method",
 
566
                                                     FALSE,
 
567
                                                     GIMP_PARAM_READWRITE));
 
568
  gimp_pdb_register_procedure (pdb, procedure);
 
569
  g_object_unref (procedure);
 
570
 
 
571
  /*
 
572
   * gimp-channel-get-opacity
 
573
   */
 
574
  procedure = gimp_procedure_new (channel_get_opacity_invoker);
 
575
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-get-opacity");
 
576
  gimp_procedure_set_static_strings (procedure,
 
577
                                     "gimp-channel-get-opacity",
 
578
                                     "Get the opacity of the specified channel.",
 
579
                                     "This procedure returns the specified channel's opacity.",
 
580
                                     "Spencer Kimball & Peter Mattis",
 
581
                                     "Spencer Kimball & Peter Mattis",
 
582
                                     "1995-1996",
 
583
                                     NULL);
 
584
  gimp_procedure_add_argument (procedure,
 
585
                               gimp_param_spec_channel_id ("channel",
 
586
                                                           "channel",
 
587
                                                           "The channel",
 
588
                                                           pdb->gimp, FALSE,
 
589
                                                           GIMP_PARAM_READWRITE));
 
590
  gimp_procedure_add_return_value (procedure,
 
591
                                   g_param_spec_double ("opacity",
 
592
                                                        "opacity",
 
593
                                                        "The channel opacity",
 
594
                                                        0, 100, 0,
 
595
                                                        GIMP_PARAM_READWRITE));
 
596
  gimp_pdb_register_procedure (pdb, procedure);
 
597
  g_object_unref (procedure);
 
598
 
 
599
  /*
 
600
   * gimp-channel-set-opacity
 
601
   */
 
602
  procedure = gimp_procedure_new (channel_set_opacity_invoker);
 
603
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-set-opacity");
 
604
  gimp_procedure_set_static_strings (procedure,
 
605
                                     "gimp-channel-set-opacity",
 
606
                                     "Set the opacity of the specified channel.",
 
607
                                     "This procedure sets the specified channel's opacity.",
 
608
                                     "Spencer Kimball & Peter Mattis",
 
609
                                     "Spencer Kimball & Peter Mattis",
 
610
                                     "1995-1996",
 
611
                                     NULL);
 
612
  gimp_procedure_add_argument (procedure,
 
613
                               gimp_param_spec_channel_id ("channel",
 
614
                                                           "channel",
 
615
                                                           "The channel",
 
616
                                                           pdb->gimp, FALSE,
 
617
                                                           GIMP_PARAM_READWRITE));
 
618
  gimp_procedure_add_argument (procedure,
 
619
                               g_param_spec_double ("opacity",
 
620
                                                    "opacity",
 
621
                                                    "The new channel opacity",
 
622
                                                    0, 100, 0,
 
623
                                                    GIMP_PARAM_READWRITE));
 
624
  gimp_pdb_register_procedure (pdb, procedure);
 
625
  g_object_unref (procedure);
 
626
 
 
627
  /*
 
628
   * gimp-channel-get-color
 
629
   */
 
630
  procedure = gimp_procedure_new (channel_get_color_invoker);
 
631
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-get-color");
 
632
  gimp_procedure_set_static_strings (procedure,
 
633
                                     "gimp-channel-get-color",
 
634
                                     "Get the compositing color of the specified channel.",
 
635
                                     "This procedure returns the specified channel's compositing color.",
 
636
                                     "Spencer Kimball & Peter Mattis",
 
637
                                     "Spencer Kimball & Peter Mattis",
 
638
                                     "1995-1996",
 
639
                                     NULL);
 
640
  gimp_procedure_add_argument (procedure,
 
641
                               gimp_param_spec_channel_id ("channel",
 
642
                                                           "channel",
 
643
                                                           "The channel",
 
644
                                                           pdb->gimp, FALSE,
 
645
                                                           GIMP_PARAM_READWRITE));
 
646
  gimp_procedure_add_return_value (procedure,
 
647
                                   gimp_param_spec_rgb ("color",
 
648
                                                        "color",
 
649
                                                        "The channel compositing color",
 
650
                                                        FALSE,
 
651
                                                        NULL,
 
652
                                                        GIMP_PARAM_READWRITE));
 
653
  gimp_pdb_register_procedure (pdb, procedure);
 
654
  g_object_unref (procedure);
 
655
 
 
656
  /*
 
657
   * gimp-channel-set-color
 
658
   */
 
659
  procedure = gimp_procedure_new (channel_set_color_invoker);
 
660
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-channel-set-color");
 
661
  gimp_procedure_set_static_strings (procedure,
 
662
                                     "gimp-channel-set-color",
 
663
                                     "Set the compositing color of the specified channel.",
 
664
                                     "This procedure sets the specified channel's compositing color.",
 
665
                                     "Spencer Kimball & Peter Mattis",
 
666
                                     "Spencer Kimball & Peter Mattis",
 
667
                                     "1995-1996",
 
668
                                     NULL);
 
669
  gimp_procedure_add_argument (procedure,
 
670
                               gimp_param_spec_channel_id ("channel",
 
671
                                                           "channel",
 
672
                                                           "The channel",
 
673
                                                           pdb->gimp, FALSE,
 
674
                                                           GIMP_PARAM_READWRITE));
 
675
  gimp_procedure_add_argument (procedure,
 
676
                               gimp_param_spec_rgb ("color",
 
677
                                                    "color",
 
678
                                                    "The new channel compositing color",
 
679
                                                    FALSE,
 
680
                                                    NULL,
 
681
                                                    GIMP_PARAM_READWRITE));
 
682
  gimp_pdb_register_procedure (pdb, procedure);
 
683
  g_object_unref (procedure);
 
684
}