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

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

#include "config.h"

25
26
#include <string.h>

27
28
#include "gimp.h"

29
30
31
32
33
34
35
36
37
38

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


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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_pop:
 *
 * Pops the topmost context from the plug-in's context stack.
 *
75
76
 * This procedure removes the topmost context from the plug-in's
 * 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
81
 *
 * Returns: TRUE on success.
 *
82
 * Since: 2.2
83
 **/
84
85
86
87
88
89
90
gboolean
gimp_context_pop (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

  return success;
}

/**
 * gimp_context_set_defaults:
 *
 * Reset context settings to their default values.
 *
 * This procedure resets context settings used by various procedures to
 * their default value. This procedure will usually be called after a
 * context push so that a script which calls procedures affected by
 * context settings will not be affected by changes in the global
 * context.
 *
 * Returns: TRUE on success.
 *
115
 * Since: 2.8
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
 **/
gboolean
gimp_context_set_defaults (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);
131
132
133

  return success;
}
134

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

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

  *num_paint_methods = 0;
  *paint_methods = NULL;

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

  if (success)
    {
      *num_paint_methods = return_vals[1].data.d_int32;
170
171
172
173
174
175
      if (*num_paint_methods > 0)
        {
          *paint_methods = g_new0 (gchar *, *num_paint_methods + 1);
          for (i = 0; i < *num_paint_methods; i++)
            (*paint_methods)[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
        }
176
177
178
179
180
181
182
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

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

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

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_stroke_method:
 *
 * Retrieve the currently active stroke method.
 *
 * This procedure returns the currently active stroke method.
 *
 * Returns: The active stroke method.
 *
 * Since: 2.10
 **/
GimpStrokeMethod
gimp_context_get_stroke_method (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpStrokeMethod stroke_method = 0;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return stroke_method;
}

/**
 * gimp_context_set_stroke_method:
 * @stroke_method: The new stroke method.
 *
 * Set the specified stroke method as the active stroke method.
 *
 * This procedure set the specified stroke method as the active stroke
 * method. The new method will be used in all subsequent stroke
 * operations.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_stroke_method (GimpStrokeMethod stroke_method)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

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

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
307
308
309
310
311
312

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

313
314
315
316
317
318
/**
 * gimp_context_get_foreground:
 * @foreground: The foreground color.
 *
 * Get the current GIMP foreground color.
 *
319
 * This procedure returns the current GIMP foreground color. The
320
321
322
323
324
 * foreground color is used in a variety of tools such as paint tools,
 * blending, and bucket fill.
 *
 * Returns: TRUE on success.
 *
325
 * Since: 2.2
326
 **/
327
328
329
330
331
332
333
gboolean
gimp_context_get_foreground (GimpRGB *foreground)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

334
  return_vals = gimp_run_procedure ("gimp-context-get-foreground",
335
336
                                    &nreturn_vals,
                                    GIMP_PDB_END);
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_foreground:
 * @foreground: The foreground color.
 *
 * Set the current GIMP foreground color.
 *
 * This procedure sets the current GIMP foreground color. After this is
 * set, operations which use foreground such as paint tools, blending,
 * and bucket fill will use the new value.
 *
 * Returns: TRUE on success.
 *
360
 * Since: 2.2
361
 **/
362
363
364
365
366
367
368
gboolean
gimp_context_set_foreground (const GimpRGB *foreground)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

369
  return_vals = gimp_run_procedure ("gimp-context-set-foreground",
370
371
372
                                    &nreturn_vals,
                                    GIMP_PDB_COLOR, foreground,
                                    GIMP_PDB_END);
373
374
375
376
377
378
379
380
381
382

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_background:
383
 * @background: The background color.
384
385
386
 *
 * Get the current GIMP background color.
 *
387
 * This procedure returns the current GIMP background color. The
388
389
390
391
392
 * background color is used in a variety of tools such as blending,
 * erasing (with non-alpha images), and image filling.
 *
 * Returns: TRUE on success.
 *
393
 * Since: 2.2
394
 **/
395
gboolean
396
gimp_context_get_background (GimpRGB *background)
397
398
399
400
401
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

402
  return_vals = gimp_run_procedure ("gimp-context-get-background",
403
404
                                    &nreturn_vals,
                                    GIMP_PDB_END);
405
406
407
408

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

  if (success)
409
    *background = return_vals[1].data.d_color;
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_background:
 * @background: The background color.
 *
 * Set the current GIMP background color.
 *
 * This procedure sets the current GIMP background color. After this is
 * set, operations which use background such as blending, filling
 * images, clearing, and erasing (in non-alpha images) will use the new
 * value.
 *
 * Returns: TRUE on success.
 *
429
 * Since: 2.2
430
 **/
431
432
433
434
435
436
437
gboolean
gimp_context_set_background (const GimpRGB *background)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

438
  return_vals = gimp_run_procedure ("gimp-context-set-background",
439
440
441
                                    &nreturn_vals,
                                    GIMP_PDB_COLOR, background,
                                    GIMP_PDB_END);
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_default_colors:
 *
 * Set the current GIMP foreground and background colors to black and
 * white.
 *
 * This procedure sets the current GIMP foreground and background
 * colors to their initial default values, black and white.
 *
 * Returns: TRUE on success.
 *
461
 * Since: 2.2
462
 **/
463
464
465
466
467
468
469
gboolean
gimp_context_set_default_colors (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

470
  return_vals = gimp_run_procedure ("gimp-context-set-default-colors",
471
472
                                    &nreturn_vals,
                                    GIMP_PDB_END);
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_swap_colors:
 *
 * Swap the current GIMP foreground and background colors.
 *
 * This procedure swaps the current GIMP foreground and background
 * colors, so that the new foreground color becomes the old background
 * color and vice versa.
 *
 * Returns: TRUE on success.
491
 *
492
 * Since: 2.2
493
 **/
494
495
496
497
498
499
500
gboolean
gimp_context_swap_colors (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

501
  return_vals = gimp_run_procedure ("gimp-context-swap-colors",
502
503
                                    &nreturn_vals,
                                    GIMP_PDB_END);
504
505
506
507
508
509
510

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
511
512
513
514
515
516
517
518
519
520
521

/**
 * gimp_context_get_opacity:
 *
 * Get the opacity.
 *
 * This procedure returns the opacity setting. The return value is a
 * floating point number between 0 and 100.
 *
 * Returns: The opacity.
 *
522
 * Since: 2.2
523
 **/
524
525
526
527
528
gdouble
gimp_context_get_opacity (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
529
  gdouble opacity = 0.0;
530

531
  return_vals = gimp_run_procedure ("gimp-context-get-opacity",
532
533
                                    &nreturn_vals,
                                    GIMP_PDB_END);
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return opacity;
}

/**
 * gimp_context_set_opacity:
 * @opacity: The opacity.
 *
 * Set the opacity.
 *
 * This procedure modifies the opacity setting. The value should be a
 * floating point number between 0 and 100.
 *
 * Returns: TRUE on success.
 *
554
 * Since: 2.2
555
 **/
556
557
558
559
560
561
562
gboolean
gimp_context_set_opacity (gdouble opacity)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

563
  return_vals = gimp_run_procedure ("gimp-context-set-opacity",
564
565
566
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, opacity,
                                    GIMP_PDB_END);
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_paint_mode:
 *
 * Get the paint mode.
 *
 * This procedure returns the paint-mode setting. The return value is
 * an integer which corresponds to the values listed in the argument
 * description.
 *
 * Returns: The paint mode.
 *
586
 * Since: 2.2
587
 **/
588
GimpLayerMode
589
590
591
592
gimp_context_get_paint_mode (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
593
  GimpLayerMode paint_mode = 0;
594

595
  return_vals = gimp_run_procedure ("gimp-context-get-paint-mode",
596
597
                                    &nreturn_vals,
                                    GIMP_PDB_END);
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return paint_mode;
}

/**
 * gimp_context_set_paint_mode:
 * @paint_mode: The paint mode.
 *
 * Set the paint mode.
 *
 * This procedure modifies the paint_mode setting.
 *
 * Returns: TRUE on success.
 *
617
 * Since: 2.2
618
 **/
619
gboolean
620
gimp_context_set_paint_mode (GimpLayerMode paint_mode)
621
622
623
624
625
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

626
  return_vals = gimp_run_procedure ("gimp-context-set-paint-mode",
627
628
629
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, paint_mode,
                                    GIMP_PDB_END);
630
631
632
633
634
635
636

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
637

638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
/**
 * gimp_context_get_line_width:
 *
 * Get the line width setting.
 *
 * This procedure returns the line width setting.
 *
 * Returns: The line width setting.
 *
 * Since: 2.10
 **/
gdouble
gimp_context_get_line_width (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble line_width = 0.0;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return line_width;
}

/**
 * gimp_context_set_line_width:
 * @line_width: The line width setting.
 *
 * Set the line width setting.
 *
 * This procedure modifies the line width setting for stroking lines.
 * This setting affects the following procedures: gimp_edit_stroke(),
 * gimp_edit_stroke_vectors().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_line_width (gdouble line_width)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-line-width",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, line_width,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_line_width_unit:
 *
 * Get the line width unit setting.
 *
 * This procedure returns the line width unit setting.
 *
 * Returns: The line width unit setting.
 *
 * Since: 2.10
 **/
GimpUnit
gimp_context_get_line_width_unit (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpUnit line_width_unit = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-line-width-unit",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    line_width_unit = return_vals[1].data.d_unit;

  gimp_destroy_params (return_vals, nreturn_vals);

  return line_width_unit;
}

/**
 * gimp_context_set_line_width_unit:
 * @line_width_unit: The line width setting unit.
 *
 * Set the line width unit setting.
 *
 * This procedure modifies the line width unit setting for stroking
 * lines.
 * This setting affects the following procedures: gimp_edit_stroke(),
 * gimp_edit_stroke_vectors().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_line_width_unit (GimpUnit line_width_unit)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-line-width-unit",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, line_width_unit,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_line_cap_style:
 *
 * Get the line cap style setting.
 *
 * This procedure returns the line cap style setting.
 *
 * Returns: The line cap style setting.
 *
 * Since: 2.10
 **/
GimpCapStyle
gimp_context_get_line_cap_style (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpCapStyle cap_style = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-line-cap-style",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return cap_style;
}

/**
 * gimp_context_set_line_cap_style:
 * @cap_style: The line cap style setting.
 *
 * Set the line cap style setting.
 *
 * This procedure modifies the line cap style setting for stroking
 * lines.
 * This setting affects the following procedures: gimp_edit_stroke(),
 * gimp_edit_stroke_vectors().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_line_cap_style (GimpCapStyle cap_style)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-line-cap-style",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, cap_style,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_line_join_style:
 *
 * Get the line join style setting.
 *
 * This procedure returns the line join style setting.
 *
 * Returns: The line join style setting.
 *
 * Since: 2.10
 **/
GimpJoinStyle
gimp_context_get_line_join_style (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpJoinStyle join_style = 0;

  return_vals = gimp_run_procedure ("gimp-context-get-line-join-style",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return join_style;
}

/**
 * gimp_context_set_line_join_style:
 * @join_style: The line join style setting.
 *
 * Set the line join style setting.
 *
 * This procedure modifies the line join style setting for stroking
 * lines.
 * This setting affects the following procedures: gimp_edit_stroke(),
 * gimp_edit_stroke_vectors().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_line_join_style (GimpJoinStyle join_style)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-line-join-style",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, join_style,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_line_miter_limit:
 *
 * Get the line miter limit setting.
 *
 * This procedure returns the line miter limit setting.
 *
 * Returns: The line miter limit setting.
 *
 * Since: 2.10
 **/
gdouble
gimp_context_get_line_miter_limit (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble miter_limit = 0.0;

  return_vals = gimp_run_procedure ("gimp-context-get-line-miter-limit",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return miter_limit;
}

/**
 * gimp_context_set_line_miter_limit:
 * @miter_limit: The line miter limit setting.
 *
 * Set the line miter limit setting.
 *
 * This procedure modifies the line miter limit setting for stroking
 * lines.
 * A mitered join is converted to a bevelled join if the miter would
 * extend to a distance of more than (miter-limit * line-width) from
 * the actual join point.
 * This setting affects the following procedures: gimp_edit_stroke(),
 * gimp_edit_stroke_vectors().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_line_miter_limit (gdouble miter_limit)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-line-miter-limit",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, miter_limit,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_line_dash_offset:
 *
 * Get the line dash offset setting.
 *
 * This procedure returns the line dash offset setting.
 *
 * Returns: The line dash offset setting.
 *
 * Since: 2.10
 **/
gdouble
gimp_context_get_line_dash_offset (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble dash_offset = 0.0;

  return_vals = gimp_run_procedure ("gimp-context-get-line-dash-offset",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return dash_offset;
}

/**
 * gimp_context_set_line_dash_offset:
 * @dash_offset: The line dash offset setting.
 *
 * Set the line dash offset setting.
 *
 * This procedure modifies the line dash offset setting for stroking
 * lines.
 * This setting affects the following procedures: gimp_edit_stroke(),
 * gimp_edit_stroke_vectors().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_line_dash_offset (gdouble dash_offset)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-line-dash-offset",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, dash_offset,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_line_dash_pattern:
 * @num_dashes: The number of dashes in the dash_pattern array.
 * @dashes: The line dash pattern setting.
 *
 * Get the line dash pattern setting.
 *
 * This procedure returns the line dash pattern setting.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_get_line_dash_pattern (gint     *num_dashes,
                                    gdouble **dashes)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-get-line-dash-pattern",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

  *num_dashes = 0;
  *dashes = NULL;

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

  if (success)
    {
      *num_dashes = return_vals[1].data.d_int32;
      *dashes = g_new (gdouble, *num_dashes);
      memcpy (*dashes,
              return_vals[2].data.d_floatarray,
              *num_dashes * sizeof (gdouble));
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_line_dash_pattern:
 * @num_dashes: The number of dashes in the dash_pattern array.
 * @dashes: The line dash pattern setting.
 *
 * Set the line dash pattern setting.
 *
 * This procedure modifies the line dash pattern setting for stroking
 * lines.
 * The unit of the dash pattern segments is the actual line width used
Richard Kreckel's avatar
Richard Kreckel committed
1078
 * for the stroke operation, in other words a segment length of 1.0
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
 * results in a square segment shape (or gap shape).
 * This setting affects the following procedures: gimp_edit_stroke(),
 * gimp_edit_stroke_vectors().
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_context_set_line_dash_pattern (gint           num_dashes,
                                    const gdouble *dashes)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-line-dash-pattern",
                                    &nreturn_vals,
                                    GIMP_PDB_INT32, num_dashes,
                                    GIMP_PDB_FLOATARRAY, dashes,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

1108
1109
1110
1111
1112
/**
 * gimp_context_get_brush:
 *
 * Retrieve the currently active brush.
 *
1113
 * This procedure returns the name of the currently active brush. All
1114
1115
1116
1117
1118
 * paint operations and stroke operations use this brush to control the
 * application of paint to the image.
 *
 * Returns: The name of the active brush.
 *
1119
 * Since: 2.2
1120
 **/
1121
1122
1123
1124
1125
1126
1127
gchar *
gimp_context_get_brush (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

1128
  return_vals = gimp_run_procedure ("gimp-context-get-brush",
1129
1130
                                    &nreturn_vals,
                                    GIMP_PDB_END);
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_brush:
1142
 * @name: The name of the brush.
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
 *
 * Set the specified brush as the active brush.
 *
 * This procedure allows the active brush to be set by specifying its
 * name. The name is simply a string which corresponds to one of the
 * names of the installed brushes. If there is no matching brush found,
 * this procedure will return an error. Otherwise, the specified brush
 * becomes active and will be used in all subsequent paint operations.
 *
 * Returns: TRUE on success.
 *
1154
 * Since: 2.2
1155
 **/
1156
1157
1158
1159
1160
1161
1162
gboolean
gimp_context_set_brush (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

1163
  return_vals = gimp_run_procedure ("gimp-context-set-brush",
1164
1165
1166
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
1167
1168
1169
1170
1171
1172
1173
1174

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

1175
1176
1177
1178
1179
1180
1181
/**
 * gimp_context_get_brush_size:
 *
 * Get brush size in pixels.
 *
 * Get the brush size in pixels for brush based paint tools.
 *
1182
 * Returns: Brush size in pixels.
1183
 *
1184
 * Since: 2.8
1185
 **/
1186
1187
gdouble
gimp_context_get_brush_size (void)
1188
1189
1190
{
  GimpParam *return_vals;
  gint nreturn_vals;
1191
  gdouble size = 0.0;
1192
1193
1194
1195
1196

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

1197
1198
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    size = return_vals[1].data.d_float;
1199
1200
1201

  gimp_destroy_params (return_vals, nreturn_vals);

1202
  return size;
1203
1204
1205
1206
}

/**
 * gimp_context_set_brush_size:
1207
 * @size: Brush size in pixels.
1208
1209
1210
1211
1212
1213
1214
 *
 * Set brush size in pixels.
 *
 * Set the brush size in pixels for brush based paint tools.
 *
 * Returns: TRUE on success.
 *
1215
 * Since: 2.8
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
 **/
gboolean
gimp_context_set_brush_size (gdouble size)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-size",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, size,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_brush_default_size:
 *
 * Set brush size to its default.
 *
 * Set the brush size to the default (max of width and height) for
 * paintbrush, airbrush, or pencil tools.
 *
 * Returns: TRUE on success.
 *
1246
 * Since: 2.8
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
 **/
gboolean
gimp_context_set_brush_default_size (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-default-size",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_brush_aspect_ratio:
 *
 * Get brush aspect ratio.
 *
 * Set the aspect ratio for brush based paint tools.
 *
1273
 * Returns: Aspect ratio.
1274
 *
1275
 * Since: 2.8
1276
 **/
1277
1278
gdouble
gimp_context_get_brush_aspect_ratio (void)
1279
1280
1281
{
  GimpParam *return_vals;
  gint nreturn_vals;
1282
  gdouble aspect = 0.0;
1283
1284
1285
1286
1287

  return_vals = gimp_run_procedure ("gimp-context-get-brush-aspect-ratio",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

1288
1289
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    aspect = return_vals[1].data.d_float;
1290
1291
1292

  gimp_destroy_params (return_vals, nreturn_vals);

1293
  return aspect;
1294
1295
1296
1297
}

/**
 * gimp_context_set_brush_aspect_ratio:
1298
 * @aspect: Aspect ratio.
1299
1300
1301
1302
1303
1304
1305
 *
 * Set brush aspect ratio.
 *
 * Set the aspect ratio for brush based paint tools.
 *
 * Returns: TRUE on success.
 *
1306
 * Since: 2.8
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
 **/
gboolean
gimp_context_set_brush_aspect_ratio (gdouble aspect)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-aspect-ratio",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, aspect,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_brush_angle:
 *
 * Get brush angle in degrees.
 *
 * Set the angle in degrees for brush based paint tools.
 *
1334
 * Returns: Angle in degrees.
1335
 *
1336
 * Since: 2.8
1337
 **/
1338
1339
gdouble
gimp_context_get_brush_angle (void)
1340
1341
1342
{
  GimpParam *return_vals;
  gint nreturn_vals;
1343
  gdouble angle = 0.0;
1344
1345
1346
1347
1348

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

1349
1350
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    angle = return_vals[1].data.d_float;
1351
1352
1353

  gimp_destroy_params (return_vals, nreturn_vals);

1354
  return angle;
1355
1356
1357
1358
}

/**
 * gimp_context_set_brush_angle:
1359
 * @angle: Angle in degrees.
1360
1361
1362
1363
1364
1365
1366
 *
 * Set brush angle in degrees.
 *
 * Set the angle in degrees for brush based paint tools.
 *
 * Returns: TRUE on success.
 *
1367
 * Since: 2.8
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
 **/
gboolean
gimp_context_set_brush_angle (gdouble angle)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-angle",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, angle,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

1388
1389
1390
1391
1392
1393
1394
1395
/**
 * gimp_context_get_brush_spacing:
 *
 * Get brush spacing as percent of size.
 *
 * Get the brush spacing as percent of size for brush based paint
 * tools.
 *
1396
 * Returns: Brush spacing as fraction of size.
1397
 *
1398
 * Since: 2.10
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
 **/
gdouble
gimp_context_get_brush_spacing (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble spacing = 0.0;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return spacing;
}

/**
 * gimp_context_set_brush_spacing:
1421
 * @spacing: Brush spacing as fraction of size.
1422
1423
1424
1425
1426
1427
1428
1429
 *
 * Set brush spacing as percent of size.
 *
 * Set the brush spacing as percent of size for brush based paint
 * tools.
 *
 * Returns: TRUE on success.
 *
1430
 * Since: 2.10
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
 **/
gboolean
gimp_context_set_brush_spacing (gdouble spacing)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-spacing",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, spacing,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_brush_default_spacing:
 *
 * Set brush spacing to its default.
 *
 * Set the brush spacing to the default for paintbrush, airbrush, or
 * pencil tools.
 *
 * Returns: TRUE on success.
 *
1461
 * Since: 2.10
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
 **/
gboolean
gimp_context_set_brush_default_spacing (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-default-spacing",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

1481
1482
1483
1484
1485
1486
1487
/**
 * gimp_context_get_brush_hardness:
 *
 * Get brush hardness in paint options.
 *
 * Get the brush hardness for brush based paint tools.
 *
1488
 * Returns: Brush hardness.
1489
 *
1490
 * Since: 2.10
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
 **/
gdouble
gimp_context_get_brush_hardness (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble hardness = 0.0;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return hardness;
}

/**
 * gimp_context_set_brush_hardness:
1513
 * @hardness: Brush hardness.
1514
1515
1516
1517
1518
1519
1520
 *
 * Set brush hardness.
 *
 * Set the brush hardness for brush based paint tools.
 *
 * Returns: TRUE on success.
 *
1521
 * Since: 2.10
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
 **/
gboolean
gimp_context_set_brush_hardness (gdouble hardness)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-hardness",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, hardness,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_set_brush_default_hardness:
 *
 * Set brush spacing to its default.
 *
 * Set the brush spacing to the default for paintbrush, airbrush, or
 * pencil tools.
 *
 * Returns: TRUE on success.
 *
1552
 * Since: 2.10
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
 **/
gboolean
gimp_context_set_brush_default_hardness (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-default-hardness",
                                    &nreturn_vals,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_brush_force:
 *
 * Get brush force in paint options.
 *
 * Get the brush application force for brush based paint tools.
 *
1579
 * Returns: Brush application force.
1580
 *
1581
 * Since: 2.10
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
 **/
gdouble
gimp_context_get_brush_force (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble force = 0.0;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return force;
}

/**
 * gimp_context_set_brush_force:
1604
 * @force: Brush application force.
1605
1606
1607
1608
1609
1610
1611
 *
 * Set brush application force.
 *
 * Set the brush application force for brush based paint tools.
 *
 * Returns: TRUE on success.
 *
1612
 * Since: 2.10
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
 **/
gboolean
gimp_context_set_brush_force (gdouble force)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-context-set-brush-force",
                                    &nreturn_vals,
                                    GIMP_PDB_FLOAT, force,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
/**
 * gimp_context_get_dynamics:
 *
 * Retrieve the currently active paint dynamics.
 *
 * This procedure returns the name of the currently active paint
 * dynamics. All paint operations and stroke operations use this paint
 * dynamics to control the application of paint to the image.
 *
 * Returns: The name of the active paint dynamics.
 *
1644
 * Since: 2.8
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
 **/
gchar *
gimp_context_get_dynamics (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_dynamics:
 * @name: The name of the paint dynamics.
 *
 * Set the specified paint dynamics as the active paint dynamics.
 *
 * This procedure allows the active paint dynamics to be set by
 * specifying its name. The name is simply a string which corresponds
 * to one of the names of the installed paint dynamics. If there is no
 * matching paint dynamics found, this procedure will return an error.
 * Otherwise, the specified paint dynamics becomes active and will be
 * used in all subsequent paint operations.
 *
 * Returns: TRUE on success.
 *
1680
 * Since: 2.8
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
 **/
gboolean
gimp_context_set_dynamics (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
/**
 * gimp_context_get_mypaint_brush:
 *
 * Retrieve the currently active MyPaint brush.
 *
 * This procedure returns the name of the currently active MyPaint
 * brush.
 *
 * Returns: The name of the active MyPaint brush.
 *
 * Since: 2.10
 **/
gchar *
gimp_context_get_mypaint_brush (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

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

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
/**
 * gimp_context_get_pattern:
 *
 * Retrieve the currently active pattern.
 *
 * This procedure returns name of the the currently active pattern. All
 * clone and bucket-fill operations with patterns will use this pattern
 * to control the application of paint to the image.
 *
 * Returns: The name of the active pattern.
 *
1779
 * Since: 2.2
1780
 **/
1781
1782
1783
1784
1785
1786
1787
gchar *
gimp_context_get_pattern (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

1788
  return_vals = gimp_run_procedure ("gimp-context-get-pattern",
1789
1790
                                    &nreturn_vals,
                                    GIMP_PDB_END);
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

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

1824
  return_vals = gimp_run_procedure ("gimp-context-set-pattern",
1825
1826
1827
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_gradient:
 *
 * Retrieve the currently active gradient.
 *
 * This procedure returns the name of the currently active gradient.
 *
 * Returns: The name of the active gradient.
 *
1845
 * Since: 2.2
1846
 **/
1847
1848
1849
1850
1851
1852
1853
gchar *
gimp_context_get_gradient (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

1854
  return_vals = gimp_run_procedure ("gimp-context-get-gradient",
1855
1856
                                    &nreturn_vals,
                                    GIMP_PDB_END);
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_gradient:
 * @name: The name of the gradient.
 *
 * Sets the specified gradient as the active gradient.
 *
 * This procedure lets you set the specified gradient as the active or
 * \"current\" one. The name is simply a string which corresponds to
 * one of the loaded gradients. If no matching gradient is found, this
 * procedure will return an error. Otherwise, the specified gradient
 * will become active and will be used for subsequent custom gradient
 * operations.
 *
 * Returns: TRUE on success.
 *
1881
 * Since: 2.2
1882
 **/
1883
1884
1885
1886
1887
1888
1889
gboolean
gimp_context_set_gradient (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

1890
  return_vals = gimp_run_procedure ("gimp-context-set-gradient",
1891
1892
1893
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_palette:
 *
 * Retrieve the currently active palette.
 *
 * This procedure returns the name of the the currently active palette.
 *
 * Returns: The name of the active palette.
 *
1911
 * Since: 2.2
1912
 **/
1913
1914
1915
1916
1917
1918
1919
gchar *
gimp_context_get_palette (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

1920
  return_vals = gimp_run_procedure ("gimp-context-get-palette",
1921
1922
                                    &nreturn_vals,
                                    GIMP_PDB_END);
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return name;
}

/**
 * gimp_context_set_palette:
 * @name: The name of the palette.
 *
 * Set the specified palette as the active palette.
 *
 * This procedure allows the active palette to be set by specifying its
 * name. The name is simply a string which corresponds to one of the
 * names of the installed palettes. If no matching palette is found,
 * this procedure will return an error. Otherwise, the specified
 * palette becomes active and will be used in all subsequent palette
 * operations.
 *
 * Returns: TRUE on success.
 *
1947
 * Since: 2.2
1948
 **/
1949
1950
1951
1952
1953
1954
1955
gboolean
gimp_context_set_palette (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

1956
  return_vals = gimp_run_procedure ("gimp-context-set-palette",
1957
1958
1959
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_context_get_font:
 *
 * Retrieve the currently active font.
 *
 * This procedure returns the name of the currently active font.
 *
 * Returns: The name of the active font.
 *
1977
 * Since: 2.2
1978
 **/
1979
1980
1981
1982
1983
1984
1985
gchar *
gimp_context_get_font (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;