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 "libgimpmath/gimpmath.h"
27
28 #include "libgimpbase/gimpbase.h"
29
30 #include "pdb-types.h"
31
32 #include "config/gimpcoreconfig.h"
33 #include "core/gimp-transform-utils.h"
34 #include "core/gimp.h"
35 #include "core/gimpchannel.h"
36 #include "core/gimpdrawable-transform.h"
37 #include "core/gimpdrawable.h"
38 #include "core/gimpimage.h"
39 #include "core/gimpparamspecs.h"
40 #include "core/gimpprogress.h"
41
42 #include "gimppdb.h"
43 #include "gimppdb-utils.h"
44 #include "gimpprocedure.h"
45 #include "internal-procs.h"
46
47 #include "gimp-intl.h"
48
49
50 static GimpValueArray *
flip_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)51 flip_invoker (GimpProcedure *procedure,
52 Gimp *gimp,
53 GimpContext *context,
54 GimpProgress *progress,
55 const GimpValueArray *args,
56 GError **error)
57 {
58 gboolean success = TRUE;
59 GimpValueArray *return_vals;
60 GimpDrawable *drawable;
61 gint32 flip_type;
62
63 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
64 flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
65
66 if (success)
67 {
68 gint x, y, width, height;
69
70 success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
71 GIMP_PDB_ITEM_CONTENT |
72 GIMP_PDB_ITEM_POSITION, error);
73
74 if (success &&
75 gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
76 {
77 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
78 GimpChannel *mask = gimp_image_get_mask (image);
79 gdouble axis;
80
81 gimp_transform_get_flip_axis (x, y, width, height,
82 flip_type, TRUE, &axis);
83
84 if (drawable != GIMP_DRAWABLE (mask) &&
85 ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
86 ! gimp_channel_is_empty (mask))
87 {
88 if (! gimp_drawable_transform_flip (drawable, context,
89 flip_type, axis, FALSE))
90 {
91 success = FALSE;
92 }
93 }
94 else
95 {
96 gimp_item_flip (GIMP_ITEM (drawable), context,
97 flip_type, axis,
98 gimp_item_get_clip (GIMP_ITEM (drawable), FALSE));
99 }
100 }
101 }
102
103 return_vals = gimp_procedure_get_return_values (procedure, success,
104 error ? *error : NULL);
105
106 if (success)
107 gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
108
109 return return_vals;
110 }
111
112 static GimpValueArray *
perspective_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)113 perspective_invoker (GimpProcedure *procedure,
114 Gimp *gimp,
115 GimpContext *context,
116 GimpProgress *progress,
117 const GimpValueArray *args,
118 GError **error)
119 {
120 gboolean success = TRUE;
121 GimpValueArray *return_vals;
122 GimpDrawable *drawable;
123 gboolean interpolation;
124 gdouble x0;
125 gdouble y0;
126 gdouble x1;
127 gdouble y1;
128 gdouble x2;
129 gdouble y2;
130 gdouble x3;
131 gdouble y3;
132
133 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
134 interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
135 x0 = g_value_get_double (gimp_value_array_index (args, 2));
136 y0 = g_value_get_double (gimp_value_array_index (args, 3));
137 x1 = g_value_get_double (gimp_value_array_index (args, 4));
138 y1 = g_value_get_double (gimp_value_array_index (args, 5));
139 x2 = g_value_get_double (gimp_value_array_index (args, 6));
140 y2 = g_value_get_double (gimp_value_array_index (args, 7));
141 x3 = g_value_get_double (gimp_value_array_index (args, 8));
142 y3 = g_value_get_double (gimp_value_array_index (args, 9));
143
144 if (success)
145 {
146 gint x, y, width, height;
147
148 success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
149 GIMP_PDB_ITEM_CONTENT |
150 GIMP_PDB_ITEM_POSITION, error);
151
152 if (success &&
153 gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
154 {
155 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
156 GimpChannel *mask = gimp_image_get_mask (image);
157 GimpMatrix3 matrix;
158 GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
159 gint off_x, off_y;
160
161 gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
162
163 x += off_x;
164 y += off_y;
165
166 /* Assemble the transformation matrix */
167 gimp_matrix3_identity (&matrix);
168 gimp_transform_matrix_perspective (&matrix,
169 x, y, width, height,
170 x0, y0, x1, y1,
171 x2, y2, x3, y3);
172
173 if (interpolation)
174 interpolation_type = gimp->config->interpolation_type;
175
176 if (progress)
177 gimp_progress_start (progress, FALSE, _("Perspective"));
178
179 if (drawable != GIMP_DRAWABLE (mask) &&
180 ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
181 ! gimp_channel_is_empty (mask))
182 {
183 if (! gimp_drawable_transform_affine (drawable, context,
184 &matrix,
185 GIMP_TRANSFORM_FORWARD,
186 interpolation_type,
187 FALSE, progress))
188 {
189 success = FALSE;
190 }
191 }
192 else
193 {
194 gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
195 GIMP_TRANSFORM_FORWARD,
196 interpolation,
197 gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
198 progress);
199 }
200
201 if (progress)
202 gimp_progress_end (progress);
203 }
204 }
205
206 return_vals = gimp_procedure_get_return_values (procedure, success,
207 error ? *error : NULL);
208
209 if (success)
210 gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
211
212 return return_vals;
213 }
214
215 static GimpValueArray *
rotate_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)216 rotate_invoker (GimpProcedure *procedure,
217 Gimp *gimp,
218 GimpContext *context,
219 GimpProgress *progress,
220 const GimpValueArray *args,
221 GError **error)
222 {
223 gboolean success = TRUE;
224 GimpValueArray *return_vals;
225 GimpDrawable *drawable;
226 gboolean interpolation;
227 gdouble angle;
228
229 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
230 interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
231 angle = g_value_get_double (gimp_value_array_index (args, 2));
232
233 if (success)
234 {
235 gint x, y, width, height;
236
237 success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
238 GIMP_PDB_ITEM_CONTENT |
239 GIMP_PDB_ITEM_POSITION, error);
240
241 if (success &&
242 gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
243 {
244 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
245 GimpChannel *mask = gimp_image_get_mask (image);
246 GimpMatrix3 matrix;
247 GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
248 gint off_x, off_y;
249
250 gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
251
252 x += off_x;
253 y += off_y;
254
255 /* Assemble the transformation matrix */
256 gimp_matrix3_identity (&matrix);
257 gimp_transform_matrix_rotate_rect (&matrix,
258 x, y, width, height,
259 angle);
260
261 if (interpolation)
262 interpolation_type = gimp->config->interpolation_type;
263
264 if (progress)
265 gimp_progress_start (progress, FALSE, _("Rotating"));
266
267 if (drawable != GIMP_DRAWABLE (mask) &&
268 ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
269 ! gimp_channel_is_empty (mask))
270 {
271 if (! gimp_drawable_transform_affine (drawable, context,
272 &matrix,
273 GIMP_TRANSFORM_FORWARD,
274 interpolation_type,
275 FALSE, progress))
276 {
277 success = FALSE;
278 }
279 }
280 else
281 {
282 gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
283 GIMP_TRANSFORM_FORWARD,
284 interpolation,
285 gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
286 progress);
287 }
288
289 if (progress)
290 gimp_progress_end (progress);
291 }
292 }
293
294 return_vals = gimp_procedure_get_return_values (procedure, success,
295 error ? *error : NULL);
296
297 if (success)
298 gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
299
300 return return_vals;
301 }
302
303 static GimpValueArray *
scale_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)304 scale_invoker (GimpProcedure *procedure,
305 Gimp *gimp,
306 GimpContext *context,
307 GimpProgress *progress,
308 const GimpValueArray *args,
309 GError **error)
310 {
311 gboolean success = TRUE;
312 GimpValueArray *return_vals;
313 GimpDrawable *drawable;
314 gboolean interpolation;
315 gdouble x0;
316 gdouble y0;
317 gdouble x1;
318 gdouble y1;
319
320 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
321 interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
322 x0 = g_value_get_double (gimp_value_array_index (args, 2));
323 y0 = g_value_get_double (gimp_value_array_index (args, 3));
324 x1 = g_value_get_double (gimp_value_array_index (args, 4));
325 y1 = g_value_get_double (gimp_value_array_index (args, 5));
326
327 if (success)
328 {
329 gint x, y, width, height;
330
331 success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
332 GIMP_PDB_ITEM_CONTENT |
333 GIMP_PDB_ITEM_POSITION, error) &&
334 x0 < x1 && y0 < y1);
335
336 if (success &&
337 gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
338 {
339 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
340 GimpChannel *mask = gimp_image_get_mask (image);
341 GimpMatrix3 matrix;
342 GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
343 gint off_x, off_y;
344
345 gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
346
347 x += off_x;
348 y += off_y;
349
350 /* Assemble the transformation matrix */
351 gimp_matrix3_identity (&matrix);
352 gimp_transform_matrix_scale (&matrix,
353 x, y, width, height,
354 x0, y0, x1 - x0, y1 - y0);
355
356 if (interpolation)
357 interpolation_type = gimp->config->interpolation_type;
358
359 if (progress)
360 gimp_progress_start (progress, FALSE, _("Scaling"));
361
362 if (drawable != GIMP_DRAWABLE (mask) &&
363 ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
364 ! gimp_channel_is_empty (mask))
365 {
366 if (! gimp_drawable_transform_affine (drawable, context,
367 &matrix,
368 GIMP_TRANSFORM_FORWARD,
369 interpolation_type,
370 FALSE, progress))
371 {
372 success = FALSE;
373 }
374 }
375 else
376 {
377 gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
378 GIMP_TRANSFORM_FORWARD,
379 interpolation,
380 gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
381 progress);
382 }
383
384 if (progress)
385 gimp_progress_end (progress);
386 }
387 }
388
389 return_vals = gimp_procedure_get_return_values (procedure, success,
390 error ? *error : NULL);
391
392 if (success)
393 gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
394
395 return return_vals;
396 }
397
398 static GimpValueArray *
shear_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)399 shear_invoker (GimpProcedure *procedure,
400 Gimp *gimp,
401 GimpContext *context,
402 GimpProgress *progress,
403 const GimpValueArray *args,
404 GError **error)
405 {
406 gboolean success = TRUE;
407 GimpValueArray *return_vals;
408 GimpDrawable *drawable;
409 gboolean interpolation;
410 gint32 shear_type;
411 gdouble magnitude;
412
413 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
414 interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
415 shear_type = g_value_get_enum (gimp_value_array_index (args, 2));
416 magnitude = g_value_get_double (gimp_value_array_index (args, 3));
417
418 if (success)
419 {
420 gint x, y, width, height;
421
422 success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
423 GIMP_PDB_ITEM_CONTENT |
424 GIMP_PDB_ITEM_POSITION, error);
425
426 if (success &&
427 gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
428 {
429 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
430 GimpChannel *mask = gimp_image_get_mask (image);
431 GimpMatrix3 matrix;
432 GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
433 gint off_x, off_y;
434
435 gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
436
437 x += off_x;
438 y += off_y;
439
440 /* Assemble the transformation matrix */
441 gimp_matrix3_identity (&matrix);
442 gimp_transform_matrix_shear (&matrix,
443 x, y, width, height,
444 shear_type, magnitude);
445
446 if (interpolation)
447 interpolation_type = gimp->config->interpolation_type;
448
449 if (progress)
450 gimp_progress_start (progress, FALSE, _("Shearing"));
451
452 if (drawable != GIMP_DRAWABLE (mask) &&
453 ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
454 ! gimp_channel_is_empty (mask))
455 {
456 if (! gimp_drawable_transform_affine (drawable, context,
457 &matrix,
458 GIMP_TRANSFORM_FORWARD,
459 interpolation_type,
460 FALSE, progress))
461 {
462 success = FALSE;
463 }
464 }
465 else
466 {
467 gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
468 GIMP_TRANSFORM_FORWARD,
469 interpolation,
470 gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
471 progress);
472 }
473
474 if (progress)
475 gimp_progress_end (progress);
476 }
477 }
478
479 return_vals = gimp_procedure_get_return_values (procedure, success,
480 error ? *error : NULL);
481
482 if (success)
483 gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
484
485 return return_vals;
486 }
487
488 static GimpValueArray *
transform_2d_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)489 transform_2d_invoker (GimpProcedure *procedure,
490 Gimp *gimp,
491 GimpContext *context,
492 GimpProgress *progress,
493 const GimpValueArray *args,
494 GError **error)
495 {
496 gboolean success = TRUE;
497 GimpValueArray *return_vals;
498 GimpDrawable *drawable;
499 gboolean interpolation;
500 gdouble source_x;
501 gdouble source_y;
502 gdouble scale_x;
503 gdouble scale_y;
504 gdouble angle;
505 gdouble dest_x;
506 gdouble dest_y;
507
508 drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
509 interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
510 source_x = g_value_get_double (gimp_value_array_index (args, 2));
511 source_y = g_value_get_double (gimp_value_array_index (args, 3));
512 scale_x = g_value_get_double (gimp_value_array_index (args, 4));
513 scale_y = g_value_get_double (gimp_value_array_index (args, 5));
514 angle = g_value_get_double (gimp_value_array_index (args, 6));
515 dest_x = g_value_get_double (gimp_value_array_index (args, 7));
516 dest_y = g_value_get_double (gimp_value_array_index (args, 8));
517
518 if (success)
519 {
520 gint x, y, width, height;
521
522 success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
523 GIMP_PDB_ITEM_CONTENT |
524 GIMP_PDB_ITEM_POSITION, error);
525
526 if (success &&
527 gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
528 {
529 GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
530 GimpChannel *mask = gimp_image_get_mask (image);
531 GimpMatrix3 matrix;
532 GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
533
534 /* Assemble the transformation matrix */
535 gimp_matrix3_identity (&matrix);
536 gimp_matrix3_translate (&matrix, -source_x, -source_y);
537 gimp_matrix3_scale (&matrix, scale_x, scale_y);
538 gimp_matrix3_rotate (&matrix, angle);
539 gimp_matrix3_translate (&matrix, dest_x, dest_y);
540
541 if (interpolation)
542 interpolation_type = gimp->config->interpolation_type;
543
544 if (progress)
545 gimp_progress_start (progress, FALSE, _("2D Transform"));
546
547 if (drawable != GIMP_DRAWABLE (mask) &&
548 ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
549 ! gimp_channel_is_empty (mask))
550 {
551 if (! gimp_drawable_transform_affine (drawable, context,
552 &matrix, GIMP_TRANSFORM_FORWARD,
553 interpolation_type,
554 FALSE, progress))
555 {
556 success = FALSE;
557 }
558 }
559 else
560 {
561 gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
562 GIMP_TRANSFORM_FORWARD,
563 interpolation,
564 gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
565 progress);
566 }
567
568 if (progress)
569 gimp_progress_end (progress);
570 }
571 }
572
573 return_vals = gimp_procedure_get_return_values (procedure, success,
574 error ? *error : NULL);
575
576 if (success)
577 gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
578
579 return return_vals;
580 }
581
582 void
register_transform_tools_procs(GimpPDB * pdb)583 register_transform_tools_procs (GimpPDB *pdb)
584 {
585 GimpProcedure *procedure;
586
587 /*
588 * gimp-flip
589 */
590 procedure = gimp_procedure_new (flip_invoker);
591 gimp_object_set_static_name (GIMP_OBJECT (procedure),
592 "gimp-flip");
593 gimp_procedure_set_static_strings (procedure,
594 "gimp-flip",
595 "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
596 "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
597 "",
598 "",
599 "",
600 "gimp-item-transform-flip-simple");
601 gimp_procedure_add_argument (procedure,
602 gimp_param_spec_drawable_id ("drawable",
603 "drawable",
604 "The affected drawable",
605 pdb->gimp, FALSE,
606 GIMP_PARAM_READWRITE));
607 gimp_procedure_add_argument (procedure,
608 gimp_param_spec_enum ("flip-type",
609 "flip type",
610 "Type of flip",
611 GIMP_TYPE_ORIENTATION_TYPE,
612 GIMP_ORIENTATION_HORIZONTAL,
613 GIMP_PARAM_READWRITE));
614 gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
615 GIMP_ORIENTATION_UNKNOWN);
616 gimp_procedure_add_return_value (procedure,
617 gimp_param_spec_drawable_id ("drawable",
618 "drawable",
619 "The flipped drawable",
620 pdb->gimp, FALSE,
621 GIMP_PARAM_READWRITE));
622 gimp_pdb_register_procedure (pdb, procedure);
623 g_object_unref (procedure);
624
625 /*
626 * gimp-perspective
627 */
628 procedure = gimp_procedure_new (perspective_invoker);
629 gimp_object_set_static_name (GIMP_OBJECT (procedure),
630 "gimp-perspective");
631 gimp_procedure_set_static_strings (procedure,
632 "gimp-perspective",
633 "Deprecated: Use 'gimp-item-transform-perspective' instead.",
634 "Deprecated: Use 'gimp-item-transform-perspective' instead.",
635 "",
636 "",
637 "",
638 "gimp-item-transform-perspective");
639 gimp_procedure_add_argument (procedure,
640 gimp_param_spec_drawable_id ("drawable",
641 "drawable",
642 "The affected drawable",
643 pdb->gimp, FALSE,
644 GIMP_PARAM_READWRITE));
645 gimp_procedure_add_argument (procedure,
646 g_param_spec_boolean ("interpolation",
647 "interpolation",
648 "Whether to use interpolation",
649 FALSE,
650 GIMP_PARAM_READWRITE));
651 gimp_procedure_add_argument (procedure,
652 g_param_spec_double ("x0",
653 "x0",
654 "The new x coordinate of upper-left corner of original bounding box",
655 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
656 GIMP_PARAM_READWRITE));
657 gimp_procedure_add_argument (procedure,
658 g_param_spec_double ("y0",
659 "y0",
660 "The new y coordinate of upper-left corner of original bounding box",
661 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
662 GIMP_PARAM_READWRITE));
663 gimp_procedure_add_argument (procedure,
664 g_param_spec_double ("x1",
665 "x1",
666 "The new x coordinate of upper-right corner of original bounding box",
667 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
668 GIMP_PARAM_READWRITE));
669 gimp_procedure_add_argument (procedure,
670 g_param_spec_double ("y1",
671 "y1",
672 "The new y coordinate of upper-right corner of original bounding box",
673 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
674 GIMP_PARAM_READWRITE));
675 gimp_procedure_add_argument (procedure,
676 g_param_spec_double ("x2",
677 "x2",
678 "The new x coordinate of lower-left corner of original bounding box",
679 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
680 GIMP_PARAM_READWRITE));
681 gimp_procedure_add_argument (procedure,
682 g_param_spec_double ("y2",
683 "y2",
684 "The new y coordinate of lower-left corner of original bounding box",
685 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
686 GIMP_PARAM_READWRITE));
687 gimp_procedure_add_argument (procedure,
688 g_param_spec_double ("x3",
689 "x3",
690 "The new x coordinate of lower-right corner of original bounding box",
691 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
692 GIMP_PARAM_READWRITE));
693 gimp_procedure_add_argument (procedure,
694 g_param_spec_double ("y3",
695 "y3",
696 "The new y coordinate of lower-right corner of original bounding box",
697 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
698 GIMP_PARAM_READWRITE));
699 gimp_procedure_add_return_value (procedure,
700 gimp_param_spec_drawable_id ("drawable",
701 "drawable",
702 "The newly mapped drawable",
703 pdb->gimp, FALSE,
704 GIMP_PARAM_READWRITE));
705 gimp_pdb_register_procedure (pdb, procedure);
706 g_object_unref (procedure);
707
708 /*
709 * gimp-rotate
710 */
711 procedure = gimp_procedure_new (rotate_invoker);
712 gimp_object_set_static_name (GIMP_OBJECT (procedure),
713 "gimp-rotate");
714 gimp_procedure_set_static_strings (procedure,
715 "gimp-rotate",
716 "Deprecated: Use 'gimp-item-transform-rotate' instead.",
717 "Deprecated: Use 'gimp-item-transform-rotate' instead.",
718 "",
719 "",
720 "",
721 "gimp-item-transform-rotate");
722 gimp_procedure_add_argument (procedure,
723 gimp_param_spec_drawable_id ("drawable",
724 "drawable",
725 "The affected drawable",
726 pdb->gimp, FALSE,
727 GIMP_PARAM_READWRITE));
728 gimp_procedure_add_argument (procedure,
729 g_param_spec_boolean ("interpolation",
730 "interpolation",
731 "Whether to use interpolation",
732 FALSE,
733 GIMP_PARAM_READWRITE));
734 gimp_procedure_add_argument (procedure,
735 g_param_spec_double ("angle",
736 "angle",
737 "The angle of rotation (radians)",
738 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
739 GIMP_PARAM_READWRITE));
740 gimp_procedure_add_return_value (procedure,
741 gimp_param_spec_drawable_id ("drawable",
742 "drawable",
743 "The rotated drawable",
744 pdb->gimp, FALSE,
745 GIMP_PARAM_READWRITE));
746 gimp_pdb_register_procedure (pdb, procedure);
747 g_object_unref (procedure);
748
749 /*
750 * gimp-scale
751 */
752 procedure = gimp_procedure_new (scale_invoker);
753 gimp_object_set_static_name (GIMP_OBJECT (procedure),
754 "gimp-scale");
755 gimp_procedure_set_static_strings (procedure,
756 "gimp-scale",
757 "Deprecated: Use 'gimp-item-transform-scale' instead.",
758 "Deprecated: Use 'gimp-item-transform-scale' instead.",
759 "",
760 "",
761 "",
762 "gimp-item-transform-scale");
763 gimp_procedure_add_argument (procedure,
764 gimp_param_spec_drawable_id ("drawable",
765 "drawable",
766 "The affected drawable",
767 pdb->gimp, FALSE,
768 GIMP_PARAM_READWRITE));
769 gimp_procedure_add_argument (procedure,
770 g_param_spec_boolean ("interpolation",
771 "interpolation",
772 "Whether to use interpolation",
773 FALSE,
774 GIMP_PARAM_READWRITE));
775 gimp_procedure_add_argument (procedure,
776 g_param_spec_double ("x0",
777 "x0",
778 "The new x coordinate of the upper-left corner of the scaled region",
779 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
780 GIMP_PARAM_READWRITE));
781 gimp_procedure_add_argument (procedure,
782 g_param_spec_double ("y0",
783 "y0",
784 "The new y coordinate of the upper-left corner of the scaled region",
785 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
786 GIMP_PARAM_READWRITE));
787 gimp_procedure_add_argument (procedure,
788 g_param_spec_double ("x1",
789 "x1",
790 "The new x coordinate of the lower-right corner of the scaled region",
791 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
792 GIMP_PARAM_READWRITE));
793 gimp_procedure_add_argument (procedure,
794 g_param_spec_double ("y1",
795 "y1",
796 "The new y coordinate of the lower-right corner of the scaled region",
797 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
798 GIMP_PARAM_READWRITE));
799 gimp_procedure_add_return_value (procedure,
800 gimp_param_spec_drawable_id ("drawable",
801 "drawable",
802 "The scaled drawable",
803 pdb->gimp, FALSE,
804 GIMP_PARAM_READWRITE));
805 gimp_pdb_register_procedure (pdb, procedure);
806 g_object_unref (procedure);
807
808 /*
809 * gimp-shear
810 */
811 procedure = gimp_procedure_new (shear_invoker);
812 gimp_object_set_static_name (GIMP_OBJECT (procedure),
813 "gimp-shear");
814 gimp_procedure_set_static_strings (procedure,
815 "gimp-shear",
816 "Deprecated: Use 'gimp-item-transform-shear' instead.",
817 "Deprecated: Use 'gimp-item-transform-shear' instead.",
818 "",
819 "",
820 "",
821 "gimp-item-transform-shear");
822 gimp_procedure_add_argument (procedure,
823 gimp_param_spec_drawable_id ("drawable",
824 "drawable",
825 "The affected drawable",
826 pdb->gimp, FALSE,
827 GIMP_PARAM_READWRITE));
828 gimp_procedure_add_argument (procedure,
829 g_param_spec_boolean ("interpolation",
830 "interpolation",
831 "Whether to use interpolation",
832 FALSE,
833 GIMP_PARAM_READWRITE));
834 gimp_procedure_add_argument (procedure,
835 gimp_param_spec_enum ("shear-type",
836 "shear type",
837 "Type of shear",
838 GIMP_TYPE_ORIENTATION_TYPE,
839 GIMP_ORIENTATION_HORIZONTAL,
840 GIMP_PARAM_READWRITE));
841 gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[2]),
842 GIMP_ORIENTATION_UNKNOWN);
843 gimp_procedure_add_argument (procedure,
844 g_param_spec_double ("magnitude",
845 "magnitude",
846 "The magnitude of the shear",
847 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
848 GIMP_PARAM_READWRITE));
849 gimp_procedure_add_return_value (procedure,
850 gimp_param_spec_drawable_id ("drawable",
851 "drawable",
852 "The sheared drawable",
853 pdb->gimp, FALSE,
854 GIMP_PARAM_READWRITE));
855 gimp_pdb_register_procedure (pdb, procedure);
856 g_object_unref (procedure);
857
858 /*
859 * gimp-transform-2d
860 */
861 procedure = gimp_procedure_new (transform_2d_invoker);
862 gimp_object_set_static_name (GIMP_OBJECT (procedure),
863 "gimp-transform-2d");
864 gimp_procedure_set_static_strings (procedure,
865 "gimp-transform-2d",
866 "Deprecated: Use 'gimp-item-transform-2d' instead.",
867 "Deprecated: Use 'gimp-item-transform-2d' instead.",
868 "",
869 "",
870 "",
871 "gimp-item-transform-2d");
872 gimp_procedure_add_argument (procedure,
873 gimp_param_spec_drawable_id ("drawable",
874 "drawable",
875 "The affected drawable",
876 pdb->gimp, FALSE,
877 GIMP_PARAM_READWRITE));
878 gimp_procedure_add_argument (procedure,
879 g_param_spec_boolean ("interpolation",
880 "interpolation",
881 "Whether to use interpolation",
882 FALSE,
883 GIMP_PARAM_READWRITE));
884 gimp_procedure_add_argument (procedure,
885 g_param_spec_double ("source-x",
886 "source x",
887 "X coordinate of the transformation center",
888 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
889 GIMP_PARAM_READWRITE));
890 gimp_procedure_add_argument (procedure,
891 g_param_spec_double ("source-y",
892 "source y",
893 "Y coordinate of the transformation center",
894 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
895 GIMP_PARAM_READWRITE));
896 gimp_procedure_add_argument (procedure,
897 g_param_spec_double ("scale-x",
898 "scale x",
899 "Amount to scale in x direction",
900 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
901 GIMP_PARAM_READWRITE));
902 gimp_procedure_add_argument (procedure,
903 g_param_spec_double ("scale-y",
904 "scale y",
905 "Amount to scale in y direction",
906 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
907 GIMP_PARAM_READWRITE));
908 gimp_procedure_add_argument (procedure,
909 g_param_spec_double ("angle",
910 "angle",
911 "The angle of rotation (radians)",
912 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
913 GIMP_PARAM_READWRITE));
914 gimp_procedure_add_argument (procedure,
915 g_param_spec_double ("dest-x",
916 "dest x",
917 "X coordinate of where the centre goes",
918 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
919 GIMP_PARAM_READWRITE));
920 gimp_procedure_add_argument (procedure,
921 g_param_spec_double ("dest-y",
922 "dest y",
923 "Y coordinate of where the centre goes",
924 -G_MAXDOUBLE, G_MAXDOUBLE, 0,
925 GIMP_PARAM_READWRITE));
926 gimp_procedure_add_return_value (procedure,
927 gimp_param_spec_drawable_id ("drawable",
928 "drawable",
929 "The transformed drawable",
930 pdb->gimp, FALSE,
931 GIMP_PARAM_READWRITE));
932 gimp_pdb_register_procedure (pdb, procedure);
933 g_object_unref (procedure);
934 }
935