gimpitemtransform_pdb.c 26.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimpitemtransform_pdb.c
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
18
 * <https://www.gnu.org/licenses/>.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 */

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

#include "config.h"

#include "gimp.h"


/**
 * SECTION: gimpitemtransform
 * @title: gimpitemtransform
 * @short_description: Functions to perform transformations on items.
 *
 * Functions to perform transformations on items.
 **/


37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
/**
 * gimp_item_transform_translate:
 * @item_ID: The item.
 * @off_x: Offset in x direction.
 * @off_y: Offset in y direction.
 *
 * Translate the item by the specified offsets.
 *
 * This procedure translates the item by the amounts specified in the
 * off_x and off_y arguments. These can be negative, and are considered
 * offsets from the current position. The offsets will be rounded to
 * the nearest pixel unless the item is a path.
 *
 * If the item is attached to an image and has its linked flag set to
 * TRUE, all additional items contained in the image which have the
 * linked flag set to TRUE will also be translated by the specified
 * offsets.
 *
 * Returns: The translated item.
 *
 * Since: 2.10
 **/
gint32
gimp_item_transform_translate (gint32  item_ID,
                               gdouble off_x,
                               gdouble off_y)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-translate",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, off_x,
                                    GIMP_PDB_FLOAT, off_y,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

83 84 85 86 87 88 89 90 91
/**
 * gimp_item_transform_flip_simple:
 * @item_ID: The affected item.
 * @flip_type: Type of flip.
 * @auto_center: Whether to automatically position the axis in the selection center.
 * @axis: coord. of flip axis.
 *
 * Flip the specified item either vertically or horizontally.
 *
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
 * This procedure flips the specified item.
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then flipped. If auto_center
 * is set to TRUE, the flip is around the selection's center.
 * Otherwise, the coordinate of the axis needs to be specified. The
 * return value is the ID of the flipped floating selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be flipped around its center if auto_center is set to
 * TRUE, otherwise the coordinate of the axis needs to be specified.
 * Additionally, if the item has its linked flag set to TRUE, all
 * additional items contained in the image which have the linked flag
 * set to TRUE will also be flipped around the same axis. The return
 * 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 113
 *
 * Returns: The flipped item.
 *
114
 * Since: 2.2
115
 **/
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
gint32
gimp_item_transform_flip_simple (gint32              item_ID,
                                 GimpOrientationType flip_type,
                                 gboolean            auto_center,
                                 gdouble             axis)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-flip-simple",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, flip_type,
                                    GIMP_PDB_INT32, auto_center,
                                    GIMP_PDB_FLOAT, axis,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_flip:
 * @item_ID: The affected item.
 * @x0: horz. coord. of one end of axis.
 * @y0: vert. coord. of one end of axis.
 * @x1: horz. coord. of other end of axis.
 * @y1: vert. coord. of other end of axis.
 *
 * Flip the specified item around a given line.
 *
152 153 154 155 156 157 158 159 160 161 162 163 164 165
 * This procedure flips the specified item.
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then flipped. The axis to
 * flip around is specified by specifying two points from that line.
 * The return value is the ID of the flipped floating selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be flipped around the specified axis. Additionally, if the
 * item has its linked flag set to TRUE, all additional items contained
 * in the image which have the linked flag set to TRUE will also be
 * flipped around the same axis. The return value will be equal to the
 * item ID supplied as input.
166
 *
167 168
 * This procedure is affected by the following context setters:
 * gimp_context_set_interpolation(),
169
 * gimp_context_set_transform_direction(),
170
 * gimp_context_set_transform_resize().
171 172 173
 *
 * Returns: The flipped item.
 *
174
 * Since: 2.8
175
 **/
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
gint32
gimp_item_transform_flip (gint32  item_ID,
                          gdouble x0,
                          gdouble y0,
                          gdouble x1,
                          gdouble y1)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-flip",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, x0,
                                    GIMP_PDB_FLOAT, y0,
                                    GIMP_PDB_FLOAT, x1,
                                    GIMP_PDB_FLOAT, y1,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_perspective:
 * @item_ID: The affected item.
 * @x0: The new x coordinate of upper-left corner of original bounding box.
 * @y0: The new y coordinate of upper-left corner of original bounding box.
 * @x1: The new x coordinate of upper-right corner of original bounding box.
 * @y1: The new y coordinate of upper-right corner of original bounding box.
 * @x2: The new x coordinate of lower-left corner of original bounding box.
 * @y2: The new y coordinate of lower-left corner of original bounding box.
 * @x3: The new x coordinate of lower-right corner of original bounding box.
 * @y3: The new y coordinate of lower-right corner of original bounding box.
 *
 * Perform a possibly non-affine transformation on the specified item.
 *
 * This procedure performs a possibly non-affine transformation on the
 * specified item by allowing the corners of the original bounding box
220 221 222 223 224 225 226 227 228 229
 * to be arbitrarily remapped to any values.
 *
 * The 4 coordinates specify the new locations of each corner of the
 * original bounding box. By specifying these values, any affine
 * transformation (rotation, scaling, translation) can be affected.
 * Additionally, these values can be specified such that the resulting
 * transformed item will appear to have been projected via a
 * perspective transform.
 *
 * 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 232 233 234 235 236 237 238 239 240
 * made into a floating selection which is then transformed as
 * specified. The return value is the ID of the transformed floating
 * selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be transformed according to the specified mapping.
 * Additionally, if the item has its linked flag set to TRUE, all
 * additional items contained in the image which have the linked flag
 * set to TRUE will also be transformed the same way. The return value
 * will be equal to the item ID supplied as input.
241
 *
242 243
 * This procedure is affected by the following context setters:
 * 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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
gint32
gimp_item_transform_perspective (gint32  item_ID,
                                 gdouble x0,
                                 gdouble y0,
                                 gdouble x1,
                                 gdouble y1,
                                 gdouble x2,
                                 gdouble y2,
                                 gdouble x3,
                                 gdouble y3)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-perspective",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, x0,
                                    GIMP_PDB_FLOAT, y0,
                                    GIMP_PDB_FLOAT, x1,
                                    GIMP_PDB_FLOAT, y1,
                                    GIMP_PDB_FLOAT, x2,
                                    GIMP_PDB_FLOAT, y2,
                                    GIMP_PDB_FLOAT, x3,
                                    GIMP_PDB_FLOAT, y3,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_rotate_simple:
 * @item_ID: The affected item.
 * @rotate_type: Type of rotation.
 * @auto_center: Whether to automatically rotate around the selection center.
 * @center_x: The hor. coordinate of the center of rotation.
 * @center_y: The vert. coordinate of the center of rotation.
 *
 * Rotate the specified item about given coordinates through the
 * specified angle.
 *
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
 * This function rotates the specified item.
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then rotated by the
 * specified amount. If auto_center is set to TRUE, the rotation is
 * around the selection's center. Otherwise, the coordinate of the
 * center point needs to be specified. The return value is the ID of
 * the rotated floating selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be rotated around its center if auto_center is set to
 * TRUE, otherwise the coordinate of the center point needs to be
 * specified. Additionally, if the item has its linked flag set to
 * TRUE, all additional items contained in the image which have the
 * linked flag set to TRUE will also be rotated around the same center
 * point. The return value will be equal to the item ID supplied as
 * input.
316
 *
317 318
 * This procedure is affected by the following context setters:
 * gimp_context_set_transform_resize().
319 320 321
 *
 * Returns: The rotated item.
 *
322
 * Since: 2.8
323
 **/
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
gint32
gimp_item_transform_rotate_simple (gint32           item_ID,
                                   GimpRotationType rotate_type,
                                   gboolean         auto_center,
                                   gdouble          center_x,
                                   gdouble          center_y)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-rotate-simple",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, rotate_type,
                                    GIMP_PDB_INT32, auto_center,
                                    GIMP_PDB_FLOAT, center_x,
                                    GIMP_PDB_FLOAT, center_y,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_rotate:
 * @item_ID: The affected item.
 * @angle: The angle of rotation (radians).
 * @auto_center: Whether to automatically rotate around the selection center.
 * @center_x: The hor. coordinate of the center of rotation.
 * @center_y: The vert. coordinate of the center of rotation.
 *
 * Rotate the specified item about given coordinates through the
 * specified angle.
 *
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
 * This function rotates the specified item.
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then rotated by the
 * specified amount. If auto_center is set to TRUE, the rotation is
 * around the selection's center. Otherwise, the coordinate of the
 * center point needs to be specified. The return value is the ID of
 * the rotated floating selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be rotated around its center if auto_center is set to
 * TRUE, otherwise the coordinate of the center point needs to be
 * specified. Additionally, if the item has its linked flag set to
 * TRUE, all additional items contained in the image which have the
 * linked flag set to TRUE will also be rotated around the same center
 * point. The return value will be equal to the item ID supplied as
 * input.
381
 *
382 383
 * This procedure is affected by the following context setters:
 * gimp_context_set_interpolation(),
384
 * gimp_context_set_transform_direction(),
385
 * gimp_context_set_transform_resize().
386 387 388
 *
 * Returns: The rotated item.
 *
389
 * Since: 2.8
390
 **/
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
gint32
gimp_item_transform_rotate (gint32   item_ID,
                            gdouble  angle,
                            gboolean auto_center,
                            gdouble  center_x,
                            gdouble  center_y)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-rotate",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, angle,
                                    GIMP_PDB_INT32, auto_center,
                                    GIMP_PDB_FLOAT, center_x,
                                    GIMP_PDB_FLOAT, center_y,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_scale:
 * @item_ID: The affected item.
 * @x0: The new x coordinate of the upper-left corner of the scaled region.
 * @y0: The new y coordinate of the upper-left corner of the scaled region.
 * @x1: The new x coordinate of the lower-right corner of the scaled region.
 * @y1: The new y coordinate of the lower-right corner of the scaled region.
 *
 * Scale the specified item.
 *
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
 * This procedure scales the specified item.
 *
 * The 2 coordinates specify the new locations of the top-left and
 * bottom-roght corners of the original bounding box.
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then scaled as specified.
 * The return value is the ID of the scaled floating selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be scaled according to the specified coordinates.
 * Additionally, if the item has its linked flag set to TRUE, all
 * additional items contained in the image which have the linked flag
 * set to TRUE will also be scaled the same way. The return value will
 * be equal to the item ID supplied as input.
445
 *
446 447
 * This procedure is affected by the following context setters:
 * gimp_context_set_interpolation(),
448
 * gimp_context_set_transform_direction(),
449
 * gimp_context_set_transform_resize().
450 451 452
 *
 * Returns: The scaled item.
 *
453
 * Since: 2.8
454
 **/
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
gint32
gimp_item_transform_scale (gint32  item_ID,
                           gdouble x0,
                           gdouble y0,
                           gdouble x1,
                           gdouble y1)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-scale",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, x0,
                                    GIMP_PDB_FLOAT, y0,
                                    GIMP_PDB_FLOAT, x1,
                                    GIMP_PDB_FLOAT, y1,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_shear:
 * @item_ID: The affected item.
 * @shear_type: Type of shear.
 * @magnitude: The magnitude of the shear.
 *
 * Shear the specified item about its center by the specified
 * magnitude.
 *
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
 * This procedure shears the specified item.
 *
 * The shear type parameter indicates whether the shear will be applied
 * horizontally or vertically. The magnitude can be either positive or
 * negative and indicates the extent (in pixels) to shear by.
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then sheared as specified.
 * The return value is the ID of the sheared floating selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be sheared according to the specified parameters.
 * Additionally, if the item has its linked flag set to TRUE, all
 * additional items contained in the image which have the linked flag
 * set to TRUE will also be sheared the same way. The return value will
 * be equal to the item ID supplied as input.
509
 *
510
 * This procedure is affected by the following context setters:
511 512
 * gimp_context_set_interpolation(),
 * gimp_context_set_transform_direction(),
513
 * gimp_context_set_transform_resize().
514 515 516
 *
 * Returns: The sheared item.
 *
517
 * Since: 2.8
518
 **/
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
gint32
gimp_item_transform_shear (gint32              item_ID,
                           GimpOrientationType shear_type,
                           gdouble             magnitude)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-shear",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, shear_type,
                                    GIMP_PDB_FLOAT, magnitude,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_2d:
 * @item_ID: The affected item.
 * @source_x: X coordinate of the transformation center.
 * @source_y: Y coordinate of the transformation center.
 * @scale_x: Amount to scale in x direction.
 * @scale_y: Amount to scale in y direction.
 * @angle: The angle of rotation (radians).
 * @dest_x: X coordinate of where the center goes.
 * @dest_y: Y coordinate of where the center goes.
 *
 * Transform the specified item in 2d.
 *
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574
 * This procedure transforms the specified item.
 *
 * The transformation is done by scaling by the x and y scale factors
 * about the point (source_x, source_y), then rotating around the same
 * point, then translating that point to the new position (dest_x,
 * dest_y).
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then transformed as
 * specified. The return value is the ID of the transformed floating
 * selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be transformed according to the specified parameters.
 * Additionally, if the item has its linked flag set to TRUE, all
 * additional items contained in the image which have the linked flag
 * set to TRUE will also be transformed the same way. The return value
 * will be equal to the item ID supplied as input.
575
 *
576 577
 * This procedure is affected by the following context setters:
 * gimp_context_set_interpolation(),
578
 * gimp_context_set_transform_direction(),
579
 * gimp_context_set_transform_resize().
580 581 582
 *
 * Returns: The transformed item.
 *
583
 * Since: 2.8
584
 **/
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
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)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-2d",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, source_x,
                                    GIMP_PDB_FLOAT, source_y,
                                    GIMP_PDB_FLOAT, scale_x,
                                    GIMP_PDB_FLOAT, scale_y,
                                    GIMP_PDB_FLOAT, angle,
                                    GIMP_PDB_FLOAT, dest_x,
                                    GIMP_PDB_FLOAT, dest_y,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}

/**
 * gimp_item_transform_matrix:
 * @item_ID: The affected item.
 * @coeff_0_0: coefficient (0,0) of the transformation matrix.
 * @coeff_0_1: coefficient (0,1) of the transformation matrix.
 * @coeff_0_2: coefficient (0,2) of the transformation matrix.
 * @coeff_1_0: coefficient (1,0) of the transformation matrix.
 * @coeff_1_1: coefficient (1,1) of the transformation matrix.
 * @coeff_1_2: coefficient (1,2) of the transformation matrix.
 * @coeff_2_0: coefficient (2,0) of the transformation matrix.
 * @coeff_2_1: coefficient (2,1) of the transformation matrix.
 * @coeff_2_2: coefficient (2,2) of the transformation matrix.
 *
 * Transform the specified item in 2d.
 *
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650
 * This procedure transforms the specified item.
 *
 * The transformation is done by assembling a 3x3 matrix from the
 * coefficients passed.
 *
 * If a selection exists and the item is a drawable, the portion of the
 * drawable which lies under the selection is cut from the drawable and
 * made into a floating selection which is then transformed as
 * specified. The return value is the ID of the transformed floating
 * selection.
 *
 * If there is no selection or the item is not a drawable, the entire
 * item will be transformed according to the specified matrix.
 * Additionally, if the item has its linked flag set to TRUE, all
 * additional items contained in the image which have the linked flag
 * set to TRUE will also be transformed the same way. The return value
 * will be equal to the item ID supplied as input.
651
 *
652 653
 * This procedure is affected by the following context setters:
 * gimp_context_set_interpolation(),
654
 * gimp_context_set_transform_direction(),
655
 * gimp_context_set_transform_resize().
656 657 658
 *
 * Returns: The transformed item.
 *
659
 * Since: 2.8
660
 **/
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697
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)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-matrix",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, coeff_0_0,
                                    GIMP_PDB_FLOAT, coeff_0_1,
                                    GIMP_PDB_FLOAT, coeff_0_2,
                                    GIMP_PDB_FLOAT, coeff_1_0,
                                    GIMP_PDB_FLOAT, coeff_1_1,
                                    GIMP_PDB_FLOAT, coeff_1_2,
                                    GIMP_PDB_FLOAT, coeff_2_0,
                                    GIMP_PDB_FLOAT, coeff_2_1,
                                    GIMP_PDB_FLOAT, coeff_2_2,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}