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 *
drawable_transform_flip_simple_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)51 drawable_transform_flip_simple_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   gboolean auto_center;
63   gdouble axis;
64   gboolean clip_result;
65 
66   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
67   flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
68   auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
69   axis = g_value_get_double (gimp_value_array_index (args, 3));
70   clip_result = g_value_get_boolean (gimp_value_array_index (args, 4));
71 
72   if (success)
73     {
74       gint x, y, width, height;
75 
76       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
77                                            GIMP_PDB_ITEM_CONTENT |
78                                            GIMP_PDB_ITEM_POSITION, error);
79 
80       if (success &&
81           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
82         {
83           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
84           GimpChannel *mask  = gimp_image_get_mask (image);
85 
86           gimp_transform_get_flip_axis (x, y, width, height,
87                                         flip_type, auto_center, &axis);
88 
89           if (drawable != GIMP_DRAWABLE (mask)                        &&
90               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
91               ! gimp_channel_is_empty (mask))
92             {
93               if (! gimp_drawable_transform_flip (drawable, context,
94                                                   flip_type, axis, clip_result))
95                 {
96                   success = FALSE;
97                 }
98             }
99           else
100             {
101               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
102 
103               gimp_item_flip (GIMP_ITEM (drawable), context,
104                               flip_type, axis, clip_result);
105             }
106         }
107     }
108 
109   return_vals = gimp_procedure_get_return_values (procedure, success,
110                                                   error ? *error : NULL);
111 
112   if (success)
113     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
114 
115   return return_vals;
116 }
117 
118 static GimpValueArray *
drawable_transform_flip_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)119 drawable_transform_flip_invoker (GimpProcedure         *procedure,
120                                  Gimp                  *gimp,
121                                  GimpContext           *context,
122                                  GimpProgress          *progress,
123                                  const GimpValueArray  *args,
124                                  GError               **error)
125 {
126   gboolean success = TRUE;
127   GimpValueArray *return_vals;
128   GimpDrawable *drawable;
129   gdouble x0;
130   gdouble y0;
131   gdouble x1;
132   gdouble y1;
133   gint32 transform_direction;
134   gint32 interpolation;
135   gboolean clip_result;
136 
137   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
138   x0 = g_value_get_double (gimp_value_array_index (args, 1));
139   y0 = g_value_get_double (gimp_value_array_index (args, 2));
140   x1 = g_value_get_double (gimp_value_array_index (args, 3));
141   y1 = g_value_get_double (gimp_value_array_index (args, 4));
142   transform_direction = g_value_get_enum (gimp_value_array_index (args, 5));
143   interpolation = g_value_get_enum (gimp_value_array_index (args, 6));
144   clip_result = g_value_get_boolean (gimp_value_array_index (args, 9));
145 
146   if (success)
147     {
148       gint x, y, width, height;
149 
150       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
151                                                         GIMP_PDB_ITEM_CONTENT |
152                                                         GIMP_PDB_ITEM_POSITION,
153                                                         error);
154 
155       if (success &&
156           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
157         {
158           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
159           GimpChannel *mask  = gimp_image_get_mask (image);
160           GimpMatrix3  matrix;
161           gint         off_x, off_y;
162 
163           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
164 
165           x += off_x;
166           y += off_y;
167 
168           /* Assemble the transformation matrix */
169           gimp_matrix3_identity (&matrix);
170           gimp_transform_matrix_flip_free (&matrix,
171                                            x0, y0, x1, y1);
172 
173           if (progress)
174             gimp_progress_start (progress, FALSE, _("Flipping"));
175 
176           if (drawable != GIMP_DRAWABLE (mask)                        &&
177               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
178               ! gimp_channel_is_empty (mask))
179             {
180               if (! gimp_drawable_transform_affine (drawable, context,
181                                                     &matrix, transform_direction,
182                                                     interpolation,
183                                                     clip_result, progress))
184                 {
185                   success = FALSE;
186                 }
187             }
188           else
189             {
190               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
191 
192               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
193                                    transform_direction,
194                                    interpolation,
195                                    clip_result, progress);
196             }
197 
198           if (progress)
199             gimp_progress_end (progress);
200         }
201     }
202 
203   return_vals = gimp_procedure_get_return_values (procedure, success,
204                                                   error ? *error : NULL);
205 
206   if (success)
207     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
208 
209   return return_vals;
210 }
211 
212 static GimpValueArray *
drawable_transform_flip_default_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)213 drawable_transform_flip_default_invoker (GimpProcedure         *procedure,
214                                          Gimp                  *gimp,
215                                          GimpContext           *context,
216                                          GimpProgress          *progress,
217                                          const GimpValueArray  *args,
218                                          GError               **error)
219 {
220   gboolean success = TRUE;
221   GimpValueArray *return_vals;
222   GimpDrawable *drawable;
223   gdouble x0;
224   gdouble y0;
225   gdouble x1;
226   gdouble y1;
227   gboolean interpolate;
228   gboolean clip_result;
229 
230   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
231   x0 = g_value_get_double (gimp_value_array_index (args, 1));
232   y0 = g_value_get_double (gimp_value_array_index (args, 2));
233   x1 = g_value_get_double (gimp_value_array_index (args, 3));
234   y1 = g_value_get_double (gimp_value_array_index (args, 4));
235   interpolate = g_value_get_boolean (gimp_value_array_index (args, 5));
236   clip_result = g_value_get_boolean (gimp_value_array_index (args, 6));
237 
238   if (success)
239     {
240       gint x, y, width, height;
241 
242       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
243                                                         GIMP_PDB_ITEM_CONTENT |
244                                                         GIMP_PDB_ITEM_POSITION, error);
245 
246       if (success &&
247           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
248         {
249           GimpImage             *image = gimp_item_get_image (GIMP_ITEM (drawable));
250           GimpChannel           *mask  = gimp_image_get_mask (image);
251           GimpMatrix3            matrix;
252           GimpInterpolationType  interpolation_type = GIMP_INTERPOLATION_NONE;
253           gint                   off_x, off_y;
254 
255           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
256 
257           x += off_x;
258           y += off_y;
259 
260           /* Assemble the transformation matrix */
261           gimp_matrix3_identity (&matrix);
262           gimp_transform_matrix_flip_free (&matrix,
263                                            x0, y0, x1, y1);
264 
265           if (interpolate)
266             interpolation_type = gimp->config->interpolation_type;
267 
268           if (progress)
269             gimp_progress_start (progress, FALSE, _("Flipping"));
270 
271           if (drawable != GIMP_DRAWABLE (mask)                        &&
272               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
273               ! gimp_channel_is_empty (mask))
274             {
275               if (! gimp_drawable_transform_affine (drawable, context,
276                                                     &matrix, GIMP_TRANSFORM_FORWARD,
277                                                     interpolation_type,
278                                                     clip_result, progress))
279                 {
280                   success = FALSE;
281                 }
282             }
283           else
284             {
285               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
286 
287               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
288                                    GIMP_TRANSFORM_FORWARD,
289                                    interpolation_type,
290                                    clip_result, progress);
291             }
292 
293           if (progress)
294             gimp_progress_end (progress);
295         }
296     }
297 
298   return_vals = gimp_procedure_get_return_values (procedure, success,
299                                                   error ? *error : NULL);
300 
301   if (success)
302     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
303 
304   return return_vals;
305 }
306 
307 static GimpValueArray *
drawable_transform_perspective_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)308 drawable_transform_perspective_invoker (GimpProcedure         *procedure,
309                                         Gimp                  *gimp,
310                                         GimpContext           *context,
311                                         GimpProgress          *progress,
312                                         const GimpValueArray  *args,
313                                         GError               **error)
314 {
315   gboolean success = TRUE;
316   GimpValueArray *return_vals;
317   GimpDrawable *drawable;
318   gdouble x0;
319   gdouble y0;
320   gdouble x1;
321   gdouble y1;
322   gdouble x2;
323   gdouble y2;
324   gdouble x3;
325   gdouble y3;
326   gint32 transform_direction;
327   gint32 interpolation;
328   gint32 clip_result;
329 
330   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
331   x0 = g_value_get_double (gimp_value_array_index (args, 1));
332   y0 = g_value_get_double (gimp_value_array_index (args, 2));
333   x1 = g_value_get_double (gimp_value_array_index (args, 3));
334   y1 = g_value_get_double (gimp_value_array_index (args, 4));
335   x2 = g_value_get_double (gimp_value_array_index (args, 5));
336   y2 = g_value_get_double (gimp_value_array_index (args, 6));
337   x3 = g_value_get_double (gimp_value_array_index (args, 7));
338   y3 = g_value_get_double (gimp_value_array_index (args, 8));
339   transform_direction = g_value_get_enum (gimp_value_array_index (args, 9));
340   interpolation = g_value_get_enum (gimp_value_array_index (args, 10));
341   clip_result = g_value_get_enum (gimp_value_array_index (args, 13));
342 
343   if (success)
344     {
345       gint x, y, width, height;
346 
347       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
348                                                         GIMP_PDB_ITEM_CONTENT |
349                                                         GIMP_PDB_ITEM_POSITION,
350                                                         error);
351 
352       if (success &&
353           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
354         {
355           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
356           GimpChannel *mask  = gimp_image_get_mask (image);
357           GimpMatrix3  matrix;
358           gint         off_x, off_y;
359 
360           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
361 
362           x += off_x;
363           y += off_y;
364 
365           /* Assemble the transformation matrix */
366           gimp_matrix3_identity (&matrix);
367           gimp_transform_matrix_perspective (&matrix,
368                                              x, y, width, height,
369                                              x0, y0, x1, y1,
370                                              x2, y2, x3, y3);
371 
372           if (progress)
373             gimp_progress_start (progress, FALSE, _("Perspective"));
374 
375           if (drawable != GIMP_DRAWABLE (mask)                        &&
376               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
377               ! gimp_channel_is_empty (mask))
378             {
379               if (! gimp_drawable_transform_affine (drawable, context,
380                                                     &matrix, transform_direction,
381                                                     interpolation,
382                                                     clip_result, progress))
383                 {
384                   success = FALSE;
385                 }
386             }
387           else
388             {
389               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
390 
391               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
392                                    transform_direction,
393                                    interpolation,
394                                    clip_result, progress);
395             }
396 
397           if (progress)
398             gimp_progress_end (progress);
399         }
400     }
401 
402   return_vals = gimp_procedure_get_return_values (procedure, success,
403                                                   error ? *error : NULL);
404 
405   if (success)
406     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
407 
408   return return_vals;
409 }
410 
411 static GimpValueArray *
drawable_transform_perspective_default_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)412 drawable_transform_perspective_default_invoker (GimpProcedure         *procedure,
413                                                 Gimp                  *gimp,
414                                                 GimpContext           *context,
415                                                 GimpProgress          *progress,
416                                                 const GimpValueArray  *args,
417                                                 GError               **error)
418 {
419   gboolean success = TRUE;
420   GimpValueArray *return_vals;
421   GimpDrawable *drawable;
422   gdouble x0;
423   gdouble y0;
424   gdouble x1;
425   gdouble y1;
426   gdouble x2;
427   gdouble y2;
428   gdouble x3;
429   gdouble y3;
430   gboolean interpolate;
431   gint32 clip_result;
432 
433   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
434   x0 = g_value_get_double (gimp_value_array_index (args, 1));
435   y0 = g_value_get_double (gimp_value_array_index (args, 2));
436   x1 = g_value_get_double (gimp_value_array_index (args, 3));
437   y1 = g_value_get_double (gimp_value_array_index (args, 4));
438   x2 = g_value_get_double (gimp_value_array_index (args, 5));
439   y2 = g_value_get_double (gimp_value_array_index (args, 6));
440   x3 = g_value_get_double (gimp_value_array_index (args, 7));
441   y3 = g_value_get_double (gimp_value_array_index (args, 8));
442   interpolate = g_value_get_boolean (gimp_value_array_index (args, 9));
443   clip_result = g_value_get_enum (gimp_value_array_index (args, 10));
444 
445   if (success)
446     {
447       gint x, y, width, height;
448 
449       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
450                                                         GIMP_PDB_ITEM_CONTENT |
451                                                         GIMP_PDB_ITEM_POSITION, error);
452 
453       if (success &&
454           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
455         {
456           GimpImage             *image = gimp_item_get_image (GIMP_ITEM (drawable));
457           GimpChannel           *mask  = gimp_image_get_mask (image);
458           GimpMatrix3            matrix;
459           GimpInterpolationType  interpolation_type = GIMP_INTERPOLATION_NONE;
460           gint                   off_x, off_y;
461 
462           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
463 
464           x += off_x;
465           y += off_y;
466 
467           /* Assemble the transformation matrix */
468           gimp_matrix3_identity (&matrix);
469           gimp_transform_matrix_perspective (&matrix,
470                                              x, y, width, height,
471                                              x0, y0, x1, y1,
472                                              x2, y2, x3, y3);
473 
474           if (interpolate)
475             interpolation_type = gimp->config->interpolation_type;
476 
477           if (progress)
478             gimp_progress_start (progress, FALSE, _("Perspective"));
479 
480           if (drawable != GIMP_DRAWABLE (mask)                        &&
481               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
482               ! gimp_channel_is_empty (mask))
483             {
484               if (! gimp_drawable_transform_affine (drawable, context,
485                                                     &matrix, GIMP_TRANSFORM_FORWARD,
486                                                     interpolation_type,
487                                                     clip_result, progress))
488                 {
489                   success = FALSE;
490                 }
491             }
492           else
493             {
494               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
495 
496               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
497                                    GIMP_TRANSFORM_FORWARD,
498                                    interpolation_type,
499                                    clip_result, progress);
500             }
501 
502           if (progress)
503             gimp_progress_end (progress);
504         }
505     }
506 
507   return_vals = gimp_procedure_get_return_values (procedure, success,
508                                                   error ? *error : NULL);
509 
510   if (success)
511     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
512 
513   return return_vals;
514 }
515 
516 static GimpValueArray *
drawable_transform_rotate_simple_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)517 drawable_transform_rotate_simple_invoker (GimpProcedure         *procedure,
518                                           Gimp                  *gimp,
519                                           GimpContext           *context,
520                                           GimpProgress          *progress,
521                                           const GimpValueArray  *args,
522                                           GError               **error)
523 {
524   gboolean success = TRUE;
525   GimpValueArray *return_vals;
526   GimpDrawable *drawable;
527   gint32 rotate_type;
528   gboolean auto_center;
529   gint32 center_x;
530   gint32 center_y;
531   gboolean clip_result;
532 
533   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
534   rotate_type = g_value_get_enum (gimp_value_array_index (args, 1));
535   auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
536   center_x = g_value_get_int (gimp_value_array_index (args, 3));
537   center_y = g_value_get_int (gimp_value_array_index (args, 4));
538   clip_result = g_value_get_boolean (gimp_value_array_index (args, 5));
539 
540   if (success)
541     {
542       gint x, y, width, height;
543 
544       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
545                                            GIMP_PDB_ITEM_CONTENT |
546                                            GIMP_PDB_ITEM_POSITION, error);
547 
548       if (success &&
549           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
550         {
551           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
552           GimpChannel *mask  = gimp_image_get_mask (image);
553           gdouble      cx    = center_x;
554           gdouble      cy    = center_y;
555 
556           gimp_transform_get_rotate_center (x, y, width, height,
557                                             auto_center, &cx, &cy);
558 
559           if (drawable != GIMP_DRAWABLE (mask)                        &&
560               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
561               ! gimp_channel_is_empty (mask))
562             {
563               if (! gimp_drawable_transform_rotate (drawable, context,
564                                                     rotate_type, cx, cy,
565                                                     clip_result))
566                 {
567                   success = FALSE;
568                 }
569             }
570           else
571             {
572               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
573 
574               gimp_item_rotate (GIMP_ITEM (drawable), context,
575                                 rotate_type, cx, cy,
576                                 clip_result);
577             }
578         }
579     }
580 
581   return_vals = gimp_procedure_get_return_values (procedure, success,
582                                                   error ? *error : NULL);
583 
584   if (success)
585     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
586 
587   return return_vals;
588 }
589 
590 static GimpValueArray *
drawable_transform_rotate_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)591 drawable_transform_rotate_invoker (GimpProcedure         *procedure,
592                                    Gimp                  *gimp,
593                                    GimpContext           *context,
594                                    GimpProgress          *progress,
595                                    const GimpValueArray  *args,
596                                    GError               **error)
597 {
598   gboolean success = TRUE;
599   GimpValueArray *return_vals;
600   GimpDrawable *drawable;
601   gdouble angle;
602   gboolean auto_center;
603   gint32 center_x;
604   gint32 center_y;
605   gint32 transform_direction;
606   gint32 interpolation;
607   gint32 clip_result;
608 
609   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
610   angle = g_value_get_double (gimp_value_array_index (args, 1));
611   auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
612   center_x = g_value_get_int (gimp_value_array_index (args, 3));
613   center_y = g_value_get_int (gimp_value_array_index (args, 4));
614   transform_direction = g_value_get_enum (gimp_value_array_index (args, 5));
615   interpolation = g_value_get_enum (gimp_value_array_index (args, 6));
616   clip_result = g_value_get_enum (gimp_value_array_index (args, 9));
617 
618   if (success)
619     {
620       gint x, y, width, height;
621 
622       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
623                                                         GIMP_PDB_ITEM_CONTENT |
624                                                         GIMP_PDB_ITEM_POSITION,
625                                                         error);
626 
627       if (success &&
628           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
629         {
630           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
631           GimpChannel *mask  = gimp_image_get_mask (image);
632           GimpMatrix3  matrix;
633           gint         off_x, off_y;
634 
635           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
636 
637           x += off_x;
638           y += off_y;
639 
640           /* Assemble the transformation matrix */
641           gimp_matrix3_identity (&matrix);
642           if (auto_center)
643             gimp_transform_matrix_rotate_rect (&matrix,
644                                                x, y, width, height, angle);
645           else
646             gimp_transform_matrix_rotate_center (&matrix,
647                                                  center_x, center_y, angle);
648 
649           if (progress)
650             gimp_progress_start (progress, FALSE, _("Rotating"));
651 
652           if (drawable != GIMP_DRAWABLE (mask)                        &&
653               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
654               ! gimp_channel_is_empty (mask))
655             {
656               if (! gimp_drawable_transform_affine (drawable, context,
657                                                     &matrix, transform_direction,
658                                                     interpolation,
659                                                     clip_result, progress))
660                 {
661                   success = FALSE;
662                 }
663             }
664           else
665             {
666               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
667 
668               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
669                                    transform_direction,
670                                    interpolation,
671                                    clip_result, progress);
672             }
673 
674           if (progress)
675             gimp_progress_end (progress);
676         }
677     }
678 
679   return_vals = gimp_procedure_get_return_values (procedure, success,
680                                                   error ? *error : NULL);
681 
682   if (success)
683     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
684 
685   return return_vals;
686 }
687 
688 static GimpValueArray *
drawable_transform_rotate_default_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)689 drawable_transform_rotate_default_invoker (GimpProcedure         *procedure,
690                                            Gimp                  *gimp,
691                                            GimpContext           *context,
692                                            GimpProgress          *progress,
693                                            const GimpValueArray  *args,
694                                            GError               **error)
695 {
696   gboolean success = TRUE;
697   GimpValueArray *return_vals;
698   GimpDrawable *drawable;
699   gdouble angle;
700   gboolean auto_center;
701   gint32 center_x;
702   gint32 center_y;
703   gboolean interpolate;
704   gint32 clip_result;
705 
706   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
707   angle = g_value_get_double (gimp_value_array_index (args, 1));
708   auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
709   center_x = g_value_get_int (gimp_value_array_index (args, 3));
710   center_y = g_value_get_int (gimp_value_array_index (args, 4));
711   interpolate = g_value_get_boolean (gimp_value_array_index (args, 5));
712   clip_result = g_value_get_enum (gimp_value_array_index (args, 6));
713 
714   if (success)
715     {
716       gint x, y, width, height;
717 
718       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
719                                                         GIMP_PDB_ITEM_CONTENT |
720                                                         GIMP_PDB_ITEM_POSITION, error);
721 
722       if (success &&
723           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
724         {
725           GimpImage             *image = gimp_item_get_image (GIMP_ITEM (drawable));
726           GimpChannel           *mask  = gimp_image_get_mask (image);
727           GimpMatrix3            matrix;
728           GimpInterpolationType  interpolation_type = GIMP_INTERPOLATION_NONE;
729           gint                   off_x, off_y;
730 
731           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
732 
733           x += off_x;
734           y += off_y;
735 
736           /* Assemble the transformation matrix */
737           gimp_matrix3_identity (&matrix);
738           if (auto_center)
739             gimp_transform_matrix_rotate_rect (&matrix,
740                                                x, y, width, height, angle);
741           else
742             gimp_transform_matrix_rotate_center (&matrix,
743                                                  center_x, center_y, angle);
744 
745           if (interpolate)
746             interpolation_type = gimp->config->interpolation_type;
747 
748           if (progress)
749             gimp_progress_start (progress, FALSE, _("Rotating"));
750 
751           if (drawable != GIMP_DRAWABLE (mask)                        &&
752               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
753               ! gimp_channel_is_empty (mask))
754             {
755               if (! gimp_drawable_transform_affine (drawable, context,
756                                                     &matrix, GIMP_TRANSFORM_FORWARD,
757                                                     interpolation_type,
758                                                     clip_result, progress))
759                 {
760                   success = FALSE;
761                 }
762             }
763           else
764             {
765               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
766 
767               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
768                                    GIMP_TRANSFORM_FORWARD,
769                                    interpolation_type,
770                                    clip_result, progress);
771             }
772 
773           if (progress)
774             gimp_progress_end (progress);
775         }
776     }
777 
778   return_vals = gimp_procedure_get_return_values (procedure, success,
779                                                   error ? *error : NULL);
780 
781   if (success)
782     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
783 
784   return return_vals;
785 }
786 
787 static GimpValueArray *
drawable_transform_scale_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)788 drawable_transform_scale_invoker (GimpProcedure         *procedure,
789                                   Gimp                  *gimp,
790                                   GimpContext           *context,
791                                   GimpProgress          *progress,
792                                   const GimpValueArray  *args,
793                                   GError               **error)
794 {
795   gboolean success = TRUE;
796   GimpValueArray *return_vals;
797   GimpDrawable *drawable;
798   gdouble x0;
799   gdouble y0;
800   gdouble x1;
801   gdouble y1;
802   gint32 transform_direction;
803   gint32 interpolation;
804   gint32 clip_result;
805 
806   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
807   x0 = g_value_get_double (gimp_value_array_index (args, 1));
808   y0 = g_value_get_double (gimp_value_array_index (args, 2));
809   x1 = g_value_get_double (gimp_value_array_index (args, 3));
810   y1 = g_value_get_double (gimp_value_array_index (args, 4));
811   transform_direction = g_value_get_enum (gimp_value_array_index (args, 5));
812   interpolation = g_value_get_enum (gimp_value_array_index (args, 6));
813   clip_result = g_value_get_enum (gimp_value_array_index (args, 9));
814 
815   if (success)
816     {
817       gint x, y, width, height;
818 
819       success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
820                                                           GIMP_PDB_ITEM_CONTENT |
821                                                           GIMP_PDB_ITEM_POSITION, error) && x0 < x1 && y0 < y1);
822 
823       if (success &&
824           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
825         {
826           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
827           GimpChannel *mask  = gimp_image_get_mask (image);
828           GimpMatrix3  matrix;
829           gint         off_x, off_y;
830 
831           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
832 
833           x += off_x;
834           y += off_y;
835 
836           /* Assemble the transformation matrix */
837           gimp_matrix3_identity (&matrix);
838           gimp_transform_matrix_scale (&matrix,
839                                        x, y, width, height,
840                                        x0, y0, x1 - x0, y1 - y0);
841 
842           if (progress)
843             gimp_progress_start (progress, FALSE, _("Scaling"));
844 
845           if (drawable != GIMP_DRAWABLE (mask)                        &&
846               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
847               ! gimp_channel_is_empty (mask))
848             {
849               if (! gimp_drawable_transform_affine (drawable, context,
850                                                     &matrix, transform_direction,
851                                                     interpolation,
852                                                     clip_result, progress))
853                 {
854                   success = FALSE;
855                 }
856             }
857           else
858             {
859               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
860 
861               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
862                                    transform_direction,
863                                    interpolation,
864                                    clip_result, progress);
865             }
866 
867           if (progress)
868             gimp_progress_end (progress);
869         }
870     }
871 
872   return_vals = gimp_procedure_get_return_values (procedure, success,
873                                                   error ? *error : NULL);
874 
875   if (success)
876     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
877 
878   return return_vals;
879 }
880 
881 static GimpValueArray *
drawable_transform_scale_default_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)882 drawable_transform_scale_default_invoker (GimpProcedure         *procedure,
883                                           Gimp                  *gimp,
884                                           GimpContext           *context,
885                                           GimpProgress          *progress,
886                                           const GimpValueArray  *args,
887                                           GError               **error)
888 {
889   gboolean success = TRUE;
890   GimpValueArray *return_vals;
891   GimpDrawable *drawable;
892   gdouble x0;
893   gdouble y0;
894   gdouble x1;
895   gdouble y1;
896   gboolean interpolate;
897   gint32 clip_result;
898 
899   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
900   x0 = g_value_get_double (gimp_value_array_index (args, 1));
901   y0 = g_value_get_double (gimp_value_array_index (args, 2));
902   x1 = g_value_get_double (gimp_value_array_index (args, 3));
903   y1 = g_value_get_double (gimp_value_array_index (args, 4));
904   interpolate = g_value_get_boolean (gimp_value_array_index (args, 5));
905   clip_result = g_value_get_enum (gimp_value_array_index (args, 6));
906 
907   if (success)
908     {
909       gint x, y, width, height;
910 
911       success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
912                                                           GIMP_PDB_ITEM_CONTENT |
913                                                           GIMP_PDB_ITEM_POSITION, error) && x0 < x1 && y0 < y1);
914 
915       if (success &&
916           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
917         {
918           GimpImage             *image = gimp_item_get_image (GIMP_ITEM (drawable));
919           GimpChannel           *mask  = gimp_image_get_mask (image);
920           GimpMatrix3            matrix;
921           GimpInterpolationType  interpolation_type = GIMP_INTERPOLATION_NONE;
922           gint                   off_x, off_y;
923 
924           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
925 
926           x += off_x;
927           y += off_y;
928 
929           /* Assemble the transformation matrix */
930           gimp_matrix3_identity (&matrix);
931           gimp_transform_matrix_scale (&matrix,
932                                        x, y, width, height,
933                                        x0, y0, x1 - x0, y1 - y0);
934 
935           if (interpolate)
936             interpolation_type = gimp->config->interpolation_type;
937 
938           if (progress)
939             gimp_progress_start (progress, FALSE, _("Scaling"));
940 
941           if (drawable != GIMP_DRAWABLE (mask)                        &&
942               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
943               ! gimp_channel_is_empty (mask))
944             {
945               if (! gimp_drawable_transform_affine (drawable, context,
946                                                     &matrix, GIMP_TRANSFORM_FORWARD,
947                                                     interpolation_type,
948                                                     clip_result, progress))
949                 {
950                   success = FALSE;
951                 }
952             }
953           else
954             {
955               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
956 
957               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
958                                    GIMP_TRANSFORM_FORWARD,
959                                    interpolation_type,
960                                    clip_result, progress);
961             }
962 
963           if (progress)
964             gimp_progress_end (progress);
965         }
966     }
967 
968   return_vals = gimp_procedure_get_return_values (procedure, success,
969                                                   error ? *error : NULL);
970 
971   if (success)
972     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
973 
974   return return_vals;
975 }
976 
977 static GimpValueArray *
drawable_transform_shear_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)978 drawable_transform_shear_invoker (GimpProcedure         *procedure,
979                                   Gimp                  *gimp,
980                                   GimpContext           *context,
981                                   GimpProgress          *progress,
982                                   const GimpValueArray  *args,
983                                   GError               **error)
984 {
985   gboolean success = TRUE;
986   GimpValueArray *return_vals;
987   GimpDrawable *drawable;
988   gint32 shear_type;
989   gdouble magnitude;
990   gint32 transform_direction;
991   gint32 interpolation;
992   gint32 clip_result;
993 
994   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
995   shear_type = g_value_get_enum (gimp_value_array_index (args, 1));
996   magnitude = g_value_get_double (gimp_value_array_index (args, 2));
997   transform_direction = g_value_get_enum (gimp_value_array_index (args, 3));
998   interpolation = g_value_get_enum (gimp_value_array_index (args, 4));
999   clip_result = g_value_get_enum (gimp_value_array_index (args, 7));
1000 
1001   if (success)
1002     {
1003       gint x, y, width, height;
1004 
1005       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
1006                                                         GIMP_PDB_ITEM_CONTENT |
1007                                                         GIMP_PDB_ITEM_POSITION,
1008                                                         error);
1009 
1010       if (success &&
1011           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
1012         {
1013           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
1014           GimpChannel *mask  = gimp_image_get_mask (image);
1015           GimpMatrix3  matrix;
1016           gint         off_x, off_y;
1017 
1018           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
1019 
1020           x += off_x;
1021           y += off_y;
1022 
1023           /* Assemble the transformation matrix */
1024           gimp_matrix3_identity (&matrix);
1025           gimp_transform_matrix_shear (&matrix,
1026                                        x, y, width, height,
1027                                        shear_type, magnitude);
1028 
1029           if (progress)
1030             gimp_progress_start (progress, FALSE, _("Shearing"));
1031 
1032           if (drawable != GIMP_DRAWABLE (mask)                        &&
1033               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
1034               ! gimp_channel_is_empty (mask))
1035             {
1036               if (! gimp_drawable_transform_affine (drawable, context,
1037                                                     &matrix, transform_direction,
1038                                                     interpolation,
1039                                                     clip_result, progress))
1040                 {
1041                   success = FALSE;
1042                 }
1043             }
1044           else
1045             {
1046               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
1047 
1048               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
1049                                    transform_direction,
1050                                    interpolation,
1051                                    clip_result, progress);
1052             }
1053 
1054           if (progress)
1055             gimp_progress_end (progress);
1056         }
1057     }
1058 
1059   return_vals = gimp_procedure_get_return_values (procedure, success,
1060                                                   error ? *error : NULL);
1061 
1062   if (success)
1063     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
1064 
1065   return return_vals;
1066 }
1067 
1068 static GimpValueArray *
drawable_transform_shear_default_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)1069 drawable_transform_shear_default_invoker (GimpProcedure         *procedure,
1070                                           Gimp                  *gimp,
1071                                           GimpContext           *context,
1072                                           GimpProgress          *progress,
1073                                           const GimpValueArray  *args,
1074                                           GError               **error)
1075 {
1076   gboolean success = TRUE;
1077   GimpValueArray *return_vals;
1078   GimpDrawable *drawable;
1079   gint32 shear_type;
1080   gdouble magnitude;
1081   gboolean interpolate;
1082   gint32 clip_result;
1083 
1084   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
1085   shear_type = g_value_get_enum (gimp_value_array_index (args, 1));
1086   magnitude = g_value_get_double (gimp_value_array_index (args, 2));
1087   interpolate = g_value_get_boolean (gimp_value_array_index (args, 3));
1088   clip_result = g_value_get_enum (gimp_value_array_index (args, 4));
1089 
1090   if (success)
1091     {
1092       gint x, y, width, height;
1093 
1094       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
1095                                                         GIMP_PDB_ITEM_CONTENT |
1096                                                         GIMP_PDB_ITEM_POSITION, error);
1097 
1098       if (success &&
1099           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
1100         {
1101           GimpImage             *image = gimp_item_get_image (GIMP_ITEM (drawable));
1102           GimpChannel           *mask  = gimp_image_get_mask (image);
1103           GimpMatrix3            matrix;
1104           GimpInterpolationType  interpolation_type = GIMP_INTERPOLATION_NONE;
1105           gint                   off_x, off_y;
1106 
1107           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
1108 
1109           x += off_x;
1110           y += off_y;
1111 
1112           /* Assemble the transformation matrix */
1113           gimp_matrix3_identity (&matrix);
1114           gimp_transform_matrix_shear (&matrix,
1115                                        x, y, width, height,
1116                                        shear_type, magnitude);
1117 
1118           if (interpolate)
1119             interpolation_type = gimp->config->interpolation_type;
1120 
1121           if (progress)
1122             gimp_progress_start (progress, FALSE, _("Shearing"));
1123 
1124           if (drawable != GIMP_DRAWABLE (mask)                        &&
1125               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
1126               ! gimp_channel_is_empty (mask))
1127             {
1128               if (! gimp_drawable_transform_affine (drawable, context,
1129                                                     &matrix, GIMP_TRANSFORM_FORWARD,
1130                                                     interpolation_type,
1131                                                     clip_result, progress))
1132                 {
1133                   success = FALSE;
1134                 }
1135             }
1136           else
1137             {
1138               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
1139 
1140               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
1141                                    GIMP_TRANSFORM_FORWARD,
1142                                    interpolation_type,
1143                                    clip_result, progress);
1144             }
1145 
1146           if (progress)
1147             gimp_progress_end (progress);
1148         }
1149     }
1150 
1151   return_vals = gimp_procedure_get_return_values (procedure, success,
1152                                                   error ? *error : NULL);
1153 
1154   if (success)
1155     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
1156 
1157   return return_vals;
1158 }
1159 
1160 static GimpValueArray *
drawable_transform_2d_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)1161 drawable_transform_2d_invoker (GimpProcedure         *procedure,
1162                                Gimp                  *gimp,
1163                                GimpContext           *context,
1164                                GimpProgress          *progress,
1165                                const GimpValueArray  *args,
1166                                GError               **error)
1167 {
1168   gboolean success = TRUE;
1169   GimpValueArray *return_vals;
1170   GimpDrawable *drawable;
1171   gdouble source_x;
1172   gdouble source_y;
1173   gdouble scale_x;
1174   gdouble scale_y;
1175   gdouble angle;
1176   gdouble dest_x;
1177   gdouble dest_y;
1178   gint32 transform_direction;
1179   gint32 interpolation;
1180   gint32 clip_result;
1181 
1182   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
1183   source_x = g_value_get_double (gimp_value_array_index (args, 1));
1184   source_y = g_value_get_double (gimp_value_array_index (args, 2));
1185   scale_x = g_value_get_double (gimp_value_array_index (args, 3));
1186   scale_y = g_value_get_double (gimp_value_array_index (args, 4));
1187   angle = g_value_get_double (gimp_value_array_index (args, 5));
1188   dest_x = g_value_get_double (gimp_value_array_index (args, 6));
1189   dest_y = g_value_get_double (gimp_value_array_index (args, 7));
1190   transform_direction = g_value_get_enum (gimp_value_array_index (args, 8));
1191   interpolation = g_value_get_enum (gimp_value_array_index (args, 9));
1192   clip_result = g_value_get_enum (gimp_value_array_index (args, 12));
1193 
1194   if (success)
1195     {
1196       gint x, y, width, height;
1197 
1198       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
1199                                                         GIMP_PDB_ITEM_CONTENT |
1200                                                         GIMP_PDB_ITEM_POSITION,
1201                                                         error);
1202 
1203       if (success &&
1204           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
1205         {
1206           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
1207           GimpChannel *mask  = gimp_image_get_mask (image);
1208           GimpMatrix3  matrix;
1209           gint         off_x, off_y;
1210 
1211           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
1212 
1213           x += off_x;
1214           y += off_y;
1215 
1216           /* Assemble the transformation matrix */
1217           gimp_matrix3_identity  (&matrix);
1218           gimp_matrix3_translate (&matrix, -source_x, -source_y);
1219           gimp_matrix3_scale     (&matrix, scale_x, scale_y);
1220           gimp_matrix3_rotate    (&matrix, angle);
1221           gimp_matrix3_translate (&matrix, dest_x, dest_y);
1222 
1223           if (progress)
1224             gimp_progress_start (progress, FALSE, _("2D Transform"));
1225 
1226           if (drawable != GIMP_DRAWABLE (mask)                        &&
1227               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
1228               ! gimp_channel_is_empty (mask))
1229             {
1230               if (! gimp_drawable_transform_affine (drawable, context,
1231                                                     &matrix, transform_direction,
1232                                                     interpolation,
1233                                                     clip_result, progress))
1234                 {
1235                   success = FALSE;
1236                 }
1237             }
1238           else
1239             {
1240               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
1241 
1242               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
1243                                    transform_direction,
1244                                    interpolation,
1245                                    clip_result, progress);
1246             }
1247 
1248           if (progress)
1249             gimp_progress_end (progress);
1250         }
1251     }
1252 
1253   return_vals = gimp_procedure_get_return_values (procedure, success,
1254                                                   error ? *error : NULL);
1255 
1256   if (success)
1257     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
1258 
1259   return return_vals;
1260 }
1261 
1262 static GimpValueArray *
drawable_transform_2d_default_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)1263 drawable_transform_2d_default_invoker (GimpProcedure         *procedure,
1264                                        Gimp                  *gimp,
1265                                        GimpContext           *context,
1266                                        GimpProgress          *progress,
1267                                        const GimpValueArray  *args,
1268                                        GError               **error)
1269 {
1270   gboolean success = TRUE;
1271   GimpValueArray *return_vals;
1272   GimpDrawable *drawable;
1273   gdouble source_x;
1274   gdouble source_y;
1275   gdouble scale_x;
1276   gdouble scale_y;
1277   gdouble angle;
1278   gdouble dest_x;
1279   gdouble dest_y;
1280   gboolean interpolate;
1281   gint32 clip_result;
1282 
1283   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
1284   source_x = g_value_get_double (gimp_value_array_index (args, 1));
1285   source_y = g_value_get_double (gimp_value_array_index (args, 2));
1286   scale_x = g_value_get_double (gimp_value_array_index (args, 3));
1287   scale_y = g_value_get_double (gimp_value_array_index (args, 4));
1288   angle = g_value_get_double (gimp_value_array_index (args, 5));
1289   dest_x = g_value_get_double (gimp_value_array_index (args, 6));
1290   dest_y = g_value_get_double (gimp_value_array_index (args, 7));
1291   interpolate = g_value_get_boolean (gimp_value_array_index (args, 8));
1292   clip_result = g_value_get_enum (gimp_value_array_index (args, 9));
1293 
1294   if (success)
1295     {
1296       gint x, y, width, height;
1297 
1298       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
1299                                                         GIMP_PDB_ITEM_CONTENT |
1300                                                         GIMP_PDB_ITEM_POSITION, error);
1301 
1302       if (success &&
1303           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
1304         {
1305           GimpImage             *image = gimp_item_get_image (GIMP_ITEM (drawable));
1306           GimpChannel           *mask  = gimp_image_get_mask (image);
1307           GimpMatrix3            matrix;
1308           GimpInterpolationType  interpolation_type = GIMP_INTERPOLATION_NONE;
1309           gint                   off_x, off_y;
1310 
1311           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
1312 
1313           x += off_x;
1314           y += off_y;
1315 
1316           /* Assemble the transformation matrix */
1317           gimp_matrix3_identity  (&matrix);
1318           gimp_matrix3_translate (&matrix, -source_x, -source_y);
1319           gimp_matrix3_scale     (&matrix, scale_x, scale_y);
1320           gimp_matrix3_rotate    (&matrix, angle);
1321           gimp_matrix3_translate (&matrix, dest_x, dest_y);
1322 
1323           if (interpolate)
1324             interpolation_type = gimp->config->interpolation_type;
1325 
1326           if (progress)
1327             gimp_progress_start (progress, FALSE, _("2D Transforming"));
1328 
1329           if (drawable != GIMP_DRAWABLE (mask)                        &&
1330               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
1331               ! gimp_channel_is_empty (mask))
1332             {
1333               if (! gimp_drawable_transform_affine (drawable, context,
1334                                                     &matrix, GIMP_TRANSFORM_FORWARD,
1335                                                     interpolation_type,
1336                                                     clip_result, progress))
1337                 {
1338                   success = FALSE;
1339                 }
1340             }
1341           else
1342             {
1343               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
1344 
1345               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
1346                                    GIMP_TRANSFORM_FORWARD,
1347                                    interpolation_type,
1348                                    clip_result, progress);
1349             }
1350 
1351           if (progress)
1352             gimp_progress_end (progress);
1353         }
1354     }
1355 
1356   return_vals = gimp_procedure_get_return_values (procedure, success,
1357                                                   error ? *error : NULL);
1358 
1359   if (success)
1360     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
1361 
1362   return return_vals;
1363 }
1364 
1365 static GimpValueArray *
drawable_transform_matrix_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)1366 drawable_transform_matrix_invoker (GimpProcedure         *procedure,
1367                                    Gimp                  *gimp,
1368                                    GimpContext           *context,
1369                                    GimpProgress          *progress,
1370                                    const GimpValueArray  *args,
1371                                    GError               **error)
1372 {
1373   gboolean success = TRUE;
1374   GimpValueArray *return_vals;
1375   GimpDrawable *drawable;
1376   gdouble coeff_0_0;
1377   gdouble coeff_0_1;
1378   gdouble coeff_0_2;
1379   gdouble coeff_1_0;
1380   gdouble coeff_1_1;
1381   gdouble coeff_1_2;
1382   gdouble coeff_2_0;
1383   gdouble coeff_2_1;
1384   gdouble coeff_2_2;
1385   gint32 transform_direction;
1386   gint32 interpolation;
1387   gint32 clip_result;
1388 
1389   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
1390   coeff_0_0 = g_value_get_double (gimp_value_array_index (args, 1));
1391   coeff_0_1 = g_value_get_double (gimp_value_array_index (args, 2));
1392   coeff_0_2 = g_value_get_double (gimp_value_array_index (args, 3));
1393   coeff_1_0 = g_value_get_double (gimp_value_array_index (args, 4));
1394   coeff_1_1 = g_value_get_double (gimp_value_array_index (args, 5));
1395   coeff_1_2 = g_value_get_double (gimp_value_array_index (args, 6));
1396   coeff_2_0 = g_value_get_double (gimp_value_array_index (args, 7));
1397   coeff_2_1 = g_value_get_double (gimp_value_array_index (args, 8));
1398   coeff_2_2 = g_value_get_double (gimp_value_array_index (args, 9));
1399   transform_direction = g_value_get_enum (gimp_value_array_index (args, 10));
1400   interpolation = g_value_get_enum (gimp_value_array_index (args, 11));
1401   clip_result = g_value_get_enum (gimp_value_array_index (args, 14));
1402 
1403   if (success)
1404     {
1405       gint x, y, width, height;
1406 
1407       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
1408                                                         GIMP_PDB_ITEM_CONTENT |
1409                                                         GIMP_PDB_ITEM_POSITION,
1410                                                         error);
1411 
1412       if (success &&
1413           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
1414         {
1415           GimpImage   *image = gimp_item_get_image (GIMP_ITEM (drawable));
1416           GimpChannel *mask  = gimp_image_get_mask (image);
1417           GimpMatrix3  matrix;
1418           gint         off_x, off_y;
1419 
1420           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
1421 
1422           x += off_x;
1423           y += off_y;
1424 
1425           /* Assemble the transformation matrix */
1426           matrix.coeff[0][0] = coeff_0_0;
1427           matrix.coeff[0][1] = coeff_0_1;
1428           matrix.coeff[0][2] = coeff_0_2;
1429           matrix.coeff[1][0] = coeff_1_0;
1430           matrix.coeff[1][1] = coeff_1_1;
1431           matrix.coeff[1][2] = coeff_1_2;
1432           matrix.coeff[2][0] = coeff_2_0;
1433           matrix.coeff[2][1] = coeff_2_1;
1434           matrix.coeff[2][2] = coeff_2_2;
1435 
1436           if (progress)
1437             gimp_progress_start (progress, FALSE, _("2D Transforming"));
1438 
1439           if (drawable != GIMP_DRAWABLE (mask)                        &&
1440               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
1441               ! gimp_channel_is_empty (mask))
1442             {
1443               if (! gimp_drawable_transform_affine (drawable, context,
1444                                                     &matrix, transform_direction,
1445                                                     interpolation,
1446                                                     clip_result, progress))
1447                 {
1448                   success = FALSE;
1449                 }
1450             }
1451           else
1452             {
1453               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
1454 
1455               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
1456                                    transform_direction,
1457                                    interpolation,
1458                                    clip_result, progress);
1459             }
1460 
1461           if (progress)
1462             gimp_progress_end (progress);
1463         }
1464     }
1465 
1466   return_vals = gimp_procedure_get_return_values (procedure, success,
1467                                                   error ? *error : NULL);
1468 
1469   if (success)
1470     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
1471 
1472   return return_vals;
1473 }
1474 
1475 static GimpValueArray *
drawable_transform_matrix_default_invoker(GimpProcedure * procedure,Gimp * gimp,GimpContext * context,GimpProgress * progress,const GimpValueArray * args,GError ** error)1476 drawable_transform_matrix_default_invoker (GimpProcedure         *procedure,
1477                                            Gimp                  *gimp,
1478                                            GimpContext           *context,
1479                                            GimpProgress          *progress,
1480                                            const GimpValueArray  *args,
1481                                            GError               **error)
1482 {
1483   gboolean success = TRUE;
1484   GimpValueArray *return_vals;
1485   GimpDrawable *drawable;
1486   gdouble coeff_0_0;
1487   gdouble coeff_0_1;
1488   gdouble coeff_0_2;
1489   gdouble coeff_1_0;
1490   gdouble coeff_1_1;
1491   gdouble coeff_1_2;
1492   gdouble coeff_2_0;
1493   gdouble coeff_2_1;
1494   gdouble coeff_2_2;
1495   gboolean interpolate;
1496   gint32 clip_result;
1497 
1498   drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
1499   coeff_0_0 = g_value_get_double (gimp_value_array_index (args, 1));
1500   coeff_0_1 = g_value_get_double (gimp_value_array_index (args, 2));
1501   coeff_0_2 = g_value_get_double (gimp_value_array_index (args, 3));
1502   coeff_1_0 = g_value_get_double (gimp_value_array_index (args, 4));
1503   coeff_1_1 = g_value_get_double (gimp_value_array_index (args, 5));
1504   coeff_1_2 = g_value_get_double (gimp_value_array_index (args, 6));
1505   coeff_2_0 = g_value_get_double (gimp_value_array_index (args, 7));
1506   coeff_2_1 = g_value_get_double (gimp_value_array_index (args, 8));
1507   coeff_2_2 = g_value_get_double (gimp_value_array_index (args, 9));
1508   interpolate = g_value_get_boolean (gimp_value_array_index (args, 10));
1509   clip_result = g_value_get_enum (gimp_value_array_index (args, 11));
1510 
1511   if (success)
1512     {
1513       gint x, y, width, height;
1514 
1515       success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
1516                                                         GIMP_PDB_ITEM_CONTENT |
1517                                                         GIMP_PDB_ITEM_POSITION, error);
1518 
1519       if (success &&
1520           gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
1521         {
1522           GimpImage             *image = gimp_item_get_image (GIMP_ITEM (drawable));
1523           GimpChannel           *mask  = gimp_image_get_mask (image);
1524           GimpMatrix3            matrix;
1525           GimpInterpolationType  interpolation_type = GIMP_INTERPOLATION_NONE;
1526           gint                   off_x, off_y;
1527 
1528           gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
1529 
1530           x += off_x;
1531           y += off_y;
1532 
1533           /* Assemble the transformation matrix */
1534           matrix.coeff[0][0] = coeff_0_0;
1535           matrix.coeff[0][1] = coeff_0_1;
1536           matrix.coeff[0][2] = coeff_0_2;
1537           matrix.coeff[1][0] = coeff_1_0;
1538           matrix.coeff[1][1] = coeff_1_1;
1539           matrix.coeff[1][2] = coeff_1_2;
1540           matrix.coeff[2][0] = coeff_2_0;
1541           matrix.coeff[2][1] = coeff_2_1;
1542           matrix.coeff[2][2] = coeff_2_2;
1543 
1544           if (interpolate)
1545             interpolation_type = gimp->config->interpolation_type;
1546 
1547           if (progress)
1548             gimp_progress_start (progress, FALSE, _("2D Transforming"));
1549 
1550           if (drawable != GIMP_DRAWABLE (mask)                        &&
1551               ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
1552               ! gimp_channel_is_empty (mask))
1553             {
1554               if (! gimp_drawable_transform_affine (drawable, context,
1555                                                     &matrix, GIMP_TRANSFORM_FORWARD,
1556                                                     interpolation_type,
1557                                                     clip_result, progress))
1558                 {
1559                   success = FALSE;
1560                 }
1561             }
1562           else
1563             {
1564               clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
1565 
1566               gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
1567                                    GIMP_TRANSFORM_FORWARD,
1568                                    interpolation_type,
1569                                    clip_result, progress);
1570             }
1571 
1572           if (progress)
1573             gimp_progress_end (progress);
1574         }
1575     }
1576 
1577   return_vals = gimp_procedure_get_return_values (procedure, success,
1578                                                   error ? *error : NULL);
1579 
1580   if (success)
1581     gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
1582 
1583   return return_vals;
1584 }
1585 
1586 void
register_drawable_transform_procs(GimpPDB * pdb)1587 register_drawable_transform_procs (GimpPDB *pdb)
1588 {
1589   GimpProcedure *procedure;
1590 
1591   /*
1592    * gimp-drawable-transform-flip-simple
1593    */
1594   procedure = gimp_procedure_new (drawable_transform_flip_simple_invoker);
1595   gimp_object_set_static_name (GIMP_OBJECT (procedure),
1596                                "gimp-drawable-transform-flip-simple");
1597   gimp_procedure_set_static_strings (procedure,
1598                                      "gimp-drawable-transform-flip-simple",
1599                                      "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
1600                                      "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
1601                                      "Jo\xc3\xa3o S. O. Bueno",
1602                                      "Jo\xc3\xa3o S. O. Bueno",
1603                                      "2004",
1604                                      "gimp-item-transform-flip-simple");
1605   gimp_procedure_add_argument (procedure,
1606                                gimp_param_spec_drawable_id ("drawable",
1607                                                             "drawable",
1608                                                             "The affected drawable",
1609                                                             pdb->gimp, FALSE,
1610                                                             GIMP_PARAM_READWRITE));
1611   gimp_procedure_add_argument (procedure,
1612                                gimp_param_spec_enum ("flip-type",
1613                                                      "flip type",
1614                                                      "Type of flip",
1615                                                      GIMP_TYPE_ORIENTATION_TYPE,
1616                                                      GIMP_ORIENTATION_HORIZONTAL,
1617                                                      GIMP_PARAM_READWRITE));
1618   gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
1619                                       GIMP_ORIENTATION_UNKNOWN);
1620   gimp_procedure_add_argument (procedure,
1621                                g_param_spec_boolean ("auto-center",
1622                                                      "auto center",
1623                                                      "Whether to automatically position the axis in the selection center",
1624                                                      FALSE,
1625                                                      GIMP_PARAM_READWRITE));
1626   gimp_procedure_add_argument (procedure,
1627                                g_param_spec_double ("axis",
1628                                                     "axis",
1629                                                     "coord. of flip axis",
1630                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1631                                                     GIMP_PARAM_READWRITE));
1632   gimp_procedure_add_argument (procedure,
1633                                g_param_spec_boolean ("clip-result",
1634                                                      "clip result",
1635                                                      "Whether to clip results",
1636                                                      FALSE,
1637                                                      GIMP_PARAM_READWRITE));
1638   gimp_procedure_add_return_value (procedure,
1639                                    gimp_param_spec_drawable_id ("drawable",
1640                                                                 "drawable",
1641                                                                 "The flipped drawable",
1642                                                                 pdb->gimp, FALSE,
1643                                                                 GIMP_PARAM_READWRITE));
1644   gimp_pdb_register_procedure (pdb, procedure);
1645   g_object_unref (procedure);
1646 
1647   /*
1648    * gimp-drawable-transform-flip
1649    */
1650   procedure = gimp_procedure_new (drawable_transform_flip_invoker);
1651   gimp_object_set_static_name (GIMP_OBJECT (procedure),
1652                                "gimp-drawable-transform-flip");
1653   gimp_procedure_set_static_strings (procedure,
1654                                      "gimp-drawable-transform-flip",
1655                                      "Deprecated: Use 'gimp-item-transform-flip' instead.",
1656                                      "Deprecated: Use 'gimp-item-transform-flip' instead.",
1657                                      "Jo\xc3\xa3o S. O. Bueno",
1658                                      "Jo\xc3\xa3o S. O. Bueno",
1659                                      "2004",
1660                                      "gimp-item-transform-flip");
1661   gimp_procedure_add_argument (procedure,
1662                                gimp_param_spec_drawable_id ("drawable",
1663                                                             "drawable",
1664                                                             "The affected drawable",
1665                                                             pdb->gimp, FALSE,
1666                                                             GIMP_PARAM_READWRITE));
1667   gimp_procedure_add_argument (procedure,
1668                                g_param_spec_double ("x0",
1669                                                     "x0",
1670                                                     "horz. coord. of one end of axis",
1671                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1672                                                     GIMP_PARAM_READWRITE));
1673   gimp_procedure_add_argument (procedure,
1674                                g_param_spec_double ("y0",
1675                                                     "y0",
1676                                                     "vert. coord. of one end of axis",
1677                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1678                                                     GIMP_PARAM_READWRITE));
1679   gimp_procedure_add_argument (procedure,
1680                                g_param_spec_double ("x1",
1681                                                     "x1",
1682                                                     "horz. coord. of other end of axis",
1683                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1684                                                     GIMP_PARAM_READWRITE));
1685   gimp_procedure_add_argument (procedure,
1686                                g_param_spec_double ("y1",
1687                                                     "y1",
1688                                                     "vert. coord. of other end of axis",
1689                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1690                                                     GIMP_PARAM_READWRITE));
1691   gimp_procedure_add_argument (procedure,
1692                                g_param_spec_enum ("transform-direction",
1693                                                   "transform direction",
1694                                                   "Direction of transformation",
1695                                                   GIMP_TYPE_TRANSFORM_DIRECTION,
1696                                                   GIMP_TRANSFORM_FORWARD,
1697                                                   GIMP_PARAM_READWRITE));
1698   gimp_procedure_add_argument (procedure,
1699                                g_param_spec_enum ("interpolation",
1700                                                   "interpolation",
1701                                                   "Type of interpolation",
1702                                                   GIMP_TYPE_INTERPOLATION_TYPE,
1703                                                   GIMP_INTERPOLATION_NONE,
1704                                                   GIMP_PARAM_READWRITE));
1705   gimp_procedure_add_argument (procedure,
1706                                g_param_spec_boolean ("supersample",
1707                                                      "supersample",
1708                                                      "This parameter is ignored",
1709                                                      FALSE,
1710                                                      GIMP_PARAM_READWRITE));
1711   gimp_procedure_add_argument (procedure,
1712                                gimp_param_spec_int32 ("recursion-level",
1713                                                       "recursion level",
1714                                                       "This parameter is ignored",
1715                                                       1, G_MAXINT32, 1,
1716                                                       GIMP_PARAM_READWRITE));
1717   gimp_procedure_add_argument (procedure,
1718                                g_param_spec_boolean ("clip-result",
1719                                                      "clip result",
1720                                                      "Whether to clip results",
1721                                                      FALSE,
1722                                                      GIMP_PARAM_READWRITE));
1723   gimp_procedure_add_return_value (procedure,
1724                                    gimp_param_spec_drawable_id ("drawable",
1725                                                                 "drawable",
1726                                                                 "The flipped drawable",
1727                                                                 pdb->gimp, FALSE,
1728                                                                 GIMP_PARAM_READWRITE));
1729   gimp_pdb_register_procedure (pdb, procedure);
1730   g_object_unref (procedure);
1731 
1732   /*
1733    * gimp-drawable-transform-flip-default
1734    */
1735   procedure = gimp_procedure_new (drawable_transform_flip_default_invoker);
1736   gimp_object_set_static_name (GIMP_OBJECT (procedure),
1737                                "gimp-drawable-transform-flip-default");
1738   gimp_procedure_set_static_strings (procedure,
1739                                      "gimp-drawable-transform-flip-default",
1740                                      "Deprecated: Use 'gimp-item-transform-flip' instead.",
1741                                      "Deprecated: Use 'gimp-item-transform-flip' instead.",
1742                                      "Jo\xc3\xa3o S. O. Bueno",
1743                                      "Jo\xc3\xa3o S. O. Bueno",
1744                                      "2004",
1745                                      "gimp-item-transform-flip");
1746   gimp_procedure_add_argument (procedure,
1747                                gimp_param_spec_drawable_id ("drawable",
1748                                                             "drawable",
1749                                                             "The affected drawable",
1750                                                             pdb->gimp, FALSE,
1751                                                             GIMP_PARAM_READWRITE));
1752   gimp_procedure_add_argument (procedure,
1753                                g_param_spec_double ("x0",
1754                                                     "x0",
1755                                                     "horz. coord. of one end of axis",
1756                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1757                                                     GIMP_PARAM_READWRITE));
1758   gimp_procedure_add_argument (procedure,
1759                                g_param_spec_double ("y0",
1760                                                     "y0",
1761                                                     "vert. coord. of one end of axis",
1762                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1763                                                     GIMP_PARAM_READWRITE));
1764   gimp_procedure_add_argument (procedure,
1765                                g_param_spec_double ("x1",
1766                                                     "x1",
1767                                                     "horz. coord. of other end of axis",
1768                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1769                                                     GIMP_PARAM_READWRITE));
1770   gimp_procedure_add_argument (procedure,
1771                                g_param_spec_double ("y1",
1772                                                     "y1",
1773                                                     "vert. coord. of other end of axis",
1774                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1775                                                     GIMP_PARAM_READWRITE));
1776   gimp_procedure_add_argument (procedure,
1777                                g_param_spec_boolean ("interpolate",
1778                                                      "interpolate",
1779                                                      "Whether to use interpolation and supersampling",
1780                                                      FALSE,
1781                                                      GIMP_PARAM_READWRITE));
1782   gimp_procedure_add_argument (procedure,
1783                                g_param_spec_boolean ("clip-result",
1784                                                      "clip result",
1785                                                      "Whether to clip results",
1786                                                      FALSE,
1787                                                      GIMP_PARAM_READWRITE));
1788   gimp_procedure_add_return_value (procedure,
1789                                    gimp_param_spec_drawable_id ("drawable",
1790                                                                 "drawable",
1791                                                                 "The flipped drawable",
1792                                                                 pdb->gimp, FALSE,
1793                                                                 GIMP_PARAM_READWRITE));
1794   gimp_pdb_register_procedure (pdb, procedure);
1795   g_object_unref (procedure);
1796 
1797   /*
1798    * gimp-drawable-transform-perspective
1799    */
1800   procedure = gimp_procedure_new (drawable_transform_perspective_invoker);
1801   gimp_object_set_static_name (GIMP_OBJECT (procedure),
1802                                "gimp-drawable-transform-perspective");
1803   gimp_procedure_set_static_strings (procedure,
1804                                      "gimp-drawable-transform-perspective",
1805                                      "Deprecated: Use 'gimp-item-transform-perspective' instead.",
1806                                      "Deprecated: Use 'gimp-item-transform-perspective' instead.",
1807                                      "Jo\xc3\xa3o S. O. Bueno",
1808                                      "Jo\xc3\xa3o S. O. Bueno",
1809                                      "2004",
1810                                      "gimp-item-transform-perspective");
1811   gimp_procedure_add_argument (procedure,
1812                                gimp_param_spec_drawable_id ("drawable",
1813                                                             "drawable",
1814                                                             "The affected drawable",
1815                                                             pdb->gimp, FALSE,
1816                                                             GIMP_PARAM_READWRITE));
1817   gimp_procedure_add_argument (procedure,
1818                                g_param_spec_double ("x0",
1819                                                     "x0",
1820                                                     "The new x coordinate of upper-left corner of original bounding box",
1821                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1822                                                     GIMP_PARAM_READWRITE));
1823   gimp_procedure_add_argument (procedure,
1824                                g_param_spec_double ("y0",
1825                                                     "y0",
1826                                                     "The new y coordinate of upper-left corner of original bounding box",
1827                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1828                                                     GIMP_PARAM_READWRITE));
1829   gimp_procedure_add_argument (procedure,
1830                                g_param_spec_double ("x1",
1831                                                     "x1",
1832                                                     "The new x coordinate of upper-right corner of original bounding box",
1833                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1834                                                     GIMP_PARAM_READWRITE));
1835   gimp_procedure_add_argument (procedure,
1836                                g_param_spec_double ("y1",
1837                                                     "y1",
1838                                                     "The new y coordinate of upper-right corner of original bounding box",
1839                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1840                                                     GIMP_PARAM_READWRITE));
1841   gimp_procedure_add_argument (procedure,
1842                                g_param_spec_double ("x2",
1843                                                     "x2",
1844                                                     "The new x coordinate of lower-left corner of original bounding box",
1845                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1846                                                     GIMP_PARAM_READWRITE));
1847   gimp_procedure_add_argument (procedure,
1848                                g_param_spec_double ("y2",
1849                                                     "y2",
1850                                                     "The new y coordinate of lower-left corner of original bounding box",
1851                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1852                                                     GIMP_PARAM_READWRITE));
1853   gimp_procedure_add_argument (procedure,
1854                                g_param_spec_double ("x3",
1855                                                     "x3",
1856                                                     "The new x coordinate of lower-right corner of original bounding box",
1857                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1858                                                     GIMP_PARAM_READWRITE));
1859   gimp_procedure_add_argument (procedure,
1860                                g_param_spec_double ("y3",
1861                                                     "y3",
1862                                                     "The new y coordinate of lower-right corner of original bounding box",
1863                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1864                                                     GIMP_PARAM_READWRITE));
1865   gimp_procedure_add_argument (procedure,
1866                                g_param_spec_enum ("transform-direction",
1867                                                   "transform direction",
1868                                                   "Direction of transformation",
1869                                                   GIMP_TYPE_TRANSFORM_DIRECTION,
1870                                                   GIMP_TRANSFORM_FORWARD,
1871                                                   GIMP_PARAM_READWRITE));
1872   gimp_procedure_add_argument (procedure,
1873                                g_param_spec_enum ("interpolation",
1874                                                   "interpolation",
1875                                                   "Type of interpolation",
1876                                                   GIMP_TYPE_INTERPOLATION_TYPE,
1877                                                   GIMP_INTERPOLATION_NONE,
1878                                                   GIMP_PARAM_READWRITE));
1879   gimp_procedure_add_argument (procedure,
1880                                g_param_spec_boolean ("supersample",
1881                                                      "supersample",
1882                                                      "This parameter is ignored",
1883                                                      FALSE,
1884                                                      GIMP_PARAM_READWRITE));
1885   gimp_procedure_add_argument (procedure,
1886                                gimp_param_spec_int32 ("recursion-level",
1887                                                       "recursion level",
1888                                                       "This parameter is ignored",
1889                                                       1, G_MAXINT32, 1,
1890                                                       GIMP_PARAM_READWRITE));
1891   gimp_procedure_add_argument (procedure,
1892                                g_param_spec_enum ("clip-result",
1893                                                   "clip result",
1894                                                   "How to clip results",
1895                                                   GIMP_TYPE_TRANSFORM_RESIZE,
1896                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
1897                                                   GIMP_PARAM_READWRITE));
1898   gimp_procedure_add_return_value (procedure,
1899                                    gimp_param_spec_drawable_id ("drawable",
1900                                                                 "drawable",
1901                                                                 "The newly mapped drawable",
1902                                                                 pdb->gimp, FALSE,
1903                                                                 GIMP_PARAM_READWRITE));
1904   gimp_pdb_register_procedure (pdb, procedure);
1905   g_object_unref (procedure);
1906 
1907   /*
1908    * gimp-drawable-transform-perspective-default
1909    */
1910   procedure = gimp_procedure_new (drawable_transform_perspective_default_invoker);
1911   gimp_object_set_static_name (GIMP_OBJECT (procedure),
1912                                "gimp-drawable-transform-perspective-default");
1913   gimp_procedure_set_static_strings (procedure,
1914                                      "gimp-drawable-transform-perspective-default",
1915                                      "Deprecated: Use 'gimp-item-transform-perspective' instead.",
1916                                      "Deprecated: Use 'gimp-item-transform-perspective' instead.",
1917                                      "Jo\xc3\xa3o S. O. Bueno",
1918                                      "Jo\xc3\xa3o S. O. Bueno",
1919                                      "2004",
1920                                      "gimp-item-transform-perspective");
1921   gimp_procedure_add_argument (procedure,
1922                                gimp_param_spec_drawable_id ("drawable",
1923                                                             "drawable",
1924                                                             "The affected drawable",
1925                                                             pdb->gimp, FALSE,
1926                                                             GIMP_PARAM_READWRITE));
1927   gimp_procedure_add_argument (procedure,
1928                                g_param_spec_double ("x0",
1929                                                     "x0",
1930                                                     "The new x coordinate of upper-left corner of original bounding box",
1931                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1932                                                     GIMP_PARAM_READWRITE));
1933   gimp_procedure_add_argument (procedure,
1934                                g_param_spec_double ("y0",
1935                                                     "y0",
1936                                                     "The new y coordinate of upper-left corner of original bounding box",
1937                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1938                                                     GIMP_PARAM_READWRITE));
1939   gimp_procedure_add_argument (procedure,
1940                                g_param_spec_double ("x1",
1941                                                     "x1",
1942                                                     "The new x coordinate of upper-right corner of original bounding box",
1943                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1944                                                     GIMP_PARAM_READWRITE));
1945   gimp_procedure_add_argument (procedure,
1946                                g_param_spec_double ("y1",
1947                                                     "y1",
1948                                                     "The new y coordinate of upper-right corner of original bounding box",
1949                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1950                                                     GIMP_PARAM_READWRITE));
1951   gimp_procedure_add_argument (procedure,
1952                                g_param_spec_double ("x2",
1953                                                     "x2",
1954                                                     "The new x coordinate of lower-left corner of original bounding box",
1955                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1956                                                     GIMP_PARAM_READWRITE));
1957   gimp_procedure_add_argument (procedure,
1958                                g_param_spec_double ("y2",
1959                                                     "y2",
1960                                                     "The new y coordinate of lower-left corner of original bounding box",
1961                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1962                                                     GIMP_PARAM_READWRITE));
1963   gimp_procedure_add_argument (procedure,
1964                                g_param_spec_double ("x3",
1965                                                     "x3",
1966                                                     "The new x coordinate of lower-right corner of original bounding box",
1967                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1968                                                     GIMP_PARAM_READWRITE));
1969   gimp_procedure_add_argument (procedure,
1970                                g_param_spec_double ("y3",
1971                                                     "y3",
1972                                                     "The new y coordinate of lower-right corner of original bounding box",
1973                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
1974                                                     GIMP_PARAM_READWRITE));
1975   gimp_procedure_add_argument (procedure,
1976                                g_param_spec_boolean ("interpolate",
1977                                                      "interpolate",
1978                                                      "Whether to use interpolation and supersampling",
1979                                                      FALSE,
1980                                                      GIMP_PARAM_READWRITE));
1981   gimp_procedure_add_argument (procedure,
1982                                g_param_spec_enum ("clip-result",
1983                                                   "clip result",
1984                                                   "How to clip results",
1985                                                   GIMP_TYPE_TRANSFORM_RESIZE,
1986                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
1987                                                   GIMP_PARAM_READWRITE));
1988   gimp_procedure_add_return_value (procedure,
1989                                    gimp_param_spec_drawable_id ("drawable",
1990                                                                 "drawable",
1991                                                                 "The newly mapped drawable",
1992                                                                 pdb->gimp, FALSE,
1993                                                                 GIMP_PARAM_READWRITE));
1994   gimp_pdb_register_procedure (pdb, procedure);
1995   g_object_unref (procedure);
1996 
1997   /*
1998    * gimp-drawable-transform-rotate-simple
1999    */
2000   procedure = gimp_procedure_new (drawable_transform_rotate_simple_invoker);
2001   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2002                                "gimp-drawable-transform-rotate-simple");
2003   gimp_procedure_set_static_strings (procedure,
2004                                      "gimp-drawable-transform-rotate-simple",
2005                                      "Deprecated: Use 'gimp-item-transform-rotate-simple' instead.",
2006                                      "Deprecated: Use 'gimp-item-transform-rotate-simple' instead.",
2007                                      "Jo\xc3\xa3o S. O. Bueno",
2008                                      "Jo\xc3\xa3o S. O. Bueno",
2009                                      "2004",
2010                                      "gimp-item-transform-rotate-simple");
2011   gimp_procedure_add_argument (procedure,
2012                                gimp_param_spec_drawable_id ("drawable",
2013                                                             "drawable",
2014                                                             "The affected drawable",
2015                                                             pdb->gimp, FALSE,
2016                                                             GIMP_PARAM_READWRITE));
2017   gimp_procedure_add_argument (procedure,
2018                                g_param_spec_enum ("rotate-type",
2019                                                   "rotate type",
2020                                                   "Type of rotation",
2021                                                   GIMP_TYPE_ROTATION_TYPE,
2022                                                   GIMP_ROTATE_90,
2023                                                   GIMP_PARAM_READWRITE));
2024   gimp_procedure_add_argument (procedure,
2025                                g_param_spec_boolean ("auto-center",
2026                                                      "auto center",
2027                                                      "Whether to automatically rotate around the selection center",
2028                                                      FALSE,
2029                                                      GIMP_PARAM_READWRITE));
2030   gimp_procedure_add_argument (procedure,
2031                                gimp_param_spec_int32 ("center-x",
2032                                                       "center x",
2033                                                       "The hor. coordinate of the center of rotation",
2034                                                       G_MININT32, G_MAXINT32, 0,
2035                                                       GIMP_PARAM_READWRITE));
2036   gimp_procedure_add_argument (procedure,
2037                                gimp_param_spec_int32 ("center-y",
2038                                                       "center y",
2039                                                       "The vert. coordinate of the center of rotation",
2040                                                       G_MININT32, G_MAXINT32, 0,
2041                                                       GIMP_PARAM_READWRITE));
2042   gimp_procedure_add_argument (procedure,
2043                                g_param_spec_boolean ("clip-result",
2044                                                      "clip result",
2045                                                      "Whether to clip results",
2046                                                      FALSE,
2047                                                      GIMP_PARAM_READWRITE));
2048   gimp_procedure_add_return_value (procedure,
2049                                    gimp_param_spec_drawable_id ("drawable",
2050                                                                 "drawable",
2051                                                                 "The rotated drawable",
2052                                                                 pdb->gimp, FALSE,
2053                                                                 GIMP_PARAM_READWRITE));
2054   gimp_pdb_register_procedure (pdb, procedure);
2055   g_object_unref (procedure);
2056 
2057   /*
2058    * gimp-drawable-transform-rotate
2059    */
2060   procedure = gimp_procedure_new (drawable_transform_rotate_invoker);
2061   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2062                                "gimp-drawable-transform-rotate");
2063   gimp_procedure_set_static_strings (procedure,
2064                                      "gimp-drawable-transform-rotate",
2065                                      "Deprecated: Use 'gimp-item-transform-rotate' instead.",
2066                                      "Deprecated: Use 'gimp-item-transform-rotate' instead.",
2067                                      "Jo\xc3\xa3o S. O. Bueno",
2068                                      "Jo\xc3\xa3o S. O. Bueno",
2069                                      "2004",
2070                                      "gimp-item-transform-rotate");
2071   gimp_procedure_add_argument (procedure,
2072                                gimp_param_spec_drawable_id ("drawable",
2073                                                             "drawable",
2074                                                             "The affected drawable",
2075                                                             pdb->gimp, FALSE,
2076                                                             GIMP_PARAM_READWRITE));
2077   gimp_procedure_add_argument (procedure,
2078                                g_param_spec_double ("angle",
2079                                                     "angle",
2080                                                     "The angle of rotation (radians)",
2081                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2082                                                     GIMP_PARAM_READWRITE));
2083   gimp_procedure_add_argument (procedure,
2084                                g_param_spec_boolean ("auto-center",
2085                                                      "auto center",
2086                                                      "Whether to automatically rotate around the selection center",
2087                                                      FALSE,
2088                                                      GIMP_PARAM_READWRITE));
2089   gimp_procedure_add_argument (procedure,
2090                                gimp_param_spec_int32 ("center-x",
2091                                                       "center x",
2092                                                       "The hor. coordinate of the center of rotation",
2093                                                       G_MININT32, G_MAXINT32, 0,
2094                                                       GIMP_PARAM_READWRITE));
2095   gimp_procedure_add_argument (procedure,
2096                                gimp_param_spec_int32 ("center-y",
2097                                                       "center y",
2098                                                       "The vert. coordinate of the center of rotation",
2099                                                       G_MININT32, G_MAXINT32, 0,
2100                                                       GIMP_PARAM_READWRITE));
2101   gimp_procedure_add_argument (procedure,
2102                                g_param_spec_enum ("transform-direction",
2103                                                   "transform direction",
2104                                                   "Direction of transformation",
2105                                                   GIMP_TYPE_TRANSFORM_DIRECTION,
2106                                                   GIMP_TRANSFORM_FORWARD,
2107                                                   GIMP_PARAM_READWRITE));
2108   gimp_procedure_add_argument (procedure,
2109                                g_param_spec_enum ("interpolation",
2110                                                   "interpolation",
2111                                                   "Type of interpolation",
2112                                                   GIMP_TYPE_INTERPOLATION_TYPE,
2113                                                   GIMP_INTERPOLATION_NONE,
2114                                                   GIMP_PARAM_READWRITE));
2115   gimp_procedure_add_argument (procedure,
2116                                g_param_spec_boolean ("supersample",
2117                                                      "supersample",
2118                                                      "This parameter is ignored",
2119                                                      FALSE,
2120                                                      GIMP_PARAM_READWRITE));
2121   gimp_procedure_add_argument (procedure,
2122                                gimp_param_spec_int32 ("recursion-level",
2123                                                       "recursion level",
2124                                                       "This parameter is ignored",
2125                                                       1, G_MAXINT32, 1,
2126                                                       GIMP_PARAM_READWRITE));
2127   gimp_procedure_add_argument (procedure,
2128                                g_param_spec_enum ("clip-result",
2129                                                   "clip result",
2130                                                   "How to clip results",
2131                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2132                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2133                                                   GIMP_PARAM_READWRITE));
2134   gimp_procedure_add_return_value (procedure,
2135                                    gimp_param_spec_drawable_id ("drawable",
2136                                                                 "drawable",
2137                                                                 "The rotated drawable",
2138                                                                 pdb->gimp, FALSE,
2139                                                                 GIMP_PARAM_READWRITE));
2140   gimp_pdb_register_procedure (pdb, procedure);
2141   g_object_unref (procedure);
2142 
2143   /*
2144    * gimp-drawable-transform-rotate-default
2145    */
2146   procedure = gimp_procedure_new (drawable_transform_rotate_default_invoker);
2147   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2148                                "gimp-drawable-transform-rotate-default");
2149   gimp_procedure_set_static_strings (procedure,
2150                                      "gimp-drawable-transform-rotate-default",
2151                                      "Deprecated: Use 'gimp-item-transform-rotate' instead.",
2152                                      "Deprecated: Use 'gimp-item-transform-rotate' instead.",
2153                                      "Jo\xc3\xa3o S. O. Bueno",
2154                                      "Jo\xc3\xa3o S. O. Bueno",
2155                                      "2004",
2156                                      "gimp-item-transform-rotate");
2157   gimp_procedure_add_argument (procedure,
2158                                gimp_param_spec_drawable_id ("drawable",
2159                                                             "drawable",
2160                                                             "The affected drawable",
2161                                                             pdb->gimp, FALSE,
2162                                                             GIMP_PARAM_READWRITE));
2163   gimp_procedure_add_argument (procedure,
2164                                g_param_spec_double ("angle",
2165                                                     "angle",
2166                                                     "The angle of rotation (radians)",
2167                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2168                                                     GIMP_PARAM_READWRITE));
2169   gimp_procedure_add_argument (procedure,
2170                                g_param_spec_boolean ("auto-center",
2171                                                      "auto center",
2172                                                      "Whether to automatically rotate around the selection center",
2173                                                      FALSE,
2174                                                      GIMP_PARAM_READWRITE));
2175   gimp_procedure_add_argument (procedure,
2176                                gimp_param_spec_int32 ("center-x",
2177                                                       "center x",
2178                                                       "The hor. coordinate of the center of rotation",
2179                                                       G_MININT32, G_MAXINT32, 0,
2180                                                       GIMP_PARAM_READWRITE));
2181   gimp_procedure_add_argument (procedure,
2182                                gimp_param_spec_int32 ("center-y",
2183                                                       "center y",
2184                                                       "The vert. coordinate of the center of rotation",
2185                                                       G_MININT32, G_MAXINT32, 0,
2186                                                       GIMP_PARAM_READWRITE));
2187   gimp_procedure_add_argument (procedure,
2188                                g_param_spec_boolean ("interpolate",
2189                                                      "interpolate",
2190                                                      "Whether to use interpolation and supersampling",
2191                                                      FALSE,
2192                                                      GIMP_PARAM_READWRITE));
2193   gimp_procedure_add_argument (procedure,
2194                                g_param_spec_enum ("clip-result",
2195                                                   "clip result",
2196                                                   "How to clip results",
2197                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2198                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2199                                                   GIMP_PARAM_READWRITE));
2200   gimp_procedure_add_return_value (procedure,
2201                                    gimp_param_spec_drawable_id ("drawable",
2202                                                                 "drawable",
2203                                                                 "The rotated drawable",
2204                                                                 pdb->gimp, FALSE,
2205                                                                 GIMP_PARAM_READWRITE));
2206   gimp_pdb_register_procedure (pdb, procedure);
2207   g_object_unref (procedure);
2208 
2209   /*
2210    * gimp-drawable-transform-scale
2211    */
2212   procedure = gimp_procedure_new (drawable_transform_scale_invoker);
2213   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2214                                "gimp-drawable-transform-scale");
2215   gimp_procedure_set_static_strings (procedure,
2216                                      "gimp-drawable-transform-scale",
2217                                      "Deprecated: Use 'gimp-item-transform-scale' instead.",
2218                                      "Deprecated: Use 'gimp-item-transform-scale' instead.",
2219                                      "Jo\xc3\xa3o S. O. Bueno",
2220                                      "Jo\xc3\xa3o S. O. Bueno",
2221                                      "2004",
2222                                      "gimp-item-transform-scale");
2223   gimp_procedure_add_argument (procedure,
2224                                gimp_param_spec_drawable_id ("drawable",
2225                                                             "drawable",
2226                                                             "The affected drawable",
2227                                                             pdb->gimp, FALSE,
2228                                                             GIMP_PARAM_READWRITE));
2229   gimp_procedure_add_argument (procedure,
2230                                g_param_spec_double ("x0",
2231                                                     "x0",
2232                                                     "The new x coordinate of the upper-left corner of the scaled region",
2233                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2234                                                     GIMP_PARAM_READWRITE));
2235   gimp_procedure_add_argument (procedure,
2236                                g_param_spec_double ("y0",
2237                                                     "y0",
2238                                                     "The new y coordinate of the upper-left corner of the scaled region",
2239                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2240                                                     GIMP_PARAM_READWRITE));
2241   gimp_procedure_add_argument (procedure,
2242                                g_param_spec_double ("x1",
2243                                                     "x1",
2244                                                     "The new x coordinate of the lower-right corner of the scaled region",
2245                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2246                                                     GIMP_PARAM_READWRITE));
2247   gimp_procedure_add_argument (procedure,
2248                                g_param_spec_double ("y1",
2249                                                     "y1",
2250                                                     "The new y coordinate of the lower-right corner of the scaled region",
2251                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2252                                                     GIMP_PARAM_READWRITE));
2253   gimp_procedure_add_argument (procedure,
2254                                g_param_spec_enum ("transform-direction",
2255                                                   "transform direction",
2256                                                   "Direction of transformation",
2257                                                   GIMP_TYPE_TRANSFORM_DIRECTION,
2258                                                   GIMP_TRANSFORM_FORWARD,
2259                                                   GIMP_PARAM_READWRITE));
2260   gimp_procedure_add_argument (procedure,
2261                                g_param_spec_enum ("interpolation",
2262                                                   "interpolation",
2263                                                   "Type of interpolation",
2264                                                   GIMP_TYPE_INTERPOLATION_TYPE,
2265                                                   GIMP_INTERPOLATION_NONE,
2266                                                   GIMP_PARAM_READWRITE));
2267   gimp_procedure_add_argument (procedure,
2268                                g_param_spec_boolean ("supersample",
2269                                                      "supersample",
2270                                                      "This parameter is ignored",
2271                                                      FALSE,
2272                                                      GIMP_PARAM_READWRITE));
2273   gimp_procedure_add_argument (procedure,
2274                                gimp_param_spec_int32 ("recursion-level",
2275                                                       "recursion level",
2276                                                       "This parameter is ignored",
2277                                                       1, G_MAXINT32, 1,
2278                                                       GIMP_PARAM_READWRITE));
2279   gimp_procedure_add_argument (procedure,
2280                                g_param_spec_enum ("clip-result",
2281                                                   "clip result",
2282                                                   "How to clip results",
2283                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2284                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2285                                                   GIMP_PARAM_READWRITE));
2286   gimp_procedure_add_return_value (procedure,
2287                                    gimp_param_spec_drawable_id ("drawable",
2288                                                                 "drawable",
2289                                                                 "The scaled drawable",
2290                                                                 pdb->gimp, FALSE,
2291                                                                 GIMP_PARAM_READWRITE));
2292   gimp_pdb_register_procedure (pdb, procedure);
2293   g_object_unref (procedure);
2294 
2295   /*
2296    * gimp-drawable-transform-scale-default
2297    */
2298   procedure = gimp_procedure_new (drawable_transform_scale_default_invoker);
2299   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2300                                "gimp-drawable-transform-scale-default");
2301   gimp_procedure_set_static_strings (procedure,
2302                                      "gimp-drawable-transform-scale-default",
2303                                      "Deprecated: Use 'gimp-item-transform-scale' instead.",
2304                                      "Deprecated: Use 'gimp-item-transform-scale' instead.",
2305                                      "Jo\xc3\xa3o S. O. Bueno",
2306                                      "Jo\xc3\xa3o S. O. Bueno",
2307                                      "2004",
2308                                      "gimp-item-transform-scale");
2309   gimp_procedure_add_argument (procedure,
2310                                gimp_param_spec_drawable_id ("drawable",
2311                                                             "drawable",
2312                                                             "The affected drawable",
2313                                                             pdb->gimp, FALSE,
2314                                                             GIMP_PARAM_READWRITE));
2315   gimp_procedure_add_argument (procedure,
2316                                g_param_spec_double ("x0",
2317                                                     "x0",
2318                                                     "The new x coordinate of the upper-left corner of the scaled region",
2319                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2320                                                     GIMP_PARAM_READWRITE));
2321   gimp_procedure_add_argument (procedure,
2322                                g_param_spec_double ("y0",
2323                                                     "y0",
2324                                                     "The new y coordinate of the upper-left corner of the scaled region",
2325                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2326                                                     GIMP_PARAM_READWRITE));
2327   gimp_procedure_add_argument (procedure,
2328                                g_param_spec_double ("x1",
2329                                                     "x1",
2330                                                     "The new x coordinate of the lower-right corner of the scaled region",
2331                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2332                                                     GIMP_PARAM_READWRITE));
2333   gimp_procedure_add_argument (procedure,
2334                                g_param_spec_double ("y1",
2335                                                     "y1",
2336                                                     "The new y coordinate of the lower-right corner of the scaled region",
2337                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2338                                                     GIMP_PARAM_READWRITE));
2339   gimp_procedure_add_argument (procedure,
2340                                g_param_spec_boolean ("interpolate",
2341                                                      "interpolate",
2342                                                      "Whether to use interpolation and supersampling",
2343                                                      FALSE,
2344                                                      GIMP_PARAM_READWRITE));
2345   gimp_procedure_add_argument (procedure,
2346                                g_param_spec_enum ("clip-result",
2347                                                   "clip result",
2348                                                   "How to clip results",
2349                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2350                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2351                                                   GIMP_PARAM_READWRITE));
2352   gimp_procedure_add_return_value (procedure,
2353                                    gimp_param_spec_drawable_id ("drawable",
2354                                                                 "drawable",
2355                                                                 "The scaled drawable",
2356                                                                 pdb->gimp, FALSE,
2357                                                                 GIMP_PARAM_READWRITE));
2358   gimp_pdb_register_procedure (pdb, procedure);
2359   g_object_unref (procedure);
2360 
2361   /*
2362    * gimp-drawable-transform-shear
2363    */
2364   procedure = gimp_procedure_new (drawable_transform_shear_invoker);
2365   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2366                                "gimp-drawable-transform-shear");
2367   gimp_procedure_set_static_strings (procedure,
2368                                      "gimp-drawable-transform-shear",
2369                                      "Deprecated: Use 'gimp-item-transform-shear' instead.",
2370                                      "Deprecated: Use 'gimp-item-transform-shear' instead.",
2371                                      "Jo\xc3\xa3o S. O. Bueno",
2372                                      "Jo\xc3\xa3o S. O. Bueno",
2373                                      "2004",
2374                                      "gimp-item-transform-shear");
2375   gimp_procedure_add_argument (procedure,
2376                                gimp_param_spec_drawable_id ("drawable",
2377                                                             "drawable",
2378                                                             "The affected drawable",
2379                                                             pdb->gimp, FALSE,
2380                                                             GIMP_PARAM_READWRITE));
2381   gimp_procedure_add_argument (procedure,
2382                                gimp_param_spec_enum ("shear-type",
2383                                                      "shear type",
2384                                                      "Type of shear",
2385                                                      GIMP_TYPE_ORIENTATION_TYPE,
2386                                                      GIMP_ORIENTATION_HORIZONTAL,
2387                                                      GIMP_PARAM_READWRITE));
2388   gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
2389                                       GIMP_ORIENTATION_UNKNOWN);
2390   gimp_procedure_add_argument (procedure,
2391                                g_param_spec_double ("magnitude",
2392                                                     "magnitude",
2393                                                     "The magnitude of the shear",
2394                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2395                                                     GIMP_PARAM_READWRITE));
2396   gimp_procedure_add_argument (procedure,
2397                                g_param_spec_enum ("transform-direction",
2398                                                   "transform direction",
2399                                                   "Direction of transformation",
2400                                                   GIMP_TYPE_TRANSFORM_DIRECTION,
2401                                                   GIMP_TRANSFORM_FORWARD,
2402                                                   GIMP_PARAM_READWRITE));
2403   gimp_procedure_add_argument (procedure,
2404                                g_param_spec_enum ("interpolation",
2405                                                   "interpolation",
2406                                                   "Type of interpolation",
2407                                                   GIMP_TYPE_INTERPOLATION_TYPE,
2408                                                   GIMP_INTERPOLATION_NONE,
2409                                                   GIMP_PARAM_READWRITE));
2410   gimp_procedure_add_argument (procedure,
2411                                g_param_spec_boolean ("supersample",
2412                                                      "supersample",
2413                                                      "This parameter is ignored",
2414                                                      FALSE,
2415                                                      GIMP_PARAM_READWRITE));
2416   gimp_procedure_add_argument (procedure,
2417                                gimp_param_spec_int32 ("recursion-level",
2418                                                       "recursion level",
2419                                                       "This parameter is ignored",
2420                                                       1, G_MAXINT32, 1,
2421                                                       GIMP_PARAM_READWRITE));
2422   gimp_procedure_add_argument (procedure,
2423                                g_param_spec_enum ("clip-result",
2424                                                   "clip result",
2425                                                   "How to clip results",
2426                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2427                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2428                                                   GIMP_PARAM_READWRITE));
2429   gimp_procedure_add_return_value (procedure,
2430                                    gimp_param_spec_drawable_id ("drawable",
2431                                                                 "drawable",
2432                                                                 "The sheared drawable",
2433                                                                 pdb->gimp, FALSE,
2434                                                                 GIMP_PARAM_READWRITE));
2435   gimp_pdb_register_procedure (pdb, procedure);
2436   g_object_unref (procedure);
2437 
2438   /*
2439    * gimp-drawable-transform-shear-default
2440    */
2441   procedure = gimp_procedure_new (drawable_transform_shear_default_invoker);
2442   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2443                                "gimp-drawable-transform-shear-default");
2444   gimp_procedure_set_static_strings (procedure,
2445                                      "gimp-drawable-transform-shear-default",
2446                                      "Deprecated: Use 'gimp-item-transform-shear' instead.",
2447                                      "Deprecated: Use 'gimp-item-transform-shear' instead.",
2448                                      "Jo\xc3\xa3o S. O. Bueno",
2449                                      "Jo\xc3\xa3o S. O. Bueno",
2450                                      "2004",
2451                                      "gimp-item-transform-shear");
2452   gimp_procedure_add_argument (procedure,
2453                                gimp_param_spec_drawable_id ("drawable",
2454                                                             "drawable",
2455                                                             "The affected drawable",
2456                                                             pdb->gimp, FALSE,
2457                                                             GIMP_PARAM_READWRITE));
2458   gimp_procedure_add_argument (procedure,
2459                                gimp_param_spec_enum ("shear-type",
2460                                                      "shear type",
2461                                                      "Type of shear",
2462                                                      GIMP_TYPE_ORIENTATION_TYPE,
2463                                                      GIMP_ORIENTATION_HORIZONTAL,
2464                                                      GIMP_PARAM_READWRITE));
2465   gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
2466                                       GIMP_ORIENTATION_UNKNOWN);
2467   gimp_procedure_add_argument (procedure,
2468                                g_param_spec_double ("magnitude",
2469                                                     "magnitude",
2470                                                     "The magnitude of the shear",
2471                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2472                                                     GIMP_PARAM_READWRITE));
2473   gimp_procedure_add_argument (procedure,
2474                                g_param_spec_boolean ("interpolate",
2475                                                      "interpolate",
2476                                                      "Whether to use interpolation and supersampling",
2477                                                      FALSE,
2478                                                      GIMP_PARAM_READWRITE));
2479   gimp_procedure_add_argument (procedure,
2480                                g_param_spec_enum ("clip-result",
2481                                                   "clip result",
2482                                                   "How to clip results",
2483                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2484                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2485                                                   GIMP_PARAM_READWRITE));
2486   gimp_procedure_add_return_value (procedure,
2487                                    gimp_param_spec_drawable_id ("drawable",
2488                                                                 "drawable",
2489                                                                 "The sheared drawable",
2490                                                                 pdb->gimp, FALSE,
2491                                                                 GIMP_PARAM_READWRITE));
2492   gimp_pdb_register_procedure (pdb, procedure);
2493   g_object_unref (procedure);
2494 
2495   /*
2496    * gimp-drawable-transform-2d
2497    */
2498   procedure = gimp_procedure_new (drawable_transform_2d_invoker);
2499   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2500                                "gimp-drawable-transform-2d");
2501   gimp_procedure_set_static_strings (procedure,
2502                                      "gimp-drawable-transform-2d",
2503                                      "Deprecated: Use 'gimp-item-transform-2d' instead.",
2504                                      "Deprecated: Use 'gimp-item-transform-2d' instead.",
2505                                      "Jo\xc3\xa3o S. O. Bueno",
2506                                      "Jo\xc3\xa3o S. O. Bueno",
2507                                      "2004",
2508                                      "gimp-item-transform-2d");
2509   gimp_procedure_add_argument (procedure,
2510                                gimp_param_spec_drawable_id ("drawable",
2511                                                             "drawable",
2512                                                             "The affected drawable",
2513                                                             pdb->gimp, FALSE,
2514                                                             GIMP_PARAM_READWRITE));
2515   gimp_procedure_add_argument (procedure,
2516                                g_param_spec_double ("source-x",
2517                                                     "source x",
2518                                                     "X coordinate of the transformation center",
2519                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2520                                                     GIMP_PARAM_READWRITE));
2521   gimp_procedure_add_argument (procedure,
2522                                g_param_spec_double ("source-y",
2523                                                     "source y",
2524                                                     "Y coordinate of the transformation center",
2525                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2526                                                     GIMP_PARAM_READWRITE));
2527   gimp_procedure_add_argument (procedure,
2528                                g_param_spec_double ("scale-x",
2529                                                     "scale x",
2530                                                     "Amount to scale in x direction",
2531                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2532                                                     GIMP_PARAM_READWRITE));
2533   gimp_procedure_add_argument (procedure,
2534                                g_param_spec_double ("scale-y",
2535                                                     "scale y",
2536                                                     "Amount to scale in y direction",
2537                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2538                                                     GIMP_PARAM_READWRITE));
2539   gimp_procedure_add_argument (procedure,
2540                                g_param_spec_double ("angle",
2541                                                     "angle",
2542                                                     "The angle of rotation (radians)",
2543                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2544                                                     GIMP_PARAM_READWRITE));
2545   gimp_procedure_add_argument (procedure,
2546                                g_param_spec_double ("dest-x",
2547                                                     "dest x",
2548                                                     "X coordinate of where the center goes",
2549                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2550                                                     GIMP_PARAM_READWRITE));
2551   gimp_procedure_add_argument (procedure,
2552                                g_param_spec_double ("dest-y",
2553                                                     "dest y",
2554                                                     "Y coordinate of where the center goes",
2555                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2556                                                     GIMP_PARAM_READWRITE));
2557   gimp_procedure_add_argument (procedure,
2558                                g_param_spec_enum ("transform-direction",
2559                                                   "transform direction",
2560                                                   "Direction of transformation",
2561                                                   GIMP_TYPE_TRANSFORM_DIRECTION,
2562                                                   GIMP_TRANSFORM_FORWARD,
2563                                                   GIMP_PARAM_READWRITE));
2564   gimp_procedure_add_argument (procedure,
2565                                g_param_spec_enum ("interpolation",
2566                                                   "interpolation",
2567                                                   "Type of interpolation",
2568                                                   GIMP_TYPE_INTERPOLATION_TYPE,
2569                                                   GIMP_INTERPOLATION_NONE,
2570                                                   GIMP_PARAM_READWRITE));
2571   gimp_procedure_add_argument (procedure,
2572                                g_param_spec_boolean ("supersample",
2573                                                      "supersample",
2574                                                      "This parameter is ignored",
2575                                                      FALSE,
2576                                                      GIMP_PARAM_READWRITE));
2577   gimp_procedure_add_argument (procedure,
2578                                gimp_param_spec_int32 ("recursion-level",
2579                                                       "recursion level",
2580                                                       "This parameter is ignored",
2581                                                       1, G_MAXINT32, 1,
2582                                                       GIMP_PARAM_READWRITE));
2583   gimp_procedure_add_argument (procedure,
2584                                g_param_spec_enum ("clip-result",
2585                                                   "clip result",
2586                                                   "How to clip results",
2587                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2588                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2589                                                   GIMP_PARAM_READWRITE));
2590   gimp_procedure_add_return_value (procedure,
2591                                    gimp_param_spec_drawable_id ("drawable",
2592                                                                 "drawable",
2593                                                                 "The transformed drawable",
2594                                                                 pdb->gimp, FALSE,
2595                                                                 GIMP_PARAM_READWRITE));
2596   gimp_pdb_register_procedure (pdb, procedure);
2597   g_object_unref (procedure);
2598 
2599   /*
2600    * gimp-drawable-transform-2d-default
2601    */
2602   procedure = gimp_procedure_new (drawable_transform_2d_default_invoker);
2603   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2604                                "gimp-drawable-transform-2d-default");
2605   gimp_procedure_set_static_strings (procedure,
2606                                      "gimp-drawable-transform-2d-default",
2607                                      "Deprecated: Use 'gimp-item-transform-2d' instead.",
2608                                      "Deprecated: Use 'gimp-item-transform-2d' instead.",
2609                                      "Jo\xc3\xa3o S. O. Bueno",
2610                                      "Jo\xc3\xa3o S. O. Bueno",
2611                                      "2004",
2612                                      "gimp-item-transform-2d");
2613   gimp_procedure_add_argument (procedure,
2614                                gimp_param_spec_drawable_id ("drawable",
2615                                                             "drawable",
2616                                                             "The affected drawable",
2617                                                             pdb->gimp, FALSE,
2618                                                             GIMP_PARAM_READWRITE));
2619   gimp_procedure_add_argument (procedure,
2620                                g_param_spec_double ("source-x",
2621                                                     "source x",
2622                                                     "X coordinate of the transformation center",
2623                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2624                                                     GIMP_PARAM_READWRITE));
2625   gimp_procedure_add_argument (procedure,
2626                                g_param_spec_double ("source-y",
2627                                                     "source y",
2628                                                     "Y coordinate of the transformation center",
2629                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2630                                                     GIMP_PARAM_READWRITE));
2631   gimp_procedure_add_argument (procedure,
2632                                g_param_spec_double ("scale-x",
2633                                                     "scale x",
2634                                                     "Amount to scale in x direction",
2635                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2636                                                     GIMP_PARAM_READWRITE));
2637   gimp_procedure_add_argument (procedure,
2638                                g_param_spec_double ("scale-y",
2639                                                     "scale y",
2640                                                     "Amount to scale in y direction",
2641                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2642                                                     GIMP_PARAM_READWRITE));
2643   gimp_procedure_add_argument (procedure,
2644                                g_param_spec_double ("angle",
2645                                                     "angle",
2646                                                     "The angle of rotation (radians)",
2647                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2648                                                     GIMP_PARAM_READWRITE));
2649   gimp_procedure_add_argument (procedure,
2650                                g_param_spec_double ("dest-x",
2651                                                     "dest x",
2652                                                     "X coordinate of where the center goes",
2653                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2654                                                     GIMP_PARAM_READWRITE));
2655   gimp_procedure_add_argument (procedure,
2656                                g_param_spec_double ("dest-y",
2657                                                     "dest y",
2658                                                     "Y coordinate of where the center goes",
2659                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2660                                                     GIMP_PARAM_READWRITE));
2661   gimp_procedure_add_argument (procedure,
2662                                g_param_spec_boolean ("interpolate",
2663                                                      "interpolate",
2664                                                      "Whether to use interpolation and supersampling",
2665                                                      FALSE,
2666                                                      GIMP_PARAM_READWRITE));
2667   gimp_procedure_add_argument (procedure,
2668                                g_param_spec_enum ("clip-result",
2669                                                   "clip result",
2670                                                   "How to clip results",
2671                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2672                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2673                                                   GIMP_PARAM_READWRITE));
2674   gimp_procedure_add_return_value (procedure,
2675                                    gimp_param_spec_drawable_id ("drawable",
2676                                                                 "drawable",
2677                                                                 "The transformed drawable",
2678                                                                 pdb->gimp, FALSE,
2679                                                                 GIMP_PARAM_READWRITE));
2680   gimp_pdb_register_procedure (pdb, procedure);
2681   g_object_unref (procedure);
2682 
2683   /*
2684    * gimp-drawable-transform-matrix
2685    */
2686   procedure = gimp_procedure_new (drawable_transform_matrix_invoker);
2687   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2688                                "gimp-drawable-transform-matrix");
2689   gimp_procedure_set_static_strings (procedure,
2690                                      "gimp-drawable-transform-matrix",
2691                                      "Deprecated: Use 'gimp-item-transform-matrix' instead.",
2692                                      "Deprecated: Use 'gimp-item-transform-matrix' instead.",
2693                                      "Jo\xc3\xa3o S. O. Bueno",
2694                                      "Jo\xc3\xa3o S. O. Bueno",
2695                                      "2004",
2696                                      "gimp-item-transform-matrix");
2697   gimp_procedure_add_argument (procedure,
2698                                gimp_param_spec_drawable_id ("drawable",
2699                                                             "drawable",
2700                                                             "The affected drawable",
2701                                                             pdb->gimp, FALSE,
2702                                                             GIMP_PARAM_READWRITE));
2703   gimp_procedure_add_argument (procedure,
2704                                g_param_spec_double ("coeff-0-0",
2705                                                     "coeff 0 0",
2706                                                     "coefficient (0,0) of the transformation matrix",
2707                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2708                                                     GIMP_PARAM_READWRITE));
2709   gimp_procedure_add_argument (procedure,
2710                                g_param_spec_double ("coeff-0-1",
2711                                                     "coeff 0 1",
2712                                                     "coefficient (0,1) of the transformation matrix",
2713                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2714                                                     GIMP_PARAM_READWRITE));
2715   gimp_procedure_add_argument (procedure,
2716                                g_param_spec_double ("coeff-0-2",
2717                                                     "coeff 0 2",
2718                                                     "coefficient (0,2) of the transformation matrix",
2719                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2720                                                     GIMP_PARAM_READWRITE));
2721   gimp_procedure_add_argument (procedure,
2722                                g_param_spec_double ("coeff-1-0",
2723                                                     "coeff 1 0",
2724                                                     "coefficient (1,0) of the transformation matrix",
2725                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2726                                                     GIMP_PARAM_READWRITE));
2727   gimp_procedure_add_argument (procedure,
2728                                g_param_spec_double ("coeff-1-1",
2729                                                     "coeff 1 1",
2730                                                     "coefficient (1,1) of the transformation matrix",
2731                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2732                                                     GIMP_PARAM_READWRITE));
2733   gimp_procedure_add_argument (procedure,
2734                                g_param_spec_double ("coeff-1-2",
2735                                                     "coeff 1 2",
2736                                                     "coefficient (1,2) of the transformation matrix",
2737                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2738                                                     GIMP_PARAM_READWRITE));
2739   gimp_procedure_add_argument (procedure,
2740                                g_param_spec_double ("coeff-2-0",
2741                                                     "coeff 2 0",
2742                                                     "coefficient (2,0) of the transformation matrix",
2743                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2744                                                     GIMP_PARAM_READWRITE));
2745   gimp_procedure_add_argument (procedure,
2746                                g_param_spec_double ("coeff-2-1",
2747                                                     "coeff 2 1",
2748                                                     "coefficient (2,1) of the transformation matrix",
2749                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2750                                                     GIMP_PARAM_READWRITE));
2751   gimp_procedure_add_argument (procedure,
2752                                g_param_spec_double ("coeff-2-2",
2753                                                     "coeff 2 2",
2754                                                     "coefficient (2,2) of the transformation matrix",
2755                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2756                                                     GIMP_PARAM_READWRITE));
2757   gimp_procedure_add_argument (procedure,
2758                                g_param_spec_enum ("transform-direction",
2759                                                   "transform direction",
2760                                                   "Direction of transformation",
2761                                                   GIMP_TYPE_TRANSFORM_DIRECTION,
2762                                                   GIMP_TRANSFORM_FORWARD,
2763                                                   GIMP_PARAM_READWRITE));
2764   gimp_procedure_add_argument (procedure,
2765                                g_param_spec_enum ("interpolation",
2766                                                   "interpolation",
2767                                                   "Type of interpolation",
2768                                                   GIMP_TYPE_INTERPOLATION_TYPE,
2769                                                   GIMP_INTERPOLATION_NONE,
2770                                                   GIMP_PARAM_READWRITE));
2771   gimp_procedure_add_argument (procedure,
2772                                g_param_spec_boolean ("supersample",
2773                                                      "supersample",
2774                                                      "This parameter is ignored",
2775                                                      FALSE,
2776                                                      GIMP_PARAM_READWRITE));
2777   gimp_procedure_add_argument (procedure,
2778                                gimp_param_spec_int32 ("recursion-level",
2779                                                       "recursion level",
2780                                                       "This parameter is ignored",
2781                                                       1, G_MAXINT32, 1,
2782                                                       GIMP_PARAM_READWRITE));
2783   gimp_procedure_add_argument (procedure,
2784                                g_param_spec_enum ("clip-result",
2785                                                   "clip result",
2786                                                   "How to clip results",
2787                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2788                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2789                                                   GIMP_PARAM_READWRITE));
2790   gimp_procedure_add_return_value (procedure,
2791                                    gimp_param_spec_drawable_id ("drawable",
2792                                                                 "drawable",
2793                                                                 "The transformed drawable",
2794                                                                 pdb->gimp, FALSE,
2795                                                                 GIMP_PARAM_READWRITE));
2796   gimp_pdb_register_procedure (pdb, procedure);
2797   g_object_unref (procedure);
2798 
2799   /*
2800    * gimp-drawable-transform-matrix-default
2801    */
2802   procedure = gimp_procedure_new (drawable_transform_matrix_default_invoker);
2803   gimp_object_set_static_name (GIMP_OBJECT (procedure),
2804                                "gimp-drawable-transform-matrix-default");
2805   gimp_procedure_set_static_strings (procedure,
2806                                      "gimp-drawable-transform-matrix-default",
2807                                      "Deprecated: Use 'gimp-item-transform-matrix' instead.",
2808                                      "Deprecated: Use 'gimp-item-transform-matrix' instead.",
2809                                      "Jo\xc3\xa3o S. O. Bueno",
2810                                      "Jo\xc3\xa3o S. O. Bueno",
2811                                      "2004",
2812                                      "gimp-item-transform-matrix");
2813   gimp_procedure_add_argument (procedure,
2814                                gimp_param_spec_drawable_id ("drawable",
2815                                                             "drawable",
2816                                                             "The affected drawable",
2817                                                             pdb->gimp, FALSE,
2818                                                             GIMP_PARAM_READWRITE));
2819   gimp_procedure_add_argument (procedure,
2820                                g_param_spec_double ("coeff-0-0",
2821                                                     "coeff 0 0",
2822                                                     "coefficient (0,0) of the transformation matrix",
2823                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2824                                                     GIMP_PARAM_READWRITE));
2825   gimp_procedure_add_argument (procedure,
2826                                g_param_spec_double ("coeff-0-1",
2827                                                     "coeff 0 1",
2828                                                     "coefficient (0,1) of the transformation matrix",
2829                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2830                                                     GIMP_PARAM_READWRITE));
2831   gimp_procedure_add_argument (procedure,
2832                                g_param_spec_double ("coeff-0-2",
2833                                                     "coeff 0 2",
2834                                                     "coefficient (0,2) of the transformation matrix",
2835                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2836                                                     GIMP_PARAM_READWRITE));
2837   gimp_procedure_add_argument (procedure,
2838                                g_param_spec_double ("coeff-1-0",
2839                                                     "coeff 1 0",
2840                                                     "coefficient (1,0) of the transformation matrix",
2841                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2842                                                     GIMP_PARAM_READWRITE));
2843   gimp_procedure_add_argument (procedure,
2844                                g_param_spec_double ("coeff-1-1",
2845                                                     "coeff 1 1",
2846                                                     "coefficient (1,1) of the transformation matrix",
2847                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2848                                                     GIMP_PARAM_READWRITE));
2849   gimp_procedure_add_argument (procedure,
2850                                g_param_spec_double ("coeff-1-2",
2851                                                     "coeff 1 2",
2852                                                     "coefficient (1,2) of the transformation matrix",
2853                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2854                                                     GIMP_PARAM_READWRITE));
2855   gimp_procedure_add_argument (procedure,
2856                                g_param_spec_double ("coeff-2-0",
2857                                                     "coeff 2 0",
2858                                                     "coefficient (2,0) of the transformation matrix",
2859                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2860                                                     GIMP_PARAM_READWRITE));
2861   gimp_procedure_add_argument (procedure,
2862                                g_param_spec_double ("coeff-2-1",
2863                                                     "coeff 2 1",
2864                                                     "coefficient (2,1) of the transformation matrix",
2865                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2866                                                     GIMP_PARAM_READWRITE));
2867   gimp_procedure_add_argument (procedure,
2868                                g_param_spec_double ("coeff-2-2",
2869                                                     "coeff 2 2",
2870                                                     "coefficient (2,2) of the transformation matrix",
2871                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
2872                                                     GIMP_PARAM_READWRITE));
2873   gimp_procedure_add_argument (procedure,
2874                                g_param_spec_boolean ("interpolate",
2875                                                      "interpolate",
2876                                                      "Whether to use interpolation and supersampling",
2877                                                      FALSE,
2878                                                      GIMP_PARAM_READWRITE));
2879   gimp_procedure_add_argument (procedure,
2880                                g_param_spec_enum ("clip-result",
2881                                                   "clip result",
2882                                                   "How to clip results",
2883                                                   GIMP_TYPE_TRANSFORM_RESIZE,
2884                                                   GIMP_TRANSFORM_RESIZE_ADJUST,
2885                                                   GIMP_PARAM_READWRITE));
2886   gimp_procedure_add_return_value (procedure,
2887                                    gimp_param_spec_drawable_id ("drawable",
2888                                                                 "drawable",
2889                                                                 "The transformed drawable",
2890                                                                 pdb->gimp, FALSE,
2891                                                                 GIMP_PARAM_READWRITE));
2892   gimp_pdb_register_procedure (pdb, procedure);
2893   g_object_unref (procedure);
2894 }
2895