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

« back to all changes in this revision

Viewing changes to app/pdb/color_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
 
24
24
#include <glib-object.h>
25
25
 
26
26
#include "pdb-types.h"
27
 
#include "procedural_db.h"
 
27
#include "gimppdb.h"
 
28
#include "gimpprocedure.h"
 
29
#include "core/gimpparamspecs.h"
28
30
 
29
31
#include "base/color-balance.h"
30
32
#include "base/colorize.h"
37
39
#include "base/pixel-processor.h"
38
40
#include "base/pixel-region.h"
39
41
#include "base/threshold.h"
40
 
#include "config/gimpbaseconfig.h"
41
42
#include "core/gimp.h"
42
43
#include "core/gimpdrawable-desaturate.h"
43
44
#include "core/gimpdrawable-equalize.h"
48
49
#include "core/gimpimage.h"
49
50
#include "gimp-intl.h"
50
51
 
51
 
static ProcRecord brightness_contrast_proc;
52
 
static ProcRecord levels_proc;
53
 
static ProcRecord levels_auto_proc;
54
 
static ProcRecord levels_stretch_proc;
55
 
static ProcRecord posterize_proc;
56
 
static ProcRecord desaturate_proc;
57
 
static ProcRecord equalize_proc;
58
 
static ProcRecord invert_proc;
59
 
static ProcRecord curves_spline_proc;
60
 
static ProcRecord curves_explicit_proc;
61
 
static ProcRecord color_balance_proc;
62
 
static ProcRecord colorize_proc;
63
 
static ProcRecord histogram_proc;
64
 
static ProcRecord hue_saturation_proc;
65
 
static ProcRecord threshold_proc;
66
 
 
67
 
void
68
 
register_color_procs (Gimp *gimp)
69
 
{
70
 
  procedural_db_register (gimp, &brightness_contrast_proc);
71
 
  procedural_db_register (gimp, &levels_proc);
72
 
  procedural_db_register (gimp, &levels_auto_proc);
73
 
  procedural_db_register (gimp, &levels_stretch_proc);
74
 
  procedural_db_register (gimp, &posterize_proc);
75
 
  procedural_db_register (gimp, &desaturate_proc);
76
 
  procedural_db_register (gimp, &equalize_proc);
77
 
  procedural_db_register (gimp, &invert_proc);
78
 
  procedural_db_register (gimp, &curves_spline_proc);
79
 
  procedural_db_register (gimp, &curves_explicit_proc);
80
 
  procedural_db_register (gimp, &color_balance_proc);
81
 
  procedural_db_register (gimp, &colorize_proc);
82
 
  procedural_db_register (gimp, &histogram_proc);
83
 
  procedural_db_register (gimp, &hue_saturation_proc);
84
 
  procedural_db_register (gimp, &threshold_proc);
85
 
}
86
 
 
87
 
static Argument *
88
 
brightness_contrast_invoker (Gimp         *gimp,
89
 
                             GimpContext  *context,
90
 
                             GimpProgress *progress,
91
 
                             Argument     *args)
 
52
#include "internal_procs.h"
 
53
 
 
54
 
 
55
static GValueArray *
 
56
brightness_contrast_invoker (GimpProcedure     *procedure,
 
57
                             Gimp              *gimp,
 
58
                             GimpContext       *context,
 
59
                             GimpProgress      *progress,
 
60
                             const GValueArray *args)
92
61
{
93
62
  gboolean success = TRUE;
94
63
  GimpDrawable *drawable;
95
64
  gint32 brightness;
96
65
  gint32 contrast;
97
66
 
98
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
99
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
100
 
    success = FALSE;
101
 
 
102
 
  brightness = args[1].value.pdb_int;
103
 
  if (brightness < -127 || brightness > 127)
104
 
    success = FALSE;
105
 
 
106
 
  contrast = args[2].value.pdb_int;
107
 
  if (contrast < -127 || contrast > 127)
108
 
    success = FALSE;
 
67
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
68
  brightness = g_value_get_int (&args->values[1]);
 
69
  contrast = g_value_get_int (&args->values[2]);
109
70
 
110
71
  if (success)
111
72
    {
127
88
                                                 contrast / 127.0,
128
89
                                                 gimp_drawable_bytes (drawable));
129
90
 
130
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
91
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
131
92
                                 x, y, width, height, FALSE);
132
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
93
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
133
94
                                 x, y, width, height, TRUE);
134
95
 
135
 
              pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
136
 
                                              &srcPR, &destPR);
 
96
              pixel_regions_process_parallel ((PixelProcessorFunc)
 
97
                                              gimp_lut_process,
 
98
                                              lut, 2, &srcPR, &destPR);
137
99
 
138
100
              gimp_lut_free (lut);
139
101
 
143
105
        }
144
106
    }
145
107
 
146
 
  return procedural_db_return_args (&brightness_contrast_proc, success);
 
108
  return gimp_procedure_get_return_values (procedure, success);
147
109
}
148
110
 
149
 
static ProcArg brightness_contrast_inargs[] =
150
 
{
151
 
  {
152
 
    GIMP_PDB_DRAWABLE,
153
 
    "drawable",
154
 
    "The drawable"
155
 
  },
156
 
  {
157
 
    GIMP_PDB_INT32,
158
 
    "brightness",
159
 
    "Brightness adjustment: (-127 <= brightness <= 127)"
160
 
  },
161
 
  {
162
 
    GIMP_PDB_INT32,
163
 
    "contrast",
164
 
    "Contrast adjustment: (-127 <= contrast <= 127)"
165
 
  }
166
 
};
167
 
 
168
 
static ProcRecord brightness_contrast_proc =
169
 
{
170
 
  "gimp_brightness_contrast",
171
 
  "Modify brightness/contrast in the specified drawable.",
172
 
  "This procedures allows the brightness and contrast of the specified drawable to be modified. Both 'brightness' and 'contrast' parameters are defined between -127 and 127.",
173
 
  "Spencer Kimball & Peter Mattis",
174
 
  "Spencer Kimball & Peter Mattis",
175
 
  "1997",
176
 
  NULL,
177
 
  GIMP_INTERNAL,
178
 
  3,
179
 
  brightness_contrast_inargs,
180
 
  0,
181
 
  NULL,
182
 
  { { brightness_contrast_invoker } }
183
 
};
184
 
 
185
 
static Argument *
186
 
levels_invoker (Gimp         *gimp,
187
 
                GimpContext  *context,
188
 
                GimpProgress *progress,
189
 
                Argument     *args)
 
111
static GValueArray *
 
112
levels_invoker (GimpProcedure     *procedure,
 
113
                Gimp              *gimp,
 
114
                GimpContext       *context,
 
115
                GimpProgress      *progress,
 
116
                const GValueArray *args)
190
117
{
191
118
  gboolean success = TRUE;
192
119
  GimpDrawable *drawable;
197
124
  gint32 low_output;
198
125
  gint32 high_output;
199
126
 
200
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
201
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
202
 
    success = FALSE;
203
 
 
204
 
  channel = args[1].value.pdb_int;
205
 
  if (channel < GIMP_HISTOGRAM_VALUE || channel > GIMP_HISTOGRAM_ALPHA)
206
 
    success = FALSE;
207
 
 
208
 
  low_input = args[2].value.pdb_int;
209
 
  if (low_input < 0 || low_input > 255)
210
 
    success = FALSE;
211
 
 
212
 
  high_input = args[3].value.pdb_int;
213
 
  if (high_input < 0 || high_input > 255)
214
 
    success = FALSE;
215
 
 
216
 
  gamma = args[4].value.pdb_float;
217
 
  if (gamma < 0.1 || gamma > 10.0)
218
 
    success = FALSE;
219
 
 
220
 
  low_output = args[5].value.pdb_int;
221
 
  if (low_output < 0 || low_output > 255)
222
 
    success = FALSE;
223
 
 
224
 
  high_output = args[6].value.pdb_int;
225
 
  if (high_output < 0 || high_output > 255)
226
 
    success = FALSE;
 
127
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
128
  channel = g_value_get_enum (&args->values[1]);
 
129
  low_input = g_value_get_int (&args->values[2]);
 
130
  high_input = g_value_get_int (&args->values[3]);
 
131
  gamma = g_value_get_double (&args->values[4]);
 
132
  low_output = g_value_get_int (&args->values[5]);
 
133
  high_output = g_value_get_int (&args->values[6]);
227
134
 
228
135
  if (success)
229
136
    {
238
145
      if (success)
239
146
        gimp_drawable_levels (drawable, context,
240
147
                              channel,
241
 
                              low_input,
242
 
                              high_input,
 
148
                              low_input, high_input,
243
149
                              gamma,
244
 
                              low_output,
245
 
                              high_output);
246
 
    }
247
 
 
248
 
  return procedural_db_return_args (&levels_proc, success);
249
 
}
250
 
 
251
 
static ProcArg levels_inargs[] =
252
 
{
253
 
  {
254
 
    GIMP_PDB_DRAWABLE,
255
 
    "drawable",
256
 
    "The drawable"
257
 
  },
258
 
  {
259
 
    GIMP_PDB_INT32,
260
 
    "channel",
261
 
    "The channel to modify: { GIMP_HISTOGRAM_VALUE (0), GIMP_HISTOGRAM_RED (1), GIMP_HISTOGRAM_GREEN (2), GIMP_HISTOGRAM_BLUE (3), GIMP_HISTOGRAM_ALPHA (4) }"
262
 
  },
263
 
  {
264
 
    GIMP_PDB_INT32,
265
 
    "low_input",
266
 
    "Intensity of lowest input: (0 <= low_input <= 255)"
267
 
  },
268
 
  {
269
 
    GIMP_PDB_INT32,
270
 
    "high_input",
271
 
    "Intensity of highest input: (0 <= high_input <= 255)"
272
 
  },
273
 
  {
274
 
    GIMP_PDB_FLOAT,
275
 
    "gamma",
276
 
    "Gamma correction factor: (0.1 <= gamma <= 10)"
277
 
  },
278
 
  {
279
 
    GIMP_PDB_INT32,
280
 
    "low_output",
281
 
    "Intensity of lowest output: (0 <= low_output <= 255)"
282
 
  },
283
 
  {
284
 
    GIMP_PDB_INT32,
285
 
    "high_output",
286
 
    "Intensity of highest output: (0 <= high_output <= 255)"
287
 
  }
288
 
};
289
 
 
290
 
static ProcRecord levels_proc =
291
 
{
292
 
  "gimp_levels",
293
 
  "Modifies intensity levels in the specified drawable.",
294
 
  "This tool allows intensity levels in the specified drawable to be remapped according to a set of parameters. The low/high input levels specify an initial mapping from the source intensities. The gamma value determines how intensities between the low and high input intensities are interpolated. A gamma value of 1.0 results in a linear interpolation. Higher gamma values result in more high-level intensities. Lower gamma values result in more low-level intensities. The low/high output levels constrain the final intensity mapping--that is, no final intensity will be lower than the low output level and no final intensity will be higher than the high output level. This tool is only valid on RGB color and grayscale images. It will not operate on indexed drawables.",
295
 
  "Spencer Kimball & Peter Mattis",
296
 
  "Spencer Kimball & Peter Mattis",
297
 
  "1995-1996",
298
 
  NULL,
299
 
  GIMP_INTERNAL,
300
 
  7,
301
 
  levels_inargs,
302
 
  0,
303
 
  NULL,
304
 
  { { levels_invoker } }
305
 
};
306
 
 
307
 
static Argument *
308
 
levels_auto_invoker (Gimp         *gimp,
309
 
                     GimpContext  *context,
310
 
                     GimpProgress *progress,
311
 
                     Argument     *args)
312
 
{
313
 
  gboolean success = TRUE;
314
 
  GimpDrawable *drawable;
315
 
 
316
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
317
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
318
 
    success = FALSE;
319
 
 
320
 
  if (success)
321
 
    {
322
 
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
323
 
          gimp_drawable_is_indexed (drawable))
324
 
        success = FALSE;
325
 
 
326
 
      if (success)
327
 
        gimp_drawable_levels_stretch (drawable, context);
328
 
    }
329
 
 
330
 
  return procedural_db_return_args (&levels_auto_proc, success);
331
 
}
332
 
 
333
 
static ProcArg levels_auto_inargs[] =
334
 
{
335
 
  {
336
 
    GIMP_PDB_DRAWABLE,
337
 
    "drawable",
338
 
    "The drawable"
339
 
  }
340
 
};
341
 
 
342
 
static ProcRecord levels_auto_proc =
343
 
{
344
 
  "gimp_levels_auto",
345
 
  "This procedure is deprecated! Use 'gimp_levels_stretch' instead.",
346
 
  "This procedure is deprecated! Use 'gimp_levels_stretch' instead.",
347
 
  "",
348
 
  "",
349
 
  "",
350
 
  "gimp_levels_stretch",
351
 
  GIMP_INTERNAL,
352
 
  1,
353
 
  levels_auto_inargs,
354
 
  0,
355
 
  NULL,
356
 
  { { levels_auto_invoker } }
357
 
};
358
 
 
359
 
static Argument *
360
 
levels_stretch_invoker (Gimp         *gimp,
361
 
                        GimpContext  *context,
362
 
                        GimpProgress *progress,
363
 
                        Argument     *args)
364
 
{
365
 
  gboolean success = TRUE;
366
 
  GimpDrawable *drawable;
367
 
 
368
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
369
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
370
 
    success = FALSE;
371
 
 
372
 
  if (success)
373
 
    {
374
 
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
375
 
          gimp_drawable_is_indexed (drawable))
376
 
        success = FALSE;
377
 
 
378
 
      if (success)
379
 
        gimp_drawable_levels_stretch (drawable, context);
380
 
    }
381
 
 
382
 
  return procedural_db_return_args (&levels_stretch_proc, success);
383
 
}
384
 
 
385
 
static ProcArg levels_stretch_inargs[] =
386
 
{
387
 
  {
388
 
    GIMP_PDB_DRAWABLE,
389
 
    "drawable",
390
 
    "The drawable"
391
 
  }
392
 
};
393
 
 
394
 
static ProcRecord levels_stretch_proc =
395
 
{
396
 
  "gimp_levels_stretch",
397
 
  "Automatically modifies intensity levels in the specified drawable.",
398
 
  "This procedure allows intensity levels in the specified drawable to be remapped according to a set of guessed parameters. It is equivalent to clicking the \"Auto\" button in the Levels tool. This procedure is only valid on RGB color and grayscale images. It will not operate on indexed drawables.",
399
 
  "Joao S.O. Bueno, Shawn Willden",
400
 
  "Joao S.O. Bueno, Shawn Willden",
401
 
  "2003",
402
 
  NULL,
403
 
  GIMP_INTERNAL,
404
 
  1,
405
 
  levels_stretch_inargs,
406
 
  0,
407
 
  NULL,
408
 
  { { levels_stretch_invoker } }
409
 
};
410
 
 
411
 
static Argument *
412
 
posterize_invoker (Gimp         *gimp,
413
 
                   GimpContext  *context,
414
 
                   GimpProgress *progress,
415
 
                   Argument     *args)
 
150
                              low_output, high_output);
 
151
    }
 
152
 
 
153
  return gimp_procedure_get_return_values (procedure, success);
 
154
}
 
155
 
 
156
static GValueArray *
 
157
levels_auto_invoker (GimpProcedure     *procedure,
 
158
                     Gimp              *gimp,
 
159
                     GimpContext       *context,
 
160
                     GimpProgress      *progress,
 
161
                     const GValueArray *args)
 
162
{
 
163
  gboolean success = TRUE;
 
164
  GimpDrawable *drawable;
 
165
 
 
166
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
167
 
 
168
  if (success)
 
169
    {
 
170
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
 
171
          gimp_drawable_is_indexed (drawable))
 
172
        success = FALSE;
 
173
 
 
174
      if (success)
 
175
        gimp_drawable_levels_stretch (drawable, context);
 
176
    }
 
177
 
 
178
  return gimp_procedure_get_return_values (procedure, success);
 
179
}
 
180
 
 
181
static GValueArray *
 
182
levels_stretch_invoker (GimpProcedure     *procedure,
 
183
                        Gimp              *gimp,
 
184
                        GimpContext       *context,
 
185
                        GimpProgress      *progress,
 
186
                        const GValueArray *args)
 
187
{
 
188
  gboolean success = TRUE;
 
189
  GimpDrawable *drawable;
 
190
 
 
191
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
192
 
 
193
  if (success)
 
194
    {
 
195
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
 
196
          gimp_drawable_is_indexed (drawable))
 
197
        success = FALSE;
 
198
 
 
199
      if (success)
 
200
        gimp_drawable_levels_stretch (drawable, context);
 
201
    }
 
202
 
 
203
  return gimp_procedure_get_return_values (procedure, success);
 
204
}
 
205
 
 
206
static GValueArray *
 
207
posterize_invoker (GimpProcedure     *procedure,
 
208
                   Gimp              *gimp,
 
209
                   GimpContext       *context,
 
210
                   GimpProgress      *progress,
 
211
                   const GValueArray *args)
416
212
{
417
213
  gboolean success = TRUE;
418
214
  GimpDrawable *drawable;
419
215
  gint32 levels;
420
216
 
421
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
422
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
423
 
    success = FALSE;
424
 
 
425
 
  levels = args[1].value.pdb_int;
426
 
  if (levels < 2 || levels > 255)
427
 
    success = FALSE;
 
217
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
218
  levels = g_value_get_int (&args->values[1]);
428
219
 
429
220
  if (success)
430
221
    {
442
233
              GimpLut     *lut;
443
234
              PixelRegion  srcPR, destPR;
444
235
 
445
 
              lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable)); 
 
236
              lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
446
237
 
447
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
238
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
448
239
                                 x, y, width, height, FALSE);
449
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
240
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
450
241
                                 x, y, width, height, TRUE);
451
242
 
452
 
              pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
453
 
                                              &srcPR, &destPR);
 
243
              pixel_regions_process_parallel ((PixelProcessorFunc)
 
244
                                              gimp_lut_process,
 
245
                                              lut, 2, &srcPR, &destPR);
454
246
 
455
247
              gimp_lut_free (lut);
456
248
 
460
252
        }
461
253
    }
462
254
 
463
 
  return procedural_db_return_args (&posterize_proc, success);
464
 
}
465
 
 
466
 
static ProcArg posterize_inargs[] =
467
 
{
468
 
  {
469
 
    GIMP_PDB_DRAWABLE,
470
 
    "drawable",
471
 
    "The drawable"
472
 
  },
473
 
  {
474
 
    GIMP_PDB_INT32,
475
 
    "levels",
476
 
    "Levels of posterization: (2 <= levels <= 255)"
477
 
  }
478
 
};
479
 
 
480
 
static ProcRecord posterize_proc =
481
 
{
482
 
  "gimp_posterize",
483
 
  "Posterize the specified drawable.",
484
 
  "This procedures reduces the number of shades allows in each intensity channel to the specified 'levels' parameter.",
485
 
  "Spencer Kimball & Peter Mattis",
486
 
  "Spencer Kimball & Peter Mattis",
487
 
  "1997",
488
 
  NULL,
489
 
  GIMP_INTERNAL,
490
 
  2,
491
 
  posterize_inargs,
492
 
  0,
493
 
  NULL,
494
 
  { { posterize_invoker } }
495
 
};
496
 
 
497
 
static Argument *
498
 
desaturate_invoker (Gimp         *gimp,
499
 
                    GimpContext  *context,
500
 
                    GimpProgress *progress,
501
 
                    Argument     *args)
502
 
{
503
 
  gboolean success = TRUE;
504
 
  GimpDrawable *drawable;
505
 
 
506
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
507
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
508
 
    success = FALSE;
509
 
 
510
 
  if (success)
511
 
    {
512
 
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
513
 
          ! gimp_drawable_is_rgb (drawable))
514
 
        success = FALSE;
515
 
 
516
 
      if (success)
517
 
        gimp_drawable_desaturate (drawable);
518
 
    }
519
 
 
520
 
  return procedural_db_return_args (&desaturate_proc, success);
521
 
}
522
 
 
523
 
static ProcArg desaturate_inargs[] =
524
 
{
525
 
  {
526
 
    GIMP_PDB_DRAWABLE,
527
 
    "drawable",
528
 
    "The drawable"
529
 
  }
530
 
};
531
 
 
532
 
static ProcRecord desaturate_proc =
533
 
{
534
 
  "gimp_desaturate",
535
 
  "Desaturate the contents of the specified drawable.",
536
 
  "This procedure desaturates the contents of the specified drawable. This procedure only works on drawables of type RGB color.",
537
 
  "Spencer Kimball & Peter Mattis",
538
 
  "Spencer Kimball & Peter Mattis",
539
 
  "1995-1996",
540
 
  NULL,
541
 
  GIMP_INTERNAL,
542
 
  1,
543
 
  desaturate_inargs,
544
 
  0,
545
 
  NULL,
546
 
  { { desaturate_invoker } }
547
 
};
548
 
 
549
 
static Argument *
550
 
equalize_invoker (Gimp         *gimp,
551
 
                  GimpContext  *context,
552
 
                  GimpProgress *progress,
553
 
                  Argument     *args)
 
255
  return gimp_procedure_get_return_values (procedure, success);
 
256
}
 
257
 
 
258
static GValueArray *
 
259
desaturate_invoker (GimpProcedure     *procedure,
 
260
                    Gimp              *gimp,
 
261
                    GimpContext       *context,
 
262
                    GimpProgress      *progress,
 
263
                    const GValueArray *args)
 
264
{
 
265
  gboolean success = TRUE;
 
266
  GimpDrawable *drawable;
 
267
 
 
268
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
269
 
 
270
  if (success)
 
271
    {
 
272
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
 
273
          ! gimp_drawable_is_rgb (drawable))
 
274
        success = FALSE;
 
275
 
 
276
      if (success)
 
277
        gimp_drawable_desaturate (drawable, GIMP_DESATURATE_LIGHTNESS);
 
278
    }
 
279
 
 
280
  return gimp_procedure_get_return_values (procedure, success);
 
281
}
 
282
 
 
283
static GValueArray *
 
284
desaturate_full_invoker (GimpProcedure     *procedure,
 
285
                         Gimp              *gimp,
 
286
                         GimpContext       *context,
 
287
                         GimpProgress      *progress,
 
288
                         const GValueArray *args)
 
289
{
 
290
  gboolean success = TRUE;
 
291
  GimpDrawable *drawable;
 
292
  gint32 desaturate_mode;
 
293
 
 
294
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
295
  desaturate_mode = g_value_get_enum (&args->values[1]);
 
296
 
 
297
  if (success)
 
298
    {
 
299
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
 
300
          ! gimp_drawable_is_rgb (drawable))
 
301
        success = FALSE;
 
302
 
 
303
      if (success)
 
304
        gimp_drawable_desaturate (drawable, desaturate_mode);
 
305
    }
 
306
 
 
307
  return gimp_procedure_get_return_values (procedure, success);
 
308
}
 
309
 
 
310
static GValueArray *
 
311
equalize_invoker (GimpProcedure     *procedure,
 
312
                  Gimp              *gimp,
 
313
                  GimpContext       *context,
 
314
                  GimpProgress      *progress,
 
315
                  const GValueArray *args)
554
316
{
555
317
  gboolean success = TRUE;
556
318
  GimpDrawable *drawable;
557
319
  gboolean mask_only;
558
320
 
559
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
560
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
561
 
    success = FALSE;
562
 
 
563
 
  mask_only = args[1].value.pdb_int ? TRUE : FALSE;
 
321
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
322
  mask_only = g_value_get_boolean (&args->values[1]);
564
323
 
565
324
  if (success)
566
325
    {
572
331
        gimp_drawable_equalize (drawable, mask_only);
573
332
    }
574
333
 
575
 
  return procedural_db_return_args (&equalize_proc, success);
 
334
  return gimp_procedure_get_return_values (procedure, success);
576
335
}
577
336
 
578
 
static ProcArg equalize_inargs[] =
579
 
{
580
 
  {
581
 
    GIMP_PDB_DRAWABLE,
582
 
    "drawable",
583
 
    "The drawable"
584
 
  },
585
 
  {
586
 
    GIMP_PDB_INT32,
587
 
    "mask_only",
588
 
    "Equalization option"
589
 
  }
590
 
};
591
 
 
592
 
static ProcRecord equalize_proc =
593
 
{
594
 
  "gimp_equalize",
595
 
  "Equalize the contents of the specified drawable.",
596
 
  "This procedure equalizes the contents of the specified drawable. Each intensity channel is equalizeed independently. The equalized intensity is given as inten' = (255 - inten). Indexed color drawables are not valid for this operation. The 'mask_only' option specifies whether to adjust only the area of the image within the selection bounds, or the entire image based on the histogram of the selected area. If there is no selection, the entire image is adjusted based on the histogram for the entire image.",
597
 
  "Spencer Kimball & Peter Mattis",
598
 
  "Spencer Kimball & Peter Mattis",
599
 
  "1995-1996",
600
 
  NULL,
601
 
  GIMP_INTERNAL,
602
 
  2,
603
 
  equalize_inargs,
604
 
  0,
605
 
  NULL,
606
 
  { { equalize_invoker } }
607
 
};
608
 
 
609
 
static Argument *
610
 
invert_invoker (Gimp         *gimp,
611
 
                GimpContext  *context,
612
 
                GimpProgress *progress,
613
 
                Argument     *args)
 
337
static GValueArray *
 
338
invert_invoker (GimpProcedure     *procedure,
 
339
                Gimp              *gimp,
 
340
                GimpContext       *context,
 
341
                GimpProgress      *progress,
 
342
                const GValueArray *args)
614
343
{
615
344
  gboolean success = TRUE;
616
345
  GimpDrawable *drawable;
617
346
 
618
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
619
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
620
 
    success = FALSE;
 
347
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
621
348
 
622
349
  if (success)
623
350
    {
629
356
        gimp_drawable_invert (drawable);
630
357
    }
631
358
 
632
 
  return procedural_db_return_args (&invert_proc, success);
 
359
  return gimp_procedure_get_return_values (procedure, success);
633
360
}
634
361
 
635
 
static ProcArg invert_inargs[] =
636
 
{
637
 
  {
638
 
    GIMP_PDB_DRAWABLE,
639
 
    "drawable",
640
 
    "The drawable"
641
 
  }
642
 
};
643
 
 
644
 
static ProcRecord invert_proc =
645
 
{
646
 
  "gimp_invert",
647
 
  "Invert the contents of the specified drawable.",
648
 
  "This procedure inverts the contents of the specified drawable. Each intensity channel is inverted independently. The inverted intensity is given as inten' = (255 - inten). Indexed color drawables are not valid for this operation.",
649
 
  "Spencer Kimball & Peter Mattis",
650
 
  "Spencer Kimball & Peter Mattis",
651
 
  "1995-1996",
652
 
  NULL,
653
 
  GIMP_INTERNAL,
654
 
  1,
655
 
  invert_inargs,
656
 
  0,
657
 
  NULL,
658
 
  { { invert_invoker } }
659
 
};
660
 
 
661
 
static Argument *
662
 
curves_spline_invoker (Gimp         *gimp,
663
 
                       GimpContext  *context,
664
 
                       GimpProgress *progress,
665
 
                       Argument     *args)
 
362
static GValueArray *
 
363
curves_spline_invoker (GimpProcedure     *procedure,
 
364
                       Gimp              *gimp,
 
365
                       GimpContext       *context,
 
366
                       GimpProgress      *progress,
 
367
                       const GValueArray *args)
666
368
{
667
369
  gboolean success = TRUE;
668
370
  GimpDrawable *drawable;
669
371
  gint32 channel;
670
372
  gint32 num_points;
671
 
  guint8 *control_pts;
672
 
 
673
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
674
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
675
 
    success = FALSE;
676
 
 
677
 
  channel = args[1].value.pdb_int;
678
 
  if (channel < GIMP_HISTOGRAM_VALUE || channel > GIMP_HISTOGRAM_ALPHA)
679
 
    success = FALSE;
680
 
 
681
 
  num_points = args[2].value.pdb_int;
682
 
  if (num_points <= 3 || num_points > 34)
683
 
    success = FALSE;
684
 
 
685
 
  control_pts = (guint8 *) args[3].value.pdb_pointer;
 
373
  const guint8 *control_pts;
 
374
 
 
375
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
376
  channel = g_value_get_enum (&args->values[1]);
 
377
  num_points = g_value_get_int (&args->values[2]);
 
378
  control_pts = gimp_value_get_int8array (&args->values[3]);
686
379
 
687
380
  if (success)
688
381
    {
732
425
                              &c,
733
426
                              gimp_drawable_bytes (drawable));
734
427
 
735
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
428
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
736
429
                                 x, y, width, height, FALSE);
737
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
430
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
738
431
                                 x, y, width, height, TRUE);
739
432
 
740
 
              pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
741
 
                                              &srcPR, &destPR);
 
433
              pixel_regions_process_parallel ((PixelProcessorFunc)
 
434
                                              gimp_lut_process,
 
435
                                              lut, 2, &srcPR, &destPR);
742
436
 
743
437
              gimp_lut_free (lut);
744
438
 
748
442
        }
749
443
    }
750
444
 
751
 
  return procedural_db_return_args (&curves_spline_proc, success);
 
445
  return gimp_procedure_get_return_values (procedure, success);
752
446
}
753
447
 
754
 
static ProcArg curves_spline_inargs[] =
755
 
{
756
 
  {
757
 
    GIMP_PDB_DRAWABLE,
758
 
    "drawable",
759
 
    "The drawable"
760
 
  },
761
 
  {
762
 
    GIMP_PDB_INT32,
763
 
    "channel",
764
 
    "The channel to modify: { GIMP_HISTOGRAM_VALUE (0), GIMP_HISTOGRAM_RED (1), GIMP_HISTOGRAM_GREEN (2), GIMP_HISTOGRAM_BLUE (3), GIMP_HISTOGRAM_ALPHA (4) }"
765
 
  },
766
 
  {
767
 
    GIMP_PDB_INT32,
768
 
    "num_points",
769
 
    "The number of values in the control point array (3 < num_points <= 34)"
770
 
  },
771
 
  {
772
 
    GIMP_PDB_INT8ARRAY,
773
 
    "control_pts",
774
 
    "The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }"
775
 
  }
776
 
};
777
 
 
778
 
static ProcRecord curves_spline_proc =
779
 
{
780
 
  "gimp_curves_spline",
781
 
  "Modifies the intensity curve(s) for specified drawable.",
782
 
  "Modifies the intensity mapping for one channel in the specified drawable. The drawable must be either grayscale or RGB, and the channel can be either an intensity component, or the value. The 'control_pts' parameter is an array of integers which define a set of control points which describe a Catmull Rom spline which yields the final intensity curve. Use the 'gimp_curves_explicit' function to explicitly modify intensity levels.",
783
 
  "Spencer Kimball & Peter Mattis",
784
 
  "Spencer Kimball & Peter Mattis",
785
 
  "1995-1996",
786
 
  NULL,
787
 
  GIMP_INTERNAL,
788
 
  4,
789
 
  curves_spline_inargs,
790
 
  0,
791
 
  NULL,
792
 
  { { curves_spline_invoker } }
793
 
};
794
 
 
795
 
static Argument *
796
 
curves_explicit_invoker (Gimp         *gimp,
797
 
                         GimpContext  *context,
798
 
                         GimpProgress *progress,
799
 
                         Argument     *args)
 
448
static GValueArray *
 
449
curves_explicit_invoker (GimpProcedure     *procedure,
 
450
                         Gimp              *gimp,
 
451
                         GimpContext       *context,
 
452
                         GimpProgress      *progress,
 
453
                         const GValueArray *args)
800
454
{
801
455
  gboolean success = TRUE;
802
456
  GimpDrawable *drawable;
803
457
  gint32 channel;
804
458
  gint32 num_bytes;
805
 
  guint8 *curve;
806
 
 
807
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
808
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
809
 
    success = FALSE;
810
 
 
811
 
  channel = args[1].value.pdb_int;
812
 
  if (channel < GIMP_HISTOGRAM_VALUE || channel > GIMP_HISTOGRAM_ALPHA)
813
 
    success = FALSE;
814
 
 
815
 
  num_bytes = args[2].value.pdb_int;
816
 
  if (num_bytes <= 0)
817
 
    success = FALSE;
818
 
 
819
 
  curve = (guint8 *) args[3].value.pdb_pointer;
 
459
  const guint8 *curve;
 
460
 
 
461
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
462
  channel = g_value_get_enum (&args->values[1]);
 
463
  num_bytes = g_value_get_int (&args->values[2]);
 
464
  curve = gimp_value_get_int8array (&args->values[3]);
820
465
 
821
466
  if (success)
822
467
    {
857
502
                              &c,
858
503
                              gimp_drawable_bytes (drawable));
859
504
 
860
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
505
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
861
506
                                 x, y, width, height, FALSE);
862
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
507
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
863
508
                                 x, y, width, height, TRUE);
864
509
 
865
 
              pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
866
 
                                              &srcPR, &destPR);
 
510
              pixel_regions_process_parallel ((PixelProcessorFunc)
 
511
                                              gimp_lut_process,
 
512
                                              lut, 2, &srcPR, &destPR);
867
513
 
868
514
              gimp_lut_free (lut);
869
515
 
873
519
        }
874
520
    }
875
521
 
876
 
  return procedural_db_return_args (&curves_explicit_proc, success);
 
522
  return gimp_procedure_get_return_values (procedure, success);
877
523
}
878
524
 
879
 
static ProcArg curves_explicit_inargs[] =
880
 
{
881
 
  {
882
 
    GIMP_PDB_DRAWABLE,
883
 
    "drawable",
884
 
    "The drawable"
885
 
  },
886
 
  {
887
 
    GIMP_PDB_INT32,
888
 
    "channel",
889
 
    "The channel to modify: { GIMP_HISTOGRAM_VALUE (0), GIMP_HISTOGRAM_RED (1), GIMP_HISTOGRAM_GREEN (2), GIMP_HISTOGRAM_BLUE (3), GIMP_HISTOGRAM_ALPHA (4) }"
890
 
  },
891
 
  {
892
 
    GIMP_PDB_INT32,
893
 
    "num_bytes",
894
 
    "The number of bytes in the new curve (always 256)"
895
 
  },
896
 
  {
897
 
    GIMP_PDB_INT8ARRAY,
898
 
    "curve",
899
 
    "The explicit curve"
900
 
  }
901
 
};
902
 
 
903
 
static ProcRecord curves_explicit_proc =
904
 
{
905
 
  "gimp_curves_explicit",
906
 
  "Modifies the intensity curve(s) for specified drawable.",
907
 
  "Modifies the intensity mapping for one channel in the specified drawable. The drawable must be either grayscale or RGB, and the channel can be either an intensity component, or the value. The 'curve' parameter is an array of bytes which explicitly defines how each pixel value in the drawable will be modified. Use the 'gimp_curves_spline' function to modify intensity levels with Catmull Rom splines.",
908
 
  "Spencer Kimball & Peter Mattis",
909
 
  "Spencer Kimball & Peter Mattis",
910
 
  "1995-1996",
911
 
  NULL,
912
 
  GIMP_INTERNAL,
913
 
  4,
914
 
  curves_explicit_inargs,
915
 
  0,
916
 
  NULL,
917
 
  { { curves_explicit_invoker } }
918
 
};
919
 
 
920
 
static Argument *
921
 
color_balance_invoker (Gimp         *gimp,
922
 
                       GimpContext  *context,
923
 
                       GimpProgress *progress,
924
 
                       Argument     *args)
 
525
static GValueArray *
 
526
color_balance_invoker (GimpProcedure     *procedure,
 
527
                       Gimp              *gimp,
 
528
                       GimpContext       *context,
 
529
                       GimpProgress      *progress,
 
530
                       const GValueArray *args)
925
531
{
926
532
  gboolean success = TRUE;
927
533
  GimpDrawable *drawable;
931
537
  gdouble magenta_green;
932
538
  gdouble yellow_blue;
933
539
 
934
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
935
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
936
 
    success = FALSE;
937
 
 
938
 
  transfer_mode = args[1].value.pdb_int;
939
 
  if (transfer_mode < GIMP_SHADOWS || transfer_mode > GIMP_HIGHLIGHTS)
940
 
    success = FALSE;
941
 
 
942
 
  preserve_lum = args[2].value.pdb_int ? TRUE : FALSE;
943
 
 
944
 
  cyan_red = args[3].value.pdb_float;
945
 
  if (cyan_red < -100.0 || cyan_red > 100.0)
946
 
    success = FALSE;
947
 
 
948
 
  magenta_green = args[4].value.pdb_float;
949
 
  if (magenta_green < -100.0 || magenta_green > 100.0)
950
 
    success = FALSE;
951
 
 
952
 
  yellow_blue = args[5].value.pdb_float;
953
 
  if (yellow_blue < -100.0 || yellow_blue > 100.0)
954
 
    success = FALSE;
 
540
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
541
  transfer_mode = g_value_get_enum (&args->values[1]);
 
542
  preserve_lum = g_value_get_boolean (&args->values[2]);
 
543
  cyan_red = g_value_get_double (&args->values[3]);
 
544
  magenta_green = g_value_get_double (&args->values[4]);
 
545
  yellow_blue = g_value_get_double (&args->values[5]);
955
546
 
956
547
  if (success)
957
548
    {
966
557
          /* The application should occur only within selection bounds */
967
558
          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
968
559
            {
969
 
              ColorBalance         cb;
970
 
              PixelRegionIterator *pr;
971
 
              PixelRegion          srcPR, destPR;
 
560
              ColorBalance  cb;
 
561
              PixelRegion   srcPR, destPR;
972
562
 
973
563
              color_balance_init (&cb);
974
564
 
980
570
 
981
571
              color_balance_create_lookup_tables (&cb);
982
572
 
983
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
573
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
984
574
                                 x, y, width, height, FALSE);
985
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
575
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
986
576
                                 x, y, width, height, TRUE);
987
577
 
988
 
              for (pr = pixel_regions_register (2, &srcPR, &destPR);
989
 
                   pr;
990
 
                   pr = pixel_regions_process (pr))
991
 
                {
992
 
                  color_balance (&srcPR, &destPR, &cb);
993
 
                }
 
578
              pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
 
579
                                              &cb, 2, &srcPR, &destPR);
994
580
 
995
581
              gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
996
582
              gimp_drawable_update (drawable, x, y, width, height);
998
584
        }
999
585
    }
1000
586
 
1001
 
  return procedural_db_return_args (&color_balance_proc, success);
 
587
  return gimp_procedure_get_return_values (procedure, success);
1002
588
}
1003
589
 
1004
 
static ProcArg color_balance_inargs[] =
1005
 
{
1006
 
  {
1007
 
    GIMP_PDB_DRAWABLE,
1008
 
    "drawable",
1009
 
    "The drawable"
1010
 
  },
1011
 
  {
1012
 
    GIMP_PDB_INT32,
1013
 
    "transfer_mode",
1014
 
    "Transfer mode: { GIMP_SHADOWS (0), GIMP_MIDTONES (1), GIMP_HIGHLIGHTS (2) }"
1015
 
  },
1016
 
  {
1017
 
    GIMP_PDB_INT32,
1018
 
    "preserve_lum",
1019
 
    "Preserve luminosity values at each pixel"
1020
 
  },
1021
 
  {
1022
 
    GIMP_PDB_FLOAT,
1023
 
    "cyan_red",
1024
 
    "Cyan-Red color balance: (-100 <= cyan_red <= 100)"
1025
 
  },
1026
 
  {
1027
 
    GIMP_PDB_FLOAT,
1028
 
    "magenta_green",
1029
 
    "Magenta-Green color balance: (-100 <= magenta_green <= 100)"
1030
 
  },
1031
 
  {
1032
 
    GIMP_PDB_FLOAT,
1033
 
    "yellow_blue",
1034
 
    "Yellow-Blue color balance: (-100 <= yellow_blue <= 100)"
1035
 
  }
1036
 
};
1037
 
 
1038
 
static ProcRecord color_balance_proc =
1039
 
{
1040
 
  "gimp_color_balance",
1041
 
  "Modify the color balance of the specified drawable.",
1042
 
  "Modify the color balance of the specified drawable. There are three axis which can be modified: cyan-red, magenta-green, and yellow-blue. Negative values increase the amount of the former, positive values increase the amount of the latter. Color balance can be controlled with the 'transfer_mode' setting, which allows shadows, midtones, and highlights in an image to be affected differently. The 'preserve_lum' parameter, if non-zero, ensures that the luminosity of each pixel remains fixed.",
1043
 
  "Spencer Kimball & Peter Mattis",
1044
 
  "Spencer Kimball & Peter Mattis",
1045
 
  "1997",
1046
 
  NULL,
1047
 
  GIMP_INTERNAL,
1048
 
  6,
1049
 
  color_balance_inargs,
1050
 
  0,
1051
 
  NULL,
1052
 
  { { color_balance_invoker } }
1053
 
};
1054
 
 
1055
 
static Argument *
1056
 
colorize_invoker (Gimp         *gimp,
1057
 
                  GimpContext  *context,
1058
 
                  GimpProgress *progress,
1059
 
                  Argument     *args)
 
590
static GValueArray *
 
591
colorize_invoker (GimpProcedure     *procedure,
 
592
                  Gimp              *gimp,
 
593
                  GimpContext       *context,
 
594
                  GimpProgress      *progress,
 
595
                  const GValueArray *args)
1060
596
{
1061
597
  gboolean success = TRUE;
1062
598
  GimpDrawable *drawable;
1064
600
  gdouble saturation;
1065
601
  gdouble lightness;
1066
602
 
1067
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1068
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1069
 
    success = FALSE;
1070
 
 
1071
 
  hue = args[1].value.pdb_float;
1072
 
  if (hue < 0.0 || hue > 360.0)
1073
 
    success = FALSE;
1074
 
 
1075
 
  saturation = args[2].value.pdb_float;
1076
 
  if (saturation < 0.0 || saturation > 100.0)
1077
 
    success = FALSE;
1078
 
 
1079
 
  lightness = args[3].value.pdb_float;
1080
 
  if (lightness < -100.0 || lightness > 100.0)
1081
 
    success = FALSE;
 
603
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
604
  hue = g_value_get_double (&args->values[1]);
 
605
  saturation = g_value_get_double (&args->values[2]);
 
606
  lightness = g_value_get_double (&args->values[3]);
1082
607
 
1083
608
  if (success)
1084
609
    {
1093
618
          /* The application should occur only within selection bounds */
1094
619
          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
1095
620
            {
1096
 
              Colorize             colors;
1097
 
              PixelRegionIterator *pr;
1098
 
              PixelRegion          srcPR, destPR;
 
621
              Colorize     colors;
 
622
              PixelRegion  srcPR, destPR;
1099
623
 
1100
624
              colorize_init (&colors);
1101
625
 
1105
629
 
1106
630
              colorize_calculate (&colors);
1107
631
 
1108
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
632
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
1109
633
                                 x, y, width, height, FALSE);
1110
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
634
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
1111
635
                                 x, y, width, height, TRUE);
1112
636
 
1113
 
              for (pr = pixel_regions_register (2, &srcPR, &destPR);
1114
 
                   pr;
1115
 
                   pr = pixel_regions_process (pr))
1116
 
                {
1117
 
                  colorize (&srcPR, &destPR, &colors);
1118
 
                }
 
637
              pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
 
638
                                              &colors, 2, &srcPR, &destPR);
1119
639
 
1120
640
              gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
1121
641
              gimp_drawable_update (drawable, x, y, width, height);
1123
643
        }
1124
644
    }
1125
645
 
1126
 
  return procedural_db_return_args (&colorize_proc, success);
 
646
  return gimp_procedure_get_return_values (procedure, success);
1127
647
}
1128
648
 
1129
 
static ProcArg colorize_inargs[] =
1130
 
{
1131
 
  {
1132
 
    GIMP_PDB_DRAWABLE,
1133
 
    "drawable",
1134
 
    "The drawable"
1135
 
  },
1136
 
  {
1137
 
    GIMP_PDB_FLOAT,
1138
 
    "hue",
1139
 
    "Hue in degrees: (0 <= hue <= 360)"
1140
 
  },
1141
 
  {
1142
 
    GIMP_PDB_FLOAT,
1143
 
    "saturation",
1144
 
    "Saturation in percent: (0 <= saturation <= 100)"
1145
 
  },
1146
 
  {
1147
 
    GIMP_PDB_FLOAT,
1148
 
    "lightness",
1149
 
    "Lightness in percent: (-100 <= lightness <= 100)"
1150
 
  }
1151
 
};
1152
 
 
1153
 
static ProcRecord colorize_proc =
1154
 
{
1155
 
  "gimp_colorize",
1156
 
  "Render the drawable as a grayscale image seen through a colored glass.",
1157
 
  "Desatures the drawable, then tints it with the specified color. This tool is only valid on RGB color images. It will not operate on grayscale or indexed drawables.",
1158
 
  "Spencer Kimball & Peter Mattis",
1159
 
  "Spencer Kimball & Peter Mattis",
1160
 
  "2004",
1161
 
  NULL,
1162
 
  GIMP_INTERNAL,
1163
 
  4,
1164
 
  colorize_inargs,
1165
 
  0,
1166
 
  NULL,
1167
 
  { { colorize_invoker } }
1168
 
};
1169
 
 
1170
 
static Argument *
1171
 
histogram_invoker (Gimp         *gimp,
1172
 
                   GimpContext  *context,
1173
 
                   GimpProgress *progress,
1174
 
                   Argument     *args)
 
649
static GValueArray *
 
650
histogram_invoker (GimpProcedure     *procedure,
 
651
                   Gimp              *gimp,
 
652
                   GimpContext       *context,
 
653
                   GimpProgress      *progress,
 
654
                   const GValueArray *args)
1175
655
{
1176
656
  gboolean success = TRUE;
1177
 
  Argument *return_args;
 
657
  GValueArray *return_vals;
1178
658
  GimpDrawable *drawable;
1179
659
  gint32 channel;
1180
660
  gint32 start_range;
1181
661
  gint32 end_range;
1182
 
  gdouble mean = 0;
1183
 
  gdouble std_dev = 0;
1184
 
  gdouble median = 0;
1185
 
  gdouble pixels = 0;
1186
 
  gdouble count = 0;
1187
 
  gdouble percentile = 0;
1188
 
 
1189
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1190
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1191
 
    success = FALSE;
1192
 
 
1193
 
  channel = args[1].value.pdb_int;
1194
 
  if (channel < GIMP_HISTOGRAM_VALUE || channel > GIMP_HISTOGRAM_ALPHA)
1195
 
    success = FALSE;
1196
 
 
1197
 
  start_range = args[2].value.pdb_int;
1198
 
  if (start_range < 0 || start_range >= 256)
1199
 
    success = FALSE;
1200
 
 
1201
 
  end_range = args[3].value.pdb_int;
1202
 
  if (end_range < 0 || end_range >= 256)
1203
 
    success = FALSE;
 
662
  gdouble mean = 0.0;
 
663
  gdouble std_dev = 0.0;
 
664
  gdouble median = 0.0;
 
665
  gdouble pixels = 0.0;
 
666
  gdouble count = 0.0;
 
667
  gdouble percentile = 0.0;
 
668
 
 
669
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
670
  channel = g_value_get_enum (&args->values[1]);
 
671
  start_range = g_value_get_int (&args->values[2]);
 
672
  end_range = g_value_get_int (&args->values[3]);
1204
673
 
1205
674
  if (success)
1206
675
    {
1214
683
 
1215
684
      if (success)
1216
685
        {
1217
 
          GimpHistogram *histogram;
1218
 
 
1219
 
          histogram = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
 
686
          GimpHistogram *histogram = gimp_histogram_new ();
1220
687
 
1221
688
          gimp_drawable_calculate_histogram (drawable, histogram);
1222
689
 
1235
702
        }
1236
703
    }
1237
704
 
1238
 
  return_args = procedural_db_return_args (&histogram_proc, success);
 
705
  return_vals = gimp_procedure_get_return_values (procedure, success);
1239
706
 
1240
707
  if (success)
1241
708
    {
1242
 
      return_args[1].value.pdb_float = mean;
1243
 
      return_args[2].value.pdb_float = std_dev;
1244
 
      return_args[3].value.pdb_float = median;
1245
 
      return_args[4].value.pdb_float = pixels;
1246
 
      return_args[5].value.pdb_float = count;
1247
 
      return_args[6].value.pdb_float = percentile;
 
709
      g_value_set_double (&return_vals->values[1], mean);
 
710
      g_value_set_double (&return_vals->values[2], std_dev);
 
711
      g_value_set_double (&return_vals->values[3], median);
 
712
      g_value_set_double (&return_vals->values[4], pixels);
 
713
      g_value_set_double (&return_vals->values[5], count);
 
714
      g_value_set_double (&return_vals->values[6], percentile);
1248
715
    }
1249
716
 
1250
 
  return return_args;
 
717
  return return_vals;
1251
718
}
1252
719
 
1253
 
static ProcArg histogram_inargs[] =
1254
 
{
1255
 
  {
1256
 
    GIMP_PDB_DRAWABLE,
1257
 
    "drawable",
1258
 
    "The drawable"
1259
 
  },
1260
 
  {
1261
 
    GIMP_PDB_INT32,
1262
 
    "channel",
1263
 
    "The channel to modify: { GIMP_HISTOGRAM_VALUE (0), GIMP_HISTOGRAM_RED (1), GIMP_HISTOGRAM_GREEN (2), GIMP_HISTOGRAM_BLUE (3), GIMP_HISTOGRAM_ALPHA (4) }"
1264
 
  },
1265
 
  {
1266
 
    GIMP_PDB_INT32,
1267
 
    "start_range",
1268
 
    "Start of the intensity measurement range"
1269
 
  },
1270
 
  {
1271
 
    GIMP_PDB_INT32,
1272
 
    "end_range",
1273
 
    "End of the intensity measurement range"
1274
 
  }
1275
 
};
1276
 
 
1277
 
static ProcArg histogram_outargs[] =
1278
 
{
1279
 
  {
1280
 
    GIMP_PDB_FLOAT,
1281
 
    "mean",
1282
 
    "Mean intensity value"
1283
 
  },
1284
 
  {
1285
 
    GIMP_PDB_FLOAT,
1286
 
    "std_dev",
1287
 
    "Standard deviation of intensity values"
1288
 
  },
1289
 
  {
1290
 
    GIMP_PDB_FLOAT,
1291
 
    "median",
1292
 
    "Median intensity value"
1293
 
  },
1294
 
  {
1295
 
    GIMP_PDB_FLOAT,
1296
 
    "pixels",
1297
 
    "Alpha-weighted pixel count for entire image"
1298
 
  },
1299
 
  {
1300
 
    GIMP_PDB_FLOAT,
1301
 
    "count",
1302
 
    "Alpha-weighted pixel count for range"
1303
 
  },
1304
 
  {
1305
 
    GIMP_PDB_FLOAT,
1306
 
    "percentile",
1307
 
    "Percentile that range falls under"
1308
 
  }
1309
 
};
1310
 
 
1311
 
static ProcRecord histogram_proc =
1312
 
{
1313
 
  "gimp_histogram",
1314
 
  "Returns information on the intensity histogram for the specified drawable.",
1315
 
  "This tool makes it possible to gather information about the intensity histogram of a drawable. A channel to examine is first specified. This can be either value, red, green, or blue, depending on whether the drawable is of type color or grayscale. The drawable may not be indexed. Second, a range of intensities are specified. The gimp_histogram function returns statistics based on the pixels in the drawable that fall under this range of values. Mean, standard deviation, median, number of pixels, and percentile are all returned. Additionally, the total count of pixels in the image is returned. Counts of pixels are weighted by any associated alpha values and by the current selection mask. That is, pixels that lie outside an active selection mask will not be counted. Similarly, pixels with transparent alpha values will not be counted.",
1316
 
  "Spencer Kimball & Peter Mattis",
1317
 
  "Spencer Kimball & Peter Mattis",
1318
 
  "1995-1996",
1319
 
  NULL,
1320
 
  GIMP_INTERNAL,
1321
 
  4,
1322
 
  histogram_inargs,
1323
 
  6,
1324
 
  histogram_outargs,
1325
 
  { { histogram_invoker } }
1326
 
};
1327
 
 
1328
 
static Argument *
1329
 
hue_saturation_invoker (Gimp         *gimp,
1330
 
                        GimpContext  *context,
1331
 
                        GimpProgress *progress,
1332
 
                        Argument     *args)
 
720
static GValueArray *
 
721
hue_saturation_invoker (GimpProcedure     *procedure,
 
722
                        Gimp              *gimp,
 
723
                        GimpContext       *context,
 
724
                        GimpProgress      *progress,
 
725
                        const GValueArray *args)
1333
726
{
1334
727
  gboolean success = TRUE;
1335
728
  GimpDrawable *drawable;
1338
731
  gdouble lightness;
1339
732
  gdouble saturation;
1340
733
 
1341
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1342
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1343
 
    success = FALSE;
1344
 
 
1345
 
  hue_range = args[1].value.pdb_int;
1346
 
  if (hue_range < GIMP_ALL_HUES || hue_range > GIMP_MAGENTA_HUES)
1347
 
    success = FALSE;
1348
 
 
1349
 
  hue_offset = args[2].value.pdb_float;
1350
 
  if (hue_offset < -180.0 || hue_offset > 180.0)
1351
 
    success = FALSE;
1352
 
 
1353
 
  lightness = args[3].value.pdb_float;
1354
 
  if (lightness < -100.0 || lightness > 100.0)
1355
 
    success = FALSE;
1356
 
 
1357
 
  saturation = args[4].value.pdb_float;
1358
 
  if (saturation < -100.0 || saturation > 100.0)
1359
 
    success = FALSE;
 
734
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
735
  hue_range = g_value_get_enum (&args->values[1]);
 
736
  hue_offset = g_value_get_double (&args->values[2]);
 
737
  lightness = g_value_get_double (&args->values[3]);
 
738
  saturation = g_value_get_double (&args->values[4]);
1360
739
 
1361
740
  if (success)
1362
741
    {
1371
750
          /* The application should occur only within selection bounds */
1372
751
          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
1373
752
            {
1374
 
              HueSaturation        hs;
1375
 
              PixelRegionIterator *pr;
1376
 
              PixelRegion          srcPR, destPR;
 
753
              HueSaturation  hs;
 
754
              PixelRegion    srcPR, destPR;
1377
755
 
1378
756
              hue_saturation_init (&hs);
1379
757
 
1384
762
              /* Calculate the transfer arrays */
1385
763
              hue_saturation_calculate_transfers (&hs);
1386
764
 
1387
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
765
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
1388
766
                                 x, y, width, height, FALSE);
1389
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
767
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
1390
768
                                 x, y, width, height, TRUE);
1391
769
 
1392
 
              for (pr = pixel_regions_register (2, &srcPR, &destPR);
1393
 
                   pr;
1394
 
                   pr = pixel_regions_process (pr))
1395
 
                {
1396
 
                  hue_saturation (&srcPR, &destPR, &hs);
1397
 
                }
 
770
              pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
 
771
                                              &hs, 2, &srcPR, &destPR);
1398
772
 
1399
773
              gimp_drawable_merge_shadow (drawable, TRUE, _("Hue-Saturation"));
1400
774
              gimp_drawable_update (drawable, x, y, width, height);
1402
776
        }
1403
777
    }
1404
778
 
1405
 
  return procedural_db_return_args (&hue_saturation_proc, success);
 
779
  return gimp_procedure_get_return_values (procedure, success);
1406
780
}
1407
781
 
1408
 
static ProcArg hue_saturation_inargs[] =
1409
 
{
1410
 
  {
1411
 
    GIMP_PDB_DRAWABLE,
1412
 
    "drawable",
1413
 
    "The drawable"
1414
 
  },
1415
 
  {
1416
 
    GIMP_PDB_INT32,
1417
 
    "hue_range",
1418
 
    "Range of affected hues: { GIMP_ALL_HUES (0), GIMP_RED_HUES (1), GIMP_YELLOW_HUES (2), GIMP_GREEN_HUES (3), GIMP_CYAN_HUES (4), GIMP_BLUE_HUES (5), GIMP_MAGENTA_HUES (6) }"
1419
 
  },
1420
 
  {
1421
 
    GIMP_PDB_FLOAT,
1422
 
    "hue_offset",
1423
 
    "Hue offset in degrees: (-180 <= hue_offset <= 180)"
1424
 
  },
1425
 
  {
1426
 
    GIMP_PDB_FLOAT,
1427
 
    "lightness",
1428
 
    "lightness modification: (-100 <= lightness <= 100)"
1429
 
  },
1430
 
  {
1431
 
    GIMP_PDB_FLOAT,
1432
 
    "saturation",
1433
 
    "saturation modification: (-100 <= saturation <= 100)"
1434
 
  }
1435
 
};
1436
 
 
1437
 
static ProcRecord hue_saturation_proc =
1438
 
{
1439
 
  "gimp_hue_saturation",
1440
 
  "Modify hue, lightness, and saturation in the specified drawable.",
1441
 
  "This procedures allows the hue, lightness, and saturation in the specified drawable to be modified. The 'hue_range' parameter provides the capability to limit range of affected hues.",
1442
 
  "Spencer Kimball & Peter Mattis",
1443
 
  "Spencer Kimball & Peter Mattis",
1444
 
  "1997",
1445
 
  NULL,
1446
 
  GIMP_INTERNAL,
1447
 
  5,
1448
 
  hue_saturation_inargs,
1449
 
  0,
1450
 
  NULL,
1451
 
  { { hue_saturation_invoker } }
1452
 
};
1453
 
 
1454
 
static Argument *
1455
 
threshold_invoker (Gimp         *gimp,
1456
 
                   GimpContext  *context,
1457
 
                   GimpProgress *progress,
1458
 
                   Argument     *args)
 
782
static GValueArray *
 
783
threshold_invoker (GimpProcedure     *procedure,
 
784
                   Gimp              *gimp,
 
785
                   GimpContext       *context,
 
786
                   GimpProgress      *progress,
 
787
                   const GValueArray *args)
1459
788
{
1460
789
  gboolean success = TRUE;
1461
790
  GimpDrawable *drawable;
1462
791
  gint32 low_threshold;
1463
792
  gint32 high_threshold;
1464
793
 
1465
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1466
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1467
 
    success = FALSE;
1468
 
 
1469
 
  low_threshold = args[1].value.pdb_int;
1470
 
  if (low_threshold < 0 || low_threshold > 255)
1471
 
    success = FALSE;
1472
 
 
1473
 
  high_threshold = args[2].value.pdb_int;
1474
 
  if (high_threshold < 0 || high_threshold > 255)
1475
 
    success = FALSE;
 
794
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
795
  low_threshold = g_value_get_int (&args->values[1]);
 
796
  high_threshold = g_value_get_int (&args->values[2]);
1476
797
 
1477
798
  if (success)
1478
799
    {
1479
800
      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
1480
801
          gimp_drawable_is_indexed (drawable) ||
1481
 
          (low_threshold >= high_threshold))
 
802
          (low_threshold > high_threshold))
1482
803
        success = FALSE;
1483
804
 
1484
805
      if (success)
1495
816
              tr.low_threshold  = low_threshold;
1496
817
              tr.high_threshold = high_threshold;
1497
818
 
1498
 
              pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
819
              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
1499
820
                                 x, y, width, height, FALSE);
1500
 
              pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
821
              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
1501
822
                                 x, y, width, height, TRUE);
1502
823
 
1503
 
              pixel_regions_process_parallel ((p_func) threshold_2, &tr, 2,
1504
 
                                              &srcPR, &destPR);
 
824
              pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
 
825
                                              &tr, 2, &srcPR, &destPR);
1505
826
 
1506
827
              gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
1507
828
              gimp_drawable_update (drawable, x, y, width, height);
1509
830
        }
1510
831
    }
1511
832
 
1512
 
  return procedural_db_return_args (&threshold_proc, success);
1513
 
}
1514
 
 
1515
 
static ProcArg threshold_inargs[] =
1516
 
{
1517
 
  {
1518
 
    GIMP_PDB_DRAWABLE,
1519
 
    "drawable",
1520
 
    "The drawable"
1521
 
  },
1522
 
  {
1523
 
    GIMP_PDB_INT32,
1524
 
    "low_threshold",
1525
 
    "The low threshold value: 0 <= low_threshold <= 255"
1526
 
  },
1527
 
  {
1528
 
    GIMP_PDB_INT32,
1529
 
    "high_threshold",
1530
 
    "The high threshold value: 0 <= high_threshold <= 255"
1531
 
  }
1532
 
};
1533
 
 
1534
 
static ProcRecord threshold_proc =
1535
 
{
1536
 
  "gimp_threshold",
1537
 
  "Threshold the specified drawable.",
1538
 
  "This procedures generates a threshold map of the specified drawable. All pixels between the values of 'low_threshold' and 'high_threshold' are replaced with white, and all other pixels with black.",
1539
 
  "Spencer Kimball & Peter Mattis",
1540
 
  "Spencer Kimball & Peter Mattis",
1541
 
  "1997",
1542
 
  NULL,
1543
 
  GIMP_INTERNAL,
1544
 
  3,
1545
 
  threshold_inargs,
1546
 
  0,
1547
 
  NULL,
1548
 
  { { threshold_invoker } }
1549
 
};
 
833
  return gimp_procedure_get_return_values (procedure, success);
 
834
}
 
835
 
 
836
void
 
837
register_color_procs (GimpPDB *pdb)
 
838
{
 
839
  GimpProcedure *procedure;
 
840
 
 
841
  /*
 
842
   * gimp-brightness-contrast
 
843
   */
 
844
  procedure = gimp_procedure_new (brightness_contrast_invoker);
 
845
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brightness-contrast");
 
846
  gimp_procedure_set_static_strings (procedure,
 
847
                                     "gimp-brightness-contrast",
 
848
                                     "Modify brightness/contrast in the specified drawable.",
 
849
                                     "This procedures allows the brightness and contrast of the specified drawable to be modified. Both 'brightness' and 'contrast' parameters are defined between -127 and 127.",
 
850
                                     "Spencer Kimball & Peter Mattis",
 
851
                                     "Spencer Kimball & Peter Mattis",
 
852
                                     "1997",
 
853
                                     NULL);
 
854
  gimp_procedure_add_argument (procedure,
 
855
                               gimp_param_spec_drawable_id ("drawable",
 
856
                                                            "drawable",
 
857
                                                            "The drawable",
 
858
                                                            pdb->gimp, FALSE,
 
859
                                                            GIMP_PARAM_READWRITE));
 
860
  gimp_procedure_add_argument (procedure,
 
861
                               gimp_param_spec_int32 ("brightness",
 
862
                                                      "brightness",
 
863
                                                      "Brightness adjustment",
 
864
                                                      -127, 127, -127,
 
865
                                                      GIMP_PARAM_READWRITE));
 
866
  gimp_procedure_add_argument (procedure,
 
867
                               gimp_param_spec_int32 ("contrast",
 
868
                                                      "contrast",
 
869
                                                      "Contrast adjustment",
 
870
                                                      -127, 127, -127,
 
871
                                                      GIMP_PARAM_READWRITE));
 
872
  gimp_pdb_register_procedure (pdb, procedure);
 
873
  g_object_unref (procedure);
 
874
 
 
875
  /*
 
876
   * gimp-levels
 
877
   */
 
878
  procedure = gimp_procedure_new (levels_invoker);
 
879
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-levels");
 
880
  gimp_procedure_set_static_strings (procedure,
 
881
                                     "gimp-levels",
 
882
                                     "Modifies intensity levels in the specified drawable.",
 
883
                                     "This tool allows intensity levels in the specified drawable to be remapped according to a set of parameters. The low/high input levels specify an initial mapping from the source intensities. The gamma value determines how intensities between the low and high input intensities are interpolated. A gamma value of 1.0 results in a linear interpolation. Higher gamma values result in more high-level intensities. Lower gamma values result in more low-level intensities. The low/high output levels constrain the final intensity mapping--that is, no final intensity will be lower than the low output level and no final intensity will be higher than the high output level. This tool is only valid on RGB color and grayscale images. It will not operate on indexed drawables.",
 
884
                                     "Spencer Kimball & Peter Mattis",
 
885
                                     "Spencer Kimball & Peter Mattis",
 
886
                                     "1995-1996",
 
887
                                     NULL);
 
888
  gimp_procedure_add_argument (procedure,
 
889
                               gimp_param_spec_drawable_id ("drawable",
 
890
                                                            "drawable",
 
891
                                                            "The drawable",
 
892
                                                            pdb->gimp, FALSE,
 
893
                                                            GIMP_PARAM_READWRITE));
 
894
  gimp_procedure_add_argument (procedure,
 
895
                               g_param_spec_enum ("channel",
 
896
                                                  "channel",
 
897
                                                  "The channel to modify",
 
898
                                                  GIMP_TYPE_HISTOGRAM_CHANNEL,
 
899
                                                  GIMP_HISTOGRAM_VALUE,
 
900
                                                  GIMP_PARAM_READWRITE));
 
901
  gimp_procedure_add_argument (procedure,
 
902
                               gimp_param_spec_int32 ("low-input",
 
903
                                                      "low input",
 
904
                                                      "Intensity of lowest input",
 
905
                                                      0, 255, 0,
 
906
                                                      GIMP_PARAM_READWRITE));
 
907
  gimp_procedure_add_argument (procedure,
 
908
                               gimp_param_spec_int32 ("high-input",
 
909
                                                      "high input",
 
910
                                                      "Intensity of highest input",
 
911
                                                      0, 255, 0,
 
912
                                                      GIMP_PARAM_READWRITE));
 
913
  gimp_procedure_add_argument (procedure,
 
914
                               g_param_spec_double ("gamma",
 
915
                                                    "gamma",
 
916
                                                    "Gamma correction factor",
 
917
                                                    0.1, 10, 0.1,
 
918
                                                    GIMP_PARAM_READWRITE));
 
919
  gimp_procedure_add_argument (procedure,
 
920
                               gimp_param_spec_int32 ("low-output",
 
921
                                                      "low output",
 
922
                                                      "Intensity of lowest output",
 
923
                                                      0, 255, 0,
 
924
                                                      GIMP_PARAM_READWRITE));
 
925
  gimp_procedure_add_argument (procedure,
 
926
                               gimp_param_spec_int32 ("high-output",
 
927
                                                      "high output",
 
928
                                                      "Intensity of highest output",
 
929
                                                      0, 255, 0,
 
930
                                                      GIMP_PARAM_READWRITE));
 
931
  gimp_pdb_register_procedure (pdb, procedure);
 
932
  g_object_unref (procedure);
 
933
 
 
934
  /*
 
935
   * gimp-levels-auto
 
936
   */
 
937
  procedure = gimp_procedure_new (levels_auto_invoker);
 
938
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-levels-auto");
 
939
  gimp_procedure_set_static_strings (procedure,
 
940
                                     "gimp-levels-auto",
 
941
                                     "This procedure is deprecated! Use 'gimp-levels-stretch' instead.",
 
942
                                     "This procedure is deprecated! Use 'gimp-levels-stretch' instead.",
 
943
                                     "",
 
944
                                     "",
 
945
                                     "",
 
946
                                     "gimp-levels-stretch");
 
947
  gimp_procedure_add_argument (procedure,
 
948
                               gimp_param_spec_drawable_id ("drawable",
 
949
                                                            "drawable",
 
950
                                                            "The drawable",
 
951
                                                            pdb->gimp, FALSE,
 
952
                                                            GIMP_PARAM_READWRITE));
 
953
  gimp_pdb_register_procedure (pdb, procedure);
 
954
  g_object_unref (procedure);
 
955
 
 
956
  /*
 
957
   * gimp-levels-stretch
 
958
   */
 
959
  procedure = gimp_procedure_new (levels_stretch_invoker);
 
960
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-levels-stretch");
 
961
  gimp_procedure_set_static_strings (procedure,
 
962
                                     "gimp-levels-stretch",
 
963
                                     "Automatically modifies intensity levels in the specified drawable.",
 
964
                                     "This procedure allows intensity levels in the specified drawable to be remapped according to a set of guessed parameters. It is equivalent to clicking the \"Auto\" button in the Levels tool. This procedure is only valid on RGB color and grayscale images. It will not operate on indexed drawables.",
 
965
                                     "Joao S.O. Bueno, Shawn Willden",
 
966
                                     "Joao S.O. Bueno, Shawn Willden",
 
967
                                     "2003",
 
968
                                     NULL);
 
969
  gimp_procedure_add_argument (procedure,
 
970
                               gimp_param_spec_drawable_id ("drawable",
 
971
                                                            "drawable",
 
972
                                                            "The drawable",
 
973
                                                            pdb->gimp, FALSE,
 
974
                                                            GIMP_PARAM_READWRITE));
 
975
  gimp_pdb_register_procedure (pdb, procedure);
 
976
  g_object_unref (procedure);
 
977
 
 
978
  /*
 
979
   * gimp-posterize
 
980
   */
 
981
  procedure = gimp_procedure_new (posterize_invoker);
 
982
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-posterize");
 
983
  gimp_procedure_set_static_strings (procedure,
 
984
                                     "gimp-posterize",
 
985
                                     "Posterize the specified drawable.",
 
986
                                     "This procedures reduces the number of shades allows in each intensity channel to the specified 'levels' parameter.",
 
987
                                     "Spencer Kimball & Peter Mattis",
 
988
                                     "Spencer Kimball & Peter Mattis",
 
989
                                     "1997",
 
990
                                     NULL);
 
991
  gimp_procedure_add_argument (procedure,
 
992
                               gimp_param_spec_drawable_id ("drawable",
 
993
                                                            "drawable",
 
994
                                                            "The drawable",
 
995
                                                            pdb->gimp, FALSE,
 
996
                                                            GIMP_PARAM_READWRITE));
 
997
  gimp_procedure_add_argument (procedure,
 
998
                               gimp_param_spec_int32 ("levels",
 
999
                                                      "levels",
 
1000
                                                      "Levels of posterization",
 
1001
                                                      2, 255, 2,
 
1002
                                                      GIMP_PARAM_READWRITE));
 
1003
  gimp_pdb_register_procedure (pdb, procedure);
 
1004
  g_object_unref (procedure);
 
1005
 
 
1006
  /*
 
1007
   * gimp-desaturate
 
1008
   */
 
1009
  procedure = gimp_procedure_new (desaturate_invoker);
 
1010
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-desaturate");
 
1011
  gimp_procedure_set_static_strings (procedure,
 
1012
                                     "gimp-desaturate",
 
1013
                                     "Desaturate the contents of the specified drawable.",
 
1014
                                     "This procedure desaturates the contents of the specified drawable. This procedure only works on drawables of type RGB color.",
 
1015
                                     "Spencer Kimball & Peter Mattis",
 
1016
                                     "Spencer Kimball & Peter Mattis",
 
1017
                                     "1995-1996",
 
1018
                                     NULL);
 
1019
  gimp_procedure_add_argument (procedure,
 
1020
                               gimp_param_spec_drawable_id ("drawable",
 
1021
                                                            "drawable",
 
1022
                                                            "The drawable",
 
1023
                                                            pdb->gimp, FALSE,
 
1024
                                                            GIMP_PARAM_READWRITE));
 
1025
  gimp_pdb_register_procedure (pdb, procedure);
 
1026
  g_object_unref (procedure);
 
1027
 
 
1028
  /*
 
1029
   * gimp-desaturate-full
 
1030
   */
 
1031
  procedure = gimp_procedure_new (desaturate_full_invoker);
 
1032
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-desaturate-full");
 
1033
  gimp_procedure_set_static_strings (procedure,
 
1034
                                     "gimp-desaturate-full",
 
1035
                                     "Desaturate the contents of the specified drawable, with the specified formula.",
 
1036
                                     "This procedure desaturates the contents of the specified drawable, with the specified formula. This procedure only works on drawables of type RGB color.",
 
1037
                                     "Karine Delvare",
 
1038
                                     "Karine Delvare",
 
1039
                                     "2005",
 
1040
                                     NULL);
 
1041
  gimp_procedure_add_argument (procedure,
 
1042
                               gimp_param_spec_drawable_id ("drawable",
 
1043
                                                            "drawable",
 
1044
                                                            "The drawable",
 
1045
                                                            pdb->gimp, FALSE,
 
1046
                                                            GIMP_PARAM_READWRITE));
 
1047
  gimp_procedure_add_argument (procedure,
 
1048
                               g_param_spec_enum ("desaturate-mode",
 
1049
                                                  "desaturate mode",
 
1050
                                                  "The formula to use to desaturate",
 
1051
                                                  GIMP_TYPE_DESATURATE_MODE,
 
1052
                                                  GIMP_DESATURATE_LIGHTNESS,
 
1053
                                                  GIMP_PARAM_READWRITE));
 
1054
  gimp_pdb_register_procedure (pdb, procedure);
 
1055
  g_object_unref (procedure);
 
1056
 
 
1057
  /*
 
1058
   * gimp-equalize
 
1059
   */
 
1060
  procedure = gimp_procedure_new (equalize_invoker);
 
1061
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-equalize");
 
1062
  gimp_procedure_set_static_strings (procedure,
 
1063
                                     "gimp-equalize",
 
1064
                                     "Equalize the contents of the specified drawable.",
 
1065
                                     "This procedure equalizes the contents of the specified drawable. Each intensity channel is equalizeed independently. The equalized intensity is given as inten' = (255 - inten). Indexed color drawables are not valid for this operation. The 'mask_only' option specifies whether to adjust only the area of the image within the selection bounds, or the entire image based on the histogram of the selected area. If there is no selection, the entire image is adjusted based on the histogram for the entire image.",
 
1066
                                     "Spencer Kimball & Peter Mattis",
 
1067
                                     "Spencer Kimball & Peter Mattis",
 
1068
                                     "1995-1996",
 
1069
                                     NULL);
 
1070
  gimp_procedure_add_argument (procedure,
 
1071
                               gimp_param_spec_drawable_id ("drawable",
 
1072
                                                            "drawable",
 
1073
                                                            "The drawable",
 
1074
                                                            pdb->gimp, FALSE,
 
1075
                                                            GIMP_PARAM_READWRITE));
 
1076
  gimp_procedure_add_argument (procedure,
 
1077
                               g_param_spec_boolean ("mask-only",
 
1078
                                                     "mask only",
 
1079
                                                     "Equalization option",
 
1080
                                                     FALSE,
 
1081
                                                     GIMP_PARAM_READWRITE));
 
1082
  gimp_pdb_register_procedure (pdb, procedure);
 
1083
  g_object_unref (procedure);
 
1084
 
 
1085
  /*
 
1086
   * gimp-invert
 
1087
   */
 
1088
  procedure = gimp_procedure_new (invert_invoker);
 
1089
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-invert");
 
1090
  gimp_procedure_set_static_strings (procedure,
 
1091
                                     "gimp-invert",
 
1092
                                     "Invert the contents of the specified drawable.",
 
1093
                                     "This procedure inverts the contents of the specified drawable. Each intensity channel is inverted independently. The inverted intensity is given as inten' = (255 - inten). Indexed color drawables are not valid for this operation.",
 
1094
                                     "Spencer Kimball & Peter Mattis",
 
1095
                                     "Spencer Kimball & Peter Mattis",
 
1096
                                     "1995-1996",
 
1097
                                     NULL);
 
1098
  gimp_procedure_add_argument (procedure,
 
1099
                               gimp_param_spec_drawable_id ("drawable",
 
1100
                                                            "drawable",
 
1101
                                                            "The drawable",
 
1102
                                                            pdb->gimp, FALSE,
 
1103
                                                            GIMP_PARAM_READWRITE));
 
1104
  gimp_pdb_register_procedure (pdb, procedure);
 
1105
  g_object_unref (procedure);
 
1106
 
 
1107
  /*
 
1108
   * gimp-curves-spline
 
1109
   */
 
1110
  procedure = gimp_procedure_new (curves_spline_invoker);
 
1111
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-curves-spline");
 
1112
  gimp_procedure_set_static_strings (procedure,
 
1113
                                     "gimp-curves-spline",
 
1114
                                     "Modifies the intensity curve(s) for specified drawable.",
 
1115
                                     "Modifies the intensity mapping for one channel in the specified drawable. The drawable must be either grayscale or RGB, and the channel can be either an intensity component, or the value. The 'control_pts' parameter is an array of integers which define a set of control points which describe a Catmull Rom spline which yields the final intensity curve. Use the 'gimp-curves-explicit' function to explicitly modify intensity levels.",
 
1116
                                     "Spencer Kimball & Peter Mattis",
 
1117
                                     "Spencer Kimball & Peter Mattis",
 
1118
                                     "1995-1996",
 
1119
                                     NULL);
 
1120
  gimp_procedure_add_argument (procedure,
 
1121
                               gimp_param_spec_drawable_id ("drawable",
 
1122
                                                            "drawable",
 
1123
                                                            "The drawable",
 
1124
                                                            pdb->gimp, FALSE,
 
1125
                                                            GIMP_PARAM_READWRITE));
 
1126
  gimp_procedure_add_argument (procedure,
 
1127
                               g_param_spec_enum ("channel",
 
1128
                                                  "channel",
 
1129
                                                  "The channel to modify",
 
1130
                                                  GIMP_TYPE_HISTOGRAM_CHANNEL,
 
1131
                                                  GIMP_HISTOGRAM_VALUE,
 
1132
                                                  GIMP_PARAM_READWRITE));
 
1133
  gimp_procedure_add_argument (procedure,
 
1134
                               gimp_param_spec_int32 ("num-points",
 
1135
                                                      "num points",
 
1136
                                                      "The number of values in the control point array",
 
1137
                                                      4, 34, 4,
 
1138
                                                      GIMP_PARAM_READWRITE));
 
1139
  gimp_procedure_add_argument (procedure,
 
1140
                               gimp_param_spec_int8_array ("control-pts",
 
1141
                                                           "control pts",
 
1142
                                                           "The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }",
 
1143
                                                           GIMP_PARAM_READWRITE));
 
1144
  gimp_pdb_register_procedure (pdb, procedure);
 
1145
  g_object_unref (procedure);
 
1146
 
 
1147
  /*
 
1148
   * gimp-curves-explicit
 
1149
   */
 
1150
  procedure = gimp_procedure_new (curves_explicit_invoker);
 
1151
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-curves-explicit");
 
1152
  gimp_procedure_set_static_strings (procedure,
 
1153
                                     "gimp-curves-explicit",
 
1154
                                     "Modifies the intensity curve(s) for specified drawable.",
 
1155
                                     "Modifies the intensity mapping for one channel in the specified drawable. The drawable must be either grayscale or RGB, and the channel can be either an intensity component, or the value. The 'curve' parameter is an array of bytes which explicitly defines how each pixel value in the drawable will be modified. Use the 'gimp-curves-spline' function to modify intensity levels with Catmull Rom splines.",
 
1156
                                     "Spencer Kimball & Peter Mattis",
 
1157
                                     "Spencer Kimball & Peter Mattis",
 
1158
                                     "1995-1996",
 
1159
                                     NULL);
 
1160
  gimp_procedure_add_argument (procedure,
 
1161
                               gimp_param_spec_drawable_id ("drawable",
 
1162
                                                            "drawable",
 
1163
                                                            "The drawable",
 
1164
                                                            pdb->gimp, FALSE,
 
1165
                                                            GIMP_PARAM_READWRITE));
 
1166
  gimp_procedure_add_argument (procedure,
 
1167
                               g_param_spec_enum ("channel",
 
1168
                                                  "channel",
 
1169
                                                  "The channel to modify",
 
1170
                                                  GIMP_TYPE_HISTOGRAM_CHANNEL,
 
1171
                                                  GIMP_HISTOGRAM_VALUE,
 
1172
                                                  GIMP_PARAM_READWRITE));
 
1173
  gimp_procedure_add_argument (procedure,
 
1174
                               gimp_param_spec_int32 ("num-bytes",
 
1175
                                                      "num bytes",
 
1176
                                                      "The number of bytes in the new curve (always 256)",
 
1177
                                                      0, G_MAXINT32, 0,
 
1178
                                                      GIMP_PARAM_READWRITE));
 
1179
  gimp_procedure_add_argument (procedure,
 
1180
                               gimp_param_spec_int8_array ("curve",
 
1181
                                                           "curve",
 
1182
                                                           "The explicit curve",
 
1183
                                                           GIMP_PARAM_READWRITE));
 
1184
  gimp_pdb_register_procedure (pdb, procedure);
 
1185
  g_object_unref (procedure);
 
1186
 
 
1187
  /*
 
1188
   * gimp-color-balance
 
1189
   */
 
1190
  procedure = gimp_procedure_new (color_balance_invoker);
 
1191
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-color-balance");
 
1192
  gimp_procedure_set_static_strings (procedure,
 
1193
                                     "gimp-color-balance",
 
1194
                                     "Modify the color balance of the specified drawable.",
 
1195
                                     "Modify the color balance of the specified drawable. There are three axis which can be modified: cyan-red, magenta-green, and yellow-blue. Negative values increase the amount of the former, positive values increase the amount of the latter. Color balance can be controlled with the 'transfer_mode' setting, which allows shadows, mid-tones, and highlights in an image to be affected differently. The 'preserve-lum' parameter, if TRUE, ensures that the luminosity of each pixel remains fixed.",
 
1196
                                     "Spencer Kimball & Peter Mattis",
 
1197
                                     "Spencer Kimball & Peter Mattis",
 
1198
                                     "1997",
 
1199
                                     NULL);
 
1200
  gimp_procedure_add_argument (procedure,
 
1201
                               gimp_param_spec_drawable_id ("drawable",
 
1202
                                                            "drawable",
 
1203
                                                            "The drawable",
 
1204
                                                            pdb->gimp, FALSE,
 
1205
                                                            GIMP_PARAM_READWRITE));
 
1206
  gimp_procedure_add_argument (procedure,
 
1207
                               g_param_spec_enum ("transfer-mode",
 
1208
                                                  "transfer mode",
 
1209
                                                  "Transfer mode",
 
1210
                                                  GIMP_TYPE_TRANSFER_MODE,
 
1211
                                                  GIMP_SHADOWS,
 
1212
                                                  GIMP_PARAM_READWRITE));
 
1213
  gimp_procedure_add_argument (procedure,
 
1214
                               g_param_spec_boolean ("preserve-lum",
 
1215
                                                     "preserve lum",
 
1216
                                                     "Preserve luminosity values at each pixel",
 
1217
                                                     FALSE,
 
1218
                                                     GIMP_PARAM_READWRITE));
 
1219
  gimp_procedure_add_argument (procedure,
 
1220
                               g_param_spec_double ("cyan-red",
 
1221
                                                    "cyan red",
 
1222
                                                    "Cyan-Red color balance",
 
1223
                                                    -100, 100, -100,
 
1224
                                                    GIMP_PARAM_READWRITE));
 
1225
  gimp_procedure_add_argument (procedure,
 
1226
                               g_param_spec_double ("magenta-green",
 
1227
                                                    "magenta green",
 
1228
                                                    "Magenta-Green color balance",
 
1229
                                                    -100, 100, -100,
 
1230
                                                    GIMP_PARAM_READWRITE));
 
1231
  gimp_procedure_add_argument (procedure,
 
1232
                               g_param_spec_double ("yellow-blue",
 
1233
                                                    "yellow blue",
 
1234
                                                    "Yellow-Blue color balance",
 
1235
                                                    -100, 100, -100,
 
1236
                                                    GIMP_PARAM_READWRITE));
 
1237
  gimp_pdb_register_procedure (pdb, procedure);
 
1238
  g_object_unref (procedure);
 
1239
 
 
1240
  /*
 
1241
   * gimp-colorize
 
1242
   */
 
1243
  procedure = gimp_procedure_new (colorize_invoker);
 
1244
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-colorize");
 
1245
  gimp_procedure_set_static_strings (procedure,
 
1246
                                     "gimp-colorize",
 
1247
                                     "Render the drawable as a grayscale image seen through a colored glass.",
 
1248
                                     "Desaturates the drawable, then tints it with the specified color. This tool is only valid on RGB color images. It will not operate on grayscale or indexed drawables.",
 
1249
                                     "Sven Neumann <sven@gimp.org>",
 
1250
                                     "Sven Neumann",
 
1251
                                     "2004",
 
1252
                                     NULL);
 
1253
  gimp_procedure_add_argument (procedure,
 
1254
                               gimp_param_spec_drawable_id ("drawable",
 
1255
                                                            "drawable",
 
1256
                                                            "The drawable",
 
1257
                                                            pdb->gimp, FALSE,
 
1258
                                                            GIMP_PARAM_READWRITE));
 
1259
  gimp_procedure_add_argument (procedure,
 
1260
                               g_param_spec_double ("hue",
 
1261
                                                    "hue",
 
1262
                                                    "Hue in degrees",
 
1263
                                                    0, 360, 0,
 
1264
                                                    GIMP_PARAM_READWRITE));
 
1265
  gimp_procedure_add_argument (procedure,
 
1266
                               g_param_spec_double ("saturation",
 
1267
                                                    "saturation",
 
1268
                                                    "Saturation in percent",
 
1269
                                                    0, 100, 0,
 
1270
                                                    GIMP_PARAM_READWRITE));
 
1271
  gimp_procedure_add_argument (procedure,
 
1272
                               g_param_spec_double ("lightness",
 
1273
                                                    "lightness",
 
1274
                                                    "Lightness in percent",
 
1275
                                                    -100, 100, -100,
 
1276
                                                    GIMP_PARAM_READWRITE));
 
1277
  gimp_pdb_register_procedure (pdb, procedure);
 
1278
  g_object_unref (procedure);
 
1279
 
 
1280
  /*
 
1281
   * gimp-histogram
 
1282
   */
 
1283
  procedure = gimp_procedure_new (histogram_invoker);
 
1284
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-histogram");
 
1285
  gimp_procedure_set_static_strings (procedure,
 
1286
                                     "gimp-histogram",
 
1287
                                     "Returns information on the intensity histogram for the specified drawable.",
 
1288
                                     "This tool makes it possible to gather information about the intensity histogram of a drawable. A channel to examine is first specified. This can be either value, red, green, or blue, depending on whether the drawable is of type color or grayscale. The drawable may not be indexed. Second, a range of intensities are specified. The 'gimp-histogram' function returns statistics based on the pixels in the drawable that fall under this range of values. Mean, standard deviation, median, number of pixels, and percentile are all returned. Additionally, the total count of pixels in the image is returned. Counts of pixels are weighted by any associated alpha values and by the current selection mask. That is, pixels that lie outside an active selection mask will not be counted. Similarly, pixels with transparent alpha values will not be counted.",
 
1289
                                     "Spencer Kimball & Peter Mattis",
 
1290
                                     "Spencer Kimball & Peter Mattis",
 
1291
                                     "1995-1996",
 
1292
                                     NULL);
 
1293
  gimp_procedure_add_argument (procedure,
 
1294
                               gimp_param_spec_drawable_id ("drawable",
 
1295
                                                            "drawable",
 
1296
                                                            "The drawable",
 
1297
                                                            pdb->gimp, FALSE,
 
1298
                                                            GIMP_PARAM_READWRITE));
 
1299
  gimp_procedure_add_argument (procedure,
 
1300
                               g_param_spec_enum ("channel",
 
1301
                                                  "channel",
 
1302
                                                  "The channel to modify",
 
1303
                                                  GIMP_TYPE_HISTOGRAM_CHANNEL,
 
1304
                                                  GIMP_HISTOGRAM_VALUE,
 
1305
                                                  GIMP_PARAM_READWRITE));
 
1306
  gimp_procedure_add_argument (procedure,
 
1307
                               gimp_param_spec_int32 ("start-range",
 
1308
                                                      "start range",
 
1309
                                                      "Start of the intensity measurement range",
 
1310
                                                      0, 256, 0,
 
1311
                                                      GIMP_PARAM_READWRITE));
 
1312
  gimp_procedure_add_argument (procedure,
 
1313
                               gimp_param_spec_int32 ("end-range",
 
1314
                                                      "end range",
 
1315
                                                      "End of the intensity measurement range",
 
1316
                                                      0, 256, 0,
 
1317
                                                      GIMP_PARAM_READWRITE));
 
1318
  gimp_procedure_add_return_value (procedure,
 
1319
                                   g_param_spec_double ("mean",
 
1320
                                                        "mean",
 
1321
                                                        "Mean intensity value",
 
1322
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1323
                                                        GIMP_PARAM_READWRITE));
 
1324
  gimp_procedure_add_return_value (procedure,
 
1325
                                   g_param_spec_double ("std-dev",
 
1326
                                                        "std dev",
 
1327
                                                        "Standard deviation of intensity values",
 
1328
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1329
                                                        GIMP_PARAM_READWRITE));
 
1330
  gimp_procedure_add_return_value (procedure,
 
1331
                                   g_param_spec_double ("median",
 
1332
                                                        "median",
 
1333
                                                        "Median intensity value",
 
1334
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1335
                                                        GIMP_PARAM_READWRITE));
 
1336
  gimp_procedure_add_return_value (procedure,
 
1337
                                   g_param_spec_double ("pixels",
 
1338
                                                        "pixels",
 
1339
                                                        "Alpha-weighted pixel count for entire image",
 
1340
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1341
                                                        GIMP_PARAM_READWRITE));
 
1342
  gimp_procedure_add_return_value (procedure,
 
1343
                                   g_param_spec_double ("count",
 
1344
                                                        "count",
 
1345
                                                        "Alpha-weighted pixel count for range",
 
1346
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1347
                                                        GIMP_PARAM_READWRITE));
 
1348
  gimp_procedure_add_return_value (procedure,
 
1349
                                   g_param_spec_double ("percentile",
 
1350
                                                        "percentile",
 
1351
                                                        "Percentile that range falls under",
 
1352
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1353
                                                        GIMP_PARAM_READWRITE));
 
1354
  gimp_pdb_register_procedure (pdb, procedure);
 
1355
  g_object_unref (procedure);
 
1356
 
 
1357
  /*
 
1358
   * gimp-hue-saturation
 
1359
   */
 
1360
  procedure = gimp_procedure_new (hue_saturation_invoker);
 
1361
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-hue-saturation");
 
1362
  gimp_procedure_set_static_strings (procedure,
 
1363
                                     "gimp-hue-saturation",
 
1364
                                     "Modify hue, lightness, and saturation in the specified drawable.",
 
1365
                                     "This procedures allows the hue, lightness, and saturation in the specified drawable to be modified. The 'hue-range' parameter provides the capability to limit range of affected hues.",
 
1366
                                     "Spencer Kimball & Peter Mattis",
 
1367
                                     "Spencer Kimball & Peter Mattis",
 
1368
                                     "1997",
 
1369
                                     NULL);
 
1370
  gimp_procedure_add_argument (procedure,
 
1371
                               gimp_param_spec_drawable_id ("drawable",
 
1372
                                                            "drawable",
 
1373
                                                            "The drawable",
 
1374
                                                            pdb->gimp, FALSE,
 
1375
                                                            GIMP_PARAM_READWRITE));
 
1376
  gimp_procedure_add_argument (procedure,
 
1377
                               g_param_spec_enum ("hue-range",
 
1378
                                                  "hue range",
 
1379
                                                  "Range of affected hues",
 
1380
                                                  GIMP_TYPE_HUE_RANGE,
 
1381
                                                  GIMP_ALL_HUES,
 
1382
                                                  GIMP_PARAM_READWRITE));
 
1383
  gimp_procedure_add_argument (procedure,
 
1384
                               g_param_spec_double ("hue-offset",
 
1385
                                                    "hue offset",
 
1386
                                                    "Hue offset in degrees",
 
1387
                                                    -180, 180, -180,
 
1388
                                                    GIMP_PARAM_READWRITE));
 
1389
  gimp_procedure_add_argument (procedure,
 
1390
                               g_param_spec_double ("lightness",
 
1391
                                                    "lightness",
 
1392
                                                    "Lightness modification",
 
1393
                                                    -100, 100, -100,
 
1394
                                                    GIMP_PARAM_READWRITE));
 
1395
  gimp_procedure_add_argument (procedure,
 
1396
                               g_param_spec_double ("saturation",
 
1397
                                                    "saturation",
 
1398
                                                    "Saturation modification",
 
1399
                                                    -100, 100, -100,
 
1400
                                                    GIMP_PARAM_READWRITE));
 
1401
  gimp_pdb_register_procedure (pdb, procedure);
 
1402
  g_object_unref (procedure);
 
1403
 
 
1404
  /*
 
1405
   * gimp-threshold
 
1406
   */
 
1407
  procedure = gimp_procedure_new (threshold_invoker);
 
1408
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-threshold");
 
1409
  gimp_procedure_set_static_strings (procedure,
 
1410
                                     "gimp-threshold",
 
1411
                                     "Threshold the specified drawable.",
 
1412
                                     "This procedures generates a threshold map of the specified drawable. All pixels between the values of 'low_threshold' and 'high_threshold' are replaced with white, and all other pixels with black.",
 
1413
                                     "Spencer Kimball & Peter Mattis",
 
1414
                                     "Spencer Kimball & Peter Mattis",
 
1415
                                     "1997",
 
1416
                                     NULL);
 
1417
  gimp_procedure_add_argument (procedure,
 
1418
                               gimp_param_spec_drawable_id ("drawable",
 
1419
                                                            "drawable",
 
1420
                                                            "The drawable",
 
1421
                                                            pdb->gimp, FALSE,
 
1422
                                                            GIMP_PARAM_READWRITE));
 
1423
  gimp_procedure_add_argument (procedure,
 
1424
                               gimp_param_spec_int32 ("low-threshold",
 
1425
                                                      "low threshold",
 
1426
                                                      "The low threshold value",
 
1427
                                                      0, 255, 0,
 
1428
                                                      GIMP_PARAM_READWRITE));
 
1429
  gimp_procedure_add_argument (procedure,
 
1430
                               gimp_param_spec_int32 ("high-threshold",
 
1431
                                                      "high threshold",
 
1432
                                                      "The high threshold value",
 
1433
                                                      0, 255, 0,
 
1434
                                                      GIMP_PARAM_READWRITE));
 
1435
  gimp_pdb_register_procedure (pdb, procedure);
 
1436
  g_object_unref (procedure);
 
1437
}