1 /* LIBGIMP - The GIMP Library
2  * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
3  *
4  * gimpselectiontools_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: gimpselectiontools
30  * @title: gimpselectiontools
31  * @short_description: Access to toolbox selection tools.
32  *
33  * Functions giving access to toolbox selection tools.
34  **/
35 
36 
37 /**
38  * gimp_by_color_select:
39  * @drawable_ID: The affected drawable.
40  * @color: The color to select.
41  * @threshold: Threshold in intensity levels.
42  * @operation: The selection operation.
43  * @antialias: Antialiasing.
44  * @feather: Feather option for selections.
45  * @feather_radius: Radius for feather operation.
46  * @sample_merged: Use the composite image, not the drawable.
47  *
48  * Deprecated: Use gimp_image_select_color() instead.
49  *
50  * Returns: TRUE on success.
51  **/
52 gboolean
gimp_by_color_select(gint32 drawable_ID,const GimpRGB * color,gint threshold,GimpChannelOps operation,gboolean antialias,gboolean feather,gdouble feather_radius,gboolean sample_merged)53 gimp_by_color_select (gint32          drawable_ID,
54                       const GimpRGB  *color,
55                       gint            threshold,
56                       GimpChannelOps  operation,
57                       gboolean        antialias,
58                       gboolean        feather,
59                       gdouble         feather_radius,
60                       gboolean        sample_merged)
61 {
62   GimpParam *return_vals;
63   gint nreturn_vals;
64   gboolean success = TRUE;
65 
66   return_vals = gimp_run_procedure ("gimp-by-color-select",
67                                     &nreturn_vals,
68                                     GIMP_PDB_DRAWABLE, drawable_ID,
69                                     GIMP_PDB_COLOR, color,
70                                     GIMP_PDB_INT32, threshold,
71                                     GIMP_PDB_INT32, operation,
72                                     GIMP_PDB_INT32, antialias,
73                                     GIMP_PDB_INT32, feather,
74                                     GIMP_PDB_FLOAT, feather_radius,
75                                     GIMP_PDB_INT32, sample_merged,
76                                     GIMP_PDB_END);
77 
78   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
79 
80   gimp_destroy_params (return_vals, nreturn_vals);
81 
82   return success;
83 }
84 
85 /**
86  * gimp_by_color_select_full:
87  * @drawable_ID: The affected drawable.
88  * @color: The color to select.
89  * @threshold: Threshold in intensity levels.
90  * @operation: The selection operation.
91  * @antialias: Antialiasing.
92  * @feather: Feather option for selections.
93  * @feather_radius_x: Radius for feather operation in X direction.
94  * @feather_radius_y: Radius for feather operation in Y direction.
95  * @sample_merged: Use the composite image, not the drawable.
96  * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
97  * @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
98  *
99  * Deprecated: Use gimp_image_select_color() instead.
100  *
101  * Returns: TRUE on success.
102  *
103  * Since: 2.4
104  **/
105 gboolean
gimp_by_color_select_full(gint32 drawable_ID,const GimpRGB * color,gint threshold,GimpChannelOps operation,gboolean antialias,gboolean feather,gdouble feather_radius_x,gdouble feather_radius_y,gboolean sample_merged,gboolean select_transparent,GimpSelectCriterion select_criterion)106 gimp_by_color_select_full (gint32               drawable_ID,
107                            const GimpRGB       *color,
108                            gint                 threshold,
109                            GimpChannelOps       operation,
110                            gboolean             antialias,
111                            gboolean             feather,
112                            gdouble              feather_radius_x,
113                            gdouble              feather_radius_y,
114                            gboolean             sample_merged,
115                            gboolean             select_transparent,
116                            GimpSelectCriterion  select_criterion)
117 {
118   GimpParam *return_vals;
119   gint nreturn_vals;
120   gboolean success = TRUE;
121 
122   return_vals = gimp_run_procedure ("gimp-by-color-select-full",
123                                     &nreturn_vals,
124                                     GIMP_PDB_DRAWABLE, drawable_ID,
125                                     GIMP_PDB_COLOR, color,
126                                     GIMP_PDB_INT32, threshold,
127                                     GIMP_PDB_INT32, operation,
128                                     GIMP_PDB_INT32, antialias,
129                                     GIMP_PDB_INT32, feather,
130                                     GIMP_PDB_FLOAT, feather_radius_x,
131                                     GIMP_PDB_FLOAT, feather_radius_y,
132                                     GIMP_PDB_INT32, sample_merged,
133                                     GIMP_PDB_INT32, select_transparent,
134                                     GIMP_PDB_INT32, select_criterion,
135                                     GIMP_PDB_END);
136 
137   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
138 
139   gimp_destroy_params (return_vals, nreturn_vals);
140 
141   return success;
142 }
143 
144 /**
145  * gimp_ellipse_select:
146  * @image_ID: The image.
147  * @x: x coordinate of upper-left corner of ellipse bounding box.
148  * @y: y coordinate of upper-left corner of ellipse bounding box.
149  * @width: The width of the ellipse.
150  * @height: The height of the ellipse.
151  * @operation: The selection operation.
152  * @antialias: Antialiasing.
153  * @feather: Feather option for selections.
154  * @feather_radius: Radius for feather operation.
155  *
156  * Deprecated: Use gimp_image_select_ellipse() instead.
157  *
158  * Returns: TRUE on success.
159  **/
160 gboolean
gimp_ellipse_select(gint32 image_ID,gdouble x,gdouble y,gdouble width,gdouble height,GimpChannelOps operation,gboolean antialias,gboolean feather,gdouble feather_radius)161 gimp_ellipse_select (gint32         image_ID,
162                      gdouble        x,
163                      gdouble        y,
164                      gdouble        width,
165                      gdouble        height,
166                      GimpChannelOps operation,
167                      gboolean       antialias,
168                      gboolean       feather,
169                      gdouble        feather_radius)
170 {
171   GimpParam *return_vals;
172   gint nreturn_vals;
173   gboolean success = TRUE;
174 
175   return_vals = gimp_run_procedure ("gimp-ellipse-select",
176                                     &nreturn_vals,
177                                     GIMP_PDB_IMAGE, image_ID,
178                                     GIMP_PDB_FLOAT, x,
179                                     GIMP_PDB_FLOAT, y,
180                                     GIMP_PDB_FLOAT, width,
181                                     GIMP_PDB_FLOAT, height,
182                                     GIMP_PDB_INT32, operation,
183                                     GIMP_PDB_INT32, antialias,
184                                     GIMP_PDB_INT32, feather,
185                                     GIMP_PDB_FLOAT, feather_radius,
186                                     GIMP_PDB_END);
187 
188   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
189 
190   gimp_destroy_params (return_vals, nreturn_vals);
191 
192   return success;
193 }
194 
195 /**
196  * gimp_free_select:
197  * @image_ID: The image.
198  * @num_segs: Number of points (count 1 coordinate as two points).
199  * @segs: Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}.
200  * @operation: The selection operation.
201  * @antialias: Antialiasing.
202  * @feather: Feather option for selections.
203  * @feather_radius: Radius for feather operation.
204  *
205  * Deprecated: Use gimp_image_select_polygon() instead.
206  *
207  * Returns: TRUE on success.
208  **/
209 gboolean
gimp_free_select(gint32 image_ID,gint num_segs,const gdouble * segs,GimpChannelOps operation,gboolean antialias,gboolean feather,gdouble feather_radius)210 gimp_free_select (gint32          image_ID,
211                   gint            num_segs,
212                   const gdouble  *segs,
213                   GimpChannelOps  operation,
214                   gboolean        antialias,
215                   gboolean        feather,
216                   gdouble         feather_radius)
217 {
218   GimpParam *return_vals;
219   gint nreturn_vals;
220   gboolean success = TRUE;
221 
222   return_vals = gimp_run_procedure ("gimp-free-select",
223                                     &nreturn_vals,
224                                     GIMP_PDB_IMAGE, image_ID,
225                                     GIMP_PDB_INT32, num_segs,
226                                     GIMP_PDB_FLOATARRAY, segs,
227                                     GIMP_PDB_INT32, operation,
228                                     GIMP_PDB_INT32, antialias,
229                                     GIMP_PDB_INT32, feather,
230                                     GIMP_PDB_FLOAT, feather_radius,
231                                     GIMP_PDB_END);
232 
233   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
234 
235   gimp_destroy_params (return_vals, nreturn_vals);
236 
237   return success;
238 }
239 
240 /**
241  * gimp_fuzzy_select:
242  * @drawable_ID: The affected drawable.
243  * @x: x coordinate of initial seed fill point: (image coordinates).
244  * @y: y coordinate of initial seed fill point: (image coordinates).
245  * @threshold: Threshold in intensity levels.
246  * @operation: The selection operation.
247  * @antialias: Antialiasing.
248  * @feather: Feather option for selections.
249  * @feather_radius: Radius for feather operation.
250  * @sample_merged: Use the composite image, not the drawable.
251  *
252  * Deprecated: Use gimp_image_select_contiguous_color() instead.
253  *
254  * Returns: TRUE on success.
255  **/
256 gboolean
gimp_fuzzy_select(gint32 drawable_ID,gdouble x,gdouble y,gint threshold,GimpChannelOps operation,gboolean antialias,gboolean feather,gdouble feather_radius,gboolean sample_merged)257 gimp_fuzzy_select (gint32         drawable_ID,
258                    gdouble        x,
259                    gdouble        y,
260                    gint           threshold,
261                    GimpChannelOps operation,
262                    gboolean       antialias,
263                    gboolean       feather,
264                    gdouble        feather_radius,
265                    gboolean       sample_merged)
266 {
267   GimpParam *return_vals;
268   gint nreturn_vals;
269   gboolean success = TRUE;
270 
271   return_vals = gimp_run_procedure ("gimp-fuzzy-select",
272                                     &nreturn_vals,
273                                     GIMP_PDB_DRAWABLE, drawable_ID,
274                                     GIMP_PDB_FLOAT, x,
275                                     GIMP_PDB_FLOAT, y,
276                                     GIMP_PDB_INT32, threshold,
277                                     GIMP_PDB_INT32, operation,
278                                     GIMP_PDB_INT32, antialias,
279                                     GIMP_PDB_INT32, feather,
280                                     GIMP_PDB_FLOAT, feather_radius,
281                                     GIMP_PDB_INT32, sample_merged,
282                                     GIMP_PDB_END);
283 
284   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
285 
286   gimp_destroy_params (return_vals, nreturn_vals);
287 
288   return success;
289 }
290 
291 /**
292  * gimp_fuzzy_select_full:
293  * @drawable_ID: The affected drawable.
294  * @x: x coordinate of initial seed fill point: (image coordinates).
295  * @y: y coordinate of initial seed fill point: (image coordinates).
296  * @threshold: Threshold in intensity levels.
297  * @operation: The selection operation.
298  * @antialias: Antialiasing.
299  * @feather: Feather option for selections.
300  * @feather_radius_x: Radius for feather operation in X direction.
301  * @feather_radius_y: Radius for feather operation in Y direction.
302  * @sample_merged: Use the composite image, not the drawable.
303  * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
304  * @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
305  *
306  * Deprecated: Use gimp_image_select_contiguous_color() instead.
307  *
308  * Returns: TRUE on success.
309  *
310  * Since: 2.4
311  **/
312 gboolean
gimp_fuzzy_select_full(gint32 drawable_ID,gdouble x,gdouble y,gint threshold,GimpChannelOps operation,gboolean antialias,gboolean feather,gdouble feather_radius_x,gdouble feather_radius_y,gboolean sample_merged,gboolean select_transparent,GimpSelectCriterion select_criterion)313 gimp_fuzzy_select_full (gint32              drawable_ID,
314                         gdouble             x,
315                         gdouble             y,
316                         gint                threshold,
317                         GimpChannelOps      operation,
318                         gboolean            antialias,
319                         gboolean            feather,
320                         gdouble             feather_radius_x,
321                         gdouble             feather_radius_y,
322                         gboolean            sample_merged,
323                         gboolean            select_transparent,
324                         GimpSelectCriterion select_criterion)
325 {
326   GimpParam *return_vals;
327   gint nreturn_vals;
328   gboolean success = TRUE;
329 
330   return_vals = gimp_run_procedure ("gimp-fuzzy-select-full",
331                                     &nreturn_vals,
332                                     GIMP_PDB_DRAWABLE, drawable_ID,
333                                     GIMP_PDB_FLOAT, x,
334                                     GIMP_PDB_FLOAT, y,
335                                     GIMP_PDB_INT32, threshold,
336                                     GIMP_PDB_INT32, operation,
337                                     GIMP_PDB_INT32, antialias,
338                                     GIMP_PDB_INT32, feather,
339                                     GIMP_PDB_FLOAT, feather_radius_x,
340                                     GIMP_PDB_FLOAT, feather_radius_y,
341                                     GIMP_PDB_INT32, sample_merged,
342                                     GIMP_PDB_INT32, select_transparent,
343                                     GIMP_PDB_INT32, select_criterion,
344                                     GIMP_PDB_END);
345 
346   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
347 
348   gimp_destroy_params (return_vals, nreturn_vals);
349 
350   return success;
351 }
352 
353 /**
354  * gimp_rect_select:
355  * @image_ID: The image.
356  * @x: x coordinate of upper-left corner of rectangle.
357  * @y: y coordinate of upper-left corner of rectangle.
358  * @width: The width of the rectangle.
359  * @height: The height of the rectangle.
360  * @operation: The selection operation.
361  * @feather: Feather option for selections.
362  * @feather_radius: Radius for feather operation.
363  *
364  * Deprecated: Use gimp_image_select_rectangle() instead.
365  *
366  * Returns: TRUE on success.
367  **/
368 gboolean
gimp_rect_select(gint32 image_ID,gdouble x,gdouble y,gdouble width,gdouble height,GimpChannelOps operation,gboolean feather,gdouble feather_radius)369 gimp_rect_select (gint32         image_ID,
370                   gdouble        x,
371                   gdouble        y,
372                   gdouble        width,
373                   gdouble        height,
374                   GimpChannelOps operation,
375                   gboolean       feather,
376                   gdouble        feather_radius)
377 {
378   GimpParam *return_vals;
379   gint nreturn_vals;
380   gboolean success = TRUE;
381 
382   return_vals = gimp_run_procedure ("gimp-rect-select",
383                                     &nreturn_vals,
384                                     GIMP_PDB_IMAGE, image_ID,
385                                     GIMP_PDB_FLOAT, x,
386                                     GIMP_PDB_FLOAT, y,
387                                     GIMP_PDB_FLOAT, width,
388                                     GIMP_PDB_FLOAT, height,
389                                     GIMP_PDB_INT32, operation,
390                                     GIMP_PDB_INT32, feather,
391                                     GIMP_PDB_FLOAT, feather_radius,
392                                     GIMP_PDB_END);
393 
394   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
395 
396   gimp_destroy_params (return_vals, nreturn_vals);
397 
398   return success;
399 }
400 
401 /**
402  * gimp_round_rect_select:
403  * @image_ID: The image.
404  * @x: x coordinate of upper-left corner of rectangle.
405  * @y: y coordinate of upper-left corner of rectangle.
406  * @width: The width of the rectangle.
407  * @height: The height of the rectangle.
408  * @corner_radius_x: The corner radius in X direction.
409  * @corner_radius_y: The corner radius in Y direction.
410  * @operation: The selection operation.
411  * @antialias: Antialiasing.
412  * @feather: Feather option for selections.
413  * @feather_radius_x: Radius for feather operation in X direction.
414  * @feather_radius_y: Radius for feather operation in Y direction.
415  *
416  * Deprecated: Use gimp_image_select_round_rectangle() instead.
417  *
418  * Returns: TRUE on success.
419  *
420  * Since: 2.4
421  **/
422 gboolean
gimp_round_rect_select(gint32 image_ID,gdouble x,gdouble y,gdouble width,gdouble height,gdouble corner_radius_x,gdouble corner_radius_y,GimpChannelOps operation,gboolean antialias,gboolean feather,gdouble feather_radius_x,gdouble feather_radius_y)423 gimp_round_rect_select (gint32         image_ID,
424                         gdouble        x,
425                         gdouble        y,
426                         gdouble        width,
427                         gdouble        height,
428                         gdouble        corner_radius_x,
429                         gdouble        corner_radius_y,
430                         GimpChannelOps operation,
431                         gboolean       antialias,
432                         gboolean       feather,
433                         gdouble        feather_radius_x,
434                         gdouble        feather_radius_y)
435 {
436   GimpParam *return_vals;
437   gint nreturn_vals;
438   gboolean success = TRUE;
439 
440   return_vals = gimp_run_procedure ("gimp-round-rect-select",
441                                     &nreturn_vals,
442                                     GIMP_PDB_IMAGE, image_ID,
443                                     GIMP_PDB_FLOAT, x,
444                                     GIMP_PDB_FLOAT, y,
445                                     GIMP_PDB_FLOAT, width,
446                                     GIMP_PDB_FLOAT, height,
447                                     GIMP_PDB_FLOAT, corner_radius_x,
448                                     GIMP_PDB_FLOAT, corner_radius_y,
449                                     GIMP_PDB_INT32, operation,
450                                     GIMP_PDB_INT32, antialias,
451                                     GIMP_PDB_INT32, feather,
452                                     GIMP_PDB_FLOAT, feather_radius_x,
453                                     GIMP_PDB_FLOAT, feather_radius_y,
454                                     GIMP_PDB_END);
455 
456   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
457 
458   gimp_destroy_params (return_vals, nreturn_vals);
459 
460   return success;
461 }
462