forked from GNOME/gimp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgimpimage_pdb.c
3119 lines (2681 loc) · 89.2 KB
/
gimpimage_pdb.c
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
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpimage_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
* <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include <string.h>
#include "gimp.h"
/**
* SECTION: gimpimage
* @title: gimpimage
* @short_description: Operations on complete images.
*
* Operations on complete images: creation, resizing/rescaling, and
* operations involving multiple layers.
**/
/**
* gimp_image_is_valid:
* @image_ID: The image to check.
*
* Returns TRUE if the image is valid.
*
* This procedure checks if the given image ID is valid and refers to
* an existing image.
*
* Returns: Whether the image ID is valid.
*
* Since: GIMP 2.4
**/
gboolean
gimp_image_is_valid (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean valid = FALSE;
return_vals = gimp_run_procedure ("gimp-image-is-valid",
&nreturn_vals,
GIMP_PDB_IMAGE, image_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_image_list:
* @num_images: The number of images currently open.
*
* Returns the list of images currently open.
*
* This procedure returns the list of images currently open in GIMP.
*
* Returns: The list of images currently open.
**/
gint *
gimp_image_list (gint *num_images)
{
GimpParam *return_vals;
gint nreturn_vals;
gint *image_ids = NULL;
return_vals = gimp_run_procedure ("gimp-image-list",
&nreturn_vals,
GIMP_PDB_END);
*num_images = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_images = return_vals[1].data.d_int32;
image_ids = g_new (gint32, *num_images);
memcpy (image_ids,
return_vals[2].data.d_int32array,
*num_images * sizeof (gint32));
}
gimp_destroy_params (return_vals, nreturn_vals);
return image_ids;
}
/**
* gimp_image_new:
* @width: The width of the image.
* @height: The height of the image.
* @type: The type of image.
*
* Creates a new image with the specified width, height, and type.
*
* Creates a new image, undisplayed with the specified extents and
* type. A layer should be created and added before this image is
* displayed, or subsequent calls to gimp_display_new() with this image
* as an argument will fail. Layers can be created using the
* gimp_layer_new() commands. They can be added to an image using the
* gimp_image_insert_layer() command.
*
* Returns: The ID of the newly created image.
**/
gint32
gimp_image_new (gint width,
gint height,
GimpImageBaseType type)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 image_ID = -1;
return_vals = gimp_run_procedure ("gimp-image-new",
&nreturn_vals,
GIMP_PDB_INT32, width,
GIMP_PDB_INT32, height,
GIMP_PDB_INT32, type,
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_image_new_with_precision:
* @width: The width of the image.
* @height: The height of the image.
* @type: The type of image.
* @precision: The precision.
*
* Creates a new image with the specified width, height, type and
* precision.
*
* Creates a new image, undisplayed with the specified extents, type
* and precision. Indexed images can only be created at
* GIMP_PRECISION_U8 precision. See gimp_image_new() for further
* details.
*
* Returns: The ID of the newly created image.
*
* Since: GIMP 2.10
**/
gint32
gimp_image_new_with_precision (gint width,
gint height,
GimpImageBaseType type,
GimpPrecision precision)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 image_ID = -1;
return_vals = gimp_run_procedure ("gimp-image-new-with-precision",
&nreturn_vals,
GIMP_PDB_INT32, width,
GIMP_PDB_INT32, height,
GIMP_PDB_INT32, type,
GIMP_PDB_INT32, precision,
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_image_duplicate:
* @image_ID: The image.
*
* Duplicate the specified image
*
* This procedure duplicates the specified image, copying all layers,
* channels, and image information.
*
* Returns: The new, duplicated image.
**/
gint32
gimp_image_duplicate (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 new_image_ID = -1;
return_vals = gimp_run_procedure ("gimp-image-duplicate",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
new_image_ID = return_vals[1].data.d_image;
gimp_destroy_params (return_vals, nreturn_vals);
return new_image_ID;
}
/**
* gimp_image_delete:
* @image_ID: The image.
*
* Delete the specified image.
*
* If there are no displays associated with this image it will be
* deleted. This means that you can not delete an image through the PDB
* that was created by the user. If the associated display was however
* created through the PDB and you know the display ID, you may delete
* the display. Removal of the last associated display will then delete
* the image.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_delete (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-delete",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_base_type:
* @image_ID: The image.
*
* Get the base type of the image.
*
* This procedure returns the image's base type. Layers in the image
* must be of this subtype, but can have an optional alpha channel.
*
* Returns: The image's base type.
**/
GimpImageBaseType
gimp_image_base_type (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpImageBaseType base_type = 0;
return_vals = gimp_run_procedure ("gimp-image-base-type",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
base_type = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return base_type;
}
/**
* gimp_image_get_precision:
* @image_ID: The image.
*
* Get the precision of the image.
*
* This procedure returns the image's precision.
*
* Returns: The image's precision.
*
* Since: GIMP 2.10
**/
GimpPrecision
gimp_image_get_precision (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpPrecision precision = 0;
return_vals = gimp_run_procedure ("gimp-image-get-precision",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
precision = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return precision;
}
/**
* gimp_image_width:
* @image_ID: The image.
*
* Return the width of the image
*
* This procedure returns the image's width. This value is independent
* of any of the layers in this image. This is the \"canvas\" width.
*
* Returns: The image's width.
**/
gint
gimp_image_width (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint width = 0;
return_vals = gimp_run_procedure ("gimp-image-width",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
width = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return width;
}
/**
* gimp_image_height:
* @image_ID: The image.
*
* Return the height of the image
*
* This procedure returns the image's height. This value is independent
* of any of the layers in this image. This is the \"canvas\" height.
*
* Returns: The image's height.
**/
gint
gimp_image_height (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint height = 0;
return_vals = gimp_run_procedure ("gimp-image-height",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
height = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return height;
}
/**
* gimp_image_free_shadow:
* @image_ID: The image.
*
* Deprecated: Use gimp_drawable_free_shadow() instead.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_free_shadow (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-free-shadow",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_resize:
* @image_ID: The image.
* @new_width: New image width.
* @new_height: New image height.
* @offx: x offset between upper left corner of old and new images: (new - old).
* @offy: y offset between upper left corner of old and new images: (new - old).
*
* Resize the image to the specified extents.
*
* This procedure resizes the image so that it's new width and height
* are equal to the supplied parameters. Offsets are also provided
* which describe the position of the previous image's content. All
* channels within the image are resized according to the specified
* parameters; this includes the image selection mask. All layers
* within the image are repositioned according to the specified
* offsets.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_resize (gint32 image_ID,
gint new_width,
gint new_height,
gint offx,
gint offy)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-resize",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, new_width,
GIMP_PDB_INT32, new_height,
GIMP_PDB_INT32, offx,
GIMP_PDB_INT32, offy,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_resize_to_layers:
* @image_ID: The image.
*
* Resize the image to fit all layers.
*
* This procedure resizes the image to the bounding box of all layers
* of the image. All channels within the image are resized to the new
* size; this includes the image selection mask. All layers within the
* image are repositioned to the new image area.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.2
**/
gboolean
gimp_image_resize_to_layers (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-resize-to-layers",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_scale:
* @image_ID: The image.
* @new_width: New image width.
* @new_height: New image height.
*
* Scale the image using the default interpolation method.
*
* This procedure scales the image so that its new width and height are
* equal to the supplied parameters. All layers and channels within the
* image are scaled according to the specified parameters; this
* includes the image selection mask. The interpolation method used can
* be set with gimp_context_set_interpolation().
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_scale (gint32 image_ID,
gint new_width,
gint new_height)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-scale",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, new_width,
GIMP_PDB_INT32, new_height,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_scale_full:
* @image_ID: The image.
* @new_width: New image width.
* @new_height: New image height.
* @interpolation: Type of interpolation.
*
* Deprecated: Use gimp_image_scale() instead.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.6
**/
gboolean
gimp_image_scale_full (gint32 image_ID,
gint new_width,
gint new_height,
GimpInterpolationType interpolation)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-scale-full",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, new_width,
GIMP_PDB_INT32, new_height,
GIMP_PDB_INT32, interpolation,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_crop:
* @image_ID: The image.
* @new_width: New image width: (0 < new_width <= width).
* @new_height: New image height: (0 < new_height <= height).
* @offx: X offset: (0 <= offx <= (width - new_width)).
* @offy: Y offset: (0 <= offy <= (height - new_height)).
*
* Crop the image to the specified extents.
*
* This procedure crops the image so that it's new width and height are
* equal to the supplied parameters. Offsets are also provided which
* describe the position of the previous image's content. All channels
* and layers within the image are cropped to the new image extents;
* this includes the image selection mask. If any parameters are out of
* range, an error is returned.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_crop (gint32 image_ID,
gint new_width,
gint new_height,
gint offx,
gint offy)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-crop",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, new_width,
GIMP_PDB_INT32, new_height,
GIMP_PDB_INT32, offx,
GIMP_PDB_INT32, offy,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_flip:
* @image_ID: The image.
* @flip_type: Type of flip.
*
* Flips the image horizontally or vertically.
*
* This procedure flips (mirrors) the image.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_flip (gint32 image_ID,
GimpOrientationType flip_type)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-flip",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, flip_type,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_rotate:
* @image_ID: The image.
* @rotate_type: Angle of rotation.
*
* Rotates the image by the specified degrees.
*
* This procedure rotates the image.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_rotate (gint32 image_ID,
GimpRotationType rotate_type)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-rotate",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, rotate_type,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_get_layers:
* @image_ID: The image.
* @num_layers: The number of layers contained in the image.
*
* Returns the list of layers contained in the specified image.
*
* This procedure returns the list of layers contained in the specified
* image. The order of layers is from topmost to bottommost.
*
* Returns: The list of layers contained in the image.
**/
gint *
gimp_image_get_layers (gint32 image_ID,
gint *num_layers)
{
GimpParam *return_vals;
gint nreturn_vals;
gint *layer_ids = NULL;
return_vals = gimp_run_procedure ("gimp-image-get-layers",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
*num_layers = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_layers = return_vals[1].data.d_int32;
layer_ids = g_new (gint32, *num_layers);
memcpy (layer_ids,
return_vals[2].data.d_int32array,
*num_layers * sizeof (gint32));
}
gimp_destroy_params (return_vals, nreturn_vals);
return layer_ids;
}
/**
* gimp_image_get_channels:
* @image_ID: The image.
* @num_channels: The number of channels contained in the image.
*
* Returns the list of channels contained in the specified image.
*
* This procedure returns the list of channels contained in the
* specified image. This does not include the selection mask, or layer
* masks. The order is from topmost to bottommost.
*
* Returns: The list of channels contained in the image.
**/
gint *
gimp_image_get_channels (gint32 image_ID,
gint *num_channels)
{
GimpParam *return_vals;
gint nreturn_vals;
gint *channel_ids = NULL;
return_vals = gimp_run_procedure ("gimp-image-get-channels",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
*num_channels = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_channels = return_vals[1].data.d_int32;
channel_ids = g_new (gint32, *num_channels);
memcpy (channel_ids,
return_vals[2].data.d_int32array,
*num_channels * sizeof (gint32));
}
gimp_destroy_params (return_vals, nreturn_vals);
return channel_ids;
}
/**
* gimp_image_get_vectors:
* @image_ID: The image.
* @num_vectors: The number of vectors contained in the image.
*
* Returns the list of vectors contained in the specified image.
*
* This procedure returns the list of vectors contained in the
* specified image.
*
* Returns: The list of vectors contained in the image.
*
* Since: GIMP 2.4
**/
gint *
gimp_image_get_vectors (gint32 image_ID,
gint *num_vectors)
{
GimpParam *return_vals;
gint nreturn_vals;
gint *vector_ids = NULL;
return_vals = gimp_run_procedure ("gimp-image-get-vectors",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
*num_vectors = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_vectors = return_vals[1].data.d_int32;
vector_ids = g_new (gint32, *num_vectors);
memcpy (vector_ids,
return_vals[2].data.d_int32array,
*num_vectors * sizeof (gint32));
}
gimp_destroy_params (return_vals, nreturn_vals);
return vector_ids;
}
/**
* gimp_image_get_active_drawable:
* @image_ID: The image.
*
* Get the image's active drawable
*
* This procedure returns the ID of the image's active drawable. This
* can be either a layer, a channel, or a layer mask. The active
* drawable is specified by the active image channel. If that is -1,
* then by the active image layer. If the active image layer has a
* layer mask and the layer mask is in edit mode, then the layer mask
* is the active drawable.
*
* Returns: The active drawable.
**/
gint32
gimp_image_get_active_drawable (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 drawable_ID = -1;
return_vals = gimp_run_procedure ("gimp-image-get-active-drawable",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
drawable_ID = return_vals[1].data.d_drawable;
gimp_destroy_params (return_vals, nreturn_vals);
return drawable_ID;
}
/**
* gimp_image_unset_active_channel:
* @image_ID: The image.
*
* Unsets the active channel in the specified image.
*
* If an active channel exists, it is unset. There then exists no
* active channel, and if desired, one can be set through a call to
* 'Set Active Channel'. No error is returned in the case of no
* existing active channel.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_unset_active_channel (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-unset-active-channel",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_get_floating_sel:
* @image_ID: The image.
*
* Return the floating selection of the image.
*
* This procedure returns the image's floating selection, if it exists.
* If it doesn't exist, -1 is returned as the layer ID.
*
* Returns: The image's floating selection.
**/
gint32
gimp_image_get_floating_sel (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 floating_sel_ID = -1;
return_vals = gimp_run_procedure ("gimp-image-get-floating-sel",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
floating_sel_ID = return_vals[1].data.d_layer;
gimp_destroy_params (return_vals, nreturn_vals);
return floating_sel_ID;
}
/**
* gimp_image_floating_sel_attached_to:
* @image_ID: The image.
*
* Return the drawable the floating selection is attached to.
*
* This procedure returns the drawable the image's floating selection
* is attached to, if it exists. If it doesn't exist, -1 is returned as
* the drawable ID.
*
* Returns: The drawable the floating selection is attached to.
**/
gint32
gimp_image_floating_sel_attached_to (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gint32 drawable_ID = -1;
return_vals = gimp_run_procedure ("gimp-image-floating-sel-attached-to",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
drawable_ID = return_vals[1].data.d_drawable;
gimp_destroy_params (return_vals, nreturn_vals);
return drawable_ID;
}
/**
* gimp_image_pick_color:
* @image_ID: The image.
* @drawable_ID: The drawable to pick from.
* @x: x coordinate of upper-left corner of rectangle.
* @y: y coordinate of upper-left corner of rectangle.
* @sample_merged: Use the composite image, not the drawable.
* @sample_average: Average the color of all the pixels in a specified radius.
* @average_radius: The radius of pixels to average.
* @color: The return color.
*
* Determine the color at the given drawable coordinates
*
* This tool determines the color at the specified coordinates. The
* returned color is an RGB triplet even for grayscale and indexed
* drawables. If the coordinates lie outside of the extents of the
* specified drawable, then an error is returned. If the drawable has
* an alpha channel, the algorithm examines the alpha value of the
* drawable at the coordinates. If the alpha value is completely
* transparent (0), then an error is returned. If the sample_merged
* parameter is TRUE, the data of the composite image will be used
* instead of that for the specified drawable. This is equivalent to
* sampling for colors after merging all visible layers. In the case of
* a merged sampling, the supplied drawable is ignored.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_pick_color (gint32 image_ID,
gint32 drawable_ID,
gdouble x,
gdouble y,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
GimpRGB *color)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-image-pick-color",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_FLOAT, x,
GIMP_PDB_FLOAT, y,
GIMP_PDB_INT32, sample_merged,
GIMP_PDB_INT32, sample_average,
GIMP_PDB_FLOAT, average_radius,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
if (success)
*color = return_vals[1].data.d_color;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_image_pick_correlate_layer: