gimpcontext_pdb.c 47.2 KB
Newer Older
1 2 3 4 5
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimpcontext_pdb.c
 *
6
 * This library is free software: you can redistribute it and/or
7 8
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
9
 * version 3 of the License, or (at your option) any later version.
10 11 12 13 14 15 16
 *
 * 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
17 18
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
19 20
 */

21
/* NOTE: This file is auto-generated by pdbgen.pl */
22 23 24 25 26

#include "config.h"

#include "gimp.h"

27 28 29 30 31 32 33 34 35 36

/**
 * SECTION: gimpcontext
 * @title: gimpcontext
 * @short_description: Functions to manipulate a plug-in's context.
 *
 * Functions to manipulate a plug-in's context.
 **/


37 38 39 40 41 42 43
/**
 * gimp_context_push:
 *
 * Pushes a context to the top of the plug-in's context stack.
 *
 * This procedure creates a new context by copying the current context.
 * This copy becomes the new current context for the calling plug-in
44
 * until it is popped again using gimp_context_pop().
45 46 47 48
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
49
 **/
50 51 52 53 54 55 56
gboolean
gimp_context_push (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

57
  return_vals = gimp_run_procedure ("gimp-context-push",
58 59
                                    &nreturn_vals,
                                    GIMP_PDB_END);
60 61 62 63 64 65 66 67 68 69 70 71 72

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_pop:
 *
 * Pops the topmost context from the plug-in's context stack.
 *
73 74
 * This procedure removes the topmost context from the plug-in's
 * context stack. The context that was active before the corresponding
75
 * call to gimp_context_push() becomes the new current context of the
76
 * plug-in.
77 78 79 80
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
81
 **/
82 83 84 85 86 87 88
gboolean
gimp_context_pop (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

89
  return_vals = gimp_run_procedure ("gimp-context-pop",
90 91
                                    &nreturn_vals,
                                    GIMP_PDB_END);
92 93 94 95

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128

  return success;
}

/**
 * gimp_context_set_defaults:
 *
 * Reset context settings to their default values.
 *
 * This procedure resets context settings used by various procedures to
 * their default value. This procedure will usually be called after a
 * context push so that a script which calls procedures affected by
 * context settings will not be affected by changes in the global
 * context.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_set_defaults (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-defaults",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);
129 130 131

  return success;
}
132

133 134 135 136 137 138 139 140 141 142 143 144 145
/**
 * gimp_context_list_paint_methods:
 * @num_paint_methods: The number of the available paint methods.
 * @paint_methods: The names of the available paint methods.
 *
 * Lists the available paint methods.
 *
 * This procedure lists the names of the available paint methods. Any
 * of the results can be used for gimp_context_set_paint_method().
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.4
146
 **/
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
gboolean
gimp_context_list_paint_methods (gint    *num_paint_methods,
                                 gchar ***paint_methods)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;
  gint i;

  return_vals = gimp_run_procedure ("gimp-context-list-paint-methods",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  *num_paint_methods = 0;
  *paint_methods = NULL;

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    {
      *num_paint_methods = return_vals[1].data.d_int32;
      *paint_methods = g_new (gchar *, *num_paint_methods);
      for (i = 0; i < *num_paint_methods; i++)
        (*paint_methods)[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

178 179 180 181 182 183 184 185 186 187 188
/**
 * gimp_context_get_paint_method:
 *
 * Retrieve the currently active paint method.
 *
 * This procedure returns the name of the currently active paint
 * method.
 *
 * Returns: The name of the active paint method.
 *
 * Since: GIMP 2.4
189
 **/
190 191 192 193 194 195 196 197
gchar *
gimp_context_get_paint_method (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

  return_vals = gimp_run_procedure ("gimp-context-get-paint-method",
198 199
                                    &nreturn_vals,
                                    GIMP_PDB_END);
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    name = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_paint_method:
 * @name: The name of the paint method.
 *
 * Set the specified paint method as the active paint method.
 *
 * This procedure allows the active paint method to be set by
 * specifying its name. The name is simply a string which corresponds
 * to one of the names of the available paint methods. If there is no
 * matching method found, this procedure will return an error.
 * Otherwise, the specified method becomes active and will be used in
 * all subsequent paint operations.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.4
225
 **/
226 227 228 229 230 231 232 233
gboolean
gimp_context_set_paint_method (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-paint-method",
234 235 236
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
237 238 239 240 241 242 243 244

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

245 246 247 248 249 250
/**
 * gimp_context_get_foreground:
 * @foreground: The foreground color.
 *
 * Get the current GIMP foreground color.
 *
251
 * This procedure returns the current GIMP foreground color. The
252 253 254 255 256 257
 * foreground color is used in a variety of tools such as paint tools,
 * blending, and bucket fill.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
258
 **/
259 260 261 262 263 264 265
gboolean
gimp_context_get_foreground (GimpRGB *foreground)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

266
  return_vals = gimp_run_procedure ("gimp-context-get-foreground",
267 268
                                    &nreturn_vals,
                                    GIMP_PDB_END);
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    *foreground = return_vals[1].data.d_color;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_foreground:
 * @foreground: The foreground color.
 *
 * Set the current GIMP foreground color.
 *
 * This procedure sets the current GIMP foreground color. After this is
 * set, operations which use foreground such as paint tools, blending,
 * and bucket fill will use the new value.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
293
 **/
294 295 296 297 298 299 300
gboolean
gimp_context_set_foreground (const GimpRGB *foreground)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

301
  return_vals = gimp_run_procedure ("gimp-context-set-foreground",
302 303 304
                                    &nreturn_vals,
                                    GIMP_PDB_COLOR, foreground,
                                    GIMP_PDB_END);
305 306 307 308 309 310 311 312 313 314

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_background:
315
 * @background: The background color.
316 317 318
 *
 * Get the current GIMP background color.
 *
319
 * This procedure returns the current GIMP background color. The
320 321 322 323 324 325
 * background color is used in a variety of tools such as blending,
 * erasing (with non-alpha images), and image filling.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
326
 **/
327
gboolean
328
gimp_context_get_background (GimpRGB *background)
329 330 331 332 333
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

334
  return_vals = gimp_run_procedure ("gimp-context-get-background",
335 336
                                    &nreturn_vals,
                                    GIMP_PDB_END);
337 338 339 340

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
341
    *background = return_vals[1].data.d_color;
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_background:
 * @background: The background color.
 *
 * Set the current GIMP background color.
 *
 * This procedure sets the current GIMP background color. After this is
 * set, operations which use background such as blending, filling
 * images, clearing, and erasing (in non-alpha images) will use the new
 * value.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
362
 **/
363 364 365 366 367 368 369
gboolean
gimp_context_set_background (const GimpRGB *background)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

370
  return_vals = gimp_run_procedure ("gimp-context-set-background",
371 372 373
                                    &nreturn_vals,
                                    GIMP_PDB_COLOR, background,
                                    GIMP_PDB_END);
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_default_colors:
 *
 * Set the current GIMP foreground and background colors to black and
 * white.
 *
 * This procedure sets the current GIMP foreground and background
 * colors to their initial default values, black and white.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
394
 **/
395 396 397 398 399 400 401
gboolean
gimp_context_set_default_colors (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

402
  return_vals = gimp_run_procedure ("gimp-context-set-default-colors",
403 404
                                    &nreturn_vals,
                                    GIMP_PDB_END);
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_swap_colors:
 *
 * Swap the current GIMP foreground and background colors.
 *
 * This procedure swaps the current GIMP foreground and background
 * colors, so that the new foreground color becomes the old background
 * color and vice versa.
 *
 * Returns: TRUE on success.
423 424
 *
 * Since: GIMP 2.2
425
 **/
426 427 428 429 430 431 432
gboolean
gimp_context_swap_colors (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

433
  return_vals = gimp_run_procedure ("gimp-context-swap-colors",
434 435
                                    &nreturn_vals,
                                    GIMP_PDB_END);
436 437 438 439 440 441 442

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
443 444 445 446 447 448 449 450 451 452 453 454

/**
 * gimp_context_get_opacity:
 *
 * Get the opacity.
 *
 * This procedure returns the opacity setting. The return value is a
 * floating point number between 0 and 100.
 *
 * Returns: The opacity.
 *
 * Since: GIMP 2.2
455
 **/
456 457 458 459 460
gdouble
gimp_context_get_opacity (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
461
  gdouble opacity = 0.0;
462

463
  return_vals = gimp_run_procedure ("gimp-context-get-opacity",
464 465
                                    &nreturn_vals,
                                    GIMP_PDB_END);
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    opacity = return_vals[1].data.d_float;

  gimp_destroy_params (return_vals, nreturn_vals);

  return opacity;
}

/**
 * gimp_context_set_opacity:
 * @opacity: The opacity.
 *
 * Set the opacity.
 *
 * This procedure modifies the opacity setting. The value should be a
 * floating point number between 0 and 100.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
487
 **/
488 489 490 491 492 493 494
gboolean
gimp_context_set_opacity (gdouble opacity)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

495
  return_vals = gimp_run_procedure ("gimp-context-set-opacity",
496 497 498
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, opacity,
                                    GIMP_PDB_END);
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_paint_mode:
 *
 * Get the paint mode.
 *
 * This procedure returns the paint-mode setting. The return value is
 * an integer which corresponds to the values listed in the argument
 * description.
 *
 * Returns: The paint mode.
 *
 * Since: GIMP 2.2
519
 **/
520 521 522 523 524 525 526
GimpLayerModeEffects
gimp_context_get_paint_mode (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpLayerModeEffects paint_mode = 0;

527
  return_vals = gimp_run_procedure ("gimp-context-get-paint-mode",
528 529
                                    &nreturn_vals,
                                    GIMP_PDB_END);
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    paint_mode = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return paint_mode;
}

/**
 * gimp_context_set_paint_mode:
 * @paint_mode: The paint mode.
 *
 * Set the paint mode.
 *
 * This procedure modifies the paint_mode setting.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
550
 **/
551 552 553 554 555 556 557
gboolean
gimp_context_set_paint_mode (GimpLayerModeEffects paint_mode)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

558
  return_vals = gimp_run_procedure ("gimp-context-set-paint-mode",
559 560 561
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, paint_mode,
                                    GIMP_PDB_END);
562 563 564 565 566 567 568

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
569 570 571 572 573 574

/**
 * gimp_context_get_brush:
 *
 * Retrieve the currently active brush.
 *
575
 * This procedure returns the name of the currently active brush. All
576 577 578 579 580 581
 * paint operations and stroke operations use this brush to control the
 * application of paint to the image.
 *
 * Returns: The name of the active brush.
 *
 * Since: GIMP 2.2
582
 **/
583 584 585 586 587 588 589
gchar *
gimp_context_get_brush (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

590
  return_vals = gimp_run_procedure ("gimp-context-get-brush",
591 592
                                    &nreturn_vals,
                                    GIMP_PDB_END);
593 594 595 596 597 598 599 600 601 602 603

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    name = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_brush:
604
 * @name: The name of the brush.
605 606 607 608 609 610 611 612 613 614 615 616
 *
 * Set the specified brush as the active brush.
 *
 * This procedure allows the active brush to be set by specifying its
 * name. The name is simply a string which corresponds to one of the
 * names of the installed brushes. If there is no matching brush found,
 * this procedure will return an error. Otherwise, the specified brush
 * becomes active and will be used in all subsequent paint operations.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
617
 **/
618 619 620 621 622 623 624
gboolean
gimp_context_set_brush (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

625
  return_vals = gimp_run_procedure ("gimp-context-set-brush",
626 627 628
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
629 630 631 632 633 634 635 636

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 698 699 700 701 702 703 704
/**
 * gimp_context_get_dynamics:
 *
 * Retrieve the currently active paint dynamics.
 *
 * This procedure returns the name of the currently active paint
 * dynamics. All paint operations and stroke operations use this paint
 * dynamics to control the application of paint to the image.
 *
 * Returns: The name of the active paint dynamics.
 *
 * Since: GIMP 2.8
 **/
gchar *
gimp_context_get_dynamics (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

  return_vals = gimp_run_procedure ("gimp-context-get-dynamics",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    name = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_dynamics:
 * @name: The name of the paint dynamics.
 *
 * Set the specified paint dynamics as the active paint dynamics.
 *
 * This procedure allows the active paint dynamics to be set by
 * specifying its name. The name is simply a string which corresponds
 * to one of the names of the installed paint dynamics. If there is no
 * matching paint dynamics found, this procedure will return an error.
 * Otherwise, the specified paint dynamics becomes active and will be
 * used in all subsequent paint operations.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_set_dynamics (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-dynamics",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

705 706 707 708 709 710 711 712 713 714 715 716
/**
 * gimp_context_get_pattern:
 *
 * Retrieve the currently active pattern.
 *
 * This procedure returns name of the the currently active pattern. All
 * clone and bucket-fill operations with patterns will use this pattern
 * to control the application of paint to the image.
 *
 * Returns: The name of the active pattern.
 *
 * Since: GIMP 2.2
717
 **/
718 719 720 721 722 723 724
gchar *
gimp_context_get_pattern (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

725
  return_vals = gimp_run_procedure ("gimp-context-get-pattern",
726 727
                                    &nreturn_vals,
                                    GIMP_PDB_END);
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    name = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_pattern:
 * @name: The name of the pattern.
 *
 * Set the specified pattern as the active pattern.
 *
 * This procedure allows the active pattern to be set by specifying its
 * name. The name is simply a string which corresponds to one of the
 * names of the installed patterns. If there is no matching pattern
 * found, this procedure will return an error. Otherwise, the specified
 * pattern becomes active and will be used in all subsequent paint
 * operations.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
753
 **/
754 755 756 757 758 759 760
gboolean
gimp_context_set_pattern (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

761
  return_vals = gimp_run_procedure ("gimp-context-set-pattern",
762 763 764
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_gradient:
 *
 * Retrieve the currently active gradient.
 *
 * This procedure returns the name of the currently active gradient.
 *
 * Returns: The name of the active gradient.
 *
 * Since: GIMP 2.2
783
 **/
784 785 786 787 788 789 790
gchar *
gimp_context_get_gradient (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

791
  return_vals = gimp_run_procedure ("gimp-context-get-gradient",
792 793
                                    &nreturn_vals,
                                    GIMP_PDB_END);
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    name = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_gradient:
 * @name: The name of the gradient.
 *
 * Sets the specified gradient as the active gradient.
 *
 * This procedure lets you set the specified gradient as the active or
 * \"current\" one. The name is simply a string which corresponds to
 * one of the loaded gradients. If no matching gradient is found, this
 * procedure will return an error. Otherwise, the specified gradient
 * will become active and will be used for subsequent custom gradient
 * operations.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
819
 **/
820 821 822 823 824 825 826
gboolean
gimp_context_set_gradient (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

827
  return_vals = gimp_run_procedure ("gimp-context-set-gradient",
828 829 830
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_palette:
 *
 * Retrieve the currently active palette.
 *
 * This procedure returns the name of the the currently active palette.
 *
 * Returns: The name of the active palette.
 *
 * Since: GIMP 2.2
849
 **/
850 851 852 853 854 855 856
gchar *
gimp_context_get_palette (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

857
  return_vals = gimp_run_procedure ("gimp-context-get-palette",
858 859
                                    &nreturn_vals,
                                    GIMP_PDB_END);
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    name = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_palette:
 * @name: The name of the palette.
 *
 * Set the specified palette as the active palette.
 *
 * This procedure allows the active palette to be set by specifying its
 * name. The name is simply a string which corresponds to one of the
 * names of the installed palettes. If no matching palette is found,
 * this procedure will return an error. Otherwise, the specified
 * palette becomes active and will be used in all subsequent palette
 * operations.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
885
 **/
886 887 888 889 890 891 892
gboolean
gimp_context_set_palette (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

893
  return_vals = gimp_run_procedure ("gimp-context-set-palette",
894 895 896
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_font:
 *
 * Retrieve the currently active font.
 *
 * This procedure returns the name of the currently active font.
 *
 * Returns: The name of the active font.
 *
 * Since: GIMP 2.2
915
 **/
916 917 918 919 920 921 922
gchar *
gimp_context_get_font (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

923
  return_vals = gimp_run_procedure ("gimp-context-get-font",
924 925
                                    &nreturn_vals,
                                    GIMP_PDB_END);
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    name = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_font:
 * @name: The name of the font.
 *
 * Set the specified font as the active font.
 *
 * This procedure allows the active font to be set by specifying its
 * name. The name is simply a string which corresponds to one of the
 * names of the installed fonts. If no matching font is found, this
 * procedure will return an error. Otherwise, the specified font
 * becomes active and will be used in all subsequent font operations.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
950
 **/
951 952 953 954 955 956 957
gboolean
gimp_context_set_font (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

958
  return_vals = gimp_run_procedure ("gimp-context-set-font",
959 960 961
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
962 963 964 965 966 967 968

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
969 970 971 972 973 974 975 976 977 978 979

/**
 * gimp_context_get_antialias:
 *
 * Get the antialias setting.
 *
 * This procedure returns the antialias setting.
 *
 * Returns: The antialias setting.
 *
 * Since: GIMP 2.8
980
 **/
981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
gboolean
gimp_context_get_antialias (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean antialias = FALSE;

  return_vals = gimp_run_procedure ("gimp-context-get-antialias",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    antialias = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return antialias;
}

/**
 * gimp_context_set_antialias:
 * @antialias: The antialias setting.
 *
 * Set the antialias setting.
 *
1006 1007 1008 1009 1010
 * This procedure modifies the antialias setting. If antialiasing is
 * turned on, the edges of selected region will contain intermediate
 * values which give the appearance of a sharper, less pixelized edge.
 * This should be set as TRUE most of the time unless a binary-only
 * selection is wanted. This settings affects the following procedures:
1011 1012 1013
 * gimp_image_select_color(), gimp_image_select_contiguous_color(),
 * gimp_image_select_round_rectangle(), gimp_image_select_ellipse(),
 * gimp_image_select_polygon(), gimp_image_select_item().
1014 1015 1016 1017
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1018
 **/
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047
gboolean
gimp_context_set_antialias (gboolean antialias)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-antialias",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, antialias,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_feather:
 *
 * Get the feather setting.
 *
 * This procedure returns the feather setting.
 *
 * Returns: The feather setting.
 *
 * Since: GIMP 2.8
1048
 **/
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
gboolean
gimp_context_get_feather (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean feather = FALSE;

  return_vals = gimp_run_procedure ("gimp-context-get-feather",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    feather = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return feather;
}

/**
 * gimp_context_set_feather:
 * @feather: The feather setting.
 *
 * Set the feather setting.
 *
1074 1075 1076
 * This procedure modifies the feather setting. If the feather option
 * is enabled, selections will be blurred before combining. The blur is
 * a gaussian blur; its radii can be controlled using
1077 1078
 * gimp_context_set_feather_radius(). This setting affects the
 * following procedures: gimp_image_select_color(),
1079 1080 1081
 * gimp_image_select_contiguous_color(), gimp_image_select_rectangle(),
 * gimp_image_select_round_rectangle(), gimp_image_select_ellipse(),
 * gimp_image_select_polygon(), gimp_image_select_item().
1082 1083 1084 1085
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1086
 **/
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117
gboolean
gimp_context_set_feather (gboolean feather)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-feather",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, feather,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_feather_radius:
 * @feather_radius_x: The horizontal feather radius.
 * @feather_radius_y: The vertical feather radius.
 *
 * Get the feather radius setting.
 *
 * This procedure returns the feather radius setting.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1118
 **/
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
gboolean
gimp_context_get_feather_radius (gdouble *feather_radius_x,
                                 gdouble *feather_radius_y)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-get-feather-radius",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  *feather_radius_x = 0.0;
  *feather_radius_y = 0.0;

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    {
      *feather_radius_x = return_vals[1].data.d_float;
      *feather_radius_y = return_vals[2].data.d_float;
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_feather_radius:
 * @feather_radius_x: The horizontal feather radius.
 * @feather_radius_y: The vertical feather radius.
 *
 * Set the feather radius setting.
 *
1154
 * This procedure modifies the feather radius setting. This setting
1155
 * affects all procedures that are affected by
1156
 * gimp_context_set_feather().
1157 1158 1159 1160
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1161
 **/
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176
gboolean
gimp_context_set_feather_radius (gdouble feather_radius_x,
                                 gdouble feather_radius_y)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-feather-radius",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, feather_radius_x,
                                    GIMP_PDB_FLOAT, feather_radius_y,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_sample_merged:
 *
 * Get the sample merged setting.
 *
 * This procedure returns the sample merged setting.
 *
 * Returns: The sample merged setting.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_get_sample_merged (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean sample_merged = FALSE;

  return_vals = gimp_run_procedure ("gimp-context-get-sample-merged",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    sample_merged = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return sample_merged;
}

/**
 * gimp_context_set_sample_merged:
 * @sample_merged: The sample merged setting.
 *
 * Set the sample merged setting.
 *
 * This procedure modifies the sample merged setting. If an operation
 * depends on the colors of the pixels present in a drawable, like when
 * doing a seed fill, this setting controls whether the pixel data from
 * the specified drawable is used ('sample-merged' is FALSE), or the
 * pixel data from the composite image ('sample-merged' is TRUE. This
 * is equivalent to sampling for colors after merging all visible
 * layers). This setting affects the following procedures:
1226
 * gimp_image_select_color(), gimp_image_select_contiguous_color().
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_set_sample_merged (gboolean sample_merged)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-sample-merged",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, sample_merged,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_sample_criterion:
 *
 * Get the sample criterion setting.
 *
 * This procedure returns the sample criterion setting.
 *
 * Returns: The sample criterion setting.
 *
 * Since: GIMP 2.8
 **/
GimpSelectCriterion
gimp_context_get_sample_criterion (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpSelectCriterion sample_criterion = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-sample-criterion",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    sample_criterion = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return sample_criterion;
}

/**
 * gimp_context_set_sample_criterion:
 * @sample_criterion: The sample criterion setting.
 *
1285
 * Set the sample criterion setting.
1286 1287 1288 1289 1290 1291
 *
 * This procedure modifies the sample criterion setting. If an
 * operation depends on the colors of the pixels present in a drawable,
 * like when doing a seed fill, this setting controls how color
 * similarity is determined. SELECT_CRITERION_COMPOSITE is the default
 * value. This setting affects the following procedures:
1292
 * gimp_image_select_color(), gimp_image_select_contiguous_color().
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-sample-criterion",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, sample_criterion,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_sample_threshold:
 *
 * Get the sample threshold setting.
 *
 * This procedure returns the sample threshold setting.
 *
 * Returns: The sample threshold setting.
 *
 * Since: GIMP 2.8
 **/
gdouble
gimp_context_get_sample_threshold (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble sample_threshold = 0.0;

  return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    sample_threshold = return_vals[1].data.d_float;

  gimp_destroy_params (return_vals, nreturn_vals);

  return sample_threshold;
}

/**
 * gimp_context_set_sample_threshold:
 * @sample_threshold: The sample threshold setting.
 *
 * Set the sample threshold setting.
 *
 * This procedure modifies the sample threshold setting. If an
 * operation depends on the colors of the pixels present in a drawable,
 * like when doing a seed fill, this setting controls what is
 * \"sufficiently close\" to be considered a similar color. If the
 * sample threshold has not been set explicitly, the default threshold
 * set in gimprc will be used. This setting affects the following
1359 1360
 * procedures: gimp_image_select_color(),
 * gimp_image_select_contiguous_color().
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_set_sample_threshold (gdouble sample_threshold)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, sample_threshold,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_sample_threshold_int:
 *
 * Get the sample threshold setting as an integer value.
 *
 * This procedure returns the sample threshold setting as an integer
 * value. See gimp_context_get_sample_threshold().
 *
 * Returns: The sample threshold setting.
 *
 * Since: GIMP 2.8
 **/
gint
gimp_context_get_sample_threshold_int (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint sample_threshold = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold-int",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    sample_threshold = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return sample_threshold;
}

/**
 * gimp_context_set_sample_threshold_int:
 * @sample_threshold: The sample threshold setting.
 *
 * Set the sample threshold setting as an integer value.
 *
 * This procedure modifies the sample threshold setting as an integer
 * value. See gimp_context_set_sample_threshold().
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_set_sample_threshold_int (gint sample_threshold)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold-int",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, sample_threshold,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_sample_transparent:
 *
 * Get the sample transparent setting.
 *
 * This procedure returns the sample transparent setting.
 *
 * Returns: The sample transparent setting.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_get_sample_transparent (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean sample_transparent = FALSE;

  return_vals = gimp_run_procedure ("gimp-context-get-sample-transparent",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    sample_transparent = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return sample_transparent;
}

/**
 * gimp_context_set_sample_transparent:
 * @sample_transparent: The sample transparent setting.
 *
 * Set the sample transparent setting.
 *
 * This procedure modifies the sample transparent setting. If an
 * operation depends on the colors of the pixels present in a drawable,
 * like when doing a seed fill, this setting controls whether
 * transparency is considered to be a unique selectable color. When
 * this setting is TRUE, transparent areas can be selected or filled.
 * This setting affects the following procedures:
1490
 * gimp_image_select_color(), gimp_image_select_contiguous_color().
1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_context_set_sample_transparent (gboolean sample_transparent)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-sample-transparent",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, sample_transparent,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1509 1510 1511 1512 1513

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
1514 1515 1516 1517 1518 1519 1520 1521

/**
 * gimp_context_get_interpolation:
 *
 * Get the interpolation type.
 *
 * This procedure returns the interpolation setting. The return value
 * is an integer which corresponds to the values listed in the argument
1522 1523 1524
 * description. If the interpolation has not been set explicitly by
 * gimp_context_set_interpolation(), the default interpolation set in
 * gimprc will be used.
1525 1526 1527 1528
 *
 * Returns: The interpolation type.
 *
 * Since: GIMP 2.8
1529
 **/
1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554
GimpInterpolationType
gimp_context_get_interpolation (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpInterpolationType interpolation = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-interpolation",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    interpolation = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return interpolation;
}

/**
 * gimp_context_set_interpolation:
 * @interpolation: The interpolation type.
 *
 * Set the interpolation type.
 *
1555 1556 1557 1558 1559 1560 1561
 * This procedure modifies the interpolation setting. This setting
 * affects affects the following procedures:
 * gimp_item_transform_flip(), gimp_item_transform_perspective(),
 * gimp_item_transform_rotate(), gimp_item_transform_scale(),
 * gimp_item_transform_shear(), gimp_item_transform_2d(),
 * gimp_item_transform_matrix(), gimp_image_scale(),
 * gimp_layer_scale().
1562 1563 1564 1565
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1566
 **/
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597
gboolean
gimp_context_set_interpolation (GimpInterpolationType interpolation)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-interpolation",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, interpolation,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_transform_direction:
 *
 * Get the transform direction.
 *
 * This procedure returns the transform direction. The return value is
 * an integer which corresponds to the values listed in the argument
 * description.
 *
 * Returns: The transform direction.
 *
 * Since: GIMP 2.8
1598
 **/
1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623
GimpTransformDirection
gimp_context_get_transform_direction (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpTransformDirection transform_direction = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-transform-direction",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    transform_direction = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return transform_direction;
}

/**
 * gimp_context_set_transform_direction:
 * @transform_direction: The transform direction.
 *
 * Set the transform direction.
 *
1624 1625 1626 1627 1628 1629
 * This procedure modifies the transform direction setting. This
 * setting affects affects the following procedures:
 * gimp_item_transform_flip(), gimp_item_transform_perspective(),
 * gimp_item_transform_rotate(), gimp_item_transform_scale(),
 * gimp_item_transform_shear(), gimp_item_transform_2d(),
 * gimp_item_transform_matrix().
1630 1631 1632 1633
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1634
 **/
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665
gboolean
gimp_context_set_transform_direction (GimpTransformDirection transform_direction)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-transform-direction",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, transform_direction,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_transform_resize:
 *
 * Get the transform resize type.
 *
 * This procedure returns the transform resize setting. The return
 * value is an integer which corresponds to the values listed in the
 * argument description.
 *
 * Returns: The transform resize type.
 *
 * Since: GIMP 2.8
1666
 **/
1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694
GimpTransformResize
gimp_context_get_transform_resize (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpTransformResize transform_resize = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-transform-resize",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    transform_resize = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return transform_resize;
}

/**
 * gimp_context_set_transform_resize:
 * @transform_resize: The transform resize type.
 *
 * Set the transform resize type.
 *
 * This procedure modifies the transform resize setting. When
 * transforming pixels, if the result of a transform operation has a
 * different size than the original area, this setting determines how
1695 1696 1697 1698 1699 1700 1701
 * the resulting area is sized. This setting affects affects the
 * following procedures: gimp_item_transform_flip(),
 * gimp_item_transform_flip_simple(),
 * gimp_item_transform_perspective(), gimp_item_transform_rotate(),
 * gimp_item_transform_rotate_simple(), gimp_item_transform_scale(),
 * gimp_item_transform_shear(), gimp_item_transform_2d(),
 * gimp_item_transform_matrix().
1702 1703 1704 1705
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1706
 **/
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735
gboolean
gimp_context_set_transform_resize (GimpTransformResize transform_resize)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-transform-resize",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, transform_resize,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_transform_recursion:
 *
 * Get the transform supersampling recursion.
 *
 * This procedure returns the transform supersampling recursion level.
 *
 * Returns: The transform recursion level.
 *
 * Since: GIMP 2.8
1736
 **/
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764
gint
gimp_context_get_transform_recursion (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint transform_recursion = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-transform-recursion",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    transform_recursion = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return transform_recursion;
}

/**
 * gimp_context_set_transform_recursion:
 * @transform_recursion: The transform recursion level.
 *
 * Set the transform supersampling recursion.
 *
 * This procedure modifies the transform supersampling recursion level
 * setting. Whether or not a transformation does supersampling is
 * determined by the interplolation type. The recursion level defaults
1765 1766 1767 1768 1769
 * to 3, which is a nice default value. This setting affects affects
 * the following procedures: gimp_item_transform_flip(),
 * gimp_item_transform_perspective(), gimp_item_transform_rotate(),
 * gimp_item_transform_scale(), gimp_item_transform_shear(),
 * gimp_item_transform_2d(), gimp_item_transform_matrix().
1770 1771 1772 1773
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
1774
 **/
1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792
gboolean
gimp_context_set_transform_recursion (gint transform_recursion)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-transform-recursion",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, transform_recursion,
                                    GIMP_PDB_END);

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}