~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to libgimp/gimpcolor_pdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LIBGIMP - The GIMP Library
 
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 
3
 *
 
4
 * gimpcolor_pdb.c
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the
 
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
 * Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
/* NOTE: This file is autogenerated by pdbgen.pl */
 
23
 
 
24
#include "config.h"
 
25
 
 
26
#include "gimp.h"
 
27
 
 
28
/**
 
29
 * gimp_brightness_contrast:
 
30
 * @drawable_ID: The drawable.
 
31
 * @brightness: Brightness adjustment.
 
32
 * @contrast: Contrast adjustment.
 
33
 *
 
34
 * Modify brightness/contrast in the specified drawable.
 
35
 *
 
36
 * This procedures allows the brightness and contrast of the specified
 
37
 * drawable to be modified. Both 'brightness' and 'contrast' parameters
 
38
 * are defined between -127 and 127.
 
39
 *
 
40
 * Returns: TRUE on success.
 
41
 */
 
42
gboolean
 
43
gimp_brightness_contrast (gint32 drawable_ID,
 
44
                          gint   brightness,
 
45
                          gint   contrast)
 
46
{
 
47
  GimpParam *return_vals;
 
48
  gint nreturn_vals;
 
49
  gboolean success = TRUE;
 
50
 
 
51
  return_vals = gimp_run_procedure ("gimp_brightness_contrast",
 
52
                                    &nreturn_vals,
 
53
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
54
                                    GIMP_PDB_INT32, brightness,
 
55
                                    GIMP_PDB_INT32, contrast,
 
56
                                    GIMP_PDB_END);
 
57
 
 
58
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
59
 
 
60
  gimp_destroy_params (return_vals, nreturn_vals);
 
61
 
 
62
  return success;
 
63
}
 
64
 
 
65
/**
 
66
 * gimp_levels:
 
67
 * @drawable_ID: The drawable.
 
68
 * @channel: The channel to modify.
 
69
 * @low_input: Intensity of lowest input.
 
70
 * @high_input: Intensity of highest input.
 
71
 * @gamma: Gamma correction factor.
 
72
 * @low_output: Intensity of lowest output.
 
73
 * @high_output: Intensity of highest output.
 
74
 *
 
75
 * Modifies intensity levels in the specified drawable.
 
76
 *
 
77
 * This tool allows intensity levels in the specified drawable to be
 
78
 * remapped according to a set of parameters. The low/high input levels
 
79
 * specify an initial mapping from the source intensities. The gamma
 
80
 * value determines how intensities between the low and high input
 
81
 * intensities are interpolated. A gamma value of 1.0 results in a
 
82
 * linear interpolation. Higher gamma values result in more high-level
 
83
 * intensities. Lower gamma values result in more low-level
 
84
 * intensities. The low/high output levels constrain the final
 
85
 * intensity mapping--that is, no final intensity will be lower than
 
86
 * the low output level and no final intensity will be higher than the
 
87
 * high output level. This tool is only valid on RGB color and
 
88
 * grayscale images. It will not operate on indexed drawables.
 
89
 *
 
90
 * Returns: TRUE on success.
 
91
 */
 
92
gboolean
 
93
gimp_levels (gint32               drawable_ID,
 
94
             GimpHistogramChannel channel,
 
95
             gint                 low_input,
 
96
             gint                 high_input,
 
97
             gdouble              gamma,
 
98
             gint                 low_output,
 
99
             gint                 high_output)
 
100
{
 
101
  GimpParam *return_vals;
 
102
  gint nreturn_vals;
 
103
  gboolean success = TRUE;
 
104
 
 
105
  return_vals = gimp_run_procedure ("gimp_levels",
 
106
                                    &nreturn_vals,
 
107
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
108
                                    GIMP_PDB_INT32, channel,
 
109
                                    GIMP_PDB_INT32, low_input,
 
110
                                    GIMP_PDB_INT32, high_input,
 
111
                                    GIMP_PDB_FLOAT, gamma,
 
112
                                    GIMP_PDB_INT32, low_output,
 
113
                                    GIMP_PDB_INT32, high_output,
 
114
                                    GIMP_PDB_END);
 
115
 
 
116
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
117
 
 
118
  gimp_destroy_params (return_vals, nreturn_vals);
 
119
 
 
120
  return success;
 
121
}
 
122
 
 
123
/**
 
124
 * gimp_levels_auto:
 
125
 * @drawable_ID: The drawable.
 
126
 *
 
127
 * This procedure is deprecated! Use gimp_levels_stretch() instead.
 
128
 *
 
129
 * Returns: TRUE on success.
 
130
 */
 
131
gboolean
 
132
gimp_levels_auto (gint32 drawable_ID)
 
133
{
 
134
  GimpParam *return_vals;
 
135
  gint nreturn_vals;
 
136
  gboolean success = TRUE;
 
137
 
 
138
  return_vals = gimp_run_procedure ("gimp_levels_auto",
 
139
                                    &nreturn_vals,
 
140
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
141
                                    GIMP_PDB_END);
 
142
 
 
143
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
144
 
 
145
  gimp_destroy_params (return_vals, nreturn_vals);
 
146
 
 
147
  return success;
 
148
}
 
149
 
 
150
/**
 
151
 * gimp_levels_stretch:
 
152
 * @drawable_ID: The drawable.
 
153
 *
 
154
 * Automatically modifies intensity levels in the specified drawable.
 
155
 *
 
156
 * This procedure allows intensity levels in the specified drawable to
 
157
 * be remapped according to a set of guessed parameters. It is
 
158
 * equivalent to clicking the \"Auto\" button in the Levels tool. This
 
159
 * procedure is only valid on RGB color and grayscale images. It will
 
160
 * not operate on indexed drawables.
 
161
 *
 
162
 * Returns: TRUE on success.
 
163
 */
 
164
gboolean
 
165
gimp_levels_stretch (gint32 drawable_ID)
 
166
{
 
167
  GimpParam *return_vals;
 
168
  gint nreturn_vals;
 
169
  gboolean success = TRUE;
 
170
 
 
171
  return_vals = gimp_run_procedure ("gimp_levels_stretch",
 
172
                                    &nreturn_vals,
 
173
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
174
                                    GIMP_PDB_END);
 
175
 
 
176
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
177
 
 
178
  gimp_destroy_params (return_vals, nreturn_vals);
 
179
 
 
180
  return success;
 
181
}
 
182
 
 
183
/**
 
184
 * gimp_posterize:
 
185
 * @drawable_ID: The drawable.
 
186
 * @levels: Levels of posterization.
 
187
 *
 
188
 * Posterize the specified drawable.
 
189
 *
 
190
 * This procedures reduces the number of shades allows in each
 
191
 * intensity channel to the specified 'levels' parameter.
 
192
 *
 
193
 * Returns: TRUE on success.
 
194
 */
 
195
gboolean
 
196
gimp_posterize (gint32 drawable_ID,
 
197
                gint   levels)
 
198
{
 
199
  GimpParam *return_vals;
 
200
  gint nreturn_vals;
 
201
  gboolean success = TRUE;
 
202
 
 
203
  return_vals = gimp_run_procedure ("gimp_posterize",
 
204
                                    &nreturn_vals,
 
205
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
206
                                    GIMP_PDB_INT32, levels,
 
207
                                    GIMP_PDB_END);
 
208
 
 
209
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
210
 
 
211
  gimp_destroy_params (return_vals, nreturn_vals);
 
212
 
 
213
  return success;
 
214
}
 
215
 
 
216
/**
 
217
 * gimp_desaturate:
 
218
 * @drawable_ID: The drawable.
 
219
 *
 
220
 * Desaturate the contents of the specified drawable.
 
221
 *
 
222
 * This procedure desaturates the contents of the specified drawable.
 
223
 * This procedure only works on drawables of type RGB color.
 
224
 *
 
225
 * Returns: TRUE on success.
 
226
 */
 
227
gboolean
 
228
gimp_desaturate (gint32 drawable_ID)
 
229
{
 
230
  GimpParam *return_vals;
 
231
  gint nreturn_vals;
 
232
  gboolean success = TRUE;
 
233
 
 
234
  return_vals = gimp_run_procedure ("gimp_desaturate",
 
235
                                    &nreturn_vals,
 
236
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
237
                                    GIMP_PDB_END);
 
238
 
 
239
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
240
 
 
241
  gimp_destroy_params (return_vals, nreturn_vals);
 
242
 
 
243
  return success;
 
244
}
 
245
 
 
246
/**
 
247
 * gimp_equalize:
 
248
 * @drawable_ID: The drawable.
 
249
 * @mask_only: Equalization option.
 
250
 *
 
251
 * Equalize the contents of the specified drawable.
 
252
 *
 
253
 * This procedure equalizes the contents of the specified drawable.
 
254
 * Each intensity channel is equalizeed independently. The equalized
 
255
 * intensity is given as inten' = (255 - inten). Indexed color
 
256
 * drawables are not valid for this operation. The 'mask_only' option
 
257
 * specifies whether to adjust only the area of the image within the
 
258
 * selection bounds, or the entire image based on the histogram of the
 
259
 * selected area. If there is no selection, the entire image is
 
260
 * adjusted based on the histogram for the entire image.
 
261
 *
 
262
 * Returns: TRUE on success.
 
263
 */
 
264
gboolean
 
265
gimp_equalize (gint32   drawable_ID,
 
266
               gboolean mask_only)
 
267
{
 
268
  GimpParam *return_vals;
 
269
  gint nreturn_vals;
 
270
  gboolean success = TRUE;
 
271
 
 
272
  return_vals = gimp_run_procedure ("gimp_equalize",
 
273
                                    &nreturn_vals,
 
274
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
275
                                    GIMP_PDB_INT32, mask_only,
 
276
                                    GIMP_PDB_END);
 
277
 
 
278
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
279
 
 
280
  gimp_destroy_params (return_vals, nreturn_vals);
 
281
 
 
282
  return success;
 
283
}
 
284
 
 
285
/**
 
286
 * gimp_invert:
 
287
 * @drawable_ID: The drawable.
 
288
 *
 
289
 * Invert the contents of the specified drawable.
 
290
 *
 
291
 * This procedure inverts the contents of the specified drawable. Each
 
292
 * intensity channel is inverted independently. The inverted intensity
 
293
 * is given as inten' = (255 - inten). Indexed color drawables are not
 
294
 * valid for this operation.
 
295
 *
 
296
 * Returns: TRUE on success.
 
297
 */
 
298
gboolean
 
299
gimp_invert (gint32 drawable_ID)
 
300
{
 
301
  GimpParam *return_vals;
 
302
  gint nreturn_vals;
 
303
  gboolean success = TRUE;
 
304
 
 
305
  return_vals = gimp_run_procedure ("gimp_invert",
 
306
                                    &nreturn_vals,
 
307
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
308
                                    GIMP_PDB_END);
 
309
 
 
310
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
311
 
 
312
  gimp_destroy_params (return_vals, nreturn_vals);
 
313
 
 
314
  return success;
 
315
}
 
316
 
 
317
/**
 
318
 * gimp_curves_spline:
 
319
 * @drawable_ID: The drawable.
 
320
 * @channel: The channel to modify.
 
321
 * @num_points: The number of values in the control point array.
 
322
 * @control_pts: The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }.
 
323
 *
 
324
 * Modifies the intensity curve(s) for specified drawable.
 
325
 *
 
326
 * Modifies the intensity mapping for one channel in the specified
 
327
 * drawable. The drawable must be either grayscale or RGB, and the
 
328
 * channel can be either an intensity component, or the value. The
 
329
 * 'control_pts' parameter is an array of integers which define a set
 
330
 * of control points which describe a Catmull Rom spline which yields
 
331
 * the final intensity curve. Use the 'gimp_curves_explicit' function
 
332
 * to explicitly modify intensity levels.
 
333
 *
 
334
 * Returns: TRUE on success.
 
335
 */
 
336
gboolean
 
337
gimp_curves_spline (gint32                drawable_ID,
 
338
                    GimpHistogramChannel  channel,
 
339
                    gint                  num_points,
 
340
                    const guint8         *control_pts)
 
341
{
 
342
  GimpParam *return_vals;
 
343
  gint nreturn_vals;
 
344
  gboolean success = TRUE;
 
345
 
 
346
  return_vals = gimp_run_procedure ("gimp_curves_spline",
 
347
                                    &nreturn_vals,
 
348
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
349
                                    GIMP_PDB_INT32, channel,
 
350
                                    GIMP_PDB_INT32, num_points,
 
351
                                    GIMP_PDB_INT8ARRAY, control_pts,
 
352
                                    GIMP_PDB_END);
 
353
 
 
354
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
355
 
 
356
  gimp_destroy_params (return_vals, nreturn_vals);
 
357
 
 
358
  return success;
 
359
}
 
360
 
 
361
/**
 
362
 * gimp_curves_explicit:
 
363
 * @drawable_ID: The drawable.
 
364
 * @channel: The channel to modify.
 
365
 * @num_bytes: The number of bytes in the new curve (always 256).
 
366
 * @curve: The explicit curve.
 
367
 *
 
368
 * Modifies the intensity curve(s) for specified drawable.
 
369
 *
 
370
 * Modifies the intensity mapping for one channel in the specified
 
371
 * drawable. The drawable must be either grayscale or RGB, and the
 
372
 * channel can be either an intensity component, or the value. The
 
373
 * 'curve' parameter is an array of bytes which explicitly defines how
 
374
 * each pixel value in the drawable will be modified. Use the
 
375
 * 'gimp_curves_spline' function to modify intensity levels with
 
376
 * Catmull Rom splines.
 
377
 *
 
378
 * Returns: TRUE on success.
 
379
 */
 
380
gboolean
 
381
gimp_curves_explicit (gint32                drawable_ID,
 
382
                      GimpHistogramChannel  channel,
 
383
                      gint                  num_bytes,
 
384
                      const guint8         *curve)
 
385
{
 
386
  GimpParam *return_vals;
 
387
  gint nreturn_vals;
 
388
  gboolean success = TRUE;
 
389
 
 
390
  return_vals = gimp_run_procedure ("gimp_curves_explicit",
 
391
                                    &nreturn_vals,
 
392
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
393
                                    GIMP_PDB_INT32, channel,
 
394
                                    GIMP_PDB_INT32, num_bytes,
 
395
                                    GIMP_PDB_INT8ARRAY, curve,
 
396
                                    GIMP_PDB_END);
 
397
 
 
398
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
399
 
 
400
  gimp_destroy_params (return_vals, nreturn_vals);
 
401
 
 
402
  return success;
 
403
}
 
404
 
 
405
/**
 
406
 * gimp_color_balance:
 
407
 * @drawable_ID: The drawable.
 
408
 * @transfer_mode: Transfer mode.
 
409
 * @preserve_lum: Preserve luminosity values at each pixel.
 
410
 * @cyan_red: Cyan-Red color balance.
 
411
 * @magenta_green: Magenta-Green color balance.
 
412
 * @yellow_blue: Yellow-Blue color balance.
 
413
 *
 
414
 * Modify the color balance of the specified drawable.
 
415
 *
 
416
 * Modify the color balance of the specified drawable. There are three
 
417
 * axis which can be modified: cyan-red, magenta-green, and
 
418
 * yellow-blue. Negative values increase the amount of the former,
 
419
 * positive values increase the amount of the latter. Color balance can
 
420
 * be controlled with the 'transfer_mode' setting, which allows
 
421
 * shadows, midtones, and highlights in an image to be affected
 
422
 * differently. The 'preserve_lum' parameter, if non-zero, ensures that
 
423
 * the luminosity of each pixel remains fixed.
 
424
 *
 
425
 * Returns: TRUE on success.
 
426
 */
 
427
gboolean
 
428
gimp_color_balance (gint32           drawable_ID,
 
429
                    GimpTransferMode transfer_mode,
 
430
                    gboolean         preserve_lum,
 
431
                    gdouble          cyan_red,
 
432
                    gdouble          magenta_green,
 
433
                    gdouble          yellow_blue)
 
434
{
 
435
  GimpParam *return_vals;
 
436
  gint nreturn_vals;
 
437
  gboolean success = TRUE;
 
438
 
 
439
  return_vals = gimp_run_procedure ("gimp_color_balance",
 
440
                                    &nreturn_vals,
 
441
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
442
                                    GIMP_PDB_INT32, transfer_mode,
 
443
                                    GIMP_PDB_INT32, preserve_lum,
 
444
                                    GIMP_PDB_FLOAT, cyan_red,
 
445
                                    GIMP_PDB_FLOAT, magenta_green,
 
446
                                    GIMP_PDB_FLOAT, yellow_blue,
 
447
                                    GIMP_PDB_END);
 
448
 
 
449
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
450
 
 
451
  gimp_destroy_params (return_vals, nreturn_vals);
 
452
 
 
453
  return success;
 
454
}
 
455
 
 
456
/**
 
457
 * gimp_colorize:
 
458
 * @drawable_ID: The drawable.
 
459
 * @hue: Hue in degrees.
 
460
 * @saturation: Saturation in percent.
 
461
 * @lightness: Lightness in percent.
 
462
 *
 
463
 * Render the drawable as a grayscale image seen through a colored
 
464
 * glass.
 
465
 *
 
466
 * Desatures the drawable, then tints it with the specified color. This
 
467
 * tool is only valid on RGB color images. It will not operate on
 
468
 * grayscale or indexed drawables.
 
469
 *
 
470
 * Returns: TRUE on success.
 
471
 *
 
472
 * Since: GIMP 2.2
 
473
 */
 
474
gboolean
 
475
gimp_colorize (gint32  drawable_ID,
 
476
               gdouble hue,
 
477
               gdouble saturation,
 
478
               gdouble lightness)
 
479
{
 
480
  GimpParam *return_vals;
 
481
  gint nreturn_vals;
 
482
  gboolean success = TRUE;
 
483
 
 
484
  return_vals = gimp_run_procedure ("gimp_colorize",
 
485
                                    &nreturn_vals,
 
486
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
487
                                    GIMP_PDB_FLOAT, hue,
 
488
                                    GIMP_PDB_FLOAT, saturation,
 
489
                                    GIMP_PDB_FLOAT, lightness,
 
490
                                    GIMP_PDB_END);
 
491
 
 
492
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
493
 
 
494
  gimp_destroy_params (return_vals, nreturn_vals);
 
495
 
 
496
  return success;
 
497
}
 
498
 
 
499
/**
 
500
 * gimp_histogram:
 
501
 * @drawable_ID: The drawable.
 
502
 * @channel: The channel to modify.
 
503
 * @start_range: Start of the intensity measurement range.
 
504
 * @end_range: End of the intensity measurement range.
 
505
 * @mean: Mean intensity value.
 
506
 * @std_dev: Standard deviation of intensity values.
 
507
 * @median: Median intensity value.
 
508
 * @pixels: Alpha-weighted pixel count for entire image.
 
509
 * @count: Alpha-weighted pixel count for range.
 
510
 * @percentile: Percentile that range falls under.
 
511
 *
 
512
 * Returns information on the intensity histogram for the specified
 
513
 * drawable.
 
514
 *
 
515
 * This tool makes it possible to gather information about the
 
516
 * intensity histogram of a drawable. A channel to examine is first
 
517
 * specified. This can be either value, red, green, or blue, depending
 
518
 * on whether the drawable is of type color or grayscale. The drawable
 
519
 * may not be indexed. Second, a range of intensities are specified.
 
520
 * The gimp_histogram function returns statistics based on the pixels
 
521
 * in the drawable that fall under this range of values. Mean, standard
 
522
 * deviation, median, number of pixels, and percentile are all
 
523
 * returned. Additionally, the total count of pixels in the image is
 
524
 * returned. Counts of pixels are weighted by any associated alpha
 
525
 * values and by the current selection mask. That is, pixels that lie
 
526
 * outside an active selection mask will not be counted. Similarly,
 
527
 * pixels with transparent alpha values will not be counted.
 
528
 *
 
529
 * Returns: TRUE on success.
 
530
 */
 
531
gboolean
 
532
gimp_histogram (gint32                drawable_ID,
 
533
                GimpHistogramChannel  channel,
 
534
                gint                  start_range,
 
535
                gint                  end_range,
 
536
                gdouble              *mean,
 
537
                gdouble              *std_dev,
 
538
                gdouble              *median,
 
539
                gdouble              *pixels,
 
540
                gdouble              *count,
 
541
                gdouble              *percentile)
 
542
{
 
543
  GimpParam *return_vals;
 
544
  gint nreturn_vals;
 
545
  gboolean success = TRUE;
 
546
 
 
547
  return_vals = gimp_run_procedure ("gimp_histogram",
 
548
                                    &nreturn_vals,
 
549
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
550
                                    GIMP_PDB_INT32, channel,
 
551
                                    GIMP_PDB_INT32, start_range,
 
552
                                    GIMP_PDB_INT32, end_range,
 
553
                                    GIMP_PDB_END);
 
554
 
 
555
  *mean = 0.0;
 
556
  *std_dev = 0.0;
 
557
  *median = 0.0;
 
558
  *pixels = 0.0;
 
559
  *count = 0.0;
 
560
  *percentile = 0.0;
 
561
 
 
562
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
563
 
 
564
  if (success)
 
565
    {
 
566
      *mean = return_vals[1].data.d_float;
 
567
      *std_dev = return_vals[2].data.d_float;
 
568
      *median = return_vals[3].data.d_float;
 
569
      *pixels = return_vals[4].data.d_float;
 
570
      *count = return_vals[5].data.d_float;
 
571
      *percentile = return_vals[6].data.d_float;
 
572
    }
 
573
 
 
574
  gimp_destroy_params (return_vals, nreturn_vals);
 
575
 
 
576
  return success;
 
577
}
 
578
 
 
579
/**
 
580
 * gimp_hue_saturation:
 
581
 * @drawable_ID: The drawable.
 
582
 * @hue_range: Range of affected hues.
 
583
 * @hue_offset: Hue offset in degrees.
 
584
 * @lightness: lightness modification.
 
585
 * @saturation: saturation modification.
 
586
 *
 
587
 * Modify hue, lightness, and saturation in the specified drawable.
 
588
 *
 
589
 * This procedures allows the hue, lightness, and saturation in the
 
590
 * specified drawable to be modified. The 'hue_range' parameter
 
591
 * provides the capability to limit range of affected hues.
 
592
 *
 
593
 * Returns: TRUE on success.
 
594
 */
 
595
gboolean
 
596
gimp_hue_saturation (gint32       drawable_ID,
 
597
                     GimpHueRange hue_range,
 
598
                     gdouble      hue_offset,
 
599
                     gdouble      lightness,
 
600
                     gdouble      saturation)
 
601
{
 
602
  GimpParam *return_vals;
 
603
  gint nreturn_vals;
 
604
  gboolean success = TRUE;
 
605
 
 
606
  return_vals = gimp_run_procedure ("gimp_hue_saturation",
 
607
                                    &nreturn_vals,
 
608
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
609
                                    GIMP_PDB_INT32, hue_range,
 
610
                                    GIMP_PDB_FLOAT, hue_offset,
 
611
                                    GIMP_PDB_FLOAT, lightness,
 
612
                                    GIMP_PDB_FLOAT, saturation,
 
613
                                    GIMP_PDB_END);
 
614
 
 
615
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
616
 
 
617
  gimp_destroy_params (return_vals, nreturn_vals);
 
618
 
 
619
  return success;
 
620
}
 
621
 
 
622
/**
 
623
 * gimp_threshold:
 
624
 * @drawable_ID: The drawable.
 
625
 * @low_threshold: The low threshold value.
 
626
 * @high_threshold: The high threshold value.
 
627
 *
 
628
 * Threshold the specified drawable.
 
629
 *
 
630
 * This procedures generates a threshold map of the specified drawable.
 
631
 * All pixels between the values of 'low_threshold' and
 
632
 * 'high_threshold' are replaced with white, and all other pixels with
 
633
 * black.
 
634
 *
 
635
 * Returns: TRUE on success.
 
636
 */
 
637
gboolean
 
638
gimp_threshold (gint32 drawable_ID,
 
639
                gint   low_threshold,
 
640
                gint   high_threshold)
 
641
{
 
642
  GimpParam *return_vals;
 
643
  gint nreturn_vals;
 
644
  gboolean success = TRUE;
 
645
 
 
646
  return_vals = gimp_run_procedure ("gimp_threshold",
 
647
                                    &nreturn_vals,
 
648
                                    GIMP_PDB_DRAWABLE, drawable_ID,
 
649
                                    GIMP_PDB_INT32, low_threshold,
 
650
                                    GIMP_PDB_INT32, high_threshold,
 
651
                                    GIMP_PDB_END);
 
652
 
 
653
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
654
 
 
655
  gimp_destroy_params (return_vals, nreturn_vals);
 
656
 
 
657
  return success;
 
658
}