1 /* LIBGIMP - The GIMP Library
2  * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
3  *
4  * gimpcontext_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 <string.h>
26 
27 #include "gimp.h"
28 
29 
30 /**
31  * SECTION: gimpcontext
32  * @title: gimpcontext
33  * @short_description: Functions to manipulate a plug-in's context.
34  *
35  * Functions to manipulate a plug-in's context.
36  **/
37 
38 
39 /**
40  * gimp_context_push:
41  *
42  * Pushes a context to the top of the plug-in's context stack.
43  *
44  * This procedure creates a new context by copying the current context.
45  * This copy becomes the new current context for the calling plug-in
46  * until it is popped again using gimp_context_pop().
47  *
48  * Returns: TRUE on success.
49  *
50  * Since: 2.2
51  **/
52 gboolean
gimp_context_push(void)53 gimp_context_push (void)
54 {
55   GimpParam *return_vals;
56   gint nreturn_vals;
57   gboolean success = TRUE;
58 
59   return_vals = gimp_run_procedure ("gimp-context-push",
60                                     &nreturn_vals,
61                                     GIMP_PDB_END);
62 
63   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
64 
65   gimp_destroy_params (return_vals, nreturn_vals);
66 
67   return success;
68 }
69 
70 /**
71  * gimp_context_pop:
72  *
73  * Pops the topmost context from the plug-in's context stack.
74  *
75  * This procedure removes the topmost context from the plug-in's
76  * context stack. The context that was active before the corresponding
77  * call to gimp_context_push() becomes the new current context of the
78  * plug-in.
79  *
80  * Returns: TRUE on success.
81  *
82  * Since: 2.2
83  **/
84 gboolean
gimp_context_pop(void)85 gimp_context_pop (void)
86 {
87   GimpParam *return_vals;
88   gint nreturn_vals;
89   gboolean success = TRUE;
90 
91   return_vals = gimp_run_procedure ("gimp-context-pop",
92                                     &nreturn_vals,
93                                     GIMP_PDB_END);
94 
95   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
96 
97   gimp_destroy_params (return_vals, nreturn_vals);
98 
99   return success;
100 }
101 
102 /**
103  * gimp_context_set_defaults:
104  *
105  * Reset context settings to their default values.
106  *
107  * This procedure resets context settings used by various procedures to
108  * their default value. This procedure will usually be called after a
109  * context push so that a script which calls procedures affected by
110  * context settings will not be affected by changes in the global
111  * context.
112  *
113  * Returns: TRUE on success.
114  *
115  * Since: 2.8
116  **/
117 gboolean
gimp_context_set_defaults(void)118 gimp_context_set_defaults (void)
119 {
120   GimpParam *return_vals;
121   gint nreturn_vals;
122   gboolean success = TRUE;
123 
124   return_vals = gimp_run_procedure ("gimp-context-set-defaults",
125                                     &nreturn_vals,
126                                     GIMP_PDB_END);
127 
128   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
129 
130   gimp_destroy_params (return_vals, nreturn_vals);
131 
132   return success;
133 }
134 
135 /**
136  * gimp_context_list_paint_methods:
137  * @num_paint_methods: The number of the available paint methods.
138  * @paint_methods: The names of the available paint methods.
139  *
140  * Lists the available paint methods.
141  *
142  * This procedure lists the names of the available paint methods. Any
143  * of the results can be used for gimp_context_set_paint_method().
144  *
145  * Returns: TRUE on success.
146  *
147  * Since: 2.4
148  **/
149 gboolean
gimp_context_list_paint_methods(gint * num_paint_methods,gchar *** paint_methods)150 gimp_context_list_paint_methods (gint    *num_paint_methods,
151                                  gchar ***paint_methods)
152 {
153   GimpParam *return_vals;
154   gint nreturn_vals;
155   gboolean success = TRUE;
156   gint i;
157 
158   return_vals = gimp_run_procedure ("gimp-context-list-paint-methods",
159                                     &nreturn_vals,
160                                     GIMP_PDB_END);
161 
162   *num_paint_methods = 0;
163   *paint_methods = NULL;
164 
165   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
166 
167   if (success)
168     {
169       *num_paint_methods = return_vals[1].data.d_int32;
170       if (*num_paint_methods > 0)
171         {
172           *paint_methods = g_new0 (gchar *, *num_paint_methods + 1);
173           for (i = 0; i < *num_paint_methods; i++)
174             (*paint_methods)[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
175         }
176     }
177 
178   gimp_destroy_params (return_vals, nreturn_vals);
179 
180   return success;
181 }
182 
183 /**
184  * gimp_context_get_paint_method:
185  *
186  * Retrieve the currently active paint method.
187  *
188  * This procedure returns the name of the currently active paint
189  * method.
190  *
191  * Returns: The name of the active paint method.
192  *
193  * Since: 2.4
194  **/
195 gchar *
gimp_context_get_paint_method(void)196 gimp_context_get_paint_method (void)
197 {
198   GimpParam *return_vals;
199   gint nreturn_vals;
200   gchar *name = NULL;
201 
202   return_vals = gimp_run_procedure ("gimp-context-get-paint-method",
203                                     &nreturn_vals,
204                                     GIMP_PDB_END);
205 
206   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
207     name = g_strdup (return_vals[1].data.d_string);
208 
209   gimp_destroy_params (return_vals, nreturn_vals);
210 
211   return name;
212 }
213 
214 /**
215  * gimp_context_set_paint_method:
216  * @name: The name of the paint method.
217  *
218  * Set the specified paint method as the active paint method.
219  *
220  * This procedure allows the active paint method to be set by
221  * specifying its name. The name is simply a string which corresponds
222  * to one of the names of the available paint methods. If there is no
223  * matching method found, this procedure will return an error.
224  * Otherwise, the specified method becomes active and will be used in
225  * all subsequent paint operations.
226  *
227  * Returns: TRUE on success.
228  *
229  * Since: 2.4
230  **/
231 gboolean
gimp_context_set_paint_method(const gchar * name)232 gimp_context_set_paint_method (const gchar *name)
233 {
234   GimpParam *return_vals;
235   gint nreturn_vals;
236   gboolean success = TRUE;
237 
238   return_vals = gimp_run_procedure ("gimp-context-set-paint-method",
239                                     &nreturn_vals,
240                                     GIMP_PDB_STRING, name,
241                                     GIMP_PDB_END);
242 
243   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
244 
245   gimp_destroy_params (return_vals, nreturn_vals);
246 
247   return success;
248 }
249 
250 /**
251  * gimp_context_get_stroke_method:
252  *
253  * Retrieve the currently active stroke method.
254  *
255  * This procedure returns the currently active stroke method.
256  *
257  * Returns: The active stroke method.
258  *
259  * Since: 2.10
260  **/
261 GimpStrokeMethod
gimp_context_get_stroke_method(void)262 gimp_context_get_stroke_method (void)
263 {
264   GimpParam *return_vals;
265   gint nreturn_vals;
266   GimpStrokeMethod stroke_method = 0;
267 
268   return_vals = gimp_run_procedure ("gimp-context-get-stroke-method",
269                                     &nreturn_vals,
270                                     GIMP_PDB_END);
271 
272   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
273     stroke_method = return_vals[1].data.d_int32;
274 
275   gimp_destroy_params (return_vals, nreturn_vals);
276 
277   return stroke_method;
278 }
279 
280 /**
281  * gimp_context_set_stroke_method:
282  * @stroke_method: The new stroke method.
283  *
284  * Set the specified stroke method as the active stroke method.
285  *
286  * This procedure set the specified stroke method as the active stroke
287  * method. The new method will be used in all subsequent stroke
288  * operations.
289  *
290  * Returns: TRUE on success.
291  *
292  * Since: 2.10
293  **/
294 gboolean
gimp_context_set_stroke_method(GimpStrokeMethod stroke_method)295 gimp_context_set_stroke_method (GimpStrokeMethod stroke_method)
296 {
297   GimpParam *return_vals;
298   gint nreturn_vals;
299   gboolean success = TRUE;
300 
301   return_vals = gimp_run_procedure ("gimp-context-set-stroke-method",
302                                     &nreturn_vals,
303                                     GIMP_PDB_INT32, stroke_method,
304                                     GIMP_PDB_END);
305 
306   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
307 
308   gimp_destroy_params (return_vals, nreturn_vals);
309 
310   return success;
311 }
312 
313 /**
314  * gimp_context_get_foreground:
315  * @foreground: The foreground color.
316  *
317  * Get the current GIMP foreground color.
318  *
319  * This procedure returns the current GIMP foreground color. The
320  * foreground color is used in a variety of tools such as paint tools,
321  * blending, and bucket fill.
322  *
323  * Returns: TRUE on success.
324  *
325  * Since: 2.2
326  **/
327 gboolean
gimp_context_get_foreground(GimpRGB * foreground)328 gimp_context_get_foreground (GimpRGB *foreground)
329 {
330   GimpParam *return_vals;
331   gint nreturn_vals;
332   gboolean success = TRUE;
333 
334   return_vals = gimp_run_procedure ("gimp-context-get-foreground",
335                                     &nreturn_vals,
336                                     GIMP_PDB_END);
337 
338   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
339 
340   if (success)
341     *foreground = return_vals[1].data.d_color;
342 
343   gimp_destroy_params (return_vals, nreturn_vals);
344 
345   return success;
346 }
347 
348 /**
349  * gimp_context_set_foreground:
350  * @foreground: The foreground color.
351  *
352  * Set the current GIMP foreground color.
353  *
354  * This procedure sets the current GIMP foreground color. After this is
355  * set, operations which use foreground such as paint tools, blending,
356  * and bucket fill will use the new value.
357  *
358  * Returns: TRUE on success.
359  *
360  * Since: 2.2
361  **/
362 gboolean
gimp_context_set_foreground(const GimpRGB * foreground)363 gimp_context_set_foreground (const GimpRGB *foreground)
364 {
365   GimpParam *return_vals;
366   gint nreturn_vals;
367   gboolean success = TRUE;
368 
369   return_vals = gimp_run_procedure ("gimp-context-set-foreground",
370                                     &nreturn_vals,
371                                     GIMP_PDB_COLOR, foreground,
372                                     GIMP_PDB_END);
373 
374   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
375 
376   gimp_destroy_params (return_vals, nreturn_vals);
377 
378   return success;
379 }
380 
381 /**
382  * gimp_context_get_background:
383  * @background: The background color.
384  *
385  * Get the current GIMP background color.
386  *
387  * This procedure returns the current GIMP background color. The
388  * background color is used in a variety of tools such as blending,
389  * erasing (with non-alpha images), and image filling.
390  *
391  * Returns: TRUE on success.
392  *
393  * Since: 2.2
394  **/
395 gboolean
gimp_context_get_background(GimpRGB * background)396 gimp_context_get_background (GimpRGB *background)
397 {
398   GimpParam *return_vals;
399   gint nreturn_vals;
400   gboolean success = TRUE;
401 
402   return_vals = gimp_run_procedure ("gimp-context-get-background",
403                                     &nreturn_vals,
404                                     GIMP_PDB_END);
405 
406   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
407 
408   if (success)
409     *background = return_vals[1].data.d_color;
410 
411   gimp_destroy_params (return_vals, nreturn_vals);
412 
413   return success;
414 }
415 
416 /**
417  * gimp_context_set_background:
418  * @background: The background color.
419  *
420  * Set the current GIMP background color.
421  *
422  * This procedure sets the current GIMP background color. After this is
423  * set, operations which use background such as blending, filling
424  * images, clearing, and erasing (in non-alpha images) will use the new
425  * value.
426  *
427  * Returns: TRUE on success.
428  *
429  * Since: 2.2
430  **/
431 gboolean
gimp_context_set_background(const GimpRGB * background)432 gimp_context_set_background (const GimpRGB *background)
433 {
434   GimpParam *return_vals;
435   gint nreturn_vals;
436   gboolean success = TRUE;
437 
438   return_vals = gimp_run_procedure ("gimp-context-set-background",
439                                     &nreturn_vals,
440                                     GIMP_PDB_COLOR, background,
441                                     GIMP_PDB_END);
442 
443   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
444 
445   gimp_destroy_params (return_vals, nreturn_vals);
446 
447   return success;
448 }
449 
450 /**
451  * gimp_context_set_default_colors:
452  *
453  * Set the current GIMP foreground and background colors to black and
454  * white.
455  *
456  * This procedure sets the current GIMP foreground and background
457  * colors to their initial default values, black and white.
458  *
459  * Returns: TRUE on success.
460  *
461  * Since: 2.2
462  **/
463 gboolean
gimp_context_set_default_colors(void)464 gimp_context_set_default_colors (void)
465 {
466   GimpParam *return_vals;
467   gint nreturn_vals;
468   gboolean success = TRUE;
469 
470   return_vals = gimp_run_procedure ("gimp-context-set-default-colors",
471                                     &nreturn_vals,
472                                     GIMP_PDB_END);
473 
474   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
475 
476   gimp_destroy_params (return_vals, nreturn_vals);
477 
478   return success;
479 }
480 
481 /**
482  * gimp_context_swap_colors:
483  *
484  * Swap the current GIMP foreground and background colors.
485  *
486  * This procedure swaps the current GIMP foreground and background
487  * colors, so that the new foreground color becomes the old background
488  * color and vice versa.
489  *
490  * Returns: TRUE on success.
491  *
492  * Since: 2.2
493  **/
494 gboolean
gimp_context_swap_colors(void)495 gimp_context_swap_colors (void)
496 {
497   GimpParam *return_vals;
498   gint nreturn_vals;
499   gboolean success = TRUE;
500 
501   return_vals = gimp_run_procedure ("gimp-context-swap-colors",
502                                     &nreturn_vals,
503                                     GIMP_PDB_END);
504 
505   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
506 
507   gimp_destroy_params (return_vals, nreturn_vals);
508 
509   return success;
510 }
511 
512 /**
513  * gimp_context_get_opacity:
514  *
515  * Get the opacity.
516  *
517  * This procedure returns the opacity setting. The return value is a
518  * floating point number between 0 and 100.
519  *
520  * Returns: The opacity.
521  *
522  * Since: 2.2
523  **/
524 gdouble
gimp_context_get_opacity(void)525 gimp_context_get_opacity (void)
526 {
527   GimpParam *return_vals;
528   gint nreturn_vals;
529   gdouble opacity = 0.0;
530 
531   return_vals = gimp_run_procedure ("gimp-context-get-opacity",
532                                     &nreturn_vals,
533                                     GIMP_PDB_END);
534 
535   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
536     opacity = return_vals[1].data.d_float;
537 
538   gimp_destroy_params (return_vals, nreturn_vals);
539 
540   return opacity;
541 }
542 
543 /**
544  * gimp_context_set_opacity:
545  * @opacity: The opacity.
546  *
547  * Set the opacity.
548  *
549  * This procedure modifies the opacity setting. The value should be a
550  * floating point number between 0 and 100.
551  *
552  * Returns: TRUE on success.
553  *
554  * Since: 2.2
555  **/
556 gboolean
gimp_context_set_opacity(gdouble opacity)557 gimp_context_set_opacity (gdouble opacity)
558 {
559   GimpParam *return_vals;
560   gint nreturn_vals;
561   gboolean success = TRUE;
562 
563   return_vals = gimp_run_procedure ("gimp-context-set-opacity",
564                                     &nreturn_vals,
565                                     GIMP_PDB_FLOAT, opacity,
566                                     GIMP_PDB_END);
567 
568   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
569 
570   gimp_destroy_params (return_vals, nreturn_vals);
571 
572   return success;
573 }
574 
575 /**
576  * gimp_context_get_paint_mode:
577  *
578  * Get the paint mode.
579  *
580  * This procedure returns the paint-mode setting. The return value is
581  * an integer which corresponds to the values listed in the argument
582  * description.
583  *
584  * Returns: The paint mode.
585  *
586  * Since: 2.2
587  **/
588 GimpLayerMode
gimp_context_get_paint_mode(void)589 gimp_context_get_paint_mode (void)
590 {
591   GimpParam *return_vals;
592   gint nreturn_vals;
593   GimpLayerMode paint_mode = 0;
594 
595   return_vals = gimp_run_procedure ("gimp-context-get-paint-mode",
596                                     &nreturn_vals,
597                                     GIMP_PDB_END);
598 
599   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
600     paint_mode = return_vals[1].data.d_int32;
601 
602   gimp_destroy_params (return_vals, nreturn_vals);
603 
604   return paint_mode;
605 }
606 
607 /**
608  * gimp_context_set_paint_mode:
609  * @paint_mode: The paint mode.
610  *
611  * Set the paint mode.
612  *
613  * This procedure modifies the paint_mode setting.
614  *
615  * Returns: TRUE on success.
616  *
617  * Since: 2.2
618  **/
619 gboolean
gimp_context_set_paint_mode(GimpLayerMode paint_mode)620 gimp_context_set_paint_mode (GimpLayerMode paint_mode)
621 {
622   GimpParam *return_vals;
623   gint nreturn_vals;
624   gboolean success = TRUE;
625 
626   return_vals = gimp_run_procedure ("gimp-context-set-paint-mode",
627                                     &nreturn_vals,
628                                     GIMP_PDB_INT32, paint_mode,
629                                     GIMP_PDB_END);
630 
631   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
632 
633   gimp_destroy_params (return_vals, nreturn_vals);
634 
635   return success;
636 }
637 
638 /**
639  * gimp_context_get_line_width:
640  *
641  * Get the line width setting.
642  *
643  * This procedure returns the line width setting.
644  *
645  * Returns: The line width setting.
646  *
647  * Since: 2.10
648  **/
649 gdouble
gimp_context_get_line_width(void)650 gimp_context_get_line_width (void)
651 {
652   GimpParam *return_vals;
653   gint nreturn_vals;
654   gdouble line_width = 0.0;
655 
656   return_vals = gimp_run_procedure ("gimp-context-get-line-width",
657                                     &nreturn_vals,
658                                     GIMP_PDB_END);
659 
660   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
661     line_width = return_vals[1].data.d_float;
662 
663   gimp_destroy_params (return_vals, nreturn_vals);
664 
665   return line_width;
666 }
667 
668 /**
669  * gimp_context_set_line_width:
670  * @line_width: The line width setting.
671  *
672  * Set the line width setting.
673  *
674  * This procedure modifies the line width setting for stroking lines.
675  *
676  * This setting affects the following procedures:
677  * gimp_drawable_edit_stroke_selection(),
678  * gimp_drawable_edit_stroke_item().
679  *
680  * Returns: TRUE on success.
681  *
682  * Since: 2.10
683  **/
684 gboolean
gimp_context_set_line_width(gdouble line_width)685 gimp_context_set_line_width (gdouble line_width)
686 {
687   GimpParam *return_vals;
688   gint nreturn_vals;
689   gboolean success = TRUE;
690 
691   return_vals = gimp_run_procedure ("gimp-context-set-line-width",
692                                     &nreturn_vals,
693                                     GIMP_PDB_FLOAT, line_width,
694                                     GIMP_PDB_END);
695 
696   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
697 
698   gimp_destroy_params (return_vals, nreturn_vals);
699 
700   return success;
701 }
702 
703 /**
704  * gimp_context_get_line_width_unit:
705  *
706  * Get the line width unit setting.
707  *
708  * This procedure returns the line width unit setting.
709  *
710  * Returns: The line width unit setting.
711  *
712  * Since: 2.10
713  **/
714 GimpUnit
gimp_context_get_line_width_unit(void)715 gimp_context_get_line_width_unit (void)
716 {
717   GimpParam *return_vals;
718   gint nreturn_vals;
719   GimpUnit line_width_unit = 0;
720 
721   return_vals = gimp_run_procedure ("gimp-context-get-line-width-unit",
722                                     &nreturn_vals,
723                                     GIMP_PDB_END);
724 
725   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
726     line_width_unit = return_vals[1].data.d_unit;
727 
728   gimp_destroy_params (return_vals, nreturn_vals);
729 
730   return line_width_unit;
731 }
732 
733 /**
734  * gimp_context_set_line_width_unit:
735  * @line_width_unit: The line width setting unit.
736  *
737  * Set the line width unit setting.
738  *
739  * This procedure modifies the line width unit setting for stroking
740  * lines.
741  *
742  * This setting affects the following procedures:
743  * gimp_drawable_edit_stroke_selection(),
744  * gimp_drawable_edit_stroke_item().
745  *
746  * Returns: TRUE on success.
747  *
748  * Since: 2.10
749  **/
750 gboolean
gimp_context_set_line_width_unit(GimpUnit line_width_unit)751 gimp_context_set_line_width_unit (GimpUnit line_width_unit)
752 {
753   GimpParam *return_vals;
754   gint nreturn_vals;
755   gboolean success = TRUE;
756 
757   return_vals = gimp_run_procedure ("gimp-context-set-line-width-unit",
758                                     &nreturn_vals,
759                                     GIMP_PDB_INT32, line_width_unit,
760                                     GIMP_PDB_END);
761 
762   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
763 
764   gimp_destroy_params (return_vals, nreturn_vals);
765 
766   return success;
767 }
768 
769 /**
770  * gimp_context_get_line_cap_style:
771  *
772  * Get the line cap style setting.
773  *
774  * This procedure returns the line cap style setting.
775  *
776  * Returns: The line cap style setting.
777  *
778  * Since: 2.10
779  **/
780 GimpCapStyle
gimp_context_get_line_cap_style(void)781 gimp_context_get_line_cap_style (void)
782 {
783   GimpParam *return_vals;
784   gint nreturn_vals;
785   GimpCapStyle cap_style = 0;
786 
787   return_vals = gimp_run_procedure ("gimp-context-get-line-cap-style",
788                                     &nreturn_vals,
789                                     GIMP_PDB_END);
790 
791   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
792     cap_style = return_vals[1].data.d_int32;
793 
794   gimp_destroy_params (return_vals, nreturn_vals);
795 
796   return cap_style;
797 }
798 
799 /**
800  * gimp_context_set_line_cap_style:
801  * @cap_style: The line cap style setting.
802  *
803  * Set the line cap style setting.
804  *
805  * This procedure modifies the line cap style setting for stroking
806  * lines.
807  *
808  * This setting affects the following procedures:
809  * gimp_drawable_edit_stroke_selection(),
810  * gimp_drawable_edit_stroke_item().
811  *
812  * Returns: TRUE on success.
813  *
814  * Since: 2.10
815  **/
816 gboolean
gimp_context_set_line_cap_style(GimpCapStyle cap_style)817 gimp_context_set_line_cap_style (GimpCapStyle cap_style)
818 {
819   GimpParam *return_vals;
820   gint nreturn_vals;
821   gboolean success = TRUE;
822 
823   return_vals = gimp_run_procedure ("gimp-context-set-line-cap-style",
824                                     &nreturn_vals,
825                                     GIMP_PDB_INT32, cap_style,
826                                     GIMP_PDB_END);
827 
828   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
829 
830   gimp_destroy_params (return_vals, nreturn_vals);
831 
832   return success;
833 }
834 
835 /**
836  * gimp_context_get_line_join_style:
837  *
838  * Get the line join style setting.
839  *
840  * This procedure returns the line join style setting.
841  *
842  * Returns: The line join style setting.
843  *
844  * Since: 2.10
845  **/
846 GimpJoinStyle
gimp_context_get_line_join_style(void)847 gimp_context_get_line_join_style (void)
848 {
849   GimpParam *return_vals;
850   gint nreturn_vals;
851   GimpJoinStyle join_style = 0;
852 
853   return_vals = gimp_run_procedure ("gimp-context-get-line-join-style",
854                                     &nreturn_vals,
855                                     GIMP_PDB_END);
856 
857   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
858     join_style = return_vals[1].data.d_int32;
859 
860   gimp_destroy_params (return_vals, nreturn_vals);
861 
862   return join_style;
863 }
864 
865 /**
866  * gimp_context_set_line_join_style:
867  * @join_style: The line join style setting.
868  *
869  * Set the line join style setting.
870  *
871  * This procedure modifies the line join style setting for stroking
872  * lines.
873  *
874  * This setting affects the following procedures:
875  * gimp_drawable_edit_stroke_selection(),
876  * gimp_drawable_edit_stroke_item().
877  *
878  * Returns: TRUE on success.
879  *
880  * Since: 2.10
881  **/
882 gboolean
gimp_context_set_line_join_style(GimpJoinStyle join_style)883 gimp_context_set_line_join_style (GimpJoinStyle join_style)
884 {
885   GimpParam *return_vals;
886   gint nreturn_vals;
887   gboolean success = TRUE;
888 
889   return_vals = gimp_run_procedure ("gimp-context-set-line-join-style",
890                                     &nreturn_vals,
891                                     GIMP_PDB_INT32, join_style,
892                                     GIMP_PDB_END);
893 
894   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
895 
896   gimp_destroy_params (return_vals, nreturn_vals);
897 
898   return success;
899 }
900 
901 /**
902  * gimp_context_get_line_miter_limit:
903  *
904  * Get the line miter limit setting.
905  *
906  * This procedure returns the line miter limit setting.
907  *
908  * Returns: The line miter limit setting.
909  *
910  * Since: 2.10
911  **/
912 gdouble
gimp_context_get_line_miter_limit(void)913 gimp_context_get_line_miter_limit (void)
914 {
915   GimpParam *return_vals;
916   gint nreturn_vals;
917   gdouble miter_limit = 0.0;
918 
919   return_vals = gimp_run_procedure ("gimp-context-get-line-miter-limit",
920                                     &nreturn_vals,
921                                     GIMP_PDB_END);
922 
923   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
924     miter_limit = return_vals[1].data.d_float;
925 
926   gimp_destroy_params (return_vals, nreturn_vals);
927 
928   return miter_limit;
929 }
930 
931 /**
932  * gimp_context_set_line_miter_limit:
933  * @miter_limit: The line miter limit setting.
934  *
935  * Set the line miter limit setting.
936  *
937  * This procedure modifies the line miter limit setting for stroking
938  * lines.
939  * A mitered join is converted to a bevelled join if the miter would
940  * extend to a distance of more than (miter-limit * line-width) from
941  * the actual join point.
942  *
943  * This setting affects the following procedures:
944  * gimp_drawable_edit_stroke_selection(),
945  * gimp_drawable_edit_stroke_item().
946  *
947  * Returns: TRUE on success.
948  *
949  * Since: 2.10
950  **/
951 gboolean
gimp_context_set_line_miter_limit(gdouble miter_limit)952 gimp_context_set_line_miter_limit (gdouble miter_limit)
953 {
954   GimpParam *return_vals;
955   gint nreturn_vals;
956   gboolean success = TRUE;
957 
958   return_vals = gimp_run_procedure ("gimp-context-set-line-miter-limit",
959                                     &nreturn_vals,
960                                     GIMP_PDB_FLOAT, miter_limit,
961                                     GIMP_PDB_END);
962 
963   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
964 
965   gimp_destroy_params (return_vals, nreturn_vals);
966 
967   return success;
968 }
969 
970 /**
971  * gimp_context_get_line_dash_offset:
972  *
973  * Get the line dash offset setting.
974  *
975  * This procedure returns the line dash offset setting.
976  *
977  * Returns: The line dash offset setting.
978  *
979  * Since: 2.10
980  **/
981 gdouble
gimp_context_get_line_dash_offset(void)982 gimp_context_get_line_dash_offset (void)
983 {
984   GimpParam *return_vals;
985   gint nreturn_vals;
986   gdouble dash_offset = 0.0;
987 
988   return_vals = gimp_run_procedure ("gimp-context-get-line-dash-offset",
989                                     &nreturn_vals,
990                                     GIMP_PDB_END);
991 
992   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
993     dash_offset = return_vals[1].data.d_float;
994 
995   gimp_destroy_params (return_vals, nreturn_vals);
996 
997   return dash_offset;
998 }
999 
1000 /**
1001  * gimp_context_set_line_dash_offset:
1002  * @dash_offset: The line dash offset setting.
1003  *
1004  * Set the line dash offset setting.
1005  *
1006  * This procedure modifies the line dash offset setting for stroking
1007  * lines.
1008  *
1009  * This setting affects the following procedures:
1010  * gimp_drawable_edit_stroke_selection(),
1011  * gimp_drawable_edit_stroke_item().
1012  *
1013  * Returns: TRUE on success.
1014  *
1015  * Since: 2.10
1016  **/
1017 gboolean
gimp_context_set_line_dash_offset(gdouble dash_offset)1018 gimp_context_set_line_dash_offset (gdouble dash_offset)
1019 {
1020   GimpParam *return_vals;
1021   gint nreturn_vals;
1022   gboolean success = TRUE;
1023 
1024   return_vals = gimp_run_procedure ("gimp-context-set-line-dash-offset",
1025                                     &nreturn_vals,
1026                                     GIMP_PDB_FLOAT, dash_offset,
1027                                     GIMP_PDB_END);
1028 
1029   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1030 
1031   gimp_destroy_params (return_vals, nreturn_vals);
1032 
1033   return success;
1034 }
1035 
1036 /**
1037  * gimp_context_get_line_dash_pattern:
1038  * @num_dashes: The number of dashes in the dash_pattern array.
1039  * @dashes: The line dash pattern setting.
1040  *
1041  * Get the line dash pattern setting.
1042  *
1043  * This procedure returns the line dash pattern setting.
1044  *
1045  * Returns: TRUE on success.
1046  *
1047  * Since: 2.10
1048  **/
1049 gboolean
gimp_context_get_line_dash_pattern(gint * num_dashes,gdouble ** dashes)1050 gimp_context_get_line_dash_pattern (gint     *num_dashes,
1051                                     gdouble **dashes)
1052 {
1053   GimpParam *return_vals;
1054   gint nreturn_vals;
1055   gboolean success = TRUE;
1056 
1057   return_vals = gimp_run_procedure ("gimp-context-get-line-dash-pattern",
1058                                     &nreturn_vals,
1059                                     GIMP_PDB_END);
1060 
1061   *num_dashes = 0;
1062   *dashes = NULL;
1063 
1064   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1065 
1066   if (success)
1067     {
1068       *num_dashes = return_vals[1].data.d_int32;
1069       *dashes = g_new (gdouble, *num_dashes);
1070       memcpy (*dashes,
1071               return_vals[2].data.d_floatarray,
1072               *num_dashes * sizeof (gdouble));
1073     }
1074 
1075   gimp_destroy_params (return_vals, nreturn_vals);
1076 
1077   return success;
1078 }
1079 
1080 /**
1081  * gimp_context_set_line_dash_pattern:
1082  * @num_dashes: The number of dashes in the dash_pattern array.
1083  * @dashes: The line dash pattern setting.
1084  *
1085  * Set the line dash pattern setting.
1086  *
1087  * This procedure modifies the line dash pattern setting for stroking
1088  * lines.
1089  *
1090  * The unit of the dash pattern segments is the actual line width used
1091  * for the stroke operation, in other words a segment length of 1.0
1092  * results in a square segment shape (or gap shape).
1093  *
1094  * This setting affects the following procedures:
1095  * gimp_drawable_edit_stroke_selection_(),
1096  * gimp_drawable_edit_stroke_item().
1097  *
1098  * Returns: TRUE on success.
1099  *
1100  * Since: 2.10
1101  **/
1102 gboolean
gimp_context_set_line_dash_pattern(gint num_dashes,const gdouble * dashes)1103 gimp_context_set_line_dash_pattern (gint           num_dashes,
1104                                     const gdouble *dashes)
1105 {
1106   GimpParam *return_vals;
1107   gint nreturn_vals;
1108   gboolean success = TRUE;
1109 
1110   return_vals = gimp_run_procedure ("gimp-context-set-line-dash-pattern",
1111                                     &nreturn_vals,
1112                                     GIMP_PDB_INT32, num_dashes,
1113                                     GIMP_PDB_FLOATARRAY, dashes,
1114                                     GIMP_PDB_END);
1115 
1116   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1117 
1118   gimp_destroy_params (return_vals, nreturn_vals);
1119 
1120   return success;
1121 }
1122 
1123 /**
1124  * gimp_context_get_brush:
1125  *
1126  * Retrieve the currently active brush.
1127  *
1128  * This procedure returns the name of the currently active brush. All
1129  * paint operations and stroke operations use this brush to control the
1130  * application of paint to the image.
1131  *
1132  * Returns: The name of the active brush.
1133  *
1134  * Since: 2.2
1135  **/
1136 gchar *
gimp_context_get_brush(void)1137 gimp_context_get_brush (void)
1138 {
1139   GimpParam *return_vals;
1140   gint nreturn_vals;
1141   gchar *name = NULL;
1142 
1143   return_vals = gimp_run_procedure ("gimp-context-get-brush",
1144                                     &nreturn_vals,
1145                                     GIMP_PDB_END);
1146 
1147   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1148     name = g_strdup (return_vals[1].data.d_string);
1149 
1150   gimp_destroy_params (return_vals, nreturn_vals);
1151 
1152   return name;
1153 }
1154 
1155 /**
1156  * gimp_context_set_brush:
1157  * @name: The name of the brush.
1158  *
1159  * Set the specified brush as the active brush.
1160  *
1161  * This procedure allows the active brush to be set by specifying its
1162  * name. The name is simply a string which corresponds to one of the
1163  * names of the installed brushes. If there is no matching brush found,
1164  * this procedure will return an error. Otherwise, the specified brush
1165  * becomes active and will be used in all subsequent paint operations.
1166  *
1167  * Returns: TRUE on success.
1168  *
1169  * Since: 2.2
1170  **/
1171 gboolean
gimp_context_set_brush(const gchar * name)1172 gimp_context_set_brush (const gchar *name)
1173 {
1174   GimpParam *return_vals;
1175   gint nreturn_vals;
1176   gboolean success = TRUE;
1177 
1178   return_vals = gimp_run_procedure ("gimp-context-set-brush",
1179                                     &nreturn_vals,
1180                                     GIMP_PDB_STRING, name,
1181                                     GIMP_PDB_END);
1182 
1183   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1184 
1185   gimp_destroy_params (return_vals, nreturn_vals);
1186 
1187   return success;
1188 }
1189 
1190 /**
1191  * gimp_context_get_brush_size:
1192  *
1193  * Get brush size in pixels.
1194  *
1195  * Get the brush size in pixels for brush based paint tools.
1196  *
1197  * Returns: Brush size in pixels.
1198  *
1199  * Since: 2.8
1200  **/
1201 gdouble
gimp_context_get_brush_size(void)1202 gimp_context_get_brush_size (void)
1203 {
1204   GimpParam *return_vals;
1205   gint nreturn_vals;
1206   gdouble size = 0.0;
1207 
1208   return_vals = gimp_run_procedure ("gimp-context-get-brush-size",
1209                                     &nreturn_vals,
1210                                     GIMP_PDB_END);
1211 
1212   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1213     size = return_vals[1].data.d_float;
1214 
1215   gimp_destroy_params (return_vals, nreturn_vals);
1216 
1217   return size;
1218 }
1219 
1220 /**
1221  * gimp_context_set_brush_size:
1222  * @size: Brush size in pixels.
1223  *
1224  * Set brush size in pixels.
1225  *
1226  * Set the brush size in pixels for brush based paint tools.
1227  *
1228  * Returns: TRUE on success.
1229  *
1230  * Since: 2.8
1231  **/
1232 gboolean
gimp_context_set_brush_size(gdouble size)1233 gimp_context_set_brush_size (gdouble size)
1234 {
1235   GimpParam *return_vals;
1236   gint nreturn_vals;
1237   gboolean success = TRUE;
1238 
1239   return_vals = gimp_run_procedure ("gimp-context-set-brush-size",
1240                                     &nreturn_vals,
1241                                     GIMP_PDB_FLOAT, size,
1242                                     GIMP_PDB_END);
1243 
1244   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1245 
1246   gimp_destroy_params (return_vals, nreturn_vals);
1247 
1248   return success;
1249 }
1250 
1251 /**
1252  * gimp_context_set_brush_default_size:
1253  *
1254  * Set brush size to its default.
1255  *
1256  * Set the brush size to the default (max of width and height) for
1257  * paintbrush, airbrush, or pencil tools.
1258  *
1259  * Returns: TRUE on success.
1260  *
1261  * Since: 2.8
1262  **/
1263 gboolean
gimp_context_set_brush_default_size(void)1264 gimp_context_set_brush_default_size (void)
1265 {
1266   GimpParam *return_vals;
1267   gint nreturn_vals;
1268   gboolean success = TRUE;
1269 
1270   return_vals = gimp_run_procedure ("gimp-context-set-brush-default-size",
1271                                     &nreturn_vals,
1272                                     GIMP_PDB_END);
1273 
1274   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1275 
1276   gimp_destroy_params (return_vals, nreturn_vals);
1277 
1278   return success;
1279 }
1280 
1281 /**
1282  * gimp_context_get_brush_aspect_ratio:
1283  *
1284  * Get brush aspect ratio.
1285  *
1286  * Set the aspect ratio for brush based paint tools.
1287  *
1288  * Returns: Aspect ratio.
1289  *
1290  * Since: 2.8
1291  **/
1292 gdouble
gimp_context_get_brush_aspect_ratio(void)1293 gimp_context_get_brush_aspect_ratio (void)
1294 {
1295   GimpParam *return_vals;
1296   gint nreturn_vals;
1297   gdouble aspect = 0.0;
1298 
1299   return_vals = gimp_run_procedure ("gimp-context-get-brush-aspect-ratio",
1300                                     &nreturn_vals,
1301                                     GIMP_PDB_END);
1302 
1303   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1304     aspect = return_vals[1].data.d_float;
1305 
1306   gimp_destroy_params (return_vals, nreturn_vals);
1307 
1308   return aspect;
1309 }
1310 
1311 /**
1312  * gimp_context_set_brush_aspect_ratio:
1313  * @aspect: Aspect ratio.
1314  *
1315  * Set brush aspect ratio.
1316  *
1317  * Set the aspect ratio for brush based paint tools.
1318  *
1319  * Returns: TRUE on success.
1320  *
1321  * Since: 2.8
1322  **/
1323 gboolean
gimp_context_set_brush_aspect_ratio(gdouble aspect)1324 gimp_context_set_brush_aspect_ratio (gdouble aspect)
1325 {
1326   GimpParam *return_vals;
1327   gint nreturn_vals;
1328   gboolean success = TRUE;
1329 
1330   return_vals = gimp_run_procedure ("gimp-context-set-brush-aspect-ratio",
1331                                     &nreturn_vals,
1332                                     GIMP_PDB_FLOAT, aspect,
1333                                     GIMP_PDB_END);
1334 
1335   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1336 
1337   gimp_destroy_params (return_vals, nreturn_vals);
1338 
1339   return success;
1340 }
1341 
1342 /**
1343  * gimp_context_get_brush_angle:
1344  *
1345  * Get brush angle in degrees.
1346  *
1347  * Set the angle in degrees for brush based paint tools.
1348  *
1349  * Returns: Angle in degrees.
1350  *
1351  * Since: 2.8
1352  **/
1353 gdouble
gimp_context_get_brush_angle(void)1354 gimp_context_get_brush_angle (void)
1355 {
1356   GimpParam *return_vals;
1357   gint nreturn_vals;
1358   gdouble angle = 0.0;
1359 
1360   return_vals = gimp_run_procedure ("gimp-context-get-brush-angle",
1361                                     &nreturn_vals,
1362                                     GIMP_PDB_END);
1363 
1364   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1365     angle = return_vals[1].data.d_float;
1366 
1367   gimp_destroy_params (return_vals, nreturn_vals);
1368 
1369   return angle;
1370 }
1371 
1372 /**
1373  * gimp_context_set_brush_angle:
1374  * @angle: Angle in degrees.
1375  *
1376  * Set brush angle in degrees.
1377  *
1378  * Set the angle in degrees for brush based paint tools.
1379  *
1380  * Returns: TRUE on success.
1381  *
1382  * Since: 2.8
1383  **/
1384 gboolean
gimp_context_set_brush_angle(gdouble angle)1385 gimp_context_set_brush_angle (gdouble angle)
1386 {
1387   GimpParam *return_vals;
1388   gint nreturn_vals;
1389   gboolean success = TRUE;
1390 
1391   return_vals = gimp_run_procedure ("gimp-context-set-brush-angle",
1392                                     &nreturn_vals,
1393                                     GIMP_PDB_FLOAT, angle,
1394                                     GIMP_PDB_END);
1395 
1396   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1397 
1398   gimp_destroy_params (return_vals, nreturn_vals);
1399 
1400   return success;
1401 }
1402 
1403 /**
1404  * gimp_context_get_brush_spacing:
1405  *
1406  * Get brush spacing as percent of size.
1407  *
1408  * Get the brush spacing as percent of size for brush based paint
1409  * tools.
1410  *
1411  * Returns: Brush spacing as fraction of size.
1412  *
1413  * Since: 2.10
1414  **/
1415 gdouble
gimp_context_get_brush_spacing(void)1416 gimp_context_get_brush_spacing (void)
1417 {
1418   GimpParam *return_vals;
1419   gint nreturn_vals;
1420   gdouble spacing = 0.0;
1421 
1422   return_vals = gimp_run_procedure ("gimp-context-get-brush-spacing",
1423                                     &nreturn_vals,
1424                                     GIMP_PDB_END);
1425 
1426   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1427     spacing = return_vals[1].data.d_float;
1428 
1429   gimp_destroy_params (return_vals, nreturn_vals);
1430 
1431   return spacing;
1432 }
1433 
1434 /**
1435  * gimp_context_set_brush_spacing:
1436  * @spacing: Brush spacing as fraction of size.
1437  *
1438  * Set brush spacing as percent of size.
1439  *
1440  * Set the brush spacing as percent of size for brush based paint
1441  * tools.
1442  *
1443  * Returns: TRUE on success.
1444  *
1445  * Since: 2.10
1446  **/
1447 gboolean
gimp_context_set_brush_spacing(gdouble spacing)1448 gimp_context_set_brush_spacing (gdouble spacing)
1449 {
1450   GimpParam *return_vals;
1451   gint nreturn_vals;
1452   gboolean success = TRUE;
1453 
1454   return_vals = gimp_run_procedure ("gimp-context-set-brush-spacing",
1455                                     &nreturn_vals,
1456                                     GIMP_PDB_FLOAT, spacing,
1457                                     GIMP_PDB_END);
1458 
1459   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1460 
1461   gimp_destroy_params (return_vals, nreturn_vals);
1462 
1463   return success;
1464 }
1465 
1466 /**
1467  * gimp_context_set_brush_default_spacing:
1468  *
1469  * Set brush spacing to its default.
1470  *
1471  * Set the brush spacing to the default for paintbrush, airbrush, or
1472  * pencil tools.
1473  *
1474  * Returns: TRUE on success.
1475  *
1476  * Since: 2.10
1477  **/
1478 gboolean
gimp_context_set_brush_default_spacing(void)1479 gimp_context_set_brush_default_spacing (void)
1480 {
1481   GimpParam *return_vals;
1482   gint nreturn_vals;
1483   gboolean success = TRUE;
1484 
1485   return_vals = gimp_run_procedure ("gimp-context-set-brush-default-spacing",
1486                                     &nreturn_vals,
1487                                     GIMP_PDB_END);
1488 
1489   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1490 
1491   gimp_destroy_params (return_vals, nreturn_vals);
1492 
1493   return success;
1494 }
1495 
1496 /**
1497  * gimp_context_get_brush_hardness:
1498  *
1499  * Get brush hardness in paint options.
1500  *
1501  * Get the brush hardness for brush based paint tools.
1502  *
1503  * Returns: Brush hardness.
1504  *
1505  * Since: 2.10
1506  **/
1507 gdouble
gimp_context_get_brush_hardness(void)1508 gimp_context_get_brush_hardness (void)
1509 {
1510   GimpParam *return_vals;
1511   gint nreturn_vals;
1512   gdouble hardness = 0.0;
1513 
1514   return_vals = gimp_run_procedure ("gimp-context-get-brush-hardness",
1515                                     &nreturn_vals,
1516                                     GIMP_PDB_END);
1517 
1518   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1519     hardness = return_vals[1].data.d_float;
1520 
1521   gimp_destroy_params (return_vals, nreturn_vals);
1522 
1523   return hardness;
1524 }
1525 
1526 /**
1527  * gimp_context_set_brush_hardness:
1528  * @hardness: Brush hardness.
1529  *
1530  * Set brush hardness.
1531  *
1532  * Set the brush hardness for brush based paint tools.
1533  *
1534  * Returns: TRUE on success.
1535  *
1536  * Since: 2.10
1537  **/
1538 gboolean
gimp_context_set_brush_hardness(gdouble hardness)1539 gimp_context_set_brush_hardness (gdouble hardness)
1540 {
1541   GimpParam *return_vals;
1542   gint nreturn_vals;
1543   gboolean success = TRUE;
1544 
1545   return_vals = gimp_run_procedure ("gimp-context-set-brush-hardness",
1546                                     &nreturn_vals,
1547                                     GIMP_PDB_FLOAT, hardness,
1548                                     GIMP_PDB_END);
1549 
1550   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1551 
1552   gimp_destroy_params (return_vals, nreturn_vals);
1553 
1554   return success;
1555 }
1556 
1557 /**
1558  * gimp_context_set_brush_default_hardness:
1559  *
1560  * Set brush spacing to its default.
1561  *
1562  * Set the brush spacing to the default for paintbrush, airbrush, or
1563  * pencil tools.
1564  *
1565  * Returns: TRUE on success.
1566  *
1567  * Since: 2.10
1568  **/
1569 gboolean
gimp_context_set_brush_default_hardness(void)1570 gimp_context_set_brush_default_hardness (void)
1571 {
1572   GimpParam *return_vals;
1573   gint nreturn_vals;
1574   gboolean success = TRUE;
1575 
1576   return_vals = gimp_run_procedure ("gimp-context-set-brush-default-hardness",
1577                                     &nreturn_vals,
1578                                     GIMP_PDB_END);
1579 
1580   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1581 
1582   gimp_destroy_params (return_vals, nreturn_vals);
1583 
1584   return success;
1585 }
1586 
1587 /**
1588  * gimp_context_get_brush_force:
1589  *
1590  * Get brush force in paint options.
1591  *
1592  * Get the brush application force for brush based paint tools.
1593  *
1594  * Returns: Brush application force.
1595  *
1596  * Since: 2.10
1597  **/
1598 gdouble
gimp_context_get_brush_force(void)1599 gimp_context_get_brush_force (void)
1600 {
1601   GimpParam *return_vals;
1602   gint nreturn_vals;
1603   gdouble force = 0.0;
1604 
1605   return_vals = gimp_run_procedure ("gimp-context-get-brush-force",
1606                                     &nreturn_vals,
1607                                     GIMP_PDB_END);
1608 
1609   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1610     force = return_vals[1].data.d_float;
1611 
1612   gimp_destroy_params (return_vals, nreturn_vals);
1613 
1614   return force;
1615 }
1616 
1617 /**
1618  * gimp_context_set_brush_force:
1619  * @force: Brush application force.
1620  *
1621  * Set brush application force.
1622  *
1623  * Set the brush application force for brush based paint tools.
1624  *
1625  * Returns: TRUE on success.
1626  *
1627  * Since: 2.10
1628  **/
1629 gboolean
gimp_context_set_brush_force(gdouble force)1630 gimp_context_set_brush_force (gdouble force)
1631 {
1632   GimpParam *return_vals;
1633   gint nreturn_vals;
1634   gboolean success = TRUE;
1635 
1636   return_vals = gimp_run_procedure ("gimp-context-set-brush-force",
1637                                     &nreturn_vals,
1638                                     GIMP_PDB_FLOAT, force,
1639                                     GIMP_PDB_END);
1640 
1641   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1642 
1643   gimp_destroy_params (return_vals, nreturn_vals);
1644 
1645   return success;
1646 }
1647 
1648 /**
1649  * gimp_context_get_dynamics:
1650  *
1651  * Retrieve the currently active paint dynamics.
1652  *
1653  * This procedure returns the name of the currently active paint
1654  * dynamics. All paint operations and stroke operations use this paint
1655  * dynamics to control the application of paint to the image.
1656  *
1657  * Returns: The name of the active paint dynamics.
1658  *
1659  * Since: 2.8
1660  **/
1661 gchar *
gimp_context_get_dynamics(void)1662 gimp_context_get_dynamics (void)
1663 {
1664   GimpParam *return_vals;
1665   gint nreturn_vals;
1666   gchar *name = NULL;
1667 
1668   return_vals = gimp_run_procedure ("gimp-context-get-dynamics",
1669                                     &nreturn_vals,
1670                                     GIMP_PDB_END);
1671 
1672   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1673     name = g_strdup (return_vals[1].data.d_string);
1674 
1675   gimp_destroy_params (return_vals, nreturn_vals);
1676 
1677   return name;
1678 }
1679 
1680 /**
1681  * gimp_context_set_dynamics:
1682  * @name: The name of the paint dynamics.
1683  *
1684  * Set the specified paint dynamics as the active paint dynamics.
1685  *
1686  * This procedure allows the active paint dynamics to be set by
1687  * specifying its name. The name is simply a string which corresponds
1688  * to one of the names of the installed paint dynamics. If there is no
1689  * matching paint dynamics found, this procedure will return an error.
1690  * Otherwise, the specified paint dynamics becomes active and will be
1691  * used in all subsequent paint operations.
1692  *
1693  * Returns: TRUE on success.
1694  *
1695  * Since: 2.8
1696  **/
1697 gboolean
gimp_context_set_dynamics(const gchar * name)1698 gimp_context_set_dynamics (const gchar *name)
1699 {
1700   GimpParam *return_vals;
1701   gint nreturn_vals;
1702   gboolean success = TRUE;
1703 
1704   return_vals = gimp_run_procedure ("gimp-context-set-dynamics",
1705                                     &nreturn_vals,
1706                                     GIMP_PDB_STRING, name,
1707                                     GIMP_PDB_END);
1708 
1709   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1710 
1711   gimp_destroy_params (return_vals, nreturn_vals);
1712 
1713   return success;
1714 }
1715 
1716 /**
1717  * gimp_context_get_mypaint_brush:
1718  *
1719  * Retrieve the currently active MyPaint brush.
1720  *
1721  * This procedure returns the name of the currently active MyPaint
1722  * brush.
1723  *
1724  * Returns: The name of the active MyPaint brush.
1725  *
1726  * Since: 2.10
1727  **/
1728 gchar *
gimp_context_get_mypaint_brush(void)1729 gimp_context_get_mypaint_brush (void)
1730 {
1731   GimpParam *return_vals;
1732   gint nreturn_vals;
1733   gchar *name = NULL;
1734 
1735   return_vals = gimp_run_procedure ("gimp-context-get-mypaint-brush",
1736                                     &nreturn_vals,
1737                                     GIMP_PDB_END);
1738 
1739   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1740     name = g_strdup (return_vals[1].data.d_string);
1741 
1742   gimp_destroy_params (return_vals, nreturn_vals);
1743 
1744   return name;
1745 }
1746 
1747 /**
1748  * gimp_context_set_mypaint_brush:
1749  * @name: The name of the MyPaint brush.
1750  *
1751  * Set the specified MyPaint brush as the active MyPaint brush.
1752  *
1753  * This procedure allows the active MyPaint brush to be set by
1754  * specifying its name. The name is simply a string which corresponds
1755  * to one of the names of the installed MyPaint brushes. If there is no
1756  * matching MyPaint brush found, this procedure will return an error.
1757  * Otherwise, the specified MyPaint brush becomes active and will be
1758  * used in all subsequent MyPaint paint operations.
1759  *
1760  * Returns: TRUE on success.
1761  *
1762  * Since: 2.10
1763  **/
1764 gboolean
gimp_context_set_mypaint_brush(const gchar * name)1765 gimp_context_set_mypaint_brush (const gchar *name)
1766 {
1767   GimpParam *return_vals;
1768   gint nreturn_vals;
1769   gboolean success = TRUE;
1770 
1771   return_vals = gimp_run_procedure ("gimp-context-set-mypaint-brush",
1772                                     &nreturn_vals,
1773                                     GIMP_PDB_STRING, name,
1774                                     GIMP_PDB_END);
1775 
1776   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1777 
1778   gimp_destroy_params (return_vals, nreturn_vals);
1779 
1780   return success;
1781 }
1782 
1783 /**
1784  * gimp_context_get_pattern:
1785  *
1786  * Retrieve the currently active pattern.
1787  *
1788  * This procedure returns name of the the currently active pattern. All
1789  * clone and bucket-fill operations with patterns will use this pattern
1790  * to control the application of paint to the image.
1791  *
1792  * Returns: The name of the active pattern.
1793  *
1794  * Since: 2.2
1795  **/
1796 gchar *
gimp_context_get_pattern(void)1797 gimp_context_get_pattern (void)
1798 {
1799   GimpParam *return_vals;
1800   gint nreturn_vals;
1801   gchar *name = NULL;
1802 
1803   return_vals = gimp_run_procedure ("gimp-context-get-pattern",
1804                                     &nreturn_vals,
1805                                     GIMP_PDB_END);
1806 
1807   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1808     name = g_strdup (return_vals[1].data.d_string);
1809 
1810   gimp_destroy_params (return_vals, nreturn_vals);
1811 
1812   return name;
1813 }
1814 
1815 /**
1816  * gimp_context_set_pattern:
1817  * @name: The name of the pattern.
1818  *
1819  * Set the specified pattern as the active pattern.
1820  *
1821  * This procedure allows the active pattern to be set by specifying its
1822  * name. The name is simply a string which corresponds to one of the
1823  * names of the installed patterns. If there is no matching pattern
1824  * found, this procedure will return an error. Otherwise, the specified
1825  * pattern becomes active and will be used in all subsequent paint
1826  * operations.
1827  *
1828  * Returns: TRUE on success.
1829  *
1830  * Since: 2.2
1831  **/
1832 gboolean
gimp_context_set_pattern(const gchar * name)1833 gimp_context_set_pattern (const gchar *name)
1834 {
1835   GimpParam *return_vals;
1836   gint nreturn_vals;
1837   gboolean success = TRUE;
1838 
1839   return_vals = gimp_run_procedure ("gimp-context-set-pattern",
1840                                     &nreturn_vals,
1841                                     GIMP_PDB_STRING, name,
1842                                     GIMP_PDB_END);
1843 
1844   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1845 
1846   gimp_destroy_params (return_vals, nreturn_vals);
1847 
1848   return success;
1849 }
1850 
1851 /**
1852  * gimp_context_get_gradient:
1853  *
1854  * Retrieve the currently active gradient.
1855  *
1856  * This procedure returns the name of the currently active gradient.
1857  *
1858  * Returns: The name of the active gradient.
1859  *
1860  * Since: 2.2
1861  **/
1862 gchar *
gimp_context_get_gradient(void)1863 gimp_context_get_gradient (void)
1864 {
1865   GimpParam *return_vals;
1866   gint nreturn_vals;
1867   gchar *name = NULL;
1868 
1869   return_vals = gimp_run_procedure ("gimp-context-get-gradient",
1870                                     &nreturn_vals,
1871                                     GIMP_PDB_END);
1872 
1873   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1874     name = g_strdup (return_vals[1].data.d_string);
1875 
1876   gimp_destroy_params (return_vals, nreturn_vals);
1877 
1878   return name;
1879 }
1880 
1881 /**
1882  * gimp_context_set_gradient:
1883  * @name: The name of the gradient.
1884  *
1885  * Sets the specified gradient as the active gradient.
1886  *
1887  * This procedure lets you set the specified gradient as the active or
1888  * \"current\" one. The name is simply a string which corresponds to
1889  * one of the loaded gradients. If no matching gradient is found, this
1890  * procedure will return an error. Otherwise, the specified gradient
1891  * will become active and will be used for subsequent custom gradient
1892  * operations.
1893  *
1894  * Returns: TRUE on success.
1895  *
1896  * Since: 2.2
1897  **/
1898 gboolean
gimp_context_set_gradient(const gchar * name)1899 gimp_context_set_gradient (const gchar *name)
1900 {
1901   GimpParam *return_vals;
1902   gint nreturn_vals;
1903   gboolean success = TRUE;
1904 
1905   return_vals = gimp_run_procedure ("gimp-context-set-gradient",
1906                                     &nreturn_vals,
1907                                     GIMP_PDB_STRING, name,
1908                                     GIMP_PDB_END);
1909 
1910   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1911 
1912   gimp_destroy_params (return_vals, nreturn_vals);
1913 
1914   return success;
1915 }
1916 
1917 /**
1918  * gimp_context_set_gradient_fg_bg_rgb:
1919  *
1920  * Sets the built-in FG-BG RGB gradient as the active gradient.
1921  *
1922  * This procedure sets the built-in FG-BG RGB gradient as the active
1923  * gradient. The gradient will be used for subsequent gradient
1924  * operations.
1925  *
1926  * Returns: TRUE on success.
1927  *
1928  * Since: 2.10
1929  **/
1930 gboolean
gimp_context_set_gradient_fg_bg_rgb(void)1931 gimp_context_set_gradient_fg_bg_rgb (void)
1932 {
1933   GimpParam *return_vals;
1934   gint nreturn_vals;
1935   gboolean success = TRUE;
1936 
1937   return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-rgb",
1938                                     &nreturn_vals,
1939                                     GIMP_PDB_END);
1940 
1941   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1942 
1943   gimp_destroy_params (return_vals, nreturn_vals);
1944 
1945   return success;
1946 }
1947 
1948 /**
1949  * gimp_context_set_gradient_fg_bg_hsv_cw:
1950  *
1951  * Sets the built-in FG-BG HSV (cw) gradient as the active gradient.
1952  *
1953  * This procedure sets the built-in FG-BG HSV (cw) gradient as the
1954  * active gradient. The gradient will be used for subsequent gradient
1955  * operations.
1956  *
1957  * Returns: TRUE on success.
1958  *
1959  * Since: 2.10
1960  **/
1961 gboolean
gimp_context_set_gradient_fg_bg_hsv_cw(void)1962 gimp_context_set_gradient_fg_bg_hsv_cw (void)
1963 {
1964   GimpParam *return_vals;
1965   gint nreturn_vals;
1966   gboolean success = TRUE;
1967 
1968   return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-cw",
1969                                     &nreturn_vals,
1970                                     GIMP_PDB_END);
1971 
1972   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1973 
1974   gimp_destroy_params (return_vals, nreturn_vals);
1975 
1976   return success;
1977 }
1978 
1979 /**
1980  * gimp_context_set_gradient_fg_bg_hsv_ccw:
1981  *
1982  * Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.
1983  *
1984  * This procedure sets the built-in FG-BG HSV (ccw) gradient as the
1985  * active gradient. The gradient will be used for subsequent gradient
1986  * operations.
1987  *
1988  * Returns: TRUE on success.
1989  *
1990  * Since: 2.10
1991  **/
1992 gboolean
gimp_context_set_gradient_fg_bg_hsv_ccw(void)1993 gimp_context_set_gradient_fg_bg_hsv_ccw (void)
1994 {
1995   GimpParam *return_vals;
1996   gint nreturn_vals;
1997   gboolean success = TRUE;
1998 
1999   return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-ccw",
2000                                     &nreturn_vals,
2001                                     GIMP_PDB_END);
2002 
2003   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2004 
2005   gimp_destroy_params (return_vals, nreturn_vals);
2006 
2007   return success;
2008 }
2009 
2010 /**
2011  * gimp_context_set_gradient_fg_transparent:
2012  *
2013  * Sets the built-in FG-Transparent gradient as the active gradient.
2014  *
2015  * This procedure sets the built-in FG-Transparent gradient as the
2016  * active gradient. The gradient will be used for subsequent gradient
2017  * operations.
2018  *
2019  * Returns: TRUE on success.
2020  *
2021  * Since: 2.10
2022  **/
2023 gboolean
gimp_context_set_gradient_fg_transparent(void)2024 gimp_context_set_gradient_fg_transparent (void)
2025 {
2026   GimpParam *return_vals;
2027   gint nreturn_vals;
2028   gboolean success = TRUE;
2029 
2030   return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-transparent",
2031                                     &nreturn_vals,
2032                                     GIMP_PDB_END);
2033 
2034   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2035 
2036   gimp_destroy_params (return_vals, nreturn_vals);
2037 
2038   return success;
2039 }
2040 
2041 /**
2042  * gimp_context_get_gradient_blend_color_space:
2043  *
2044  * Get the gradient blend color space.
2045  *
2046  * Get the gradient blend color space for paint tools and the gradient
2047  * tool.
2048  *
2049  * Returns: Color blend space.
2050  *
2051  * Since: 2.10
2052  **/
2053 GimpGradientBlendColorSpace
gimp_context_get_gradient_blend_color_space(void)2054 gimp_context_get_gradient_blend_color_space (void)
2055 {
2056   GimpParam *return_vals;
2057   gint nreturn_vals;
2058   GimpGradientBlendColorSpace blend_color_space = 0;
2059 
2060   return_vals = gimp_run_procedure ("gimp-context-get-gradient-blend-color-space",
2061                                     &nreturn_vals,
2062                                     GIMP_PDB_END);
2063 
2064   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2065     blend_color_space = return_vals[1].data.d_int32;
2066 
2067   gimp_destroy_params (return_vals, nreturn_vals);
2068 
2069   return blend_color_space;
2070 }
2071 
2072 /**
2073  * gimp_context_set_gradient_blend_color_space:
2074  * @blend_color_space: Blend color space.
2075  *
2076  * Set the gradient blend color space.
2077  *
2078  * Set the gradient blend color space for paint tools and the gradient
2079  * tool.
2080  *
2081  * Returns: TRUE on success.
2082  *
2083  * Since: 2.10
2084  **/
2085 gboolean
gimp_context_set_gradient_blend_color_space(GimpGradientBlendColorSpace blend_color_space)2086 gimp_context_set_gradient_blend_color_space (GimpGradientBlendColorSpace blend_color_space)
2087 {
2088   GimpParam *return_vals;
2089   gint nreturn_vals;
2090   gboolean success = TRUE;
2091 
2092   return_vals = gimp_run_procedure ("gimp-context-set-gradient-blend-color-space",
2093                                     &nreturn_vals,
2094                                     GIMP_PDB_INT32, blend_color_space,
2095                                     GIMP_PDB_END);
2096 
2097   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2098 
2099   gimp_destroy_params (return_vals, nreturn_vals);
2100 
2101   return success;
2102 }
2103 
2104 /**
2105  * gimp_context_get_gradient_repeat_mode:
2106  *
2107  * Get the gradient repeat mode.
2108  *
2109  * Get the gradient repeat mode for paint tools and the gradient tool.
2110  *
2111  * Returns: Repeat mode.
2112  *
2113  * Since: 2.10
2114  **/
2115 GimpRepeatMode
gimp_context_get_gradient_repeat_mode(void)2116 gimp_context_get_gradient_repeat_mode (void)
2117 {
2118   GimpParam *return_vals;
2119   gint nreturn_vals;
2120   GimpRepeatMode repeat_mode = 0;
2121 
2122   return_vals = gimp_run_procedure ("gimp-context-get-gradient-repeat-mode",
2123                                     &nreturn_vals,
2124                                     GIMP_PDB_END);
2125 
2126   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2127     repeat_mode = return_vals[1].data.d_int32;
2128 
2129   gimp_destroy_params (return_vals, nreturn_vals);
2130 
2131   return repeat_mode;
2132 }
2133 
2134 /**
2135  * gimp_context_set_gradient_repeat_mode:
2136  * @repeat_mode: Repeat mode.
2137  *
2138  * Set the gradient repeat mode.
2139  *
2140  * Set the gradient repeat mode for paint tools and the gradient tool.
2141  *
2142  * Returns: TRUE on success.
2143  *
2144  * Since: 2.10
2145  **/
2146 gboolean
gimp_context_set_gradient_repeat_mode(GimpRepeatMode repeat_mode)2147 gimp_context_set_gradient_repeat_mode (GimpRepeatMode repeat_mode)
2148 {
2149   GimpParam *return_vals;
2150   gint nreturn_vals;
2151   gboolean success = TRUE;
2152 
2153   return_vals = gimp_run_procedure ("gimp-context-set-gradient-repeat-mode",
2154                                     &nreturn_vals,
2155                                     GIMP_PDB_INT32, repeat_mode,
2156                                     GIMP_PDB_END);
2157 
2158   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2159 
2160   gimp_destroy_params (return_vals, nreturn_vals);
2161 
2162   return success;
2163 }
2164 
2165 /**
2166  * gimp_context_get_gradient_reverse:
2167  *
2168  * Get the gradient reverse setting.
2169  *
2170  * Get the gradient reverse setting for paint tools and the gradient
2171  * tool.
2172  *
2173  * Returns: Reverse.
2174  *
2175  * Since: 2.10
2176  **/
2177 gboolean
gimp_context_get_gradient_reverse(void)2178 gimp_context_get_gradient_reverse (void)
2179 {
2180   GimpParam *return_vals;
2181   gint nreturn_vals;
2182   gboolean reverse = FALSE;
2183 
2184   return_vals = gimp_run_procedure ("gimp-context-get-gradient-reverse",
2185                                     &nreturn_vals,
2186                                     GIMP_PDB_END);
2187 
2188   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2189     reverse = return_vals[1].data.d_int32;
2190 
2191   gimp_destroy_params (return_vals, nreturn_vals);
2192 
2193   return reverse;
2194 }
2195 
2196 /**
2197  * gimp_context_set_gradient_reverse:
2198  * @reverse: Reverse.
2199  *
2200  * Set the gradient reverse setting.
2201  *
2202  * Set the gradient reverse setting for paint tools and the gradient
2203  * tool.
2204  *
2205  * Returns: TRUE on success.
2206  *
2207  * Since: 2.10
2208  **/
2209 gboolean
gimp_context_set_gradient_reverse(gboolean reverse)2210 gimp_context_set_gradient_reverse (gboolean reverse)
2211 {
2212   GimpParam *return_vals;
2213   gint nreturn_vals;
2214   gboolean success = TRUE;
2215 
2216   return_vals = gimp_run_procedure ("gimp-context-set-gradient-reverse",
2217                                     &nreturn_vals,
2218                                     GIMP_PDB_INT32, reverse,
2219                                     GIMP_PDB_END);
2220 
2221   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2222 
2223   gimp_destroy_params (return_vals, nreturn_vals);
2224 
2225   return success;
2226 }
2227 
2228 /**
2229  * gimp_context_get_palette:
2230  *
2231  * Retrieve the currently active palette.
2232  *
2233  * This procedure returns the name of the the currently active palette.
2234  *
2235  * Returns: The name of the active palette.
2236  *
2237  * Since: 2.2
2238  **/
2239 gchar *
gimp_context_get_palette(void)2240 gimp_context_get_palette (void)
2241 {
2242   GimpParam *return_vals;
2243   gint nreturn_vals;
2244   gchar *name = NULL;
2245 
2246   return_vals = gimp_run_procedure ("gimp-context-get-palette",
2247                                     &nreturn_vals,
2248                                     GIMP_PDB_END);
2249 
2250   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2251     name = g_strdup (return_vals[1].data.d_string);
2252 
2253   gimp_destroy_params (return_vals, nreturn_vals);
2254 
2255   return name;
2256 }
2257 
2258 /**
2259  * gimp_context_set_palette:
2260  * @name: The name of the palette.
2261  *
2262  * Set the specified palette as the active palette.
2263  *
2264  * This procedure allows the active palette to be set by specifying its
2265  * name. The name is simply a string which corresponds to one of the
2266  * names of the installed palettes. If no matching palette is found,
2267  * this procedure will return an error. Otherwise, the specified
2268  * palette becomes active and will be used in all subsequent palette
2269  * operations.
2270  *
2271  * Returns: TRUE on success.
2272  *
2273  * Since: 2.2
2274  **/
2275 gboolean
gimp_context_set_palette(const gchar * name)2276 gimp_context_set_palette (const gchar *name)
2277 {
2278   GimpParam *return_vals;
2279   gint nreturn_vals;
2280   gboolean success = TRUE;
2281 
2282   return_vals = gimp_run_procedure ("gimp-context-set-palette",
2283                                     &nreturn_vals,
2284                                     GIMP_PDB_STRING, name,
2285                                     GIMP_PDB_END);
2286 
2287   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2288 
2289   gimp_destroy_params (return_vals, nreturn_vals);
2290 
2291   return success;
2292 }
2293 
2294 /**
2295  * gimp_context_get_font:
2296  *
2297  * Retrieve the currently active font.
2298  *
2299  * This procedure returns the name of the currently active font.
2300  *
2301  * Returns: The name of the active font.
2302  *
2303  * Since: 2.2
2304  **/
2305 gchar *
gimp_context_get_font(void)2306 gimp_context_get_font (void)
2307 {
2308   GimpParam *return_vals;
2309   gint nreturn_vals;
2310   gchar *name = NULL;
2311 
2312   return_vals = gimp_run_procedure ("gimp-context-get-font",
2313                                     &nreturn_vals,
2314                                     GIMP_PDB_END);
2315 
2316   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2317     name = g_strdup (return_vals[1].data.d_string);
2318 
2319   gimp_destroy_params (return_vals, nreturn_vals);
2320 
2321   return name;
2322 }
2323 
2324 /**
2325  * gimp_context_set_font:
2326  * @name: The name of the font.
2327  *
2328  * Set the specified font as the active font.
2329  *
2330  * This procedure allows the active font to be set by specifying its
2331  * name. The name is simply a string which corresponds to one of the
2332  * names of the installed fonts. If no matching font is found, this
2333  * procedure will return an error. Otherwise, the specified font
2334  * becomes active and will be used in all subsequent font operations.
2335  *
2336  * Returns: TRUE on success.
2337  *
2338  * Since: 2.2
2339  **/
2340 gboolean
gimp_context_set_font(const gchar * name)2341 gimp_context_set_font (const gchar *name)
2342 {
2343   GimpParam *return_vals;
2344   gint nreturn_vals;
2345   gboolean success = TRUE;
2346 
2347   return_vals = gimp_run_procedure ("gimp-context-set-font",
2348                                     &nreturn_vals,
2349                                     GIMP_PDB_STRING, name,
2350                                     GIMP_PDB_END);
2351 
2352   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2353 
2354   gimp_destroy_params (return_vals, nreturn_vals);
2355 
2356   return success;
2357 }
2358 
2359 /**
2360  * gimp_context_get_antialias:
2361  *
2362  * Get the antialias setting.
2363  *
2364  * This procedure returns the antialias setting.
2365  *
2366  * Returns: The antialias setting.
2367  *
2368  * Since: 2.8
2369  **/
2370 gboolean
gimp_context_get_antialias(void)2371 gimp_context_get_antialias (void)
2372 {
2373   GimpParam *return_vals;
2374   gint nreturn_vals;
2375   gboolean antialias = FALSE;
2376 
2377   return_vals = gimp_run_procedure ("gimp-context-get-antialias",
2378                                     &nreturn_vals,
2379                                     GIMP_PDB_END);
2380 
2381   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2382     antialias = return_vals[1].data.d_int32;
2383 
2384   gimp_destroy_params (return_vals, nreturn_vals);
2385 
2386   return antialias;
2387 }
2388 
2389 /**
2390  * gimp_context_set_antialias:
2391  * @antialias: The antialias setting.
2392  *
2393  * Set the antialias setting.
2394  *
2395  * This procedure modifies the antialias setting. If antialiasing is
2396  * turned on, the edges of selected region will contain intermediate
2397  * values which give the appearance of a sharper, less pixelized edge.
2398  * This should be set as TRUE most of the time unless a binary-only
2399  * selection is wanted.
2400  *
2401  * This setting affects the following procedures:
2402  * gimp_image_select_color(), gimp_image_select_contiguous_color(),
2403  * gimp_image_select_round_rectangle(), gimp_image_select_ellipse(),
2404  * gimp_image_select_polygon(), gimp_image_select_item(),
2405  * gimp_drawable_edit_bucket_fill(), gimp_drawable_edit_stroke_item(),
2406  * gimp_drawable_edit_stroke_selection().
2407  *
2408  * Returns: TRUE on success.
2409  *
2410  * Since: 2.8
2411  **/
2412 gboolean
gimp_context_set_antialias(gboolean antialias)2413 gimp_context_set_antialias (gboolean antialias)
2414 {
2415   GimpParam *return_vals;
2416   gint nreturn_vals;
2417   gboolean success = TRUE;
2418 
2419   return_vals = gimp_run_procedure ("gimp-context-set-antialias",
2420                                     &nreturn_vals,
2421                                     GIMP_PDB_INT32, antialias,
2422                                     GIMP_PDB_END);
2423 
2424   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2425 
2426   gimp_destroy_params (return_vals, nreturn_vals);
2427 
2428   return success;
2429 }
2430 
2431 /**
2432  * gimp_context_get_feather:
2433  *
2434  * Get the feather setting.
2435  *
2436  * This procedure returns the feather setting.
2437  *
2438  * Returns: The feather setting.
2439  *
2440  * Since: 2.8
2441  **/
2442 gboolean
gimp_context_get_feather(void)2443 gimp_context_get_feather (void)
2444 {
2445   GimpParam *return_vals;
2446   gint nreturn_vals;
2447   gboolean feather = FALSE;
2448 
2449   return_vals = gimp_run_procedure ("gimp-context-get-feather",
2450                                     &nreturn_vals,
2451                                     GIMP_PDB_END);
2452 
2453   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2454     feather = return_vals[1].data.d_int32;
2455 
2456   gimp_destroy_params (return_vals, nreturn_vals);
2457 
2458   return feather;
2459 }
2460 
2461 /**
2462  * gimp_context_set_feather:
2463  * @feather: The feather setting.
2464  *
2465  * Set the feather setting.
2466  *
2467  * This procedure modifies the feather setting. If the feather option
2468  * is enabled, selections will be blurred before combining. The blur is
2469  * a gaussian blur; its radii can be controlled using
2470  * gimp_context_set_feather_radius().
2471  *
2472  * This setting affects the following procedures:
2473  * gimp_image_select_color(), gimp_image_select_contiguous_color(),
2474  * gimp_image_select_rectangle(), gimp_image_select_round_rectangle(),
2475  * gimp_image_select_ellipse(), gimp_image_select_polygon(),
2476  * gimp_image_select_item().
2477  *
2478  * Returns: TRUE on success.
2479  *
2480  * Since: 2.8
2481  **/
2482 gboolean
gimp_context_set_feather(gboolean feather)2483 gimp_context_set_feather (gboolean feather)
2484 {
2485   GimpParam *return_vals;
2486   gint nreturn_vals;
2487   gboolean success = TRUE;
2488 
2489   return_vals = gimp_run_procedure ("gimp-context-set-feather",
2490                                     &nreturn_vals,
2491                                     GIMP_PDB_INT32, feather,
2492                                     GIMP_PDB_END);
2493 
2494   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2495 
2496   gimp_destroy_params (return_vals, nreturn_vals);
2497 
2498   return success;
2499 }
2500 
2501 /**
2502  * gimp_context_get_feather_radius:
2503  * @feather_radius_x: The horizontal feather radius.
2504  * @feather_radius_y: The vertical feather radius.
2505  *
2506  * Get the feather radius setting.
2507  *
2508  * This procedure returns the feather radius setting.
2509  *
2510  * Returns: TRUE on success.
2511  *
2512  * Since: 2.8
2513  **/
2514 gboolean
gimp_context_get_feather_radius(gdouble * feather_radius_x,gdouble * feather_radius_y)2515 gimp_context_get_feather_radius (gdouble *feather_radius_x,
2516                                  gdouble *feather_radius_y)
2517 {
2518   GimpParam *return_vals;
2519   gint nreturn_vals;
2520   gboolean success = TRUE;
2521 
2522   return_vals = gimp_run_procedure ("gimp-context-get-feather-radius",
2523                                     &nreturn_vals,
2524                                     GIMP_PDB_END);
2525 
2526   *feather_radius_x = 0.0;
2527   *feather_radius_y = 0.0;
2528 
2529   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2530 
2531   if (success)
2532     {
2533       *feather_radius_x = return_vals[1].data.d_float;
2534       *feather_radius_y = return_vals[2].data.d_float;
2535     }
2536 
2537   gimp_destroy_params (return_vals, nreturn_vals);
2538 
2539   return success;
2540 }
2541 
2542 /**
2543  * gimp_context_set_feather_radius:
2544  * @feather_radius_x: The horizontal feather radius.
2545  * @feather_radius_y: The vertical feather radius.
2546  *
2547  * Set the feather radius setting.
2548  *
2549  * This procedure modifies the feather radius setting.
2550  *
2551  * This setting affects all procedures that are affected by
2552  * gimp_context_set_feather().
2553  *
2554  * Returns: TRUE on success.
2555  *
2556  * Since: 2.8
2557  **/
2558 gboolean
gimp_context_set_feather_radius(gdouble feather_radius_x,gdouble feather_radius_y)2559 gimp_context_set_feather_radius (gdouble feather_radius_x,
2560                                  gdouble feather_radius_y)
2561 {
2562   GimpParam *return_vals;
2563   gint nreturn_vals;
2564   gboolean success = TRUE;
2565 
2566   return_vals = gimp_run_procedure ("gimp-context-set-feather-radius",
2567                                     &nreturn_vals,
2568                                     GIMP_PDB_FLOAT, feather_radius_x,
2569                                     GIMP_PDB_FLOAT, feather_radius_y,
2570                                     GIMP_PDB_END);
2571 
2572   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2573 
2574   gimp_destroy_params (return_vals, nreturn_vals);
2575 
2576   return success;
2577 }
2578 
2579 /**
2580  * gimp_context_get_sample_merged:
2581  *
2582  * Get the sample merged setting.
2583  *
2584  * This procedure returns the sample merged setting.
2585  *
2586  * Returns: The sample merged setting.
2587  *
2588  * Since: 2.8
2589  **/
2590 gboolean
gimp_context_get_sample_merged(void)2591 gimp_context_get_sample_merged (void)
2592 {
2593   GimpParam *return_vals;
2594   gint nreturn_vals;
2595   gboolean sample_merged = FALSE;
2596 
2597   return_vals = gimp_run_procedure ("gimp-context-get-sample-merged",
2598                                     &nreturn_vals,
2599                                     GIMP_PDB_END);
2600 
2601   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2602     sample_merged = return_vals[1].data.d_int32;
2603 
2604   gimp_destroy_params (return_vals, nreturn_vals);
2605 
2606   return sample_merged;
2607 }
2608 
2609 /**
2610  * gimp_context_set_sample_merged:
2611  * @sample_merged: The sample merged setting.
2612  *
2613  * Set the sample merged setting.
2614  *
2615  * This procedure modifies the sample merged setting. If an operation
2616  * depends on the colors of the pixels present in a drawable, like when
2617  * doing a seed fill, this setting controls whether the pixel data from
2618  * the specified drawable is used ('sample-merged' is FALSE), or the
2619  * pixel data from the composite image ('sample-merged' is TRUE. This
2620  * is equivalent to sampling for colors after merging all visible
2621  * layers).
2622  *
2623  * This setting affects the following procedures:
2624  * gimp_image_select_color(), gimp_image_select_contiguous_color(),
2625  * gimp_drawable_edit_bucket_fill().
2626  *
2627  * Returns: TRUE on success.
2628  *
2629  * Since: 2.8
2630  **/
2631 gboolean
gimp_context_set_sample_merged(gboolean sample_merged)2632 gimp_context_set_sample_merged (gboolean sample_merged)
2633 {
2634   GimpParam *return_vals;
2635   gint nreturn_vals;
2636   gboolean success = TRUE;
2637 
2638   return_vals = gimp_run_procedure ("gimp-context-set-sample-merged",
2639                                     &nreturn_vals,
2640                                     GIMP_PDB_INT32, sample_merged,
2641                                     GIMP_PDB_END);
2642 
2643   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2644 
2645   gimp_destroy_params (return_vals, nreturn_vals);
2646 
2647   return success;
2648 }
2649 
2650 /**
2651  * gimp_context_get_sample_criterion:
2652  *
2653  * Get the sample criterion setting.
2654  *
2655  * This procedure returns the sample criterion setting.
2656  *
2657  * Returns: The sample criterion setting.
2658  *
2659  * Since: 2.8
2660  **/
2661 GimpSelectCriterion
gimp_context_get_sample_criterion(void)2662 gimp_context_get_sample_criterion (void)
2663 {
2664   GimpParam *return_vals;
2665   gint nreturn_vals;
2666   GimpSelectCriterion sample_criterion = 0;
2667 
2668   return_vals = gimp_run_procedure ("gimp-context-get-sample-criterion",
2669                                     &nreturn_vals,
2670                                     GIMP_PDB_END);
2671 
2672   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2673     sample_criterion = return_vals[1].data.d_int32;
2674 
2675   gimp_destroy_params (return_vals, nreturn_vals);
2676 
2677   return sample_criterion;
2678 }
2679 
2680 /**
2681  * gimp_context_set_sample_criterion:
2682  * @sample_criterion: The sample criterion setting.
2683  *
2684  * Set the sample criterion setting.
2685  *
2686  * This procedure modifies the sample criterion setting. If an
2687  * operation depends on the colors of the pixels present in a drawable,
2688  * like when doing a seed fill, this setting controls how color
2689  * similarity is determined. SELECT_CRITERION_COMPOSITE is the default
2690  * value.
2691  *
2692  * This setting affects the following procedures:
2693  * gimp_image_select_color(), gimp_image_select_contiguous_color(),
2694  * gimp_drawable_edit_bucket_fill().
2695  *
2696  * Returns: TRUE on success.
2697  *
2698  * Since: 2.8
2699  **/
2700 gboolean
gimp_context_set_sample_criterion(GimpSelectCriterion sample_criterion)2701 gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion)
2702 {
2703   GimpParam *return_vals;
2704   gint nreturn_vals;
2705   gboolean success = TRUE;
2706 
2707   return_vals = gimp_run_procedure ("gimp-context-set-sample-criterion",
2708                                     &nreturn_vals,
2709                                     GIMP_PDB_INT32, sample_criterion,
2710                                     GIMP_PDB_END);
2711 
2712   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2713 
2714   gimp_destroy_params (return_vals, nreturn_vals);
2715 
2716   return success;
2717 }
2718 
2719 /**
2720  * gimp_context_get_sample_threshold:
2721  *
2722  * Get the sample threshold setting.
2723  *
2724  * This procedure returns the sample threshold setting.
2725  *
2726  * Returns: The sample threshold setting.
2727  *
2728  * Since: 2.8
2729  **/
2730 gdouble
gimp_context_get_sample_threshold(void)2731 gimp_context_get_sample_threshold (void)
2732 {
2733   GimpParam *return_vals;
2734   gint nreturn_vals;
2735   gdouble sample_threshold = 0.0;
2736 
2737   return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold",
2738                                     &nreturn_vals,
2739                                     GIMP_PDB_END);
2740 
2741   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2742     sample_threshold = return_vals[1].data.d_float;
2743 
2744   gimp_destroy_params (return_vals, nreturn_vals);
2745 
2746   return sample_threshold;
2747 }
2748 
2749 /**
2750  * gimp_context_set_sample_threshold:
2751  * @sample_threshold: The sample threshold setting.
2752  *
2753  * Set the sample threshold setting.
2754  *
2755  * This procedure modifies the sample threshold setting. If an
2756  * operation depends on the colors of the pixels present in a drawable,
2757  * like when doing a seed fill, this setting controls what is
2758  * \"sufficiently close\" to be considered a similar color. If the
2759  * sample threshold has not been set explicitly, the default threshold
2760  * set in gimprc will be used.
2761  *
2762  * This setting affects the following procedures:
2763  * gimp_image_select_color(), gimp_image_select_contiguous_color(),
2764  * gimp_drawable_edit_bucket_fill().
2765  *
2766  * Returns: TRUE on success.
2767  *
2768  * Since: 2.8
2769  **/
2770 gboolean
gimp_context_set_sample_threshold(gdouble sample_threshold)2771 gimp_context_set_sample_threshold (gdouble sample_threshold)
2772 {
2773   GimpParam *return_vals;
2774   gint nreturn_vals;
2775   gboolean success = TRUE;
2776 
2777   return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold",
2778                                     &nreturn_vals,
2779                                     GIMP_PDB_FLOAT, sample_threshold,
2780                                     GIMP_PDB_END);
2781 
2782   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2783 
2784   gimp_destroy_params (return_vals, nreturn_vals);
2785 
2786   return success;
2787 }
2788 
2789 /**
2790  * gimp_context_get_sample_threshold_int:
2791  *
2792  * Get the sample threshold setting as an integer value.
2793  *
2794  * This procedure returns the sample threshold setting as an integer
2795  * value. See gimp_context_get_sample_threshold().
2796  *
2797  * Returns: The sample threshold setting.
2798  *
2799  * Since: 2.8
2800  **/
2801 gint
gimp_context_get_sample_threshold_int(void)2802 gimp_context_get_sample_threshold_int (void)
2803 {
2804   GimpParam *return_vals;
2805   gint nreturn_vals;
2806   gint sample_threshold = 0;
2807 
2808   return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold-int",
2809                                     &nreturn_vals,
2810                                     GIMP_PDB_END);
2811 
2812   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2813     sample_threshold = return_vals[1].data.d_int32;
2814 
2815   gimp_destroy_params (return_vals, nreturn_vals);
2816 
2817   return sample_threshold;
2818 }
2819 
2820 /**
2821  * gimp_context_set_sample_threshold_int:
2822  * @sample_threshold: The sample threshold setting.
2823  *
2824  * Set the sample threshold setting as an integer value.
2825  *
2826  * This procedure modifies the sample threshold setting as an integer
2827  * value. See gimp_context_set_sample_threshold().
2828  *
2829  * Returns: TRUE on success.
2830  *
2831  * Since: 2.8
2832  **/
2833 gboolean
gimp_context_set_sample_threshold_int(gint sample_threshold)2834 gimp_context_set_sample_threshold_int (gint sample_threshold)
2835 {
2836   GimpParam *return_vals;
2837   gint nreturn_vals;
2838   gboolean success = TRUE;
2839 
2840   return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold-int",
2841                                     &nreturn_vals,
2842                                     GIMP_PDB_INT32, sample_threshold,
2843                                     GIMP_PDB_END);
2844 
2845   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2846 
2847   gimp_destroy_params (return_vals, nreturn_vals);
2848 
2849   return success;
2850 }
2851 
2852 /**
2853  * gimp_context_get_sample_transparent:
2854  *
2855  * Get the sample transparent setting.
2856  *
2857  * This procedure returns the sample transparent setting.
2858  *
2859  * Returns: The sample transparent setting.
2860  *
2861  * Since: 2.8
2862  **/
2863 gboolean
gimp_context_get_sample_transparent(void)2864 gimp_context_get_sample_transparent (void)
2865 {
2866   GimpParam *return_vals;
2867   gint nreturn_vals;
2868   gboolean sample_transparent = FALSE;
2869 
2870   return_vals = gimp_run_procedure ("gimp-context-get-sample-transparent",
2871                                     &nreturn_vals,
2872                                     GIMP_PDB_END);
2873 
2874   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2875     sample_transparent = return_vals[1].data.d_int32;
2876 
2877   gimp_destroy_params (return_vals, nreturn_vals);
2878 
2879   return sample_transparent;
2880 }
2881 
2882 /**
2883  * gimp_context_set_sample_transparent:
2884  * @sample_transparent: The sample transparent setting.
2885  *
2886  * Set the sample transparent setting.
2887  *
2888  * This procedure modifies the sample transparent setting. If an
2889  * operation depends on the colors of the pixels present in a drawable,
2890  * like when doing a seed fill, this setting controls whether
2891  * transparency is considered to be a unique selectable color. When
2892  * this setting is TRUE, transparent areas can be selected or filled.
2893  *
2894  * This setting affects the following procedures:
2895  * gimp_image_select_color(), gimp_image_select_contiguous_color(),
2896  * gimp_drawable_edit_bucket_fill().
2897  *
2898  * Returns: TRUE on success.
2899  *
2900  * Since: 2.8
2901  **/
2902 gboolean
gimp_context_set_sample_transparent(gboolean sample_transparent)2903 gimp_context_set_sample_transparent (gboolean sample_transparent)
2904 {
2905   GimpParam *return_vals;
2906   gint nreturn_vals;
2907   gboolean success = TRUE;
2908 
2909   return_vals = gimp_run_procedure ("gimp-context-set-sample-transparent",
2910                                     &nreturn_vals,
2911                                     GIMP_PDB_INT32, sample_transparent,
2912                                     GIMP_PDB_END);
2913 
2914   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2915 
2916   gimp_destroy_params (return_vals, nreturn_vals);
2917 
2918   return success;
2919 }
2920 
2921 /**
2922  * gimp_context_get_diagonal_neighbors:
2923  *
2924  * Get the diagonal neighbors setting.
2925  *
2926  * This procedure returns the diagonal neighbors setting.
2927  *
2928  * Returns: The diagonal neighbors setting.
2929  *
2930  * Since: 2.10
2931  **/
2932 gboolean
gimp_context_get_diagonal_neighbors(void)2933 gimp_context_get_diagonal_neighbors (void)
2934 {
2935   GimpParam *return_vals;
2936   gint nreturn_vals;
2937   gboolean diagonal_neighbors = FALSE;
2938 
2939   return_vals = gimp_run_procedure ("gimp-context-get-diagonal-neighbors",
2940                                     &nreturn_vals,
2941                                     GIMP_PDB_END);
2942 
2943   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
2944     diagonal_neighbors = return_vals[1].data.d_int32;
2945 
2946   gimp_destroy_params (return_vals, nreturn_vals);
2947 
2948   return diagonal_neighbors;
2949 }
2950 
2951 /**
2952  * gimp_context_set_diagonal_neighbors:
2953  * @diagonal_neighbors: The diagonal neighbors setting.
2954  *
2955  * Set the diagonal neighbors setting.
2956  *
2957  * This procedure modifies the diagonal neighbors setting. If the
2958  * affected region of an operation is based on a seed point, like when
2959  * doing a seed fill, then, when this setting is TRUE, all eight
2960  * neighbors of each pixel are considered when calculating the affected
2961  * region; in contrast, when this setting is FALSE, only the four
2962  * orthogonal neighbors of each pixel are considered.
2963  *
2964  * This setting affects the following procedures:
2965  * gimp_image_select_contiguous_color(),
2966  * gimp_drawable_edit_bucket_fill().
2967  *
2968  * Returns: TRUE on success.
2969  *
2970  * Since: 2.10
2971  **/
2972 gboolean
gimp_context_set_diagonal_neighbors(gboolean diagonal_neighbors)2973 gimp_context_set_diagonal_neighbors (gboolean diagonal_neighbors)
2974 {
2975   GimpParam *return_vals;
2976   gint nreturn_vals;
2977   gboolean success = TRUE;
2978 
2979   return_vals = gimp_run_procedure ("gimp-context-set-diagonal-neighbors",
2980                                     &nreturn_vals,
2981                                     GIMP_PDB_INT32, diagonal_neighbors,
2982                                     GIMP_PDB_END);
2983 
2984   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
2985 
2986   gimp_destroy_params (return_vals, nreturn_vals);
2987 
2988   return success;
2989 }
2990 
2991 /**
2992  * gimp_context_get_distance_metric:
2993  *
2994  * Get the distance metric used in some computations.
2995  *
2996  * This procedure returns the distance metric in the current context.
2997  * See gimp_context_set_distance_metric() to know more about its usage.
2998  *
2999  * Returns: The distance metric.
3000  *
3001  * Since: 2.10
3002  **/
3003 GeglDistanceMetric
gimp_context_get_distance_metric(void)3004 gimp_context_get_distance_metric (void)
3005 {
3006   GimpParam *return_vals;
3007   gint nreturn_vals;
3008   GeglDistanceMetric metric = 0;
3009 
3010   return_vals = gimp_run_procedure ("gimp-context-get-distance-metric",
3011                                     &nreturn_vals,
3012                                     GIMP_PDB_END);
3013 
3014   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3015     metric = return_vals[1].data.d_int32;
3016 
3017   gimp_destroy_params (return_vals, nreturn_vals);
3018 
3019   return metric;
3020 }
3021 
3022 /**
3023  * gimp_context_set_distance_metric:
3024  * @metric: The distance metric.
3025  *
3026  * Set the distance metric used in some computations.
3027  *
3028  * This procedure modifies the distance metric used in some
3029  * computations, such as gimp_drawable_edit_gradient_fill(). In
3030  * particular, it does not change the metric used in generic distance
3031  * computation on canvas, as in the Measure tool.
3032  *
3033  * This setting affects the following procedures:
3034  * gimp_drawable_edit_gradient_fill().
3035  *
3036  * Returns: TRUE on success.
3037  *
3038  * Since: 2.10
3039  **/
3040 gboolean
gimp_context_set_distance_metric(GeglDistanceMetric metric)3041 gimp_context_set_distance_metric (GeglDistanceMetric metric)
3042 {
3043   GimpParam *return_vals;
3044   gint nreturn_vals;
3045   gboolean success = TRUE;
3046 
3047   return_vals = gimp_run_procedure ("gimp-context-set-distance-metric",
3048                                     &nreturn_vals,
3049                                     GIMP_PDB_INT32, metric,
3050                                     GIMP_PDB_END);
3051 
3052   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3053 
3054   gimp_destroy_params (return_vals, nreturn_vals);
3055 
3056   return success;
3057 }
3058 
3059 /**
3060  * gimp_context_get_interpolation:
3061  *
3062  * Get the interpolation type.
3063  *
3064  * This procedure returns the interpolation setting. The return value
3065  * is an integer which corresponds to the values listed in the argument
3066  * description. If the interpolation has not been set explicitly by
3067  * gimp_context_set_interpolation(), the default interpolation set in
3068  * gimprc will be used.
3069  *
3070  * Returns: The interpolation type.
3071  *
3072  * Since: 2.8
3073  **/
3074 GimpInterpolationType
gimp_context_get_interpolation(void)3075 gimp_context_get_interpolation (void)
3076 {
3077   GimpParam *return_vals;
3078   gint nreturn_vals;
3079   GimpInterpolationType interpolation = 0;
3080 
3081   return_vals = gimp_run_procedure ("gimp-context-get-interpolation",
3082                                     &nreturn_vals,
3083                                     GIMP_PDB_END);
3084 
3085   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3086     interpolation = return_vals[1].data.d_int32;
3087 
3088   gimp_destroy_params (return_vals, nreturn_vals);
3089 
3090   return interpolation;
3091 }
3092 
3093 /**
3094  * gimp_context_set_interpolation:
3095  * @interpolation: The interpolation type.
3096  *
3097  * Set the interpolation type.
3098  *
3099  * This procedure modifies the interpolation setting.
3100  *
3101  * This setting affects affects the following procedures:
3102  * gimp_item_transform_flip(), gimp_item_transform_perspective(),
3103  * gimp_item_transform_rotate(), gimp_item_transform_scale(),
3104  * gimp_item_transform_shear(), gimp_item_transform_2d(),
3105  * gimp_item_transform_matrix(), gimp_image_scale(),
3106  * gimp_layer_scale().
3107  *
3108  * Returns: TRUE on success.
3109  *
3110  * Since: 2.8
3111  **/
3112 gboolean
gimp_context_set_interpolation(GimpInterpolationType interpolation)3113 gimp_context_set_interpolation (GimpInterpolationType interpolation)
3114 {
3115   GimpParam *return_vals;
3116   gint nreturn_vals;
3117   gboolean success = TRUE;
3118 
3119   return_vals = gimp_run_procedure ("gimp-context-set-interpolation",
3120                                     &nreturn_vals,
3121                                     GIMP_PDB_INT32, interpolation,
3122                                     GIMP_PDB_END);
3123 
3124   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3125 
3126   gimp_destroy_params (return_vals, nreturn_vals);
3127 
3128   return success;
3129 }
3130 
3131 /**
3132  * gimp_context_get_transform_direction:
3133  *
3134  * Get the transform direction.
3135  *
3136  * This procedure returns the transform direction. The return value is
3137  * an integer which corresponds to the values listed in the argument
3138  * description.
3139  *
3140  * Returns: The transform direction.
3141  *
3142  * Since: 2.8
3143  **/
3144 GimpTransformDirection
gimp_context_get_transform_direction(void)3145 gimp_context_get_transform_direction (void)
3146 {
3147   GimpParam *return_vals;
3148   gint nreturn_vals;
3149   GimpTransformDirection transform_direction = 0;
3150 
3151   return_vals = gimp_run_procedure ("gimp-context-get-transform-direction",
3152                                     &nreturn_vals,
3153                                     GIMP_PDB_END);
3154 
3155   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3156     transform_direction = return_vals[1].data.d_int32;
3157 
3158   gimp_destroy_params (return_vals, nreturn_vals);
3159 
3160   return transform_direction;
3161 }
3162 
3163 /**
3164  * gimp_context_set_transform_direction:
3165  * @transform_direction: The transform direction.
3166  *
3167  * Set the transform direction.
3168  *
3169  * This procedure modifies the transform direction setting.
3170  *
3171  * This setting affects affects the following procedures:
3172  * gimp_item_transform_flip(), gimp_item_transform_perspective(),
3173  * gimp_item_transform_rotate(), gimp_item_transform_scale(),
3174  * gimp_item_transform_shear(), gimp_item_transform_2d(),
3175  * gimp_item_transform_matrix().
3176  *
3177  * Returns: TRUE on success.
3178  *
3179  * Since: 2.8
3180  **/
3181 gboolean
gimp_context_set_transform_direction(GimpTransformDirection transform_direction)3182 gimp_context_set_transform_direction (GimpTransformDirection transform_direction)
3183 {
3184   GimpParam *return_vals;
3185   gint nreturn_vals;
3186   gboolean success = TRUE;
3187 
3188   return_vals = gimp_run_procedure ("gimp-context-set-transform-direction",
3189                                     &nreturn_vals,
3190                                     GIMP_PDB_INT32, transform_direction,
3191                                     GIMP_PDB_END);
3192 
3193   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3194 
3195   gimp_destroy_params (return_vals, nreturn_vals);
3196 
3197   return success;
3198 }
3199 
3200 /**
3201  * gimp_context_get_transform_resize:
3202  *
3203  * Get the transform resize type.
3204  *
3205  * This procedure returns the transform resize setting. The return
3206  * value is an integer which corresponds to the values listed in the
3207  * argument description.
3208  *
3209  * Returns: The transform resize type.
3210  *
3211  * Since: 2.8
3212  **/
3213 GimpTransformResize
gimp_context_get_transform_resize(void)3214 gimp_context_get_transform_resize (void)
3215 {
3216   GimpParam *return_vals;
3217   gint nreturn_vals;
3218   GimpTransformResize transform_resize = 0;
3219 
3220   return_vals = gimp_run_procedure ("gimp-context-get-transform-resize",
3221                                     &nreturn_vals,
3222                                     GIMP_PDB_END);
3223 
3224   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3225     transform_resize = return_vals[1].data.d_int32;
3226 
3227   gimp_destroy_params (return_vals, nreturn_vals);
3228 
3229   return transform_resize;
3230 }
3231 
3232 /**
3233  * gimp_context_set_transform_resize:
3234  * @transform_resize: The transform resize type.
3235  *
3236  * Set the transform resize type.
3237  *
3238  * This procedure modifies the transform resize setting. When
3239  * transforming pixels, if the result of a transform operation has a
3240  * different size than the original area, this setting determines how
3241  * the resulting area is sized.
3242  *
3243  * This setting affects affects the following procedures:
3244  * gimp_item_transform_flip(), gimp_item_transform_flip_simple(),
3245  * gimp_item_transform_perspective(), gimp_item_transform_rotate(),
3246  * gimp_item_transform_rotate_simple(), gimp_item_transform_scale(),
3247  * gimp_item_transform_shear(), gimp_item_transform_2d(),
3248  * gimp_item_transform_matrix().
3249  *
3250  * Returns: TRUE on success.
3251  *
3252  * Since: 2.8
3253  **/
3254 gboolean
gimp_context_set_transform_resize(GimpTransformResize transform_resize)3255 gimp_context_set_transform_resize (GimpTransformResize transform_resize)
3256 {
3257   GimpParam *return_vals;
3258   gint nreturn_vals;
3259   gboolean success = TRUE;
3260 
3261   return_vals = gimp_run_procedure ("gimp-context-set-transform-resize",
3262                                     &nreturn_vals,
3263                                     GIMP_PDB_INT32, transform_resize,
3264                                     GIMP_PDB_END);
3265 
3266   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3267 
3268   gimp_destroy_params (return_vals, nreturn_vals);
3269 
3270   return success;
3271 }
3272 
3273 /**
3274  * gimp_context_get_transform_recursion:
3275  *
3276  * Deprecated: There is no replacement for this procedure.
3277  *
3278  * Returns: This returns always 3 and is meaningless.
3279  **/
3280 gint
gimp_context_get_transform_recursion(void)3281 gimp_context_get_transform_recursion (void)
3282 {
3283   GimpParam *return_vals;
3284   gint nreturn_vals;
3285   gint transform_recursion = 0;
3286 
3287   return_vals = gimp_run_procedure ("gimp-context-get-transform-recursion",
3288                                     &nreturn_vals,
3289                                     GIMP_PDB_END);
3290 
3291   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3292     transform_recursion = return_vals[1].data.d_int32;
3293 
3294   gimp_destroy_params (return_vals, nreturn_vals);
3295 
3296   return transform_recursion;
3297 }
3298 
3299 /**
3300  * gimp_context_set_transform_recursion:
3301  * @transform_recursion: This parameter is ignored.
3302  *
3303  * Deprecated: There is no replacement for this procedure.
3304  *
3305  * Returns: TRUE on success.
3306  **/
3307 gboolean
gimp_context_set_transform_recursion(gint transform_recursion)3308 gimp_context_set_transform_recursion (gint transform_recursion)
3309 {
3310   GimpParam *return_vals;
3311   gint nreturn_vals;
3312   gboolean success = TRUE;
3313 
3314   return_vals = gimp_run_procedure ("gimp-context-set-transform-recursion",
3315                                     &nreturn_vals,
3316                                     GIMP_PDB_INT32, transform_recursion,
3317                                     GIMP_PDB_END);
3318 
3319   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3320 
3321   gimp_destroy_params (return_vals, nreturn_vals);
3322 
3323   return success;
3324 }
3325 
3326 /**
3327  * gimp_context_get_ink_size:
3328  *
3329  * Get ink blob size in pixels.
3330  *
3331  * Get the ink blob size in pixels for ink tool.
3332  *
3333  * Returns: ink blob size in pixels.
3334  *
3335  * Since: 2.8
3336  **/
3337 gdouble
gimp_context_get_ink_size(void)3338 gimp_context_get_ink_size (void)
3339 {
3340   GimpParam *return_vals;
3341   gint nreturn_vals;
3342   gdouble size = 0.0;
3343 
3344   return_vals = gimp_run_procedure ("gimp-context-get-ink-size",
3345                                     &nreturn_vals,
3346                                     GIMP_PDB_END);
3347 
3348   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3349     size = return_vals[1].data.d_float;
3350 
3351   gimp_destroy_params (return_vals, nreturn_vals);
3352 
3353   return size;
3354 }
3355 
3356 /**
3357  * gimp_context_set_ink_size:
3358  * @size: ink blob size in pixels.
3359  *
3360  * Set ink blob size in pixels.
3361  *
3362  * Set the ink blob size in pixels for ink tool.
3363  *
3364  * Returns: TRUE on success.
3365  *
3366  * Since: 2.8
3367  **/
3368 gboolean
gimp_context_set_ink_size(gdouble size)3369 gimp_context_set_ink_size (gdouble size)
3370 {
3371   GimpParam *return_vals;
3372   gint nreturn_vals;
3373   gboolean success = TRUE;
3374 
3375   return_vals = gimp_run_procedure ("gimp-context-set-ink-size",
3376                                     &nreturn_vals,
3377                                     GIMP_PDB_FLOAT, size,
3378                                     GIMP_PDB_END);
3379 
3380   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3381 
3382   gimp_destroy_params (return_vals, nreturn_vals);
3383 
3384   return success;
3385 }
3386 
3387 /**
3388  * gimp_context_get_ink_angle:
3389  *
3390  * Get ink angle in degrees.
3391  *
3392  * Get the ink angle in degrees for ink tool.
3393  *
3394  * Returns: ink angle in degrees.
3395  *
3396  * Since: 2.8
3397  **/
3398 gdouble
gimp_context_get_ink_angle(void)3399 gimp_context_get_ink_angle (void)
3400 {
3401   GimpParam *return_vals;
3402   gint nreturn_vals;
3403   gdouble angle = 0.0;
3404 
3405   return_vals = gimp_run_procedure ("gimp-context-get-ink-angle",
3406                                     &nreturn_vals,
3407                                     GIMP_PDB_END);
3408 
3409   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3410     angle = return_vals[1].data.d_float;
3411 
3412   gimp_destroy_params (return_vals, nreturn_vals);
3413 
3414   return angle;
3415 }
3416 
3417 /**
3418  * gimp_context_set_ink_angle:
3419  * @angle: ink angle in degrees.
3420  *
3421  * Set ink angle in degrees.
3422  *
3423  * Set the ink angle in degrees for ink tool.
3424  *
3425  * Returns: TRUE on success.
3426  *
3427  * Since: 2.8
3428  **/
3429 gboolean
gimp_context_set_ink_angle(gdouble angle)3430 gimp_context_set_ink_angle (gdouble angle)
3431 {
3432   GimpParam *return_vals;
3433   gint nreturn_vals;
3434   gboolean success = TRUE;
3435 
3436   return_vals = gimp_run_procedure ("gimp-context-set-ink-angle",
3437                                     &nreturn_vals,
3438                                     GIMP_PDB_FLOAT, angle,
3439                                     GIMP_PDB_END);
3440 
3441   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3442 
3443   gimp_destroy_params (return_vals, nreturn_vals);
3444 
3445   return success;
3446 }
3447 
3448 /**
3449  * gimp_context_get_ink_size_sensitivity:
3450  *
3451  * Get ink size sensitivity.
3452  *
3453  * Get the ink size sensitivity for ink tool.
3454  *
3455  * Returns: ink size sensitivity.
3456  *
3457  * Since: 2.8
3458  **/
3459 gdouble
gimp_context_get_ink_size_sensitivity(void)3460 gimp_context_get_ink_size_sensitivity (void)
3461 {
3462   GimpParam *return_vals;
3463   gint nreturn_vals;
3464   gdouble size = 0.0;
3465 
3466   return_vals = gimp_run_procedure ("gimp-context-get-ink-size-sensitivity",
3467                                     &nreturn_vals,
3468                                     GIMP_PDB_END);
3469 
3470   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3471     size = return_vals[1].data.d_float;
3472 
3473   gimp_destroy_params (return_vals, nreturn_vals);
3474 
3475   return size;
3476 }
3477 
3478 /**
3479  * gimp_context_set_ink_size_sensitivity:
3480  * @size: ink size sensitivity.
3481  *
3482  * Set ink size sensitivity.
3483  *
3484  * Set the ink size sensitivity for ink tool.
3485  *
3486  * Returns: TRUE on success.
3487  *
3488  * Since: 2.8
3489  **/
3490 gboolean
gimp_context_set_ink_size_sensitivity(gdouble size)3491 gimp_context_set_ink_size_sensitivity (gdouble size)
3492 {
3493   GimpParam *return_vals;
3494   gint nreturn_vals;
3495   gboolean success = TRUE;
3496 
3497   return_vals = gimp_run_procedure ("gimp-context-set-ink-size-sensitivity",
3498                                     &nreturn_vals,
3499                                     GIMP_PDB_FLOAT, size,
3500                                     GIMP_PDB_END);
3501 
3502   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3503 
3504   gimp_destroy_params (return_vals, nreturn_vals);
3505 
3506   return success;
3507 }
3508 
3509 /**
3510  * gimp_context_get_ink_tilt_sensitivity:
3511  *
3512  * Get ink tilt sensitivity.
3513  *
3514  * Get the ink tilt sensitivity for ink tool.
3515  *
3516  * Returns: ink tilt sensitivity.
3517  *
3518  * Since: 2.8
3519  **/
3520 gdouble
gimp_context_get_ink_tilt_sensitivity(void)3521 gimp_context_get_ink_tilt_sensitivity (void)
3522 {
3523   GimpParam *return_vals;
3524   gint nreturn_vals;
3525   gdouble tilt = 0.0;
3526 
3527   return_vals = gimp_run_procedure ("gimp-context-get-ink-tilt-sensitivity",
3528                                     &nreturn_vals,
3529                                     GIMP_PDB_END);
3530 
3531   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3532     tilt = return_vals[1].data.d_float;
3533 
3534   gimp_destroy_params (return_vals, nreturn_vals);
3535 
3536   return tilt;
3537 }
3538 
3539 /**
3540  * gimp_context_set_ink_tilt_sensitivity:
3541  * @tilt: ink tilt sensitivity.
3542  *
3543  * Set ink tilt sensitivity.
3544  *
3545  * Set the ink tilt sensitivity for ink tool.
3546  *
3547  * Returns: TRUE on success.
3548  *
3549  * Since: 2.8
3550  **/
3551 gboolean
gimp_context_set_ink_tilt_sensitivity(gdouble tilt)3552 gimp_context_set_ink_tilt_sensitivity (gdouble tilt)
3553 {
3554   GimpParam *return_vals;
3555   gint nreturn_vals;
3556   gboolean success = TRUE;
3557 
3558   return_vals = gimp_run_procedure ("gimp-context-set-ink-tilt-sensitivity",
3559                                     &nreturn_vals,
3560                                     GIMP_PDB_FLOAT, tilt,
3561                                     GIMP_PDB_END);
3562 
3563   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3564 
3565   gimp_destroy_params (return_vals, nreturn_vals);
3566 
3567   return success;
3568 }
3569 
3570 /**
3571  * gimp_context_get_ink_speed_sensitivity:
3572  *
3573  * Get ink speed sensitivity.
3574  *
3575  * Get the ink speed sensitivity for ink tool.
3576  *
3577  * Returns: ink speed sensitivity.
3578  *
3579  * Since: 2.8
3580  **/
3581 gdouble
gimp_context_get_ink_speed_sensitivity(void)3582 gimp_context_get_ink_speed_sensitivity (void)
3583 {
3584   GimpParam *return_vals;
3585   gint nreturn_vals;
3586   gdouble speed = 0.0;
3587 
3588   return_vals = gimp_run_procedure ("gimp-context-get-ink-speed-sensitivity",
3589                                     &nreturn_vals,
3590                                     GIMP_PDB_END);
3591 
3592   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3593     speed = return_vals[1].data.d_float;
3594 
3595   gimp_destroy_params (return_vals, nreturn_vals);
3596 
3597   return speed;
3598 }
3599 
3600 /**
3601  * gimp_context_set_ink_speed_sensitivity:
3602  * @speed: ink speed sensitivity.
3603  *
3604  * Set ink speed sensitivity.
3605  *
3606  * Set the ink speed sensitivity for ink tool.
3607  *
3608  * Returns: TRUE on success.
3609  *
3610  * Since: 2.8
3611  **/
3612 gboolean
gimp_context_set_ink_speed_sensitivity(gdouble speed)3613 gimp_context_set_ink_speed_sensitivity (gdouble speed)
3614 {
3615   GimpParam *return_vals;
3616   gint nreturn_vals;
3617   gboolean success = TRUE;
3618 
3619   return_vals = gimp_run_procedure ("gimp-context-set-ink-speed-sensitivity",
3620                                     &nreturn_vals,
3621                                     GIMP_PDB_FLOAT, speed,
3622                                     GIMP_PDB_END);
3623 
3624   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3625 
3626   gimp_destroy_params (return_vals, nreturn_vals);
3627 
3628   return success;
3629 }
3630 
3631 /**
3632  * gimp_context_get_ink_blob_type:
3633  *
3634  * Get ink blob type.
3635  *
3636  * Get the ink blob type for ink tool.
3637  *
3638  * Returns: Ink blob type.
3639  *
3640  * Since: 2.8
3641  **/
3642 GimpInkBlobType
gimp_context_get_ink_blob_type(void)3643 gimp_context_get_ink_blob_type (void)
3644 {
3645   GimpParam *return_vals;
3646   gint nreturn_vals;
3647   GimpInkBlobType type = 0;
3648 
3649   return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-type",
3650                                     &nreturn_vals,
3651                                     GIMP_PDB_END);
3652 
3653   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3654     type = return_vals[1].data.d_int32;
3655 
3656   gimp_destroy_params (return_vals, nreturn_vals);
3657 
3658   return type;
3659 }
3660 
3661 /**
3662  * gimp_context_set_ink_blob_type:
3663  * @type: Ink blob type.
3664  *
3665  * Set ink blob type.
3666  *
3667  * Set the ink blob type for ink tool.
3668  *
3669  * Returns: TRUE on success.
3670  *
3671  * Since: 2.8
3672  **/
3673 gboolean
gimp_context_set_ink_blob_type(GimpInkBlobType type)3674 gimp_context_set_ink_blob_type (GimpInkBlobType type)
3675 {
3676   GimpParam *return_vals;
3677   gint nreturn_vals;
3678   gboolean success = TRUE;
3679 
3680   return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-type",
3681                                     &nreturn_vals,
3682                                     GIMP_PDB_INT32, type,
3683                                     GIMP_PDB_END);
3684 
3685   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3686 
3687   gimp_destroy_params (return_vals, nreturn_vals);
3688 
3689   return success;
3690 }
3691 
3692 /**
3693  * gimp_context_get_ink_blob_aspect_ratio:
3694  *
3695  * Get ink blob aspect ratio.
3696  *
3697  * Get the ink blob aspect ratio for ink tool.
3698  *
3699  * Returns: ink blob aspect ratio.
3700  *
3701  * Since: 2.8
3702  **/
3703 gdouble
gimp_context_get_ink_blob_aspect_ratio(void)3704 gimp_context_get_ink_blob_aspect_ratio (void)
3705 {
3706   GimpParam *return_vals;
3707   gint nreturn_vals;
3708   gdouble aspect = 0.0;
3709 
3710   return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-aspect-ratio",
3711                                     &nreturn_vals,
3712                                     GIMP_PDB_END);
3713 
3714   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3715     aspect = return_vals[1].data.d_float;
3716 
3717   gimp_destroy_params (return_vals, nreturn_vals);
3718 
3719   return aspect;
3720 }
3721 
3722 /**
3723  * gimp_context_set_ink_blob_aspect_ratio:
3724  * @aspect: ink blob aspect ratio.
3725  *
3726  * Set ink blob aspect ratio.
3727  *
3728  * Set the ink blob aspect ratio for ink tool.
3729  *
3730  * Returns: TRUE on success.
3731  *
3732  * Since: 2.8
3733  **/
3734 gboolean
gimp_context_set_ink_blob_aspect_ratio(gdouble aspect)3735 gimp_context_set_ink_blob_aspect_ratio (gdouble aspect)
3736 {
3737   GimpParam *return_vals;
3738   gint nreturn_vals;
3739   gboolean success = TRUE;
3740 
3741   return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-aspect-ratio",
3742                                     &nreturn_vals,
3743                                     GIMP_PDB_FLOAT, aspect,
3744                                     GIMP_PDB_END);
3745 
3746   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3747 
3748   gimp_destroy_params (return_vals, nreturn_vals);
3749 
3750   return success;
3751 }
3752 
3753 /**
3754  * gimp_context_get_ink_blob_angle:
3755  *
3756  * Get ink blob angle in degrees.
3757  *
3758  * Get the ink blob angle in degrees for ink tool.
3759  *
3760  * Returns: ink blob angle in degrees.
3761  *
3762  * Since: 2.8
3763  **/
3764 gdouble
gimp_context_get_ink_blob_angle(void)3765 gimp_context_get_ink_blob_angle (void)
3766 {
3767   GimpParam *return_vals;
3768   gint nreturn_vals;
3769   gdouble angle = 0.0;
3770 
3771   return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-angle",
3772                                     &nreturn_vals,
3773                                     GIMP_PDB_END);
3774 
3775   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
3776     angle = return_vals[1].data.d_float;
3777 
3778   gimp_destroy_params (return_vals, nreturn_vals);
3779 
3780   return angle;
3781 }
3782 
3783 /**
3784  * gimp_context_set_ink_blob_angle:
3785  * @angle: ink blob angle in degrees.
3786  *
3787  * Set ink blob angle in degrees.
3788  *
3789  * Set the ink blob angle in degrees for ink tool.
3790  *
3791  * Returns: TRUE on success.
3792  *
3793  * Since: 2.8
3794  **/
3795 gboolean
gimp_context_set_ink_blob_angle(gdouble angle)3796 gimp_context_set_ink_blob_angle (gdouble angle)
3797 {
3798   GimpParam *return_vals;
3799   gint nreturn_vals;
3800   gboolean success = TRUE;
3801 
3802   return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-angle",
3803                                     &nreturn_vals,
3804                                     GIMP_PDB_FLOAT, angle,
3805                                     GIMP_PDB_END);
3806 
3807   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
3808 
3809   gimp_destroy_params (return_vals, nreturn_vals);
3810 
3811   return success;
3812 }
3813