summaryrefslogtreecommitdiffstats
path: root/libgimp/gimpdrawableedit_pdb.c
blob: f8eb93b2209b6217608a346b5a47cdfaf4f95438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimpdrawableedit_pdb.c
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <https://www.gnu.org/licenses/>.
 */

/* NOTE: This file is auto-generated by pdbgen.pl */

#include "config.h"

#include "gimp.h"


/**
 * SECTION: gimpdrawableedit
 * @title: gimpdrawableedit
 * @short_description: Drawable edit functions (clear, fill, gradient, stroke etc.)
 *
 * Drawable edit functions (clear, fill, gradient, stroke etc.)
 **/


/**
 * gimp_drawable_edit_clear:
 * @drawable_ID: The drawable to clear from.
 *
 * Clear selected area of drawable.
 *
 * This procedure clears the specified drawable. If the drawable has an
 * alpha channel, the cleared pixels will become transparent. If the
 * drawable does not have an alpha channel, cleared pixels will be set
 * to the background color. This procedure only affects regions within
 * a selection if there is a selection active.
 *
 * This procedure is affected by the following context setters:
 * gimp_context_set_background().
 *
 * Returns: TRUE on success.
 **/
gboolean
gimp_drawable_edit_clear (gint32 drawable_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-drawable-edit-clear",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_drawable_edit_fill:
 * @drawable_ID: The drawable to fill to.
 * @fill_type: The type of fill.
 *
 * Fill selected area of drawable.
 *
 * This procedure fills the specified drawable according to fill mode.
 * This procedure only affects regions within a selection if there is a
 * selection active. If you want to fill the whole drawable, regardless
 * of the selection, use gimp_drawable_fill().
 *
 * This procedure is affected by the following context setters:
 * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
 * gimp_context_set_foreground(), gimp_context_set_background(),
 * gimp_context_set_pattern().
 *
 * Returns: TRUE on success.
 **/
gboolean
gimp_drawable_edit_fill (gint32       drawable_ID,
                         GimpFillType fill_type)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-drawable-edit-fill",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_INT32, fill_type,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_drawable_edit_bucket_fill:
 * @drawable_ID: The affected drawable.
 * @fill_type: The type of fill.
 * @x: The x coordinate of this bucket fill's application.
 * @y: The y coordinate of this bucket fill's application.
 *
 * Fill the area by a seed fill starting at the specified coordinates.
 *
 * This procedure does a seed fill at the specified coordinates, using
 * various parameters from the current context.
 * In the case of merged sampling, the x and y coordinates are relative
 * to the image's origin; otherwise, they are relative to the
 * drawable's origin.
 *
 * This procedure is affected by the following context setters:
 * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
 * gimp_context_set_foreground(), gimp_context_set_background(),
 * gimp_context_set_pattern(), gimp_context_set_sample_threshold(),
 * gimp_context_set_sample_merged(),
 * gimp_context_set_sample_criterion(),
 * gimp_context_set_diagonal_neighbors(), gimp_context_set_antialias().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_drawable_edit_bucket_fill (gint32       drawable_ID,
                                GimpFillType fill_type,
                                gdouble      x,
                                gdouble      y)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-drawable-edit-bucket-fill",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_INT32, fill_type,
                                    GIMP_PDB_FLOAT, x,
                                    GIMP_PDB_FLOAT, y,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_drawable_edit_gradient_fill:
 * @drawable_ID: The affected drawable.
 * @gradient_type: The type of gradient.
 * @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
 * @supersample: Do adaptive supersampling.
 * @supersample_max_depth: Maximum recursion levels for supersampling.
 * @supersample_threshold: Supersampling threshold.
 * @dither: Use dithering to reduce banding.
 * @x1: The x coordinate of this gradient's starting point.
 * @y1: The y coordinate of this gradient's starting point.
 * @x2: The x coordinate of this gradient's ending point.
 * @y2: The y coordinate of this gradient's ending point.
 *
 * Draw a gradient between the starting and ending coordinates with the
 * specified gradient type.
 *
 * This tool requires information on the gradient type. It creates the
 * specified variety of gradient using the starting and ending
 * coordinates as defined for each gradient type. For shapeburst
 * gradient types, the context's distance metric is also relevant and
 * can be updated with gimp_context_set_distance_metric().
 *
 * This procedure is affected by the following context setters:
 * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
 * gimp_context_set_foreground(), gimp_context_set_background(),
 * gimp_context_set_gradient() and all gradient property settings,
 * gimp_context_set_distance_metric().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_drawable_edit_gradient_fill (gint32           drawable_ID,
                                  GimpGradientType gradient_type,
                                  gdouble          offset,
                                  gboolean         supersample,
                                  gint             supersample_max_depth,
                                  gdouble          supersample_threshold,
                                  gboolean         dither,
                                  gdouble          x1,
                                  gdouble          y1,
                                  gdouble          x2,
                                  gdouble          y2)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-drawable-edit-gradient-fill",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_INT32, gradient_type,
                                    GIMP_PDB_FLOAT, offset,
                                    GIMP_PDB_INT32, supersample,
                                    GIMP_PDB_INT32, supersample_max_depth,
                                    GIMP_PDB_FLOAT, supersample_threshold,
                                    GIMP_PDB_INT32, dither,
                                    GIMP_PDB_FLOAT, x1,
                                    GIMP_PDB_FLOAT, y1,
                                    GIMP_PDB_FLOAT, x2,
                                    GIMP_PDB_FLOAT, y2,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_drawable_edit_stroke_selection:
 * @drawable_ID: The drawable to stroke to.
 *
 * Stroke the current selection
 *
 * This procedure strokes the current selection, painting along the
 * selection boundary with the active paint method and brush, or using
 * a plain line with configurable properties. The paint is applied to
 * the specified drawable regardless of the active selection.
 *
 * This procedure is affected by the following context setters:
 * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
 * gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
 * gimp_context_set_foreground(), gimp_context_set_brush() and all
 * brush property settings, gimp_context_set_gradient() and all
 * gradient property settings, gimp_context_set_line_width() and all
 * line property settings, gimp_context_set_antialias().
 *
 * Returns: TRUE on success.
 **/
gboolean
gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-drawable-edit-stroke-selection",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_drawable_edit_stroke_item:
 * @drawable_ID: The drawable to stroke to.
 * @item_ID: The item to stroke.
 *
 * Stroke the specified item
 *
 * This procedure strokes the specified item, painting along its
 * outline (e.g. along a path, or along a channel's boundary), with the
 * active paint method and brush, or using a plain line with
 * configurable properties.
 *
 * This procedure is affected by the following context setters:
 * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
 * gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
 * gimp_context_set_foreground(), gimp_context_set_brush() and all
 * brush property settings, gimp_context_set_gradient() and all
 * gradient property settings, gimp_context_set_line_width() and all
 * line property settings, gimp_context_set_antialias().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_drawable_edit_stroke_item (gint32 drawable_ID,
                                gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-drawable-edit-stroke-item",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}