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