1 /* LIBGIMP - The GIMP Library
2  * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
3  *
4  * gimpitemtransform_pdb.c
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 3 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library.  If not, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 /* NOTE: This file is auto-generated by pdbgen.pl */
22 
23 #include "config.h"
24 
25 #include "gimp.h"
26 
27 
28 /**
29  * SECTION: gimpitemtransform
30  * @title: gimpitemtransform
31  * @short_description: Functions to perform transformations on items.
32  *
33  * Functions to perform transformations on items.
34  **/
35 
36 
37 /**
38  * gimp_item_transform_translate:
39  * @item_ID: The item.
40  * @off_x: Offset in x direction.
41  * @off_y: Offset in y direction.
42  *
43  * Translate the item by the specified offsets.
44  *
45  * This procedure translates the item by the amounts specified in the
46  * off_x and off_y arguments. These can be negative, and are considered
47  * offsets from the current position. The offsets will be rounded to
48  * the nearest pixel unless the item is a path.
49  *
50  * If the item is attached to an image and has its linked flag set to
51  * TRUE, all additional items contained in the image which have the
52  * linked flag set to TRUE will also be translated by the specified
53  * offsets.
54  *
55  * Returns: The translated item.
56  *
57  * Since: 2.10
58  **/
59 gint32
gimp_item_transform_translate(gint32 item_ID,gdouble off_x,gdouble off_y)60 gimp_item_transform_translate (gint32  item_ID,
61                                gdouble off_x,
62                                gdouble off_y)
63 {
64   GimpParam *return_vals;
65   gint nreturn_vals;
66   gint32 ret_item_ID = -1;
67 
68   return_vals = gimp_run_procedure ("gimp-item-transform-translate",
69                                     &nreturn_vals,
70                                     GIMP_PDB_ITEM, item_ID,
71                                     GIMP_PDB_FLOAT, off_x,
72                                     GIMP_PDB_FLOAT, off_y,
73                                     GIMP_PDB_END);
74 
75   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
76     ret_item_ID = return_vals[1].data.d_item;
77 
78   gimp_destroy_params (return_vals, nreturn_vals);
79 
80   return ret_item_ID;
81 }
82 
83 /**
84  * gimp_item_transform_flip_simple:
85  * @item_ID: The affected item.
86  * @flip_type: Type of flip.
87  * @auto_center: Whether to automatically position the axis in the selection center.
88  * @axis: coord. of flip axis.
89  *
90  * Flip the specified item either vertically or horizontally.
91  *
92  * This procedure flips the specified item.
93  *
94  * If a selection exists and the item is a drawable, the portion of the
95  * drawable which lies under the selection is cut from the drawable and
96  * made into a floating selection which is then flipped. If auto_center
97  * is set to TRUE, the flip is around the selection's center.
98  * Otherwise, the coordinate of the axis needs to be specified. The
99  * return value is the ID of the flipped floating selection.
100  *
101  * If there is no selection or the item is not a drawable, the entire
102  * item will be flipped around its center if auto_center is set to
103  * TRUE, otherwise the coordinate of the axis needs to be specified.
104  * Additionally, if the item has its linked flag set to TRUE, all
105  * additional items contained in the image which have the linked flag
106  * set to TRUE will also be flipped around the same axis. The return
107  * value will be equal to the item ID supplied as input.
108  *
109  * This procedure is affected by the following context setters:
110  * gimp_context_set_transform_resize().
111  *
112  * Returns: The flipped item.
113  *
114  * Since: 2.2
115  **/
116 gint32
gimp_item_transform_flip_simple(gint32 item_ID,GimpOrientationType flip_type,gboolean auto_center,gdouble axis)117 gimp_item_transform_flip_simple (gint32              item_ID,
118                                  GimpOrientationType flip_type,
119                                  gboolean            auto_center,
120                                  gdouble             axis)
121 {
122   GimpParam *return_vals;
123   gint nreturn_vals;
124   gint32 ret_item_ID = -1;
125 
126   return_vals = gimp_run_procedure ("gimp-item-transform-flip-simple",
127                                     &nreturn_vals,
128                                     GIMP_PDB_ITEM, item_ID,
129                                     GIMP_PDB_INT32, flip_type,
130                                     GIMP_PDB_INT32, auto_center,
131                                     GIMP_PDB_FLOAT, axis,
132                                     GIMP_PDB_END);
133 
134   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
135     ret_item_ID = return_vals[1].data.d_item;
136 
137   gimp_destroy_params (return_vals, nreturn_vals);
138 
139   return ret_item_ID;
140 }
141 
142 /**
143  * gimp_item_transform_flip:
144  * @item_ID: The affected item.
145  * @x0: horz. coord. of one end of axis.
146  * @y0: vert. coord. of one end of axis.
147  * @x1: horz. coord. of other end of axis.
148  * @y1: vert. coord. of other end of axis.
149  *
150  * Flip the specified item around a given line.
151  *
152  * This procedure flips the specified item.
153  *
154  * If a selection exists and the item is a drawable, the portion of the
155  * drawable which lies under the selection is cut from the drawable and
156  * made into a floating selection which is then flipped. The axis to
157  * flip around is specified by specifying two points from that line.
158  * The return value is the ID of the flipped floating selection.
159  *
160  * If there is no selection or the item is not a drawable, the entire
161  * item will be flipped around the specified axis. Additionally, if the
162  * item has its linked flag set to TRUE, all additional items contained
163  * in the image which have the linked flag set to TRUE will also be
164  * flipped around the same axis. The return value will be equal to the
165  * item ID supplied as input.
166  *
167  * This procedure is affected by the following context setters:
168  * gimp_context_set_interpolation(),
169  * gimp_context_set_transform_direction(),
170  * gimp_context_set_transform_resize().
171  *
172  * Returns: The flipped item.
173  *
174  * Since: 2.8
175  **/
176 gint32
gimp_item_transform_flip(gint32 item_ID,gdouble x0,gdouble y0,gdouble x1,gdouble y1)177 gimp_item_transform_flip (gint32  item_ID,
178                           gdouble x0,
179                           gdouble y0,
180                           gdouble x1,
181                           gdouble y1)
182 {
183   GimpParam *return_vals;
184   gint nreturn_vals;
185   gint32 ret_item_ID = -1;
186 
187   return_vals = gimp_run_procedure ("gimp-item-transform-flip",
188                                     &nreturn_vals,
189                                     GIMP_PDB_ITEM, item_ID,
190                                     GIMP_PDB_FLOAT, x0,
191                                     GIMP_PDB_FLOAT, y0,
192                                     GIMP_PDB_FLOAT, x1,
193                                     GIMP_PDB_FLOAT, y1,
194                                     GIMP_PDB_END);
195 
196   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
197     ret_item_ID = return_vals[1].data.d_item;
198 
199   gimp_destroy_params (return_vals, nreturn_vals);
200 
201   return ret_item_ID;
202 }
203 
204 /**
205  * gimp_item_transform_perspective:
206  * @item_ID: The affected item.
207  * @x0: The new x coordinate of upper-left corner of original bounding box.
208  * @y0: The new y coordinate of upper-left corner of original bounding box.
209  * @x1: The new x coordinate of upper-right corner of original bounding box.
210  * @y1: The new y coordinate of upper-right corner of original bounding box.
211  * @x2: The new x coordinate of lower-left corner of original bounding box.
212  * @y2: The new y coordinate of lower-left corner of original bounding box.
213  * @x3: The new x coordinate of lower-right corner of original bounding box.
214  * @y3: The new y coordinate of lower-right corner of original bounding box.
215  *
216  * Perform a possibly non-affine transformation on the specified item.
217  *
218  * This procedure performs a possibly non-affine transformation on the
219  * specified item by allowing the corners of the original bounding box
220  * to be arbitrarily remapped to any values.
221  *
222  * The 4 coordinates specify the new locations of each corner of the
223  * original bounding box. By specifying these values, any affine
224  * transformation (rotation, scaling, translation) can be affected.
225  * Additionally, these values can be specified such that the resulting
226  * transformed item will appear to have been projected via a
227  * perspective transform.
228  *
229  * If a selection exists and the item is a drawable, the portion of the
230  * drawable which lies under the selection is cut from the drawable and
231  * made into a floating selection which is then transformed as
232  * specified. The return value is the ID of the transformed floating
233  * selection.
234  *
235  * If there is no selection or the item is not a drawable, the entire
236  * item will be transformed according to the specified mapping.
237  * Additionally, if the item has its linked flag set to TRUE, all
238  * additional items contained in the image which have the linked flag
239  * set to TRUE will also be transformed the same way. The return value
240  * will be equal to the item ID supplied as input.
241  *
242  * This procedure is affected by the following context setters:
243  * gimp_context_set_interpolation(),
244  * gimp_context_set_transform_direction(),
245  * gimp_context_set_transform_resize().
246  *
247  * Returns: The transformed item.
248  *
249  * Since: 2.8
250  **/
251 gint32
gimp_item_transform_perspective(gint32 item_ID,gdouble x0,gdouble y0,gdouble x1,gdouble y1,gdouble x2,gdouble y2,gdouble x3,gdouble y3)252 gimp_item_transform_perspective (gint32  item_ID,
253                                  gdouble x0,
254                                  gdouble y0,
255                                  gdouble x1,
256                                  gdouble y1,
257                                  gdouble x2,
258                                  gdouble y2,
259                                  gdouble x3,
260                                  gdouble y3)
261 {
262   GimpParam *return_vals;
263   gint nreturn_vals;
264   gint32 ret_item_ID = -1;
265 
266   return_vals = gimp_run_procedure ("gimp-item-transform-perspective",
267                                     &nreturn_vals,
268                                     GIMP_PDB_ITEM, item_ID,
269                                     GIMP_PDB_FLOAT, x0,
270                                     GIMP_PDB_FLOAT, y0,
271                                     GIMP_PDB_FLOAT, x1,
272                                     GIMP_PDB_FLOAT, y1,
273                                     GIMP_PDB_FLOAT, x2,
274                                     GIMP_PDB_FLOAT, y2,
275                                     GIMP_PDB_FLOAT, x3,
276                                     GIMP_PDB_FLOAT, y3,
277                                     GIMP_PDB_END);
278 
279   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
280     ret_item_ID = return_vals[1].data.d_item;
281 
282   gimp_destroy_params (return_vals, nreturn_vals);
283 
284   return ret_item_ID;
285 }
286 
287 /**
288  * gimp_item_transform_rotate_simple:
289  * @item_ID: The affected item.
290  * @rotate_type: Type of rotation.
291  * @auto_center: Whether to automatically rotate around the selection center.
292  * @center_x: The hor. coordinate of the center of rotation.
293  * @center_y: The vert. coordinate of the center of rotation.
294  *
295  * Rotate the specified item about given coordinates through the
296  * specified angle.
297  *
298  * This function rotates the specified item.
299  *
300  * If a selection exists and the item is a drawable, the portion of the
301  * drawable which lies under the selection is cut from the drawable and
302  * made into a floating selection which is then rotated by the
303  * specified amount. If auto_center is set to TRUE, the rotation is
304  * around the selection's center. Otherwise, the coordinate of the
305  * center point needs to be specified. The return value is the ID of
306  * the rotated floating selection.
307  *
308  * If there is no selection or the item is not a drawable, the entire
309  * item will be rotated around its center if auto_center is set to
310  * TRUE, otherwise the coordinate of the center point needs to be
311  * specified. Additionally, if the item has its linked flag set to
312  * TRUE, all additional items contained in the image which have the
313  * linked flag set to TRUE will also be rotated around the same center
314  * point. The return value will be equal to the item ID supplied as
315  * input.
316  *
317  * This procedure is affected by the following context setters:
318  * gimp_context_set_transform_resize().
319  *
320  * Returns: The rotated item.
321  *
322  * Since: 2.8
323  **/
324 gint32
gimp_item_transform_rotate_simple(gint32 item_ID,GimpRotationType rotate_type,gboolean auto_center,gdouble center_x,gdouble center_y)325 gimp_item_transform_rotate_simple (gint32           item_ID,
326                                    GimpRotationType rotate_type,
327                                    gboolean         auto_center,
328                                    gdouble          center_x,
329                                    gdouble          center_y)
330 {
331   GimpParam *return_vals;
332   gint nreturn_vals;
333   gint32 ret_item_ID = -1;
334 
335   return_vals = gimp_run_procedure ("gimp-item-transform-rotate-simple",
336                                     &nreturn_vals,
337                                     GIMP_PDB_ITEM, item_ID,
338                                     GIMP_PDB_INT32, rotate_type,
339                                     GIMP_PDB_INT32, auto_center,
340                                     GIMP_PDB_FLOAT, center_x,
341                                     GIMP_PDB_FLOAT, center_y,
342                                     GIMP_PDB_END);
343 
344   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
345     ret_item_ID = return_vals[1].data.d_item;
346 
347   gimp_destroy_params (return_vals, nreturn_vals);
348 
349   return ret_item_ID;
350 }
351 
352 /**
353  * gimp_item_transform_rotate:
354  * @item_ID: The affected item.
355  * @angle: The angle of rotation (radians).
356  * @auto_center: Whether to automatically rotate around the selection center.
357  * @center_x: The hor. coordinate of the center of rotation.
358  * @center_y: The vert. coordinate of the center of rotation.
359  *
360  * Rotate the specified item about given coordinates through the
361  * specified angle.
362  *
363  * This function rotates the specified item.
364  *
365  * If a selection exists and the item is a drawable, the portion of the
366  * drawable which lies under the selection is cut from the drawable and
367  * made into a floating selection which is then rotated by the
368  * specified amount. If auto_center is set to TRUE, the rotation is
369  * around the selection's center. Otherwise, the coordinate of the
370  * center point needs to be specified. The return value is the ID of
371  * the rotated floating selection.
372  *
373  * If there is no selection or the item is not a drawable, the entire
374  * item will be rotated around its center if auto_center is set to
375  * TRUE, otherwise the coordinate of the center point needs to be
376  * specified. Additionally, if the item has its linked flag set to
377  * TRUE, all additional items contained in the image which have the
378  * linked flag set to TRUE will also be rotated around the same center
379  * point. The return value will be equal to the item ID supplied as
380  * input.
381  *
382  * This procedure is affected by the following context setters:
383  * gimp_context_set_interpolation(),
384  * gimp_context_set_transform_direction(),
385  * gimp_context_set_transform_resize().
386  *
387  * Returns: The rotated item.
388  *
389  * Since: 2.8
390  **/
391 gint32
gimp_item_transform_rotate(gint32 item_ID,gdouble angle,gboolean auto_center,gdouble center_x,gdouble center_y)392 gimp_item_transform_rotate (gint32   item_ID,
393                             gdouble  angle,
394                             gboolean auto_center,
395                             gdouble  center_x,
396                             gdouble  center_y)
397 {
398   GimpParam *return_vals;
399   gint nreturn_vals;
400   gint32 ret_item_ID = -1;
401 
402   return_vals = gimp_run_procedure ("gimp-item-transform-rotate",
403                                     &nreturn_vals,
404                                     GIMP_PDB_ITEM, item_ID,
405                                     GIMP_PDB_FLOAT, angle,
406                                     GIMP_PDB_INT32, auto_center,
407                                     GIMP_PDB_FLOAT, center_x,
408                                     GIMP_PDB_FLOAT, center_y,
409                                     GIMP_PDB_END);
410 
411   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
412     ret_item_ID = return_vals[1].data.d_item;
413 
414   gimp_destroy_params (return_vals, nreturn_vals);
415 
416   return ret_item_ID;
417 }
418 
419 /**
420  * gimp_item_transform_scale:
421  * @item_ID: The affected item.
422  * @x0: The new x coordinate of the upper-left corner of the scaled region.
423  * @y0: The new y coordinate of the upper-left corner of the scaled region.
424  * @x1: The new x coordinate of the lower-right corner of the scaled region.
425  * @y1: The new y coordinate of the lower-right corner of the scaled region.
426  *
427  * Scale the specified item.
428  *
429  * This procedure scales the specified item.
430  *
431  * The 2 coordinates specify the new locations of the top-left and
432  * bottom-roght corners of the original bounding box.
433  *
434  * If a selection exists and the item is a drawable, the portion of the
435  * drawable which lies under the selection is cut from the drawable and
436  * made into a floating selection which is then scaled as specified.
437  * The return value is the ID of the scaled floating selection.
438  *
439  * If there is no selection or the item is not a drawable, the entire
440  * item will be scaled according to the specified coordinates.
441  * Additionally, if the item has its linked flag set to TRUE, all
442  * additional items contained in the image which have the linked flag
443  * set to TRUE will also be scaled the same way. The return value will
444  * be equal to the item ID supplied as input.
445  *
446  * This procedure is affected by the following context setters:
447  * gimp_context_set_interpolation(),
448  * gimp_context_set_transform_direction(),
449  * gimp_context_set_transform_resize().
450  *
451  * Returns: The scaled item.
452  *
453  * Since: 2.8
454  **/
455 gint32
gimp_item_transform_scale(gint32 item_ID,gdouble x0,gdouble y0,gdouble x1,gdouble y1)456 gimp_item_transform_scale (gint32  item_ID,
457                            gdouble x0,
458                            gdouble y0,
459                            gdouble x1,
460                            gdouble y1)
461 {
462   GimpParam *return_vals;
463   gint nreturn_vals;
464   gint32 ret_item_ID = -1;
465 
466   return_vals = gimp_run_procedure ("gimp-item-transform-scale",
467                                     &nreturn_vals,
468                                     GIMP_PDB_ITEM, item_ID,
469                                     GIMP_PDB_FLOAT, x0,
470                                     GIMP_PDB_FLOAT, y0,
471                                     GIMP_PDB_FLOAT, x1,
472                                     GIMP_PDB_FLOAT, y1,
473                                     GIMP_PDB_END);
474 
475   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
476     ret_item_ID = return_vals[1].data.d_item;
477 
478   gimp_destroy_params (return_vals, nreturn_vals);
479 
480   return ret_item_ID;
481 }
482 
483 /**
484  * gimp_item_transform_shear:
485  * @item_ID: The affected item.
486  * @shear_type: Type of shear.
487  * @magnitude: The magnitude of the shear.
488  *
489  * Shear the specified item about its center by the specified
490  * magnitude.
491  *
492  * This procedure shears the specified item.
493  *
494  * The shear type parameter indicates whether the shear will be applied
495  * horizontally or vertically. The magnitude can be either positive or
496  * negative and indicates the extent (in pixels) to shear by.
497  *
498  * If a selection exists and the item is a drawable, the portion of the
499  * drawable which lies under the selection is cut from the drawable and
500  * made into a floating selection which is then sheared as specified.
501  * The return value is the ID of the sheared floating selection.
502  *
503  * If there is no selection or the item is not a drawable, the entire
504  * item will be sheared according to the specified parameters.
505  * Additionally, if the item has its linked flag set to TRUE, all
506  * additional items contained in the image which have the linked flag
507  * set to TRUE will also be sheared the same way. The return value will
508  * be equal to the item ID supplied as input.
509  *
510  * This procedure is affected by the following context setters:
511  * gimp_context_set_interpolation(),
512  * gimp_context_set_transform_direction(),
513  * gimp_context_set_transform_resize().
514  *
515  * Returns: The sheared item.
516  *
517  * Since: 2.8
518  **/
519 gint32
gimp_item_transform_shear(gint32 item_ID,GimpOrientationType shear_type,gdouble magnitude)520 gimp_item_transform_shear (gint32              item_ID,
521                            GimpOrientationType shear_type,
522                            gdouble             magnitude)
523 {
524   GimpParam *return_vals;
525   gint nreturn_vals;
526   gint32 ret_item_ID = -1;
527 
528   return_vals = gimp_run_procedure ("gimp-item-transform-shear",
529                                     &nreturn_vals,
530                                     GIMP_PDB_ITEM, item_ID,
531                                     GIMP_PDB_INT32, shear_type,
532                                     GIMP_PDB_FLOAT, magnitude,
533                                     GIMP_PDB_END);
534 
535   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
536     ret_item_ID = return_vals[1].data.d_item;
537 
538   gimp_destroy_params (return_vals, nreturn_vals);
539 
540   return ret_item_ID;
541 }
542 
543 /**
544  * gimp_item_transform_2d:
545  * @item_ID: The affected item.
546  * @source_x: X coordinate of the transformation center.
547  * @source_y: Y coordinate of the transformation center.
548  * @scale_x: Amount to scale in x direction.
549  * @scale_y: Amount to scale in y direction.
550  * @angle: The angle of rotation (radians).
551  * @dest_x: X coordinate of where the center goes.
552  * @dest_y: Y coordinate of where the center goes.
553  *
554  * Transform the specified item in 2d.
555  *
556  * This procedure transforms the specified item.
557  *
558  * The transformation is done by scaling by the x and y scale factors
559  * about the point (source_x, source_y), then rotating around the same
560  * point, then translating that point to the new position (dest_x,
561  * dest_y).
562  *
563  * If a selection exists and the item is a drawable, the portion of the
564  * drawable which lies under the selection is cut from the drawable and
565  * made into a floating selection which is then transformed as
566  * specified. The return value is the ID of the transformed floating
567  * selection.
568  *
569  * If there is no selection or the item is not a drawable, the entire
570  * item will be transformed according to the specified parameters.
571  * Additionally, if the item has its linked flag set to TRUE, all
572  * additional items contained in the image which have the linked flag
573  * set to TRUE will also be transformed the same way. The return value
574  * will be equal to the item ID supplied as input.
575  *
576  * This procedure is affected by the following context setters:
577  * gimp_context_set_interpolation(),
578  * gimp_context_set_transform_direction(),
579  * gimp_context_set_transform_resize().
580  *
581  * Returns: The transformed item.
582  *
583  * Since: 2.8
584  **/
585 gint32
gimp_item_transform_2d(gint32 item_ID,gdouble source_x,gdouble source_y,gdouble scale_x,gdouble scale_y,gdouble angle,gdouble dest_x,gdouble dest_y)586 gimp_item_transform_2d (gint32  item_ID,
587                         gdouble source_x,
588                         gdouble source_y,
589                         gdouble scale_x,
590                         gdouble scale_y,
591                         gdouble angle,
592                         gdouble dest_x,
593                         gdouble dest_y)
594 {
595   GimpParam *return_vals;
596   gint nreturn_vals;
597   gint32 ret_item_ID = -1;
598 
599   return_vals = gimp_run_procedure ("gimp-item-transform-2d",
600                                     &nreturn_vals,
601                                     GIMP_PDB_ITEM, item_ID,
602                                     GIMP_PDB_FLOAT, source_x,
603                                     GIMP_PDB_FLOAT, source_y,
604                                     GIMP_PDB_FLOAT, scale_x,
605                                     GIMP_PDB_FLOAT, scale_y,
606                                     GIMP_PDB_FLOAT, angle,
607                                     GIMP_PDB_FLOAT, dest_x,
608                                     GIMP_PDB_FLOAT, dest_y,
609                                     GIMP_PDB_END);
610 
611   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
612     ret_item_ID = return_vals[1].data.d_item;
613 
614   gimp_destroy_params (return_vals, nreturn_vals);
615 
616   return ret_item_ID;
617 }
618 
619 /**
620  * gimp_item_transform_matrix:
621  * @item_ID: The affected item.
622  * @coeff_0_0: coefficient (0,0) of the transformation matrix.
623  * @coeff_0_1: coefficient (0,1) of the transformation matrix.
624  * @coeff_0_2: coefficient (0,2) of the transformation matrix.
625  * @coeff_1_0: coefficient (1,0) of the transformation matrix.
626  * @coeff_1_1: coefficient (1,1) of the transformation matrix.
627  * @coeff_1_2: coefficient (1,2) of the transformation matrix.
628  * @coeff_2_0: coefficient (2,0) of the transformation matrix.
629  * @coeff_2_1: coefficient (2,1) of the transformation matrix.
630  * @coeff_2_2: coefficient (2,2) of the transformation matrix.
631  *
632  * Transform the specified item in 2d.
633  *
634  * This procedure transforms the specified item.
635  *
636  * The transformation is done by assembling a 3x3 matrix from the
637  * coefficients passed.
638  *
639  * If a selection exists and the item is a drawable, the portion of the
640  * drawable which lies under the selection is cut from the drawable and
641  * made into a floating selection which is then transformed as
642  * specified. The return value is the ID of the transformed floating
643  * selection.
644  *
645  * If there is no selection or the item is not a drawable, the entire
646  * item will be transformed according to the specified matrix.
647  * Additionally, if the item has its linked flag set to TRUE, all
648  * additional items contained in the image which have the linked flag
649  * set to TRUE will also be transformed the same way. The return value
650  * will be equal to the item ID supplied as input.
651  *
652  * This procedure is affected by the following context setters:
653  * gimp_context_set_interpolation(),
654  * gimp_context_set_transform_direction(),
655  * gimp_context_set_transform_resize().
656  *
657  * Returns: The transformed item.
658  *
659  * Since: 2.8
660  **/
661 gint32
gimp_item_transform_matrix(gint32 item_ID,gdouble coeff_0_0,gdouble coeff_0_1,gdouble coeff_0_2,gdouble coeff_1_0,gdouble coeff_1_1,gdouble coeff_1_2,gdouble coeff_2_0,gdouble coeff_2_1,gdouble coeff_2_2)662 gimp_item_transform_matrix (gint32  item_ID,
663                             gdouble coeff_0_0,
664                             gdouble coeff_0_1,
665                             gdouble coeff_0_2,
666                             gdouble coeff_1_0,
667                             gdouble coeff_1_1,
668                             gdouble coeff_1_2,
669                             gdouble coeff_2_0,
670                             gdouble coeff_2_1,
671                             gdouble coeff_2_2)
672 {
673   GimpParam *return_vals;
674   gint nreturn_vals;
675   gint32 ret_item_ID = -1;
676 
677   return_vals = gimp_run_procedure ("gimp-item-transform-matrix",
678                                     &nreturn_vals,
679                                     GIMP_PDB_ITEM, item_ID,
680                                     GIMP_PDB_FLOAT, coeff_0_0,
681                                     GIMP_PDB_FLOAT, coeff_0_1,
682                                     GIMP_PDB_FLOAT, coeff_0_2,
683                                     GIMP_PDB_FLOAT, coeff_1_0,
684                                     GIMP_PDB_FLOAT, coeff_1_1,
685                                     GIMP_PDB_FLOAT, coeff_1_2,
686                                     GIMP_PDB_FLOAT, coeff_2_0,
687                                     GIMP_PDB_FLOAT, coeff_2_1,
688                                     GIMP_PDB_FLOAT, coeff_2_2,
689                                     GIMP_PDB_END);
690 
691   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
692     ret_item_ID = return_vals[1].data.d_item;
693 
694   gimp_destroy_params (return_vals, nreturn_vals);
695 
696   return ret_item_ID;
697 }
698