1 /* GIMP - The GNU Image Manipulation Program
2 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18 /* NOTE: This file is auto-generated by pdbgen.pl. */
19
20 #include "config.h"
21
22 #include <gegl.h>
23
24 #include <gdk-pixbuf/gdk-pixbuf.h>
25
26 #include "libgimpconfig/gimpconfig.h"
27
28 #include "libgimpbase/gimpbase.h"
29
30 #include "pdb-types.h"
31
32 #include "core/gimp-edit.h"
33 #include "core/gimp-gradients.h"
34 #include "core/gimp.h"
35 #include "core/gimpbuffer.h"
36 #include "core/gimpchannel.h"
37 #include "core/gimpdrawable-bucket-fill.h"
38 #include "core/gimpdrawable-edit.h"
39 #include "core/gimpdrawable-gradient.h"
40 #include "core/gimpdrawable.h"
41 #include "core/gimpimage.h"
42 #include "core/gimplayer.h"
43 #include "core/gimpparamspecs.h"
44 #include "core/gimpprogress.h"
45 #include "core/gimpstrokeoptions.h"
46 #include "vectors/gimpvectors.h"
47
48 #include "gimppdb.h"
49 #include "gimppdb-utils.h"
50 #include "gimppdbcontext.h"
51 #include "gimpprocedure.h"
52 #include "internal-procs.h"
53
54 #include "gimp-intl.h"
55
56
57 static GimpValueArray *
edit_cut_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)58 edit_cut_invoker (GimpProcedure *procedure,
59 Gimp *gimp,
60 GimpContext *context,
61 GimpProgress *progress,
62 const GimpValueArray *args,
63 GError **error)
64 {
65 gboolean success = TRUE;
66 GimpValueArray *return_vals;
67 GimpDrawable *drawable;
68 gboolean non_empty = FALSE;
69
70 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
71
72 if (success)
73 {
74 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
75 GIMP_PDB_ITEM_CONTENT, error) &&
76 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
77 {
78 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
79 GError *my_error = NULL;
80
81 non_empty = gimp_edit_cut (image, drawable, context, &my_error) != NULL;
82
83 if (! non_empty)
84 {
85 gimp_message_literal (gimp,
86 G_OBJECT (progress), GIMP_MESSAGE_WARNING,
87 my_error->message);
88 g_clear_error (&my_error);
89 }
90 }
91 else
92 success = FALSE;
93 }
94
95 return_vals = gimp_procedure_get_return_values (procedure, success,
96 error ? *error : NULL);
97
98 if (success)
99 g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
100
101 return return_vals;
102 }
103
104 static GimpValueArray *
edit_copy_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)105 edit_copy_invoker (GimpProcedure *procedure,
106 Gimp *gimp,
107 GimpContext *context,
108 GimpProgress *progress,
109 const GimpValueArray *args,
110 GError **error)
111 {
112 gboolean success = TRUE;
113 GimpValueArray *return_vals;
114 GimpDrawable *drawable;
115 gboolean non_empty = FALSE;
116
117 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
118
119 if (success)
120 {
121 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
122 {
123 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
124 GError *my_error = NULL;
125
126 non_empty = gimp_edit_copy (image, drawable, context, &my_error) != NULL;
127
128 if (! non_empty)
129 {
130 gimp_message_literal (gimp,
131 G_OBJECT (progress), GIMP_MESSAGE_WARNING,
132 my_error->message);
133 g_clear_error (&my_error);
134 }
135 }
136 else
137 success = FALSE;
138 }
139
140 return_vals = gimp_procedure_get_return_values (procedure, success,
141 error ? *error : NULL);
142
143 if (success)
144 g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
145
146 return return_vals;
147 }
148
149 static GimpValueArray *
edit_copy_visible_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)150 edit_copy_visible_invoker (GimpProcedure *procedure,
151 Gimp *gimp,
152 GimpContext *context,
153 GimpProgress *progress,
154 const GimpValueArray *args,
155 GError **error)
156 {
157 gboolean success = TRUE;
158 GimpValueArray *return_vals;
159 GimpImage *image;
160 gboolean non_empty = FALSE;
161
162 image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
163
164 if (success)
165 {
166 GError *my_error = NULL;
167
168 non_empty = gimp_edit_copy_visible (image, context, &my_error) != NULL;
169
170 if (! non_empty)
171 {
172 gimp_message_literal (gimp,
173 G_OBJECT (progress), GIMP_MESSAGE_WARNING,
174 my_error->message);
175 g_clear_error (&my_error);
176 }
177 }
178
179 return_vals = gimp_procedure_get_return_values (procedure, success,
180 error ? *error : NULL);
181
182 if (success)
183 g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
184
185 return return_vals;
186 }
187
188 static GimpValueArray *
edit_paste_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)189 edit_paste_invoker (GimpProcedure *procedure,
190 Gimp *gimp,
191 GimpContext *context,
192 GimpProgress *progress,
193 const GimpValueArray *args,
194 GError **error)
195 {
196 gboolean success = TRUE;
197 GimpValueArray *return_vals;
198 GimpDrawable *drawable;
199 gboolean paste_into;
200 GimpLayer *floating_sel = NULL;
201
202 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
203 paste_into = g_value_get_boolean (gimp_value_array_index (args, 1));
204
205 if (success)
206 {
207 GimpObject *paste = gimp_get_clipboard_object (gimp);
208
209 if (paste &&
210 gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
211 GIMP_PDB_ITEM_CONTENT, error) &&
212 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
213 {
214 floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
215 drawable, paste,
216 paste_into ?
217 GIMP_PASTE_TYPE_FLOATING_INTO :
218 GIMP_PASTE_TYPE_FLOATING,
219 -1, -1, -1, -1);
220
221 if (! floating_sel)
222 success = FALSE;
223 }
224 else
225 success = FALSE;
226 }
227
228 return_vals = gimp_procedure_get_return_values (procedure, success,
229 error ? *error : NULL);
230
231 if (success)
232 gimp_value_set_layer (gimp_value_array_index (return_vals, 1), floating_sel);
233
234 return return_vals;
235 }
236
237 static GimpValueArray *
edit_paste_as_new_image_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)238 edit_paste_as_new_image_invoker (GimpProcedure *procedure,
239 Gimp *gimp,
240 GimpContext *context,
241 GimpProgress *progress,
242 const GimpValueArray *args,
243 GError **error)
244 {
245 gboolean success = TRUE;
246 GimpValueArray *return_vals;
247 GimpImage *image = NULL;
248
249 GimpObject *paste = gimp_get_clipboard_object (gimp);
250
251 if (paste)
252 {
253 image = gimp_edit_paste_as_new_image (gimp, paste);
254
255 if (! image)
256 success = FALSE;
257 }
258
259 return_vals = gimp_procedure_get_return_values (procedure, success,
260 error ? *error : NULL);
261
262 if (success)
263 gimp_value_set_image (gimp_value_array_index (return_vals, 1), image);
264
265 return return_vals;
266 }
267
268 static GimpValueArray *
edit_named_cut_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)269 edit_named_cut_invoker (GimpProcedure *procedure,
270 Gimp *gimp,
271 GimpContext *context,
272 GimpProgress *progress,
273 const GimpValueArray *args,
274 GError **error)
275 {
276 gboolean success = TRUE;
277 GimpValueArray *return_vals;
278 GimpDrawable *drawable;
279 const gchar *buffer_name;
280 gchar *real_name = NULL;
281
282 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
283 buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
284
285 if (success)
286 {
287 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
288 GIMP_PDB_ITEM_CONTENT, error) &&
289 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
290 {
291 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
292 GError *my_error = NULL;
293
294 real_name = (gchar *) gimp_edit_named_cut (image, buffer_name,
295 drawable, context, &my_error);
296
297 if (real_name)
298 {
299 real_name = g_strdup (real_name);
300 }
301 else
302 {
303 gimp_message_literal (gimp,
304 G_OBJECT (progress), GIMP_MESSAGE_WARNING,
305 my_error->message);
306 g_clear_error (&my_error);
307 }
308 }
309 else
310 success = FALSE;
311 }
312
313 return_vals = gimp_procedure_get_return_values (procedure, success,
314 error ? *error : NULL);
315
316 if (success)
317 g_value_take_string (gimp_value_array_index (return_vals, 1), real_name);
318
319 return return_vals;
320 }
321
322 static GimpValueArray *
edit_named_copy_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)323 edit_named_copy_invoker (GimpProcedure *procedure,
324 Gimp *gimp,
325 GimpContext *context,
326 GimpProgress *progress,
327 const GimpValueArray *args,
328 GError **error)
329 {
330 gboolean success = TRUE;
331 GimpValueArray *return_vals;
332 GimpDrawable *drawable;
333 const gchar *buffer_name;
334 gchar *real_name = NULL;
335
336 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
337 buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
338
339 if (success)
340 {
341 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
342 {
343 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
344 GError *my_error = NULL;
345
346 real_name = (gchar *) gimp_edit_named_copy (image, buffer_name,
347 drawable, context, &my_error);
348
349 if (real_name)
350 {
351 real_name = g_strdup (real_name);
352 }
353 else
354 {
355 gimp_message_literal (gimp,
356 G_OBJECT (progress), GIMP_MESSAGE_WARNING,
357 my_error->message);
358 g_clear_error (&my_error);
359 }
360 }
361 else
362 success = FALSE;
363 }
364
365 return_vals = gimp_procedure_get_return_values (procedure, success,
366 error ? *error : NULL);
367
368 if (success)
369 g_value_take_string (gimp_value_array_index (return_vals, 1), real_name);
370
371 return return_vals;
372 }
373
374 static GimpValueArray *
edit_named_copy_visible_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)375 edit_named_copy_visible_invoker (GimpProcedure *procedure,
376 Gimp *gimp,
377 GimpContext *context,
378 GimpProgress *progress,
379 const GimpValueArray *args,
380 GError **error)
381 {
382 gboolean success = TRUE;
383 GimpValueArray *return_vals;
384 GimpImage *image;
385 const gchar *buffer_name;
386 gchar *real_name = NULL;
387
388 image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
389 buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
390
391 if (success)
392 {
393 GError *my_error = NULL;
394
395 real_name = (gchar *) gimp_edit_named_copy_visible (image, buffer_name,
396 context, &my_error);
397
398 if (real_name)
399 {
400 real_name = g_strdup (real_name);
401 }
402 else
403 {
404 gimp_message_literal (gimp,
405 G_OBJECT (progress), GIMP_MESSAGE_WARNING,
406 my_error->message);
407 g_clear_error (&my_error);
408 }
409 }
410
411 return_vals = gimp_procedure_get_return_values (procedure, success,
412 error ? *error : NULL);
413
414 if (success)
415 g_value_take_string (gimp_value_array_index (return_vals, 1), real_name);
416
417 return return_vals;
418 }
419
420 static GimpValueArray *
edit_named_paste_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)421 edit_named_paste_invoker (GimpProcedure *procedure,
422 Gimp *gimp,
423 GimpContext *context,
424 GimpProgress *progress,
425 const GimpValueArray *args,
426 GError **error)
427 {
428 gboolean success = TRUE;
429 GimpValueArray *return_vals;
430 GimpDrawable *drawable;
431 const gchar *buffer_name;
432 gboolean paste_into;
433 GimpLayer *floating_sel = NULL;
434
435 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
436 buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
437 paste_into = g_value_get_boolean (gimp_value_array_index (args, 2));
438
439 if (success)
440 {
441 GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
442
443 if (buffer &&
444 gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
445 GIMP_PDB_ITEM_CONTENT, error) &&
446 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
447 {
448 floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
449 drawable, GIMP_OBJECT (buffer),
450 paste_into ?
451 GIMP_PASTE_TYPE_FLOATING_INTO :
452 GIMP_PASTE_TYPE_FLOATING,
453 -1, -1, -1, -1);
454 if (! floating_sel)
455 success = FALSE;
456 }
457 else
458 success = FALSE;
459 }
460
461 return_vals = gimp_procedure_get_return_values (procedure, success,
462 error ? *error : NULL);
463
464 if (success)
465 gimp_value_set_layer (gimp_value_array_index (return_vals, 1), floating_sel);
466
467 return return_vals;
468 }
469
470 static GimpValueArray *
edit_named_paste_as_new_image_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)471 edit_named_paste_as_new_image_invoker (GimpProcedure *procedure,
472 Gimp *gimp,
473 GimpContext *context,
474 GimpProgress *progress,
475 const GimpValueArray *args,
476 GError **error)
477 {
478 gboolean success = TRUE;
479 GimpValueArray *return_vals;
480 const gchar *buffer_name;
481 GimpImage *image = NULL;
482
483 buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
484
485 if (success)
486 {
487 GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
488
489 if (buffer)
490 {
491 image = gimp_edit_paste_as_new_image (gimp, GIMP_OBJECT (buffer));
492
493 if (! image)
494 success = FALSE;
495 }
496 else
497 success = FALSE;
498 }
499
500 return_vals = gimp_procedure_get_return_values (procedure, success,
501 error ? *error : NULL);
502
503 if (success)
504 gimp_value_set_image (gimp_value_array_index (return_vals, 1), image);
505
506 return return_vals;
507 }
508
509 static GimpValueArray *
edit_clear_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)510 edit_clear_invoker (GimpProcedure *procedure,
511 Gimp *gimp,
512 GimpContext *context,
513 GimpProgress *progress,
514 const GimpValueArray *args,
515 GError **error)
516 {
517 gboolean success = TRUE;
518 GimpDrawable *drawable;
519
520 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
521
522 if (success)
523 {
524 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
525 GIMP_PDB_ITEM_CONTENT, error) &&
526 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
527 {
528 gimp_drawable_edit_clear (drawable, context);
529 }
530 else
531 success = FALSE;
532 }
533
534 return gimp_procedure_get_return_values (procedure, success,
535 error ? *error : NULL);
536 }
537
538 static GimpValueArray *
edit_fill_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)539 edit_fill_invoker (GimpProcedure *procedure,
540 Gimp *gimp,
541 GimpContext *context,
542 GimpProgress *progress,
543 const GimpValueArray *args,
544 GError **error)
545 {
546 gboolean success = TRUE;
547 GimpDrawable *drawable;
548 gint32 fill_type;
549
550 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
551 fill_type = g_value_get_enum (gimp_value_array_index (args, 1));
552
553 if (success)
554 {
555 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
556 GIMP_PDB_ITEM_CONTENT, error) &&
557 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
558 {
559 GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
560
561 if (gimp_fill_options_set_by_fill_type (options, context,
562 fill_type, error))
563 {
564 gimp_drawable_edit_fill (drawable, options, NULL);
565 }
566 else
567 success = FALSE;
568
569 g_object_unref (options);
570 }
571 else
572 success = FALSE;
573 }
574
575 return gimp_procedure_get_return_values (procedure, success,
576 error ? *error : NULL);
577 }
578
579 static GimpValueArray *
edit_bucket_fill_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)580 edit_bucket_fill_invoker (GimpProcedure *procedure,
581 Gimp *gimp,
582 GimpContext *context,
583 GimpProgress *progress,
584 const GimpValueArray *args,
585 GError **error)
586 {
587 gboolean success = TRUE;
588 GimpDrawable *drawable;
589 gint32 fill_mode;
590 gint32 paint_mode;
591 gdouble opacity;
592 gdouble threshold;
593 gboolean sample_merged;
594 gdouble x;
595 gdouble y;
596
597 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
598 fill_mode = g_value_get_enum (gimp_value_array_index (args, 1));
599 paint_mode = g_value_get_enum (gimp_value_array_index (args, 2));
600 opacity = g_value_get_double (gimp_value_array_index (args, 3));
601 threshold = g_value_get_double (gimp_value_array_index (args, 4));
602 sample_merged = g_value_get_boolean (gimp_value_array_index (args, 5));
603 x = g_value_get_double (gimp_value_array_index (args, 6));
604 y = g_value_get_double (gimp_value_array_index (args, 7));
605
606 if (success)
607 {
608 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
609 GIMP_PDB_ITEM_CONTENT, error) &&
610 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
611 {
612 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
613 GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
614
615 if (gimp_fill_options_set_by_fill_mode (options, context,
616 fill_mode, error))
617 {
618 if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
619 paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
620
621 gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
622 gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
623
624 if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
625 {
626 gimp_drawable_edit_fill (drawable, options, NULL);
627 }
628 else
629 {
630 gimp_drawable_bucket_fill (drawable, options,
631 FALSE /* don't fill transparent */,
632 GIMP_SELECT_CRITERION_COMPOSITE,
633 threshold / 255.0,
634 sample_merged,
635 FALSE /* no diagonal neighbors */,
636 x, y);
637 }
638 }
639 else
640 success = FALSE;
641
642 g_object_unref (options);
643 }
644 else
645 success = FALSE;
646 }
647
648 return gimp_procedure_get_return_values (procedure, success,
649 error ? *error : NULL);
650 }
651
652 static GimpValueArray *
edit_bucket_fill_full_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)653 edit_bucket_fill_full_invoker (GimpProcedure *procedure,
654 Gimp *gimp,
655 GimpContext *context,
656 GimpProgress *progress,
657 const GimpValueArray *args,
658 GError **error)
659 {
660 gboolean success = TRUE;
661 GimpDrawable *drawable;
662 gint32 fill_mode;
663 gint32 paint_mode;
664 gdouble opacity;
665 gdouble threshold;
666 gboolean sample_merged;
667 gboolean fill_transparent;
668 gint32 select_criterion;
669 gdouble x;
670 gdouble y;
671
672 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
673 fill_mode = g_value_get_enum (gimp_value_array_index (args, 1));
674 paint_mode = g_value_get_enum (gimp_value_array_index (args, 2));
675 opacity = g_value_get_double (gimp_value_array_index (args, 3));
676 threshold = g_value_get_double (gimp_value_array_index (args, 4));
677 sample_merged = g_value_get_boolean (gimp_value_array_index (args, 5));
678 fill_transparent = g_value_get_boolean (gimp_value_array_index (args, 6));
679 select_criterion = g_value_get_enum (gimp_value_array_index (args, 7));
680 x = g_value_get_double (gimp_value_array_index (args, 8));
681 y = g_value_get_double (gimp_value_array_index (args, 9));
682
683 if (success)
684 {
685 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
686 GIMP_PDB_ITEM_CONTENT, error) &&
687 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
688 {
689 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
690 GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
691
692 if (gimp_fill_options_set_by_fill_mode (options, context,
693 fill_mode, error))
694 {
695 if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
696 paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
697
698 gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
699 gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
700
701 if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
702 {
703 gimp_drawable_edit_fill (drawable, options, NULL);
704 }
705 else
706 {
707 gimp_drawable_bucket_fill (drawable, options,
708 fill_transparent,
709 select_criterion,
710 threshold / 255.0,
711 sample_merged,
712 FALSE /* no diagonal neighbors */,
713 x, y);
714 }
715 }
716 else
717 success = FALSE;
718
719 g_object_unref (options);
720 }
721 else
722 success = FALSE;
723 }
724
725 return gimp_procedure_get_return_values (procedure, success,
726 error ? *error : NULL);
727 }
728
729 static GimpValueArray *
edit_blend_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)730 edit_blend_invoker (GimpProcedure *procedure,
731 Gimp *gimp,
732 GimpContext *context,
733 GimpProgress *progress,
734 const GimpValueArray *args,
735 GError **error)
736 {
737 gboolean success = TRUE;
738 GimpDrawable *drawable;
739 gint32 blend_mode;
740 gint32 paint_mode;
741 gint32 gradient_type;
742 gdouble opacity;
743 gdouble offset;
744 gint32 repeat;
745 gboolean reverse;
746 gboolean supersample;
747 gint32 max_depth;
748 gdouble threshold;
749 gboolean dither;
750 gdouble x1;
751 gdouble y1;
752 gdouble x2;
753 gdouble y2;
754
755 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
756 blend_mode = g_value_get_enum (gimp_value_array_index (args, 1));
757 paint_mode = g_value_get_enum (gimp_value_array_index (args, 2));
758 gradient_type = g_value_get_enum (gimp_value_array_index (args, 3));
759 opacity = g_value_get_double (gimp_value_array_index (args, 4));
760 offset = g_value_get_double (gimp_value_array_index (args, 5));
761 repeat = g_value_get_enum (gimp_value_array_index (args, 6));
762 reverse = g_value_get_boolean (gimp_value_array_index (args, 7));
763 supersample = g_value_get_boolean (gimp_value_array_index (args, 8));
764 max_depth = g_value_get_int (gimp_value_array_index (args, 9));
765 threshold = g_value_get_double (gimp_value_array_index (args, 10));
766 dither = g_value_get_boolean (gimp_value_array_index (args, 11));
767 x1 = g_value_get_double (gimp_value_array_index (args, 12));
768 y1 = g_value_get_double (gimp_value_array_index (args, 13));
769 x2 = g_value_get_double (gimp_value_array_index (args, 14));
770 y2 = g_value_get_double (gimp_value_array_index (args, 15));
771
772 if (success)
773 {
774 success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
775 GIMP_PDB_ITEM_CONTENT, error) &&
776 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
777
778 if (success)
779 {
780 if (supersample)
781 {
782 if (max_depth < 1 || max_depth > 9)
783 success = FALSE;
784
785 if (threshold < 0.0 || threshold > 4.0)
786 success = FALSE;
787 }
788 else
789 {
790 max_depth = CLAMP (max_depth, 1, 9);
791 threshold = CLAMP (threshold, 0.0, 4.0);
792 }
793 }
794
795 if (success)
796 {
797 GimpGradient *gradient;
798
799 if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
800 paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
801
802 if (progress)
803 gimp_progress_start (progress, FALSE, _("Gradient"));
804
805 switch (blend_mode)
806 {
807 case GIMP_BLEND_FG_BG_RGB:
808 gradient = gimp_gradients_get_fg_bg_rgb (context->gimp);
809 break;
810
811 case GIMP_BLEND_FG_BG_HSV:
812 gradient = gimp_gradients_get_fg_bg_hsv_cw (context->gimp);
813 break;
814
815 case GIMP_BLEND_FG_TRANSPARENT:
816 gradient = gimp_gradients_get_fg_transparent (context->gimp);
817 break;
818
819 case GIMP_BLEND_CUSTOM:
820 default:
821 gradient = gimp_context_get_gradient (context);
822 break;
823 }
824
825 gimp_drawable_gradient (drawable,
826 context,
827 gradient,
828 GIMP_PDB_CONTEXT (context)->distance_metric,
829 paint_mode,
830 gradient_type,
831 opacity / 100.0,
832 offset, repeat, reverse,
833 GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
834 supersample, max_depth,
835 threshold, dither,
836 x1, y1, x2, y2,
837 progress);
838
839 if (progress)
840 gimp_progress_end (progress);
841 }
842 }
843
844 return gimp_procedure_get_return_values (procedure, success,
845 error ? *error : NULL);
846 }
847
848 static GimpValueArray *
edit_stroke_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)849 edit_stroke_invoker (GimpProcedure *procedure,
850 Gimp *gimp,
851 GimpContext *context,
852 GimpProgress *progress,
853 const GimpValueArray *args,
854 GError **error)
855 {
856 gboolean success = TRUE;
857 GimpDrawable *drawable;
858
859 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
860
861 if (success)
862 {
863 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
864 GIMP_PDB_ITEM_CONTENT, error) &&
865 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
866 {
867 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
868 GimpStrokeOptions *options;
869 GimpPaintOptions *paint_options;
870
871 options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
872
873 paint_options =
874 gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
875 paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
876
877 success = gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
878 drawable, context, options, paint_options,
879 TRUE, progress, error);
880
881 g_object_unref (paint_options);
882 }
883 else
884 success = FALSE;
885 }
886
887 return gimp_procedure_get_return_values (procedure, success,
888 error ? *error : NULL);
889 }
890
891 static GimpValueArray *
edit_stroke_vectors_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)892 edit_stroke_vectors_invoker (GimpProcedure *procedure,
893 Gimp *gimp,
894 GimpContext *context,
895 GimpProgress *progress,
896 const GimpValueArray *args,
897 GError **error)
898 {
899 gboolean success = TRUE;
900 GimpDrawable *drawable;
901 GimpVectors *vectors;
902
903 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
904 vectors = gimp_value_get_vectors (gimp_value_array_index (args, 1), gimp);
905
906 if (success)
907 {
908 if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
909 GIMP_PDB_ITEM_CONTENT, error) &&
910 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
911 gimp_pdb_item_is_attached (GIMP_ITEM (vectors),
912 gimp_item_get_image (GIMP_ITEM (drawable)),
913 0, error))
914 {
915 GimpStrokeOptions *options;
916 GimpPaintOptions *paint_options;
917
918 options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
919
920 paint_options =
921 gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
922 paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
923
924 success = gimp_item_stroke (GIMP_ITEM (vectors),
925 drawable, context, options, paint_options,
926 TRUE, progress, error);
927
928 g_object_unref (paint_options);
929 }
930 else
931 success = FALSE;
932 }
933
934 return gimp_procedure_get_return_values (procedure, success,
935 error ? *error : NULL);
936 }
937
938 void
register_edit_procs(GimpPDB * pdb)939 register_edit_procs (GimpPDB *pdb)
940 {
941 GimpProcedure *procedure;
942
943 /*
944 * gimp-edit-cut
945 */
946 procedure = gimp_procedure_new (edit_cut_invoker);
947 gimp_object_set_static_name (GIMP_OBJECT (procedure),
948 "gimp-edit-cut");
949 gimp_procedure_set_static_strings (procedure,
950 "gimp-edit-cut",
951 "Cut from the specified drawable.",
952 "If there is a selection in the image, then the area specified by the selection is cut from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the 'gimp-edit-paste' command. If there is no selection, then the specified drawable will be removed and its contents stored in the internal GIMP edit buffer. This procedure will fail if the selected area lies completely outside the bounds of the current drawable and there is nothing to copy from.",
953 "Spencer Kimball & Peter Mattis",
954 "Spencer Kimball & Peter Mattis",
955 "1995-1996",
956 NULL);
957 gimp_procedure_add_argument (procedure,
958 gimp_param_spec_drawable_id ("drawable",
959 "drawable",
960 "The drawable to cut from",
961 pdb->gimp, FALSE,
962 GIMP_PARAM_READWRITE));
963 gimp_procedure_add_return_value (procedure,
964 g_param_spec_boolean ("non-empty",
965 "non empty",
966 "TRUE if the cut was successful, FALSE if there was nothing to copy from",
967 FALSE,
968 GIMP_PARAM_READWRITE));
969 gimp_pdb_register_procedure (pdb, procedure);
970 g_object_unref (procedure);
971
972 /*
973 * gimp-edit-copy
974 */
975 procedure = gimp_procedure_new (edit_copy_invoker);
976 gimp_object_set_static_name (GIMP_OBJECT (procedure),
977 "gimp-edit-copy");
978 gimp_procedure_set_static_strings (procedure,
979 "gimp-edit-copy",
980 "Copy from the specified drawable.",
981 "If there is a selection in the image, then the area specified by the selection is copied from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the 'gimp-edit-paste' command. If there is no selection, then the specified drawable's contents will be stored in the internal GIMP edit buffer. This procedure will fail if the selected area lies completely outside the bounds of the current drawable and there is nothing to copy from.",
982 "Spencer Kimball & Peter Mattis",
983 "Spencer Kimball & Peter Mattis",
984 "1995-1996",
985 NULL);
986 gimp_procedure_add_argument (procedure,
987 gimp_param_spec_drawable_id ("drawable",
988 "drawable",
989 "The drawable to copy from",
990 pdb->gimp, FALSE,
991 GIMP_PARAM_READWRITE));
992 gimp_procedure_add_return_value (procedure,
993 g_param_spec_boolean ("non-empty",
994 "non empty",
995 "TRUE if the cut was successful, FALSE if there was nothing to copy from",
996 FALSE,
997 GIMP_PARAM_READWRITE));
998 gimp_pdb_register_procedure (pdb, procedure);
999 g_object_unref (procedure);
1000
1001 /*
1002 * gimp-edit-copy-visible
1003 */
1004 procedure = gimp_procedure_new (edit_copy_visible_invoker);
1005 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1006 "gimp-edit-copy-visible");
1007 gimp_procedure_set_static_strings (procedure,
1008 "gimp-edit-copy-visible",
1009 "Copy from the projection.",
1010 "If there is a selection in the image, then the area specified by the selection is copied from the projection and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the 'gimp-edit-paste' command. If there is no selection, then the projection's contents will be stored in the internal GIMP edit buffer.",
1011 "Michael Natterer <mitch@gimp.org>",
1012 "Michael Natterer",
1013 "2004",
1014 NULL);
1015 gimp_procedure_add_argument (procedure,
1016 gimp_param_spec_image_id ("image",
1017 "image",
1018 "The image to copy from",
1019 pdb->gimp, FALSE,
1020 GIMP_PARAM_READWRITE));
1021 gimp_procedure_add_return_value (procedure,
1022 g_param_spec_boolean ("non-empty",
1023 "non empty",
1024 "TRUE if the copy was successful",
1025 FALSE,
1026 GIMP_PARAM_READWRITE));
1027 gimp_pdb_register_procedure (pdb, procedure);
1028 g_object_unref (procedure);
1029
1030 /*
1031 * gimp-edit-paste
1032 */
1033 procedure = gimp_procedure_new (edit_paste_invoker);
1034 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1035 "gimp-edit-paste");
1036 gimp_procedure_set_static_strings (procedure,
1037 "gimp-edit-paste",
1038 "Paste buffer to the specified drawable.",
1039 "This procedure pastes a copy of the internal GIMP edit buffer to the specified drawable. The GIMP edit buffer will be empty unless a call was previously made to either 'gimp-edit-cut' or 'gimp-edit-copy'. The \"paste_into\" option specifies whether to clear the current image selection, or to paste the buffer \"behind\" the selection. This allows the selection to act as a mask for the pasted buffer. Anywhere that the selection mask is non-zero, the pasted buffer will show through. The pasted buffer will be a new layer in the image which is designated as the image floating selection. If the image has a floating selection at the time of pasting, the old floating selection will be anchored to its drawable before the new floating selection is added. This procedure returns the new floating layer. The resulting floating selection will already be attached to the specified drawable, and a subsequent call to floating_sel_attach is not needed.",
1040 "Spencer Kimball & Peter Mattis",
1041 "Spencer Kimball & Peter Mattis",
1042 "1995-1996",
1043 NULL);
1044 gimp_procedure_add_argument (procedure,
1045 gimp_param_spec_drawable_id ("drawable",
1046 "drawable",
1047 "The drawable to paste to",
1048 pdb->gimp, FALSE,
1049 GIMP_PARAM_READWRITE));
1050 gimp_procedure_add_argument (procedure,
1051 g_param_spec_boolean ("paste-into",
1052 "paste into",
1053 "Clear selection, or paste behind it?",
1054 FALSE,
1055 GIMP_PARAM_READWRITE));
1056 gimp_procedure_add_return_value (procedure,
1057 gimp_param_spec_layer_id ("floating-sel",
1058 "floating sel",
1059 "The new floating selection",
1060 pdb->gimp, FALSE,
1061 GIMP_PARAM_READWRITE));
1062 gimp_pdb_register_procedure (pdb, procedure);
1063 g_object_unref (procedure);
1064
1065 /*
1066 * gimp-edit-paste-as-new-image
1067 */
1068 procedure = gimp_procedure_new (edit_paste_as_new_image_invoker);
1069 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1070 "gimp-edit-paste-as-new-image");
1071 gimp_procedure_set_static_strings (procedure,
1072 "gimp-edit-paste-as-new-image",
1073 "Paste buffer to a new image.",
1074 "This procedure pastes a copy of the internal GIMP edit buffer to a new image. The GIMP edit buffer will be empty unless a call was previously made to either 'gimp-edit-cut' or 'gimp-edit-copy'. This procedure returns the new image or -1 if the edit buffer was empty.",
1075 "Michael Natterer <mitch@gimp.org>",
1076 "Michael Natterer",
1077 "2005",
1078 NULL);
1079 gimp_procedure_add_return_value (procedure,
1080 gimp_param_spec_image_id ("image",
1081 "image",
1082 "The new image",
1083 pdb->gimp, FALSE,
1084 GIMP_PARAM_READWRITE));
1085 gimp_pdb_register_procedure (pdb, procedure);
1086 g_object_unref (procedure);
1087
1088 /*
1089 * gimp-edit-named-cut
1090 */
1091 procedure = gimp_procedure_new (edit_named_cut_invoker);
1092 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1093 "gimp-edit-named-cut");
1094 gimp_procedure_set_static_strings (procedure,
1095 "gimp-edit-named-cut",
1096 "Cut into a named buffer.",
1097 "This procedure works like 'gimp-edit-cut', but additionally stores the cut buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.",
1098 "Michael Natterer <mitch@gimp.org>",
1099 "Michael Natterer",
1100 "2005",
1101 NULL);
1102 gimp_procedure_add_argument (procedure,
1103 gimp_param_spec_drawable_id ("drawable",
1104 "drawable",
1105 "The drawable to cut from",
1106 pdb->gimp, FALSE,
1107 GIMP_PARAM_READWRITE));
1108 gimp_procedure_add_argument (procedure,
1109 gimp_param_spec_string ("buffer-name",
1110 "buffer name",
1111 "The name of the buffer to create",
1112 FALSE, FALSE, TRUE,
1113 NULL,
1114 GIMP_PARAM_READWRITE));
1115 gimp_procedure_add_return_value (procedure,
1116 gimp_param_spec_string ("real-name",
1117 "real name",
1118 "The real name given to the buffer, or NULL if the cut failed",
1119 FALSE, FALSE, FALSE,
1120 NULL,
1121 GIMP_PARAM_READWRITE));
1122 gimp_pdb_register_procedure (pdb, procedure);
1123 g_object_unref (procedure);
1124
1125 /*
1126 * gimp-edit-named-copy
1127 */
1128 procedure = gimp_procedure_new (edit_named_copy_invoker);
1129 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1130 "gimp-edit-named-copy");
1131 gimp_procedure_set_static_strings (procedure,
1132 "gimp-edit-named-copy",
1133 "Copy into a named buffer.",
1134 "This procedure works like 'gimp-edit-copy', but additionally stores the copied buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.",
1135 "Michael Natterer <mitch@gimp.org>",
1136 "Michael Natterer",
1137 "2005",
1138 NULL);
1139 gimp_procedure_add_argument (procedure,
1140 gimp_param_spec_drawable_id ("drawable",
1141 "drawable",
1142 "The drawable to copy from",
1143 pdb->gimp, FALSE,
1144 GIMP_PARAM_READWRITE));
1145 gimp_procedure_add_argument (procedure,
1146 gimp_param_spec_string ("buffer-name",
1147 "buffer name",
1148 "The name of the buffer to create",
1149 FALSE, FALSE, TRUE,
1150 NULL,
1151 GIMP_PARAM_READWRITE));
1152 gimp_procedure_add_return_value (procedure,
1153 gimp_param_spec_string ("real-name",
1154 "real name",
1155 "The real name given to the buffer, or NULL if the copy failed",
1156 FALSE, FALSE, FALSE,
1157 NULL,
1158 GIMP_PARAM_READWRITE));
1159 gimp_pdb_register_procedure (pdb, procedure);
1160 g_object_unref (procedure);
1161
1162 /*
1163 * gimp-edit-named-copy-visible
1164 */
1165 procedure = gimp_procedure_new (edit_named_copy_visible_invoker);
1166 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1167 "gimp-edit-named-copy-visible");
1168 gimp_procedure_set_static_strings (procedure,
1169 "gimp-edit-named-copy-visible",
1170 "Copy from the projection into a named buffer.",
1171 "This procedure works like 'gimp-edit-copy-visible', but additionally stores the copied buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.",
1172 "Michael Natterer <mitch@gimp.org>",
1173 "Michael Natterer",
1174 "2005",
1175 NULL);
1176 gimp_procedure_add_argument (procedure,
1177 gimp_param_spec_image_id ("image",
1178 "image",
1179 "The image to copy from",
1180 pdb->gimp, FALSE,
1181 GIMP_PARAM_READWRITE));
1182 gimp_procedure_add_argument (procedure,
1183 gimp_param_spec_string ("buffer-name",
1184 "buffer name",
1185 "The name of the buffer to create",
1186 FALSE, FALSE, TRUE,
1187 NULL,
1188 GIMP_PARAM_READWRITE));
1189 gimp_procedure_add_return_value (procedure,
1190 gimp_param_spec_string ("real-name",
1191 "real name",
1192 "The real name given to the buffer, or NULL if the copy failed",
1193 FALSE, FALSE, FALSE,
1194 NULL,
1195 GIMP_PARAM_READWRITE));
1196 gimp_pdb_register_procedure (pdb, procedure);
1197 g_object_unref (procedure);
1198
1199 /*
1200 * gimp-edit-named-paste
1201 */
1202 procedure = gimp_procedure_new (edit_named_paste_invoker);
1203 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1204 "gimp-edit-named-paste");
1205 gimp_procedure_set_static_strings (procedure,
1206 "gimp-edit-named-paste",
1207 "Paste named buffer to the specified drawable.",
1208 "This procedure works like 'gimp-edit-paste' but pastes a named buffer instead of the global buffer.",
1209 "Michael Natterer <mitch@gimp.org>",
1210 "Michael Natterer",
1211 "2005",
1212 NULL);
1213 gimp_procedure_add_argument (procedure,
1214 gimp_param_spec_drawable_id ("drawable",
1215 "drawable",
1216 "The drawable to paste to",
1217 pdb->gimp, FALSE,
1218 GIMP_PARAM_READWRITE));
1219 gimp_procedure_add_argument (procedure,
1220 gimp_param_spec_string ("buffer-name",
1221 "buffer name",
1222 "The name of the buffer to paste",
1223 FALSE, FALSE, FALSE,
1224 NULL,
1225 GIMP_PARAM_READWRITE));
1226 gimp_procedure_add_argument (procedure,
1227 g_param_spec_boolean ("paste-into",
1228 "paste into",
1229 "Clear selection, or paste behind it?",
1230 FALSE,
1231 GIMP_PARAM_READWRITE));
1232 gimp_procedure_add_return_value (procedure,
1233 gimp_param_spec_layer_id ("floating-sel",
1234 "floating sel",
1235 "The new floating selection",
1236 pdb->gimp, FALSE,
1237 GIMP_PARAM_READWRITE));
1238 gimp_pdb_register_procedure (pdb, procedure);
1239 g_object_unref (procedure);
1240
1241 /*
1242 * gimp-edit-named-paste-as-new-image
1243 */
1244 procedure = gimp_procedure_new (edit_named_paste_as_new_image_invoker);
1245 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1246 "gimp-edit-named-paste-as-new-image");
1247 gimp_procedure_set_static_strings (procedure,
1248 "gimp-edit-named-paste-as-new-image",
1249 "Paste named buffer to a new image.",
1250 "This procedure works like 'gimp-edit-paste-as-new-image' but pastes a named buffer instead of the global buffer.",
1251 "Michael Natterer <mitch@gimp.org>",
1252 "Michael Natterer",
1253 "2005",
1254 NULL);
1255 gimp_procedure_add_argument (procedure,
1256 gimp_param_spec_string ("buffer-name",
1257 "buffer name",
1258 "The name of the buffer to paste",
1259 FALSE, FALSE, FALSE,
1260 NULL,
1261 GIMP_PARAM_READWRITE));
1262 gimp_procedure_add_return_value (procedure,
1263 gimp_param_spec_image_id ("image",
1264 "image",
1265 "The new image",
1266 pdb->gimp, FALSE,
1267 GIMP_PARAM_READWRITE));
1268 gimp_pdb_register_procedure (pdb, procedure);
1269 g_object_unref (procedure);
1270
1271 /*
1272 * gimp-edit-clear
1273 */
1274 procedure = gimp_procedure_new (edit_clear_invoker);
1275 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1276 "gimp-edit-clear");
1277 gimp_procedure_set_static_strings (procedure,
1278 "gimp-edit-clear",
1279 "Clear selected area of drawable.",
1280 "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.\n"
1281 "\n"
1282 "Deprecated: Use 'gimp-drawable-edit-clear' instead.",
1283 "Spencer Kimball & Peter Mattis",
1284 "Spencer Kimball & Peter Mattis",
1285 "1995-1996",
1286 "gimp-drawable-edit-clear");
1287 gimp_procedure_add_argument (procedure,
1288 gimp_param_spec_drawable_id ("drawable",
1289 "drawable",
1290 "The drawable to clear from",
1291 pdb->gimp, FALSE,
1292 GIMP_PARAM_READWRITE));
1293 gimp_pdb_register_procedure (pdb, procedure);
1294 g_object_unref (procedure);
1295
1296 /*
1297 * gimp-edit-fill
1298 */
1299 procedure = gimp_procedure_new (edit_fill_invoker);
1300 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1301 "gimp-edit-fill");
1302 gimp_procedure_set_static_strings (procedure,
1303 "gimp-edit-fill",
1304 "Fill selected area of drawable.",
1305 "This procedure fills the specified drawable with the fill mode. If the fill mode is foreground, the current foreground color is used. If the fill mode is background, the current background color is used. Other fill modes should not be used. 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'.\n"
1306 "\n"
1307 "Deprecated: Use 'gimp-drawable-edit-fill' instead.",
1308 "Spencer Kimball & Peter Mattis & Raphael Quinet",
1309 "Spencer Kimball & Peter Mattis",
1310 "1995-2000",
1311 "gimp-drawable-edit-fill");
1312 gimp_procedure_add_argument (procedure,
1313 gimp_param_spec_drawable_id ("drawable",
1314 "drawable",
1315 "The drawable to fill to",
1316 pdb->gimp, FALSE,
1317 GIMP_PARAM_READWRITE));
1318 gimp_procedure_add_argument (procedure,
1319 g_param_spec_enum ("fill-type",
1320 "fill type",
1321 "The type of fill",
1322 GIMP_TYPE_FILL_TYPE,
1323 GIMP_FILL_FOREGROUND,
1324 GIMP_PARAM_READWRITE));
1325 gimp_pdb_register_procedure (pdb, procedure);
1326 g_object_unref (procedure);
1327
1328 /*
1329 * gimp-edit-bucket-fill
1330 */
1331 procedure = gimp_procedure_new (edit_bucket_fill_invoker);
1332 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1333 "gimp-edit-bucket-fill");
1334 gimp_procedure_set_static_strings (procedure,
1335 "gimp-edit-bucket-fill",
1336 "Fill the area specified either by the current selection if there is one, or by a seed fill starting at the specified coordinates.",
1337 "This tool requires information on the paint application mode, and the fill mode, which can either be in the foreground color, or in the currently active pattern. If there is no selection, a seed fill is executed at the specified coordinates and extends outward in keeping with the threshold parameter. If there is a selection in the target image, the threshold, sample merged, x, and y arguments are unused. If the sample_merged parameter is TRUE, the data of the composite image will be used instead of that for the specified drawable. This is equivalent to sampling for colors after merging all visible layers. 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.\n"
1338 "\n"
1339 "Deprecated: Use 'gimp-drawable-edit-bucket-fill' instead.",
1340 "Spencer Kimball & Peter Mattis",
1341 "Spencer Kimball & Peter Mattis",
1342 "1995-1996",
1343 "gimp-drawable-edit-bucket-fill");
1344 gimp_procedure_add_argument (procedure,
1345 gimp_param_spec_drawable_id ("drawable",
1346 "drawable",
1347 "The affected drawable",
1348 pdb->gimp, FALSE,
1349 GIMP_PARAM_READWRITE));
1350 gimp_procedure_add_argument (procedure,
1351 g_param_spec_enum ("fill-mode",
1352 "fill mode",
1353 "The type of fill",
1354 GIMP_TYPE_BUCKET_FILL_MODE,
1355 GIMP_BUCKET_FILL_FG,
1356 GIMP_PARAM_READWRITE));
1357 gimp_procedure_add_argument (procedure,
1358 g_param_spec_enum ("paint-mode",
1359 "paint mode",
1360 "The paint application mode",
1361 GIMP_TYPE_LAYER_MODE,
1362 GIMP_LAYER_MODE_NORMAL,
1363 GIMP_PARAM_READWRITE));
1364 gimp_procedure_add_argument (procedure,
1365 g_param_spec_double ("opacity",
1366 "opacity",
1367 "The opacity of the final bucket fill",
1368 0, 100, 0,
1369 GIMP_PARAM_READWRITE));
1370 gimp_procedure_add_argument (procedure,
1371 g_param_spec_double ("threshold",
1372 "threshold",
1373 "The threshold determines how extensive the seed fill will be. It's value is specified in terms of intensity levels. This parameter is only valid when there is no selection in the specified image.",
1374 0, 255, 0,
1375 GIMP_PARAM_READWRITE));
1376 gimp_procedure_add_argument (procedure,
1377 g_param_spec_boolean ("sample-merged",
1378 "sample merged",
1379 "Use the composite image, not the drawable",
1380 FALSE,
1381 GIMP_PARAM_READWRITE));
1382 gimp_procedure_add_argument (procedure,
1383 g_param_spec_double ("x",
1384 "x",
1385 "The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
1386 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1387 GIMP_PARAM_READWRITE));
1388 gimp_procedure_add_argument (procedure,
1389 g_param_spec_double ("y",
1390 "y",
1391 "The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
1392 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1393 GIMP_PARAM_READWRITE));
1394 gimp_pdb_register_procedure (pdb, procedure);
1395 g_object_unref (procedure);
1396
1397 /*
1398 * gimp-edit-bucket-fill-full
1399 */
1400 procedure = gimp_procedure_new (edit_bucket_fill_full_invoker);
1401 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1402 "gimp-edit-bucket-fill-full");
1403 gimp_procedure_set_static_strings (procedure,
1404 "gimp-edit-bucket-fill-full",
1405 "Fill the area specified either by the current selection if there is one, or by a seed fill starting at the specified coordinates.",
1406 "This tool requires information on the paint application mode, and the fill mode, which can either be in the foreground color, or in the currently active pattern. If there is no selection, a seed fill is executed at the specified coordinates and extends outward in keeping with the threshold parameter. If there is a selection in the target image, the threshold, sample merged, x, and y arguments are unused. If the sample_merged parameter is TRUE, the data of the composite image will be used instead of that for the specified drawable. This is equivalent to sampling for colors after merging all visible layers. 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.\n"
1407 "\n"
1408 "Deprecated: Use 'gimp-drawable-edit-bucket-fill' instead.",
1409 "David Gowers",
1410 "David Gowers",
1411 "2006",
1412 "gimp-drawable-edit-bucket-fill");
1413 gimp_procedure_add_argument (procedure,
1414 gimp_param_spec_drawable_id ("drawable",
1415 "drawable",
1416 "The affected drawable",
1417 pdb->gimp, FALSE,
1418 GIMP_PARAM_READWRITE));
1419 gimp_procedure_add_argument (procedure,
1420 g_param_spec_enum ("fill-mode",
1421 "fill mode",
1422 "The type of fill",
1423 GIMP_TYPE_BUCKET_FILL_MODE,
1424 GIMP_BUCKET_FILL_FG,
1425 GIMP_PARAM_READWRITE));
1426 gimp_procedure_add_argument (procedure,
1427 g_param_spec_enum ("paint-mode",
1428 "paint mode",
1429 "The paint application mode",
1430 GIMP_TYPE_LAYER_MODE,
1431 GIMP_LAYER_MODE_NORMAL,
1432 GIMP_PARAM_READWRITE));
1433 gimp_procedure_add_argument (procedure,
1434 g_param_spec_double ("opacity",
1435 "opacity",
1436 "The opacity of the final bucket fill",
1437 0, 100, 0,
1438 GIMP_PARAM_READWRITE));
1439 gimp_procedure_add_argument (procedure,
1440 g_param_spec_double ("threshold",
1441 "threshold",
1442 "The threshold determines how extensive the seed fill will be. It's value is specified in terms of intensity levels. This parameter is only valid when there is no selection in the specified image.",
1443 0, 255, 0,
1444 GIMP_PARAM_READWRITE));
1445 gimp_procedure_add_argument (procedure,
1446 g_param_spec_boolean ("sample-merged",
1447 "sample merged",
1448 "Use the composite image, not the drawable",
1449 FALSE,
1450 GIMP_PARAM_READWRITE));
1451 gimp_procedure_add_argument (procedure,
1452 g_param_spec_boolean ("fill-transparent",
1453 "fill transparent",
1454 "Whether to consider transparent pixels for filling. If TRUE, transparency is considered as a unique fillable color.",
1455 FALSE,
1456 GIMP_PARAM_READWRITE));
1457 gimp_procedure_add_argument (procedure,
1458 g_param_spec_enum ("select-criterion",
1459 "select criterion",
1460 "The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.",
1461 GIMP_TYPE_SELECT_CRITERION,
1462 GIMP_SELECT_CRITERION_COMPOSITE,
1463 GIMP_PARAM_READWRITE));
1464 gimp_procedure_add_argument (procedure,
1465 g_param_spec_double ("x",
1466 "x",
1467 "The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
1468 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1469 GIMP_PARAM_READWRITE));
1470 gimp_procedure_add_argument (procedure,
1471 g_param_spec_double ("y",
1472 "y",
1473 "The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
1474 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1475 GIMP_PARAM_READWRITE));
1476 gimp_pdb_register_procedure (pdb, procedure);
1477 g_object_unref (procedure);
1478
1479 /*
1480 * gimp-edit-blend
1481 */
1482 procedure = gimp_procedure_new (edit_blend_invoker);
1483 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1484 "gimp-edit-blend");
1485 gimp_procedure_set_static_strings (procedure,
1486 "gimp-edit-blend",
1487 "Blend between the starting and ending coordinates with the specified blend mode and gradient type.",
1488 "This tool requires information on the paint application mode, the blend mode, and the gradient type. It creates the specified variety of blend 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'.\n"
1489 "\n"
1490 "Deprecated: Use 'gimp-drawable-edit-gradient-fill' instead.",
1491 "Spencer Kimball & Peter Mattis",
1492 "Spencer Kimball & Peter Mattis",
1493 "1995-1996",
1494 "gimp-drawable-edit-gradient-fill");
1495 gimp_procedure_add_argument (procedure,
1496 gimp_param_spec_drawable_id ("drawable",
1497 "drawable",
1498 "The affected drawable",
1499 pdb->gimp, FALSE,
1500 GIMP_PARAM_READWRITE));
1501 gimp_procedure_add_argument (procedure,
1502 g_param_spec_enum ("blend-mode",
1503 "blend mode",
1504 "The type of blend",
1505 GIMP_TYPE_BLEND_MODE,
1506 GIMP_BLEND_FG_BG_RGB,
1507 GIMP_PARAM_READWRITE));
1508 gimp_procedure_add_argument (procedure,
1509 g_param_spec_enum ("paint-mode",
1510 "paint mode",
1511 "The paint application mode",
1512 GIMP_TYPE_LAYER_MODE,
1513 GIMP_LAYER_MODE_NORMAL,
1514 GIMP_PARAM_READWRITE));
1515 gimp_procedure_add_argument (procedure,
1516 g_param_spec_enum ("gradient-type",
1517 "gradient type",
1518 "The type of gradient",
1519 GIMP_TYPE_GRADIENT_TYPE,
1520 GIMP_GRADIENT_LINEAR,
1521 GIMP_PARAM_READWRITE));
1522 gimp_procedure_add_argument (procedure,
1523 g_param_spec_double ("opacity",
1524 "opacity",
1525 "The opacity of the final blend",
1526 0, 100, 0,
1527 GIMP_PARAM_READWRITE));
1528 gimp_procedure_add_argument (procedure,
1529 g_param_spec_double ("offset",
1530 "offset",
1531 "Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.",
1532 0, G_MAXDOUBLE, 0,
1533 GIMP_PARAM_READWRITE));
1534 gimp_procedure_add_argument (procedure,
1535 g_param_spec_enum ("repeat",
1536 "repeat",
1537 "Repeat mode",
1538 GIMP_TYPE_REPEAT_MODE,
1539 GIMP_REPEAT_NONE,
1540 GIMP_PARAM_READWRITE));
1541 gimp_procedure_add_argument (procedure,
1542 g_param_spec_boolean ("reverse",
1543 "reverse",
1544 "Use the reverse gradient",
1545 FALSE,
1546 GIMP_PARAM_READWRITE));
1547 gimp_procedure_add_argument (procedure,
1548 g_param_spec_boolean ("supersample",
1549 "supersample",
1550 "Do adaptive supersampling",
1551 FALSE,
1552 GIMP_PARAM_READWRITE));
1553 gimp_procedure_add_argument (procedure,
1554 gimp_param_spec_int32 ("max-depth",
1555 "max depth",
1556 "Maximum recursion levels for supersampling",
1557 1, 9, 1,
1558 GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
1559 gimp_procedure_add_argument (procedure,
1560 g_param_spec_double ("threshold",
1561 "threshold",
1562 "Supersampling threshold",
1563 0, 4, 0,
1564 GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
1565 gimp_procedure_add_argument (procedure,
1566 g_param_spec_boolean ("dither",
1567 "dither",
1568 "Use dithering to reduce banding",
1569 FALSE,
1570 GIMP_PARAM_READWRITE));
1571 gimp_procedure_add_argument (procedure,
1572 g_param_spec_double ("x1",
1573 "x1",
1574 "The x coordinate of this blend's starting point",
1575 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1576 GIMP_PARAM_READWRITE));
1577 gimp_procedure_add_argument (procedure,
1578 g_param_spec_double ("y1",
1579 "y1",
1580 "The y coordinate of this blend's starting point",
1581 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1582 GIMP_PARAM_READWRITE));
1583 gimp_procedure_add_argument (procedure,
1584 g_param_spec_double ("x2",
1585 "x2",
1586 "The x coordinate of this blend's ending point",
1587 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1588 GIMP_PARAM_READWRITE));
1589 gimp_procedure_add_argument (procedure,
1590 g_param_spec_double ("y2",
1591 "y2",
1592 "The y coordinate of this blend's ending point",
1593 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1594 GIMP_PARAM_READWRITE));
1595 gimp_pdb_register_procedure (pdb, procedure);
1596 g_object_unref (procedure);
1597
1598 /*
1599 * gimp-edit-stroke
1600 */
1601 procedure = gimp_procedure_new (edit_stroke_invoker);
1602 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1603 "gimp-edit-stroke");
1604 gimp_procedure_set_static_strings (procedure,
1605 "gimp-edit-stroke",
1606 "Stroke the current selection",
1607 "This procedure strokes the current selection, painting along the selection boundary with the active brush and foreground color. The paint is applied to the specified drawable regardless of the active selection.\n"
1608 "\n"
1609 "Deprecated: Use 'gimp-drawable-edit-stroke-selection' instead.",
1610 "Spencer Kimball & Peter Mattis",
1611 "Spencer Kimball & Peter Mattis",
1612 "1995-1996",
1613 "gimp-drawable-edit-stroke-selection");
1614 gimp_procedure_add_argument (procedure,
1615 gimp_param_spec_drawable_id ("drawable",
1616 "drawable",
1617 "The drawable to stroke to",
1618 pdb->gimp, FALSE,
1619 GIMP_PARAM_READWRITE));
1620 gimp_pdb_register_procedure (pdb, procedure);
1621 g_object_unref (procedure);
1622
1623 /*
1624 * gimp-edit-stroke-vectors
1625 */
1626 procedure = gimp_procedure_new (edit_stroke_vectors_invoker);
1627 gimp_object_set_static_name (GIMP_OBJECT (procedure),
1628 "gimp-edit-stroke-vectors");
1629 gimp_procedure_set_static_strings (procedure,
1630 "gimp-edit-stroke-vectors",
1631 "Stroke the specified vectors object",
1632 "This procedure strokes the specified vectors object, painting along the path with the active brush and foreground color.\n"
1633 "\n"
1634 "Deprecated: Use 'gimp-drawable-edit-stroke-item' instead.",
1635 "Simon Budig",
1636 "Simon Budig",
1637 "2006",
1638 "gimp-drawable-edit-stroke-item");
1639 gimp_procedure_add_argument (procedure,
1640 gimp_param_spec_drawable_id ("drawable",
1641 "drawable",
1642 "The drawable to stroke to",
1643 pdb->gimp, FALSE,
1644 GIMP_PARAM_READWRITE));
1645 gimp_procedure_add_argument (procedure,
1646 gimp_param_spec_vectors_id ("vectors",
1647 "vectors",
1648 "The vectors object",
1649 pdb->gimp, FALSE,
1650 GIMP_PARAM_READWRITE));
1651 gimp_pdb_register_procedure (pdb, procedure);
1652 g_object_unref (procedure);
1653 }
1654