summaryrefslogtreecommitdiffstats
path: root/libgimp/gimpitem_pdb.c
blob: b5ab9e2192eec29ac49d7bda7f38dfd897edf857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
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
1078
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
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimpitem_pdb.c
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <https://www.gnu.org/licenses/>.
 */

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

#include "config.h"

#include <string.h>

#include "gimp.h"


/**
 * SECTION: gimpitem
 * @title: gimpitem
 * @short_description: Functions to manipulate items.
 *
 * Functions to manipulate items.
 **/


/**
 * gimp_item_is_valid:
 * @item_ID: The item to check.
 *
 * Returns TRUE if the item is valid.
 *
 * This procedure checks if the given item ID is valid and refers to an
 * existing item.
 *
 * Returns: Whether the item ID is valid.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_valid (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean valid = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-valid",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return valid;
}

/**
 * gimp_item_get_image:
 * @item_ID: The item.
 *
 * Returns the item's image.
 *
 * This procedure returns the item's image.
 *
 * Returns: The item's image.
 *
 * Since: 2.8
 **/
gint32
gimp_item_get_image (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 image_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-get-image",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    image_ID = return_vals[1].data.d_image;

  gimp_destroy_params (return_vals, nreturn_vals);

  return image_ID;
}

/**
 * gimp_item_delete:
 * @item_ID: The item to delete.
 *
 * Delete a item.
 *
 * This procedure deletes the specified item. This must not be done if
 * the image containing this item was already deleted or if the item
 * was already removed from the image. The only case in which this
 * procedure is useful is if you want to get rid of a item which has
 * not yet been added to an image.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_delete (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-delete",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_is_drawable:
 * @item_ID: The item.
 *
 * Returns whether the item is a drawable.
 *
 * This procedure returns TRUE if the specified item is a drawable.
 *
 * Returns: TRUE if the item is a drawable, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_drawable (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean drawable = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-drawable",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return drawable;
}

/**
 * gimp_item_is_layer:
 * @item_ID: The item.
 *
 * Returns whether the item is a layer.
 *
 * This procedure returns TRUE if the specified item is a layer.
 *
 * Returns: TRUE if the item is a layer, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_layer (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean layer = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-layer",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return layer;
}

/**
 * gimp_item_is_text_layer:
 * @item_ID: The item.
 *
 * Returns whether the item is a text layer.
 *
 * This procedure returns TRUE if the specified item is a text layer.
 *
 * Returns: TRUE if the item is a text layer, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_text_layer (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean text_layer = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-text-layer",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return text_layer;
}

/**
 * gimp_item_is_channel:
 * @item_ID: The item.
 *
 * Returns whether the item is a channel.
 *
 * This procedure returns TRUE if the specified item is a channel.
 *
 * Returns: TRUE if the item is a channel, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_channel (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean channel = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-channel",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return channel;
}

/**
 * gimp_item_is_layer_mask:
 * @item_ID: The item.
 *
 * Returns whether the item is a layer mask.
 *
 * This procedure returns TRUE if the specified item is a layer mask.
 *
 * Returns: TRUE if the item is a layer mask, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_layer_mask (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean layer_mask = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-layer-mask",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return layer_mask;
}

/**
 * gimp_item_is_selection:
 * @item_ID: The item.
 *
 * Returns whether the item is a selection.
 *
 * This procedure returns TRUE if the specified item is a selection.
 *
 * Returns: TRUE if the item is a selection, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_selection (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean selection = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-selection",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return selection;
}

/**
 * gimp_item_is_vectors:
 * @item_ID: The item.
 *
 * Returns whether the item is a vectors.
 *
 * This procedure returns TRUE if the specified item is a vectors.
 *
 * Returns: TRUE if the item is a vectors, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_vectors (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean vectors = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-vectors",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return vectors;
}

/**
 * gimp_item_is_group:
 * @item_ID: The item.
 *
 * Returns whether the item is a group item.
 *
 * This procedure returns TRUE if the specified item is a group item
 * which can have children.
 *
 * Returns: TRUE if the item is a group, FALSE otherwise.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_is_group (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean group = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-is-group",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return group;
}

/**
 * gimp_item_get_parent:
 * @item_ID: The item.
 *
 * Returns the item's parent item.
 *
 * This procedure returns the item's parent item, if any.
 *
 * Returns: The item's parent item.
 *
 * Since: 2.8
 **/
gint32
gimp_item_get_parent (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 parent_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-get-parent",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return parent_ID;
}

/**
 * gimp_item_get_children:
 * @item_ID: The item.
 * @num_children: The item's number of children.
 *
 * Returns the item's list of children.
 *
 * This procedure returns the list of items which are children of the
 * specified item. The order is topmost to bottommost.
 *
 * Returns: The item's list of children.
 *
 * Since: 2.8
 **/
gint *
gimp_item_get_children (gint32  item_ID,
                        gint   *num_children)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint *child_ids = NULL;

  return_vals = gimp_run_procedure ("gimp-item-get-children",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

  *num_children = 0;

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    {
      *num_children = return_vals[1].data.d_int32;
      child_ids = g_new (gint32, *num_children);
      memcpy (child_ids,
              return_vals[2].data.d_int32array,
              *num_children * sizeof (gint32));
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return child_ids;
}

/**
 * gimp_item_get_expanded:
 * @item_ID: The item.
 *
 * Returns whether the item is expanded.
 *
 * This procedure returns TRUE if the specified item is expanded.
 *
 * Returns: TRUE if the item is expanded, FALSE otherwise.
 *
 * Since: 2.10
 **/
gboolean
gimp_item_get_expanded (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean expanded = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-get-expanded",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return expanded;
}

/**
 * gimp_item_set_expanded:
 * @item_ID: The item.
 * @expanded: TRUE to expand the item, FALSE to collapse the item.
 *
 * Sets the expanded state of the item.
 *
 * This procedure expands or collapses the item.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_item_set_expanded (gint32   item_ID,
                        gboolean expanded)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-expanded",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, expanded,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_get_name:
 * @item_ID: The item.
 *
 * Get the name of the specified item.
 *
 * This procedure returns the specified item's name.
 *
 * Returns: The item name.
 *
 * Since: 2.8
 **/
gchar *
gimp_item_get_name (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *name = NULL;

  return_vals = gimp_run_procedure ("gimp-item-get-name",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    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_item_set_name:
 * @item_ID: The item.
 * @name: The new item name.
 *
 * Set the name of the specified item.
 *
 * This procedure sets the specified item's name.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_set_name (gint32       item_ID,
                    const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-name",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    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;
}

/**
 * gimp_item_get_visible:
 * @item_ID: The item.
 *
 * Get the visibility of the specified item.
 *
 * This procedure returns the specified item's visibility.
 *
 * Returns: The item visibility.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_get_visible (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean visible = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-get-visible",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return visible;
}

/**
 * gimp_item_set_visible:
 * @item_ID: The item.
 * @visible: The new item visibility.
 *
 * Set the visibility of the specified item.
 *
 * This procedure sets the specified item's visibility.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_set_visible (gint32   item_ID,
                       gboolean visible)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-visible",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, visible,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_get_linked:
 * @item_ID: The item.
 *
 * Get the linked state of the specified item.
 *
 * This procedure returns the specified item's linked state.
 *
 * Returns: The item linked state (for moves).
 *
 * Since: 2.8
 **/
gboolean
gimp_item_get_linked (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean linked = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-get-linked",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return linked;
}

/**
 * gimp_item_set_linked:
 * @item_ID: The item.
 * @linked: The new item linked state.
 *
 * Set the linked state of the specified item.
 *
 * This procedure sets the specified item's linked state.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_set_linked (gint32   item_ID,
                      gboolean linked)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-linked",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, linked,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_get_lock_content:
 * @item_ID: The item.
 *
 * Get the 'lock content' state of the specified item.
 *
 * This procedure returns the specified item's lock content state.
 *
 * Returns: Whether the item's contents are locked.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_get_lock_content (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean lock_content = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-get-lock-content",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return lock_content;
}

/**
 * gimp_item_set_lock_content:
 * @item_ID: The item.
 * @lock_content: The new item 'lock content' state.
 *
 * Set the 'lock content' state of the specified item.
 *
 * This procedure sets the specified item's lock content state.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_set_lock_content (gint32   item_ID,
                            gboolean lock_content)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-lock-content",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, lock_content,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_get_lock_position:
 * @item_ID: The item.
 *
 * Get the 'lock position' state of the specified item.
 *
 * This procedure returns the specified item's lock position state.
 *
 * Returns: Whether the item's position is locked.
 *
 * Since: 2.10
 **/
gboolean
gimp_item_get_lock_position (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean lock_position = FALSE;

  return_vals = gimp_run_procedure ("gimp-item-get-lock-position",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return lock_position;
}

/**
 * gimp_item_set_lock_position:
 * @item_ID: The item.
 * @lock_position: The new item 'lock position' state.
 *
 * Set the 'lock position' state of the specified item.
 *
 * This procedure sets the specified item's lock position state.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_item_set_lock_position (gint32   item_ID,
                             gboolean lock_position)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-lock-position",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, lock_position,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_get_color_tag:
 * @item_ID: The item.
 *
 * Get the color tag of the specified item.
 *
 * This procedure returns the specified item's color tag.
 *
 * Returns: The item's color tag.
 *
 * Since: 2.10
 **/
GimpColorTag
gimp_item_get_color_tag (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpColorTag color_tag = 0;

  return_vals = gimp_run_procedure ("gimp-item-get-color-tag",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return color_tag;
}

/**
 * gimp_item_set_color_tag:
 * @item_ID: The item.
 * @color_tag: The new item color tag.
 *
 * Set the color tag of the specified item.
 *
 * This procedure sets the specified item's color tag.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_item_set_color_tag (gint32       item_ID,
                         GimpColorTag color_tag)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-color-tag",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, color_tag,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_get_tattoo:
 * @item_ID: The item.
 *
 * Get the tattoo of the specified item.
 *
 * This procedure returns the specified item's tattoo. A tattoo is a
 * unique and permanent identifier attached to a item that can be used
 * to uniquely identify a item within an image even between sessions.
 *
 * Returns: The item tattoo.
 *
 * Since: 2.8
 **/
gint
gimp_item_get_tattoo (gint32 item_ID)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint tattoo = 0;

  return_vals = gimp_run_procedure ("gimp-item-get-tattoo",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    tattoo = return_vals[1].data.d_tattoo;

  gimp_destroy_params (return_vals, nreturn_vals);

  return tattoo;
}

/**
 * gimp_item_set_tattoo:
 * @item_ID: The item.
 * @tattoo: The new item tattoo.
 *
 * Set the tattoo of the specified item.
 *
 * This procedure sets the specified item's tattoo. A tattoo is a
 * unique and permanent identifier attached to a item that can be used
 * to uniquely identify a item within an image even between sessions.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_set_tattoo (gint32 item_ID,
                      gint   tattoo)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-set-tattoo",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_INT32, tattoo,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_attach_parasite:
 * @item_ID: The item.
 * @parasite: The parasite to attach to the item.
 *
 * Add a parasite to an item.
 *
 * This procedure attaches a parasite to an item. It has no return
 * values.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_attach_parasite (gint32              item_ID,
                           const GimpParasite *parasite)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-attach-parasite",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_PARASITE, parasite,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_item_detach_parasite:
 * @item_ID: The item.
 * @name: The name of the parasite to detach from the item.
 *
 * Removes a parasite from an item.
 *
 * This procedure detaches a parasite from an item. It has no return
 * values.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.8
 **/
gboolean
gimp_item_detach_parasite (gint32       item_ID,
                           const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-item-detach-parasite",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    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;
}

/**
 * gimp_item_get_parasite:
 * @item_ID: The item.
 * @name: The name of the parasite to find.
 *
 * Look up a parasite in an item
 *
 * Finds and returns the parasite that is attached to an item.
 *
 * Returns: The found parasite.
 *
 * Since: 2.8
 **/
GimpParasite *
gimp_item_get_parasite (gint32       item_ID,
                        const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  GimpParasite *parasite = NULL;

  return_vals = gimp_run_procedure ("gimp-item-get-parasite",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite);

  gimp_destroy_params (return_vals, nreturn_vals);

  return parasite;
}

/**
 * gimp_item_get_parasite_list:
 * @item_ID: The item.
 * @num_parasites: The number of attached parasites.
 *
 * List all parasites.
 *
 * Returns a list of all parasites currently attached the an item.
 *
 * Returns: The names of currently attached parasites. The returned
 * value must be freed with g_strfreev().
 *
 * Since: 2.8
 **/
gchar **
gimp_item_get_parasite_list (gint32  item_ID,
                             gint   *num_parasites)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar **parasites = NULL;
  gint i;

  return_vals = gimp_run_procedure ("gimp-item-get-parasite-list",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_END);

  *num_parasites = 0;

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    {
      *num_parasites = return_vals[1].data.d_int32;
      if (*num_parasites > 0)
        {
          parasites = g_new0 (gchar *, *num_parasites + 1);
          for (i = 0; i < *num_parasites; i++)
            parasites[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
        }
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return parasites;
}