1
/* LIBGIMP - The GIMP Library
2
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
22
/* NOTE: This file is autogenerated by pdbgen.pl */
30
* @image_ID: The image to which to add the layer.
31
* @width: The layer width.
32
* @height: The layer height.
33
* @type: The layer type.
34
* @name: The layer name.
35
* @opacity: The layer opacity.
36
* @mode: The layer combination mode.
40
* This procedure creates a new layer with the specified width, height,
41
* and type. Name, opacity, and mode are also supplied parameters. The
42
* new layer still needs to be added to the image, as this is not
43
* automatic. Add the new layer with the 'gimp_image_add_layer'
44
* command. Other attributes such as layer mask modes, and offsets
45
* should be set with explicit procedure calls.
47
* Returns: The newly created layer.
50
_gimp_layer_new (gint32 image_ID,
56
GimpLayerModeEffects mode)
58
GimpParam *return_vals;
62
return_vals = gimp_run_procedure ("gimp_layer_new",
64
GIMP_PDB_IMAGE, image_ID,
65
GIMP_PDB_INT32, width,
66
GIMP_PDB_INT32, height,
68
GIMP_PDB_STRING, name,
69
GIMP_PDB_FLOAT, opacity,
73
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
74
layer_ID = return_vals[1].data.d_layer;
76
gimp_destroy_params (return_vals, nreturn_vals);
82
* gimp_layer_new_from_drawable:
83
* @drawable_ID: The source drawable from where the new layer is copied.
84
* @dest_image_ID: The destination image to which to add the layer.
86
* Create a new layer by copying an existing drawable.
88
* This procedure creates a new layer as a copy of the specified
89
* drawable. The new layer still needs to be added to the image, as
90
* this is not automatic. Add the new layer with the
91
* 'gimp_image_add_layer' command. Other attributes such as layer mask
92
* modes, and offsets should be set with explicit procedure calls.
94
* Returns: The newly copied layer.
97
gimp_layer_new_from_drawable (gint32 drawable_ID,
100
GimpParam *return_vals;
102
gint32 layer_copy_ID = -1;
104
return_vals = gimp_run_procedure ("gimp_layer_new_from_drawable",
106
GIMP_PDB_DRAWABLE, drawable_ID,
107
GIMP_PDB_IMAGE, dest_image_ID,
110
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
111
layer_copy_ID = return_vals[1].data.d_layer;
113
gimp_destroy_params (return_vals, nreturn_vals);
115
return layer_copy_ID;
120
* @layer_ID: The layer to copy.
121
* @add_alpha: Add an alpha channel to the copied layer.
125
* This procedure copies the specified layer and returns the copy. The
126
* newly copied layer is for use within the original layer's image. It
127
* should not be subsequently added to any other image. The copied
128
* layer can optionally have an added alpha channel. This is useful if
129
* the background layer in an image is being copied and added to the
132
* Returns: The newly copied layer.
135
_gimp_layer_copy (gint32 layer_ID,
138
GimpParam *return_vals;
140
gint32 layer_copy_ID = -1;
142
return_vals = gimp_run_procedure ("gimp_layer_copy",
144
GIMP_PDB_LAYER, layer_ID,
145
GIMP_PDB_INT32, add_alpha,
148
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
149
layer_copy_ID = return_vals[1].data.d_layer;
151
gimp_destroy_params (return_vals, nreturn_vals);
153
return layer_copy_ID;
157
* gimp_layer_add_alpha:
158
* @layer_ID: The layer.
160
* Add an alpha channel to the layer if it doesn't already have one.
162
* This procedure adds an additional component to the specified layer
163
* if it does not already possess an alpha channel. An alpha channel
164
* makes it possible to move a layer from the bottom of the layer stack
165
* and to clear and erase to transparency, instead of the background
166
* color. This transforms images of type RGB to RGBA, GRAY to GRAYA,
167
* and INDEXED to INDEXEDA.
169
* Returns: TRUE on success.
172
gimp_layer_add_alpha (gint32 layer_ID)
174
GimpParam *return_vals;
176
gboolean success = TRUE;
178
return_vals = gimp_run_procedure ("gimp_layer_add_alpha",
180
GIMP_PDB_LAYER, layer_ID,
183
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
185
gimp_destroy_params (return_vals, nreturn_vals);
192
* @layer_ID: The layer.
193
* @new_width: New layer width.
194
* @new_height: New layer height.
195
* @local_origin: Use a local origin (as opposed to the image origin).
197
* Scale the layer to the specified extents.
199
* This procedure scales the layer so that it's new width and height
200
* are equal to the supplied parameters. The \"local_origin\" parameter
201
* specifies whether to scale from the center of the layer, or from the
202
* image origin. This operation only works if the layer has been added
205
* Returns: TRUE on success.
208
gimp_layer_scale (gint32 layer_ID,
211
gboolean local_origin)
213
GimpParam *return_vals;
215
gboolean success = TRUE;
217
return_vals = gimp_run_procedure ("gimp_layer_scale",
219
GIMP_PDB_LAYER, layer_ID,
220
GIMP_PDB_INT32, new_width,
221
GIMP_PDB_INT32, new_height,
222
GIMP_PDB_INT32, local_origin,
225
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
227
gimp_destroy_params (return_vals, nreturn_vals);
234
* @layer_ID: The layer.
235
* @new_width: New layer width.
236
* @new_height: New layer height.
237
* @offx: x offset between upper left corner of old and new layers: (old - new).
238
* @offy: y offset between upper left corner of old and new layers: (old - new).
240
* Resize the layer to the specified extents.
242
* This procedure resizes the layer so that it's new width and height
243
* are equal to the supplied parameters. Offsets are also provided
244
* which describe the position of the previous layer's content. This
245
* operation only works if the layer has been added to an image.
247
* Returns: TRUE on success.
250
gimp_layer_resize (gint32 layer_ID,
256
GimpParam *return_vals;
258
gboolean success = TRUE;
260
return_vals = gimp_run_procedure ("gimp_layer_resize",
262
GIMP_PDB_LAYER, layer_ID,
263
GIMP_PDB_INT32, new_width,
264
GIMP_PDB_INT32, new_height,
265
GIMP_PDB_INT32, offx,
266
GIMP_PDB_INT32, offy,
269
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
271
gimp_destroy_params (return_vals, nreturn_vals);
277
* gimp_layer_resize_to_image_size:
278
* @layer_ID: The layer to resize.
280
* Resize a layer to the image size.
282
* This procedure resizes the layer so that it's new width and height
283
* are equal to the width and height of its image container.
285
* Returns: TRUE on success.
288
gimp_layer_resize_to_image_size (gint32 layer_ID)
290
GimpParam *return_vals;
292
gboolean success = TRUE;
294
return_vals = gimp_run_procedure ("gimp_layer_resize_to_image_size",
296
GIMP_PDB_LAYER, layer_ID,
299
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
301
gimp_destroy_params (return_vals, nreturn_vals);
307
* gimp_layer_translate:
308
* @layer_ID: The layer.
309
* @offx: Offset in x direction.
310
* @offy: Offset in y direction.
312
* Translate the layer by the specified offsets.
314
* This procedure translates the layer by the amounts specified in the
315
* x and y arguments. These can be negative, and are considered offsets
316
* from the current position. This command only works if the layer has
317
* been added to an image. All additional layers contained in the image
318
* which have the linked flag set to TRUE w ill also be translated by
319
* the specified offsets.
321
* Returns: TRUE on success.
324
gimp_layer_translate (gint32 layer_ID,
328
GimpParam *return_vals;
330
gboolean success = TRUE;
332
return_vals = gimp_run_procedure ("gimp_layer_translate",
334
GIMP_PDB_LAYER, layer_ID,
335
GIMP_PDB_INT32, offx,
336
GIMP_PDB_INT32, offy,
339
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
341
gimp_destroy_params (return_vals, nreturn_vals);
347
* gimp_layer_set_offsets:
348
* @layer_ID: The layer.
349
* @offx: Offset in x direction.
350
* @offy: Offset in y direction.
352
* Set the layer offsets.
354
* This procedure sets the offsets for the specified layer. The offsets
355
* are relative to the image origin and can be any values. This
356
* operation is valid only on layers which have been added to an image.
358
* Returns: TRUE on success.
361
gimp_layer_set_offsets (gint32 layer_ID,
365
GimpParam *return_vals;
367
gboolean success = TRUE;
369
return_vals = gimp_run_procedure ("gimp_layer_set_offsets",
371
GIMP_PDB_LAYER, layer_ID,
372
GIMP_PDB_INT32, offx,
373
GIMP_PDB_INT32, offy,
376
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
378
gimp_destroy_params (return_vals, nreturn_vals);
384
* gimp_layer_create_mask:
385
* @layer_ID: The layer to which to add the mask.
386
* @mask_type: The type of mask.
388
* Create a layer mask for the specified specified layer.
390
* This procedure creates a layer mask for the specified layer. Layer
391
* masks serve as an additional alpha channel for a layer. A number of
392
* ifferent types of masks are allowed for initialisation: completely
393
* white masks (which will leave the layer fully visible), completely
394
* black masks (which will give the layer complete transparency, the
395
* layer's already existing alpha channel (which will leave the layer
396
* fully visible, but which may be more useful than a white mask), the
397
* current selection or a grayscale copy of the layer. The layer mask
398
* still needs to be added to the layer. This can be done with a call
399
* to 'gimp_layer_add_mask'.
401
* Returns: The newly created mask.
404
gimp_layer_create_mask (gint32 layer_ID,
405
GimpAddMaskType mask_type)
407
GimpParam *return_vals;
411
return_vals = gimp_run_procedure ("gimp_layer_create_mask",
413
GIMP_PDB_LAYER, layer_ID,
414
GIMP_PDB_INT32, mask_type,
417
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
418
mask_ID = return_vals[1].data.d_layer_mask;
420
gimp_destroy_params (return_vals, nreturn_vals);
426
* gimp_layer_get_mask:
427
* @layer_ID: The layer.
429
* Get the specified layer's mask if it exists.
431
* This procedure returns the specified layer's mask, or -1 if none
434
* Returns: The layer mask.
437
gimp_layer_get_mask (gint32 layer_ID)
439
GimpParam *return_vals;
443
return_vals = gimp_run_procedure ("gimp_layer_get_mask",
445
GIMP_PDB_LAYER, layer_ID,
448
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
449
mask_ID = return_vals[1].data.d_channel;
451
gimp_destroy_params (return_vals, nreturn_vals);
457
* gimp_layer_from_mask:
458
* @mask_ID: Mask for which to return the layer.
460
* Get the specified mask's layer.
462
* This procedure returns the specified mask's layer , or -1 if none
465
* Returns: The mask's layer.
470
gimp_layer_from_mask (gint32 mask_ID)
472
GimpParam *return_vals;
474
gint32 layer_ID = -1;
476
return_vals = gimp_run_procedure ("gimp_layer_from_mask",
478
GIMP_PDB_CHANNEL, mask_ID,
481
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
482
layer_ID = return_vals[1].data.d_layer;
484
gimp_destroy_params (return_vals, nreturn_vals);
490
* gimp_layer_add_mask:
491
* @layer_ID: The layer to receive the mask.
492
* @mask_ID: The mask to add to the layer.
494
* Add a layer mask to the specified layer.
496
* This procedure adds a layer mask to the specified layer. Layer masks
497
* serve as an additional alpha channel for a layer. This procedure
498
* will fail if a number of prerequisites aren't met. The layer cannot
499
* already have a layer mask. The specified mask must exist and have
500
* the same dimensions as the layer. Both the mask and the layer must
501
* have been created for use with the specified image.
503
* Returns: TRUE on success.
506
gimp_layer_add_mask (gint32 layer_ID,
509
GimpParam *return_vals;
511
gboolean success = TRUE;
513
return_vals = gimp_run_procedure ("gimp_layer_add_mask",
515
GIMP_PDB_LAYER, layer_ID,
516
GIMP_PDB_CHANNEL, mask_ID,
519
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
521
gimp_destroy_params (return_vals, nreturn_vals);
527
* gimp_layer_remove_mask:
528
* @layer_ID: The layer from which to remove mask.
529
* @mode: Removal mode.
531
* Remove the specified layer mask from the layer.
533
* This procedure removes the specified layer mask from the layer. If
534
* the mask doesn't exist, an error is returned.
536
* Returns: TRUE on success.
539
gimp_layer_remove_mask (gint32 layer_ID,
540
GimpMaskApplyMode mode)
542
GimpParam *return_vals;
544
gboolean success = TRUE;
546
return_vals = gimp_run_procedure ("gimp_layer_remove_mask",
548
GIMP_PDB_LAYER, layer_ID,
549
GIMP_PDB_INT32, mode,
552
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
554
gimp_destroy_params (return_vals, nreturn_vals);
560
* gimp_layer_is_floating_sel:
561
* @layer_ID: The layer.
563
* Is the specified layer a floating selection?
565
* This procedure returns whether the layer is a floating selection.
566
* Floating selections are special cases of layers which are attached
567
* to a specific drawable.
569
* Returns: Non-zero if the layer is a floating selection.
572
gimp_layer_is_floating_sel (gint32 layer_ID)
574
GimpParam *return_vals;
576
gboolean is_floating_sel = FALSE;
578
return_vals = gimp_run_procedure ("gimp_layer_is_floating_sel",
580
GIMP_PDB_LAYER, layer_ID,
583
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
584
is_floating_sel = return_vals[1].data.d_int32;
586
gimp_destroy_params (return_vals, nreturn_vals);
588
return is_floating_sel;
592
* gimp_layer_get_preserve_trans:
593
* @layer_ID: The layer.
595
* Get the preserve transperancy setting of the specified layer.
597
* This procedure returns the specified layer's preserve transperancy
600
* Returns: The layer's preserve transperancy setting.
603
gimp_layer_get_preserve_trans (gint32 layer_ID)
605
GimpParam *return_vals;
607
gboolean preserve_trans = FALSE;
609
return_vals = gimp_run_procedure ("gimp_layer_get_preserve_trans",
611
GIMP_PDB_LAYER, layer_ID,
614
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
615
preserve_trans = return_vals[1].data.d_int32;
617
gimp_destroy_params (return_vals, nreturn_vals);
619
return preserve_trans;
623
* gimp_layer_set_preserve_trans:
624
* @layer_ID: The layer.
625
* @preserve_trans: The new layer's preserve transperancy setting.
627
* Set the preserve transperancy setting of the specified layer.
629
* This procedure sets the specified layer's preserve transperancy
632
* Returns: TRUE on success.
635
gimp_layer_set_preserve_trans (gint32 layer_ID,
636
gboolean preserve_trans)
638
GimpParam *return_vals;
640
gboolean success = TRUE;
642
return_vals = gimp_run_procedure ("gimp_layer_set_preserve_trans",
644
GIMP_PDB_LAYER, layer_ID,
645
GIMP_PDB_INT32, preserve_trans,
648
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
650
gimp_destroy_params (return_vals, nreturn_vals);
656
* gimp_layer_get_apply_mask:
657
* @layer_ID: The layer.
659
* Get the apply mask of the specified layer.
661
* This procedure returns the specified layer's apply mask. If the
662
* value is non-zero, then the layer mask for this layer is currently
663
* being composited with the layer's alpha channel.
665
* Returns: The layer apply mask.
668
gimp_layer_get_apply_mask (gint32 layer_ID)
670
GimpParam *return_vals;
672
gboolean apply_mask = FALSE;
674
return_vals = gimp_run_procedure ("gimp_layer_get_apply_mask",
676
GIMP_PDB_LAYER, layer_ID,
679
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
680
apply_mask = return_vals[1].data.d_int32;
682
gimp_destroy_params (return_vals, nreturn_vals);
688
* gimp_layer_set_apply_mask:
689
* @layer_ID: The layer.
690
* @apply_mask: The new layer apply mask.
692
* Set the apply mask of the specified layer.
694
* This procedure sets the specified layer's apply mask. This controls
695
* whether the layer's mask is currently affecting the alpha channel.
696
* If there is no layer mask, this function will return an error.
698
* Returns: TRUE on success.
701
gimp_layer_set_apply_mask (gint32 layer_ID,
704
GimpParam *return_vals;
706
gboolean success = TRUE;
708
return_vals = gimp_run_procedure ("gimp_layer_set_apply_mask",
710
GIMP_PDB_LAYER, layer_ID,
711
GIMP_PDB_INT32, apply_mask,
714
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
716
gimp_destroy_params (return_vals, nreturn_vals);
722
* gimp_layer_get_show_mask:
723
* @layer_ID: The layer.
725
* Get the show mask of the specified layer.
727
* This procedure returns the specified layer's show mask. If the value
728
* is non-zero, then the layer mask for this layer is currently being
729
* shown instead of the layer.
731
* Returns: The layer show mask.
734
gimp_layer_get_show_mask (gint32 layer_ID)
736
GimpParam *return_vals;
738
gboolean show_mask = FALSE;
740
return_vals = gimp_run_procedure ("gimp_layer_get_show_mask",
742
GIMP_PDB_LAYER, layer_ID,
745
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
746
show_mask = return_vals[1].data.d_int32;
748
gimp_destroy_params (return_vals, nreturn_vals);
754
* gimp_layer_set_show_mask:
755
* @layer_ID: The layer.
756
* @show_mask: The new layer show mask.
758
* Set the show mask of the specified layer.
760
* This procedure sets the specified layer's show mask. This controls
761
* whether the layer or it's mask is visible. Non-zero values indicate
762
* that the mask should be visible. If the layer has no mask, then this
763
* function returns an error.
765
* Returns: TRUE on success.
768
gimp_layer_set_show_mask (gint32 layer_ID,
771
GimpParam *return_vals;
773
gboolean success = TRUE;
775
return_vals = gimp_run_procedure ("gimp_layer_set_show_mask",
777
GIMP_PDB_LAYER, layer_ID,
778
GIMP_PDB_INT32, show_mask,
781
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
783
gimp_destroy_params (return_vals, nreturn_vals);
789
* gimp_layer_get_edit_mask:
790
* @layer_ID: The layer.
792
* Get the show mask of the specified layer.
794
* This procedure returns the specified layer's show mask. If the value
795
* is non-zero, then the layer mask for this layer is currently active,
798
* Returns: The layer show mask.
801
gimp_layer_get_edit_mask (gint32 layer_ID)
803
GimpParam *return_vals;
805
gboolean edit_mask = FALSE;
807
return_vals = gimp_run_procedure ("gimp_layer_get_edit_mask",
809
GIMP_PDB_LAYER, layer_ID,
812
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
813
edit_mask = return_vals[1].data.d_int32;
815
gimp_destroy_params (return_vals, nreturn_vals);
821
* gimp_layer_set_edit_mask:
822
* @layer_ID: The layer.
823
* @edit_mask: The new layer show mask.
825
* Set the show mask of the specified layer.
827
* This procedure sets the specified layer's show mask. This controls
828
* whether the layer or it's mask is currently active for editing. If
829
* the specified layer has no layer mask, then this procedure will
832
* Returns: TRUE on success.
835
gimp_layer_set_edit_mask (gint32 layer_ID,
838
GimpParam *return_vals;
840
gboolean success = TRUE;
842
return_vals = gimp_run_procedure ("gimp_layer_set_edit_mask",
844
GIMP_PDB_LAYER, layer_ID,
845
GIMP_PDB_INT32, edit_mask,
848
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
850
gimp_destroy_params (return_vals, nreturn_vals);
856
* gimp_layer_get_opacity:
857
* @layer_ID: The layer.
859
* Get the opacity of the specified layer.
861
* This procedure returns the specified layer's opacity.
863
* Returns: The layer opacity.
866
gimp_layer_get_opacity (gint32 layer_ID)
868
GimpParam *return_vals;
872
return_vals = gimp_run_procedure ("gimp_layer_get_opacity",
874
GIMP_PDB_LAYER, layer_ID,
877
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
878
opacity = return_vals[1].data.d_float;
880
gimp_destroy_params (return_vals, nreturn_vals);
886
* gimp_layer_set_opacity:
887
* @layer_ID: The layer.
888
* @opacity: The new layer opacity.
890
* Set the opacity of the specified layer.
892
* This procedure sets the specified layer's opacity.
894
* Returns: TRUE on success.
897
gimp_layer_set_opacity (gint32 layer_ID,
900
GimpParam *return_vals;
902
gboolean success = TRUE;
904
return_vals = gimp_run_procedure ("gimp_layer_set_opacity",
906
GIMP_PDB_LAYER, layer_ID,
907
GIMP_PDB_FLOAT, opacity,
910
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
912
gimp_destroy_params (return_vals, nreturn_vals);
918
* gimp_layer_get_mode:
919
* @layer_ID: The layer.
921
* Get the combination mode of the specified layer.
923
* This procedure returns the specified layer's combination mode.
925
* Returns: The layer combination mode.
928
gimp_layer_get_mode (gint32 layer_ID)
930
GimpParam *return_vals;
932
GimpLayerModeEffects mode = 0;
934
return_vals = gimp_run_procedure ("gimp_layer_get_mode",
936
GIMP_PDB_LAYER, layer_ID,
939
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
940
mode = return_vals[1].data.d_int32;
942
gimp_destroy_params (return_vals, nreturn_vals);
948
* gimp_layer_set_mode:
949
* @layer_ID: The layer.
950
* @mode: The new layer combination mode.
952
* Set the combination mode of the specified layer.
954
* This procedure sets the specified layer's combination mode.
956
* Returns: TRUE on success.
959
gimp_layer_set_mode (gint32 layer_ID,
960
GimpLayerModeEffects mode)
962
GimpParam *return_vals;
964
gboolean success = TRUE;
966
return_vals = gimp_run_procedure ("gimp_layer_set_mode",
968
GIMP_PDB_LAYER, layer_ID,
969
GIMP_PDB_INT32, mode,
972
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
974
gimp_destroy_params (return_vals, nreturn_vals);