18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
33
foreach (qw(width height)) {
34
push @inargs, { name => "new_$_",
36
desc => "New image $_: %%desc%%" }
43
$blurb = "Returns the list of ${type}s contained in the specified image.";
46
This procedure returns the list of ${type}s contained in the specified image.
21
$blurb = 'Returns TRUE if the image is valid.';
24
This procedure checks if the given image ID is valid and refers to an
28
&neo_pdb_misc('2007', '2.4');
51
@inargs = ( &std_image_arg );
31
{ name => 'image', type => 'image', no_validate => 1,
32
desc => 'The image to check' }
54
{ name => "${type}_ids", type => 'int32array', init => 1,
55
desc => "The list of ${type}s contained in the image",
56
array => { name => "num_${type}s", init => 1,
57
desc => "The number of ${type}s contained in the image" } }
36
{ name => 'valid', type => 'boolean',
37
desc => 'Whether the image ID is valid' }
61
vars => [ 'GList *list = NULL', 'gint i' ],
64
list = GIMP_LIST (gimage->${type}s)->list;
65
num_${type}s = g_list_length (list);
69
${type}_ids = g_new (gint32, num_${type}s);
70
for (i = 0; i < num_${type}s; i++, list = g_list_next (list))
71
${type}_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
43
valid = GIMP_IS_IMAGE (image);
79
my ($type, $op, $pos) = @_;
83
($op, $extra) = $op =~ /([^_]+)_(.*)/;
88
$layer = ', or the layer has no alpha channel' if $type eq 'layer';
90
$blurb = "\u$op the specified $type in the image's $type stack";
91
$blurb .= " $extra of stack" if $extra;
94
This procedure ${op}s the specified $type one step in the existing $type stack.
95
It will not move the $type if there is no $type $pos it$layer.
97
$help =~ s/one step in/"$extra of"/e if $extra;
103
$inargs[1]->{desc} .= " to $op $extra";
111
code => "success = gimp_image_${op}_$type$extra (gimage, $type);"
115
sub image_get_prop_proc {
116
my ($prop, $type, $desc, $func) = @_;
118
if ($desc =~ /\bis\b/) {
119
$blurb = "Returns if the specified image's $desc.";
120
$help = "This procedure returns if the specified image's $desc. ";
122
$blurb = "Returns the specified image's $desc.";
123
$help = "This procedure returns the specified image's $desc. ";
128
@inargs = ( &std_image_arg );
131
{ name => $prop, type => $type,
132
desc => "The $desc", no_declare => 1 }
135
my $alias = $func ? "gimp_image_get_$prop (gimage)" : "gimage->$prop";
136
$alias = "g_strdup ($alias)" if $type eq 'string';
137
$outargs[0]->{alias} .= "$alias";
140
sub image_set_prop_proc {
141
my ($prop, $type, $desc, $func) = @_;
143
if ($desc =~ /\bis\b/) {
144
$blurb = "Sets if the specified image's $desc.";
145
$help = "This procedure sets if the specified image's $desc. ";
147
$blurb = "Sets the specified image's $desc.";
148
$help = "This procedure sets the specified image's $desc. ";
155
{ name => $prop, type => $type,
156
desc => "The new image $desc" }
159
if ($type =~ /float/) {
160
$inargs[1]->{desc} .= ' (%%desc%%)';
163
$invoke{code} = $func ? "gimp_image_set_$prop (gimage, $prop);"
164
: "gimage->$prop = $prop;";
167
sub image_accessors {
168
my ($prop, $type, $desc, $func, $extra) = @_;
169
my (@extra, %extra); my $once = 0;
171
ref($extra) ? (@extra = @$extra) : (@extra = ($extra, $extra));
172
%extra = map { $once++ ? 'set' : 'get', $_ ? $_ : "" } @extra;
174
foreach (sort keys %extra) {
175
my $proc = "image_${_}_$prop";
180
sub @{[ scalar caller ]}::$proc {
181
\&image_${_}_prop_proc('$prop', '$type', '$desc', $func);
191
50
$blurb = 'Returns the list of images currently open.';
489
390
$help = <<'HELP';
490
391
This procedure is intended as a memory saving device. If any shadow memory has
491
392
been allocated, it will be freed automatically on a call to
497
@inargs = ( &std_image_arg );
399
{ name => 'image', type => 'image',
400
desc => 'The image' }
499
%invoke = ( code => 'gimp_image_free_shadow (gimage);' );
406
gimp_image_free_shadow_tiles (image);
502
412
sub image_get_layers {
503
&image_list_proc('layer');
505
$help .= 'The order of layers is from topmost to bottommost.';
413
$blurb = 'Returns the list of layers contained in the specified image.';
416
This procedure returns the list of layers contained in the specified image.
417
The order of layers is from topmost to bottommost.
423
{ name => 'image', type => 'image',
424
desc => 'The image' }
428
{ name => 'layer_ids', type => 'int32array',
429
desc => 'The list of layers contained in the image',
430
array => { name => 'num_layers',
431
desc => 'The number of layers contained in the image' } }
437
GList *list = GIMP_LIST (image->layers)->list;
439
num_layers = g_list_length (list);
445
layer_ids = g_new (gint32, num_layers);
447
for (i = 0; i < num_layers; i++, list = g_list_next (list))
448
layer_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
508
455
sub image_get_channels {
509
&image_list_proc('channel');
456
$blurb = 'Returns the list of channels contained in the specified image.';
459
This procedure returns the list of channels contained in the specified image.
512
460
This does not include the selection mask, or layer masks. The order is from
513
461
topmost to bottommost.
467
{ name => 'image', type => 'image',
468
desc => 'The image' }
472
{ name => 'channel_ids', type => 'int32array',
473
desc => 'The list of channels contained in the image',
474
array => { name => 'num_channels',
475
desc => 'The number of channels contained in the image' } }
481
GList *list = GIMP_LIST (image->channels)->list;
483
num_channels = g_list_length (list);
489
channel_ids = g_new (gint32, num_channels);
491
for (i = 0; i < num_channels; i++, list = g_list_next (list))
492
channel_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
499
sub image_get_vectors {
500
$blurb = 'Returns the list of vectors contained in the specified image.';
503
This procedure returns the list of vectors contained in the specified image.
506
&simon_pdb_misc('2005', '2.4');
509
{ name => 'image', type => 'image',
510
desc => 'The image' }
514
{ name => 'vector_ids', type => 'int32array',
515
desc => 'The list of vectors contained in the image',
516
array => { name => 'num_vectors',
517
desc => 'The number of vectors contained in the image' } }
523
GList *list = GIMP_LIST (image->vectors)->list;
525
num_vectors = g_list_length (list);
531
vector_ids = g_new (gint32, num_vectors);
533
for (i = 0; i < num_vectors; i++, list = g_list_next (list))
534
vector_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
517
541
sub image_unset_active_channel {
622
@inargs = ( &std_image_arg );
624
push @inargs, { name => $_, type => 'int32',
625
desc => "The $_ coordinate for the pick" }
659
{ name => 'image', type => 'image',
660
desc => 'The image' },
661
{ name => 'x', type => 'int32',
662
desc => 'The x coordinate for the pick' },
663
{ name => 'y', type => 'int32',
664
desc => 'The y coordinate for the pick' }
629
{ name => 'layer', type => 'layer', init => 1,
668
{ name => 'layer', type => 'layer',
630
669
desc => 'The layer found at the specified coordinates' }
634
code => 'layer = gimp_image_pick_correlate_layer (gimage, x, y);'
675
layer = gimp_image_pick_correlate_layer (image, x, y);
681
sub image_get_layer_position {
682
$blurb = 'Returns the position of the layer in the layer stack.';
685
This procedure determines the positioin of the specified layer in the images
686
layer stack. If the layer doesn't exist in the image, an error is returned.
689
&simon_pdb_misc('2006', '2.4');
692
{ name => 'image', type => 'image',
693
desc => 'The image' },
694
{ name => 'layer', type => 'layer',
695
desc => 'The layer' }
699
{ name => 'position', type => 'int32',
700
desc => "The position of the layer in the layer stack" }
707
position = gimp_container_get_child_index (GIMP_CONTAINER (image->layers),
708
GIMP_OBJECT (layer));
638
716
sub image_raise_layer {
639
&type_move('layer', 'raise', 'above');
717
$blurb = "Raise the specified layer in the image's layer stack";
720
This procedure raises the specified layer one step in the existing layer stack.
721
It will not move the layer if there is no layer above it.
727
{ name => 'image', type => 'image',
728
desc => 'The image' },
729
{ name => 'layer', type => 'layer',
730
desc => 'The layer to raise' }
736
success = gimp_image_raise_layer (image, layer);
643
742
sub image_lower_layer {
644
&type_move('layer', 'lower', 'below');
743
$blurb = "Lower the specified layer in the image's layer stack";
746
This procedure lowers the specified layer one step in the existing layer stack.
747
It will not move the layer if there is no layer below it.
753
{ name => 'image', type => 'image',
754
desc => 'The image' },
755
{ name => 'layer', type => 'layer',
756
desc => 'The layer to lower' }
762
success = gimp_image_lower_layer (image, layer);
648
768
sub image_raise_layer_to_top {
649
&type_move('layer', 'raise_to_top', 'above');
650
$copyright = "Wolfgang Hofer";
651
$author = $copyright . ", Sven Neumann";
770
Raise the specified layer in the image's layer stack to top of stack
774
This procedure raises the specified layer to top of the existing layer stack.
775
It will not move the layer if there is no layer above it.
778
&wolfgang_pdb_misc('1998');
779
$author .= ", Sven Neumann";
782
{ name => 'image', type => 'image',
783
desc => 'The image' },
784
{ name => 'layer', type => 'layer',
785
desc => 'The layer to raise to top' }
791
success = gimp_image_raise_layer_to_top (image, layer);
655
797
sub image_lower_layer_to_bottom {
656
&type_move('layer', 'lower_to_bottom', 'below');
657
$copyright = "Wolfgang Hofer";
658
$author = $copyright . ", Sven Neumann";
799
Lower the specified layer in the image's layer stack to bottom of stack
803
This procedure lowers the specified layer to bottom of the existing layer stack.
804
It will not move the layer if there is no layer below it.
807
&wolfgang_pdb_misc('1998');
808
$author .= ", Sven Neumann";
811
{ name => 'image', type => 'image',
812
desc => 'The image' },
813
{ name => 'layer', type => 'layer',
814
desc => 'The layer to lower to bottom' }
820
success = gimp_image_lower_layer_to_bottom (image, layer);
662
826
sub image_merge_visible_layers {
993
{ name => 'image', type => 'image',
994
desc => 'The image' },
995
{ name => 'layer', type => 'layer',
996
desc => 'The layer' }
817
%invoke = ( code => 'gimp_image_remove_layer (gimage, layer);' );
1002
gimp_image_remove_layer (image, layer);
820
1008
sub image_add_layer_mask {
821
&std_pdb_deprecated ('gimp_layer_add_mask');
1009
&std_pdb_deprecated ('gimp-layer-add-mask');
1012
{ name => 'image', type => 'image',
1013
desc => 'The image' },
1014
{ name => 'layer', type => 'layer',
1015
desc => 'The layer to receive the mask' },
826
1016
{ name => 'mask', type => 'layer_mask',
827
1017
desc => 'The mask to add to the layer' }
829
$inargs[1]->{desc} .= ' to receive the mask';
832
1021
code => <<'CODE'
834
success = gimp_layer_add_mask (layer, mask, TRUE) != NULL;
1023
if (! gimp_layer_add_mask (layer, mask, TRUE))
840
1030
sub image_remove_layer_mask {
841
&std_pdb_deprecated ('gimp_layer_remove_mask');
1031
&std_pdb_deprecated ('gimp-layer-remove-mask');
1034
{ name => 'image', type => 'image',
1035
desc => 'The image' },
1036
{ name => 'layer', type => 'layer',
1037
desc => 'The layer from which to remove mask' },
846
1038
{ name => 'mode', type => 'enum GimpMaskApplyMode',
847
desc => 'Removal mode: { %%desc%% }' }
849
$inargs[1]->{desc} .= ' from which to remove mask';
851
%invoke = ( code => 'gimp_layer_apply_mask (layer, mode, TRUE);' );
1039
desc => 'Removal mode' }
1045
gimp_layer_apply_mask (layer, mode, TRUE);
1051
sub image_get_channel_position {
1052
$blurb = 'Returns the position of the channel in the channel stack.';
1055
This procedure determines the positioin of the specified channel in the images
1056
channel stack. If the channel doesn't exist in the image, an error is returned.
1059
&simon_pdb_misc('2006', '2.4');
1062
{ name => 'image', type => 'image',
1063
desc => 'The image' },
1064
{ name => 'channel', type => 'channel',
1065
desc => 'The channel' }
1069
{ name => 'position', type => 'int32',
1070
desc => "The position of the channel in the channel stack" }
1077
position = gimp_container_get_child_index (GIMP_CONTAINER (image->channels),
1078
GIMP_OBJECT (channel));
854
1086
sub image_raise_channel {
855
&type_move('channel', 'raise', 'above');
1087
$blurb = "Raise the specified channel in the image's channel stack";
1090
This procedure raises the specified channel one step in the existing
1091
channel stack. It will not move the channel if there is no channel
1098
{ name => 'image', type => 'image',
1099
desc => 'The image' },
1100
{ name => 'channel', type => 'channel',
1101
desc => 'The channel to raise' }
1107
success = gimp_image_raise_channel (image, channel);
859
1113
sub image_lower_channel {
860
&type_move('layer', 'lower', 'below');
1114
$blurb = "Lower the specified channel in the image's channel stack";
1117
This procedure lowers the specified channel one step in the existing
1118
channel stack. It will not move the channel if there is no channel
1125
{ name => 'image', type => 'image',
1126
desc => 'The image' },
1127
{ name => 'channel', type => 'channel',
1128
desc => 'The channel to lower' }
1134
success = gimp_image_lower_channel (image, channel);
864
1140
sub image_add_channel {
909
%invoke = ( code => 'gimp_image_remove_channel (gimage, channel);' );
1183
{ name => 'image', type => 'image',
1184
desc => 'The image' },
1185
{ name => 'channel', type => 'channel',
1186
desc => 'The channel' }
1192
gimp_image_remove_channel (image, channel);
1198
sub image_add_vectors {
1199
$blurb = 'Add the specified vectors object to the image.';
1202
This procedure adds the specified vectors object to the image at the given
1203
position. If the position is specified as -1, then the vectors object is
1204
inserted at the top of the vectors stack.
1210
{ name => 'image', type => 'image',
1211
desc => 'The image' },
1212
{ name => 'vectors', type => 'vectors',
1213
desc => 'The vectors object' },
1214
{ name => 'position', type => 'int32',
1215
desc => 'The vectors objects position' }
1218
$invoke{code} = <<'CODE';
1220
if (g_object_is_floating (vectors))
1221
success = gimp_image_add_vectors (image, vectors, MAX (position, -1));
1228
sub image_remove_vectors {
1229
$blurb = 'Remove the specified path from the image.';
1232
This procedure removes the specified path from the image. If the path
1233
doesn't exist, an error is returned.
1236
&simon_pdb_misc('2005', '2.4');
1239
{ name => 'image', type => 'image',
1240
desc => 'The image' },
1241
{ name => 'vectors', type => 'vectors',
1242
desc => 'The vectors object' }
1248
gimp_image_remove_vectors (image, vectors);
1254
sub image_get_vectors_position {
1255
$blurb = 'Returns the position of the vectors object in the vectors objects stack.';
1258
This procedure determines the positioin of the specified vectors object in the
1259
images vectors object stack. If the vectors object doesn't exist in the image,
1260
an error is returned.
1263
&simon_pdb_misc('2006', '2.4');
1266
{ name => 'image', type => 'image',
1267
desc => 'The image' },
1268
{ name => 'vectors', type => 'vectors',
1269
desc => 'The vectors object' }
1273
{ name => 'position', type => 'int32',
1274
desc => "The position of the vectors object in the vectors stack" }
1281
position = gimp_container_get_child_index (GIMP_CONTAINER (image->vectors),
1282
GIMP_OBJECT (vectors));
1290
sub image_raise_vectors {
1291
$blurb = "Raise the specified vectors in the image's vectors stack";
1294
This procedure raises the specified vectors one step in the existing
1295
vectors stack. It will not move the vectors if there is no vectors
1299
&simon_pdb_misc('2005', '2.4');
1302
{ name => 'image', type => 'image',
1303
desc => 'The image' },
1304
{ name => 'vectors', type => 'vectors',
1305
desc => 'The vectors object to raise' }
1311
success = gimp_image_raise_vectors (image, vectors);
1317
sub image_lower_vectors {
1318
$blurb = "Lower the specified vectors in the image's vectors stack";
1321
This procedure lowers the specified vectors one step in the existing
1322
vectors stack. It will not move the vectors if there is no vectors
1326
&simon_pdb_misc('2005', '2.4');
1329
{ name => 'image', type => 'image',
1330
desc => 'The image' },
1331
{ name => 'vectors', type => 'vectors',
1332
desc => 'The vectors object to lower' }
1338
success = gimp_image_lower_vectors (image, vectors);
1344
sub image_raise_vectors_to_top {
1346
Raise the specified vectors in the image's vectors stack to top of stack
1350
This procedure raises the specified vectors to top of the existing
1351
vectors stack. It will not move the vectors if there is no vectors
1355
&simon_pdb_misc('2005', '2.4');
1358
{ name => 'image', type => 'image',
1359
desc => 'The image' },
1360
{ name => 'vectors', type => 'vectors',
1361
desc => 'The vectors object to raise to top' }
1367
success = gimp_image_raise_vectors_to_top (image, vectors);
1373
sub image_lower_vectors_to_bottom {
1375
Lower the specified vectors in the image's vectors stack to bottom of stack
1379
This procedure lowers the specified vectors to bottom of the existing
1380
vectors stack. It will not move the vectors if there is no vectors
1384
&simon_pdb_misc('2005', '2.4');
1387
{ name => 'image', type => 'image',
1388
desc => 'The image' },
1389
{ name => 'vectors', type => 'vectors',
1390
desc => 'The vectors object to lower to bottom' }
1396
success = gimp_image_lower_vectors_to_bottom (image, vectors);
912
1402
sub image_get_active_drawable {
995
1501
$help = <<'HELP';
996
1502
This procedure sets the entries in the specified image's colormap. The number
997
of entries is specified by the "num_bytes" parameter and corresponds to the
998
number of INT8 triples that must be contained in the "colormap" array. The actual
999
number of colors in the transmitted colormap is "num_bytes" / 3.
1503
of entries is specified by the 'num-bytes' parameter and corresponds to the
1504
number of INT8 triples that must be contained in the 'colormap' array. The
1505
actual number of colors in the transmitted colormap is 'num-bytes' / 3.
1511
{ name => 'image', type => 'image',
1512
desc => 'The image' },
1006
1513
{ name => 'colormap', type => 'int8array', wrap => 1,
1007
desc => "The new colormap values",
1514
desc => 'The new colormap values',
1008
1515
array => { name => 'num_bytes', type => '0 <= int32 <= 768',
1009
desc => 'Number of bytes in the colormap array:
1516
desc => 'Number of bytes in the colormap array' } }
1014
1520
headers => [ qw("core/gimpimage-colormap.h") ],
1015
code => 'gimp_image_set_colormap (gimage, colormap, num_bytes / 3, TRUE);' );
1523
gimp_image_set_colormap (image, colormap, num_bytes / 3, TRUE);
1018
1529
sub image_clean_all {
1019
1530
$blurb = 'Set the image dirty count to 0.';
1021
1532
$help = <<'HELP';
1022
This procedure sets the specified image's dirty count to 0, allowing operations
1023
to occur without having a 'dirtied' image. This is especially useful for
1024
creating and loading images which should not initially be considered dirty, even
1025
though layers must be created, filled, and installed in the image.
1533
This procedure sets the specified image's dirty count to 0, allowing
1534
operations to occur without having a 'dirtied' image. This is
1535
especially useful for creating and loading images which should not
1536
initially be considered dirty, even though layers must be created,
1537
filled, and installed in the image. Note that save plug-ins must NOT
1538
call this function themselves after saving the image.
1030
@inargs = ( &std_image_arg );
1544
{ name => 'image', type => 'image',
1545
desc => 'The image' }
1032
%invoke = ( code => 'gimp_image_clean_all (gimage);' );
1551
gimp_image_clean_all (image);
1035
1557
sub image_is_dirty {
1036
1558
$blurb = 'Checks if the image has unsaved changes.';
1038
1560
$help = <<'HELP';
1039
This procedure checks the specified image's dirty count to see if it needs
1561
This procedure checks the specified image's dirty count to see if it
1562
needs to be saved. Note that saving the image does not automatically
1563
set the dirty count to 0, you need to call gimp_image_clean_all() after
1564
calling a save procedure to make the image clean.
1045
@inargs = ( &std_image_arg );
1570
{ name => 'image', type => 'image',
1571
desc => 'The image' }
1048
{ name => 'dirty', type => 'boolean', init => 1,
1049
desc => 'True if the image has unsaved changes.' }
1575
{ name => 'dirty', type => 'boolean',
1576
desc => 'TRUE if the image has unsaved changes.' }
1052
%invoke = ( code => 'dirty = (gimage->dirty != 0);' );
1582
dirty = (image->dirty != 0);
1055
1588
sub image_get_floating_sel {
1110
foreach (qw(width height)) {
1113
\$blurb = 'Return the $_ of the image';
1116
This procedure returns the image's $_. This value is independent of any of
1117
the layers in this image. This is the "canvas" $_.
1122
\@inargs = ( \&std_image_arg );
1125
{ name => '$_', type => 'int32',
1126
desc => "The image's $_",
1127
alias => 'gimage->$_', no_declare => 1 }
1133
&image_accessors('active_layer', 'layer', 'active layer', 1,
1134
[ <<'CODE1', <<'CODE2' ]);
1135
$invoke{code} = "active_layer = $outargs[0]->{alias};";
1136
delete @{$outargs[0]}{qw(alias no_declare)};
1137
$outargs[0]->{return_fail} = -1;
1138
$outargs[0]->{init} = 1;
1652
$blurb = 'Return the width of the image';
1655
This procedure returns the image's width. This value is independent of any of
1656
the layers in this image. This is the "canvas" width.
1662
{ name => 'image', type => 'image',
1663
desc => 'The image' }
1667
{ name => 'width', type => 'int32',
1668
desc => "The image's width" }
1674
width = gimp_image_get_width (image);
1681
$blurb = 'Return the height of the image';
1684
This procedure returns the image's height. This value is independent of any of
1685
the layers in this image. This is the "canvas" height.
1691
{ name => 'image', type => 'image',
1692
desc => 'The image' }
1696
{ name => 'height', type => 'int32',
1697
desc => "The image's height" }
1703
height = gimp_image_get_height (image);
1709
sub image_get_active_layer {
1710
$blurb = "Returns the specified image's active layer.";
1140
1712
$help = <<'HELP';
1141
1713
If there is an active layer, its ID will be returned, otherwise, -1. If a
1142
1714
channel is currently active, then no layer will be. If a layer mask is active,
1143
1715
then this will return the associated layer.
1146
$invoke{code} =~ s/;//g;
1147
$invoke{code} = "success = ($invoke{code} == active_layer);";
1721
{ name => 'image', type => 'image',
1722
desc => 'The image' }
1726
{ name => 'active_layer', type => 'layer',
1727
desc => 'The active layer' }
1733
active_layer = gimp_image_get_active_layer (image);
1739
sub image_set_active_layer {
1740
$blurb = "Sets the specified image's active layer.";
1149
1742
$help = <<'HELP';
1150
1743
If the layer exists, it is set as the active layer in the image. Any
1174
1802
exception is a previously existing floating selection, in which case
1175
1803
this procedure will return an execution error.
1179
&image_accessors('selection', 'selection', 'selection', 1,
1180
[ <<'CODE', undef ]);
1181
$invoke{code} = "success = (selection = gimp_image_get_mask (gimage)) != NULL;";
1182
delete @{$outargs[0]}{qw(alias no_declare)};
1183
$outargs[0]->{desc} .= ' channel';
1184
$outargs[0]->{init} = 1;
1809
{ name => 'image', type => 'image',
1810
desc => 'The image' },
1811
{ name => 'active_channel', type => 'channel',
1812
desc => 'The new image active channel' }
1818
if (gimp_image_set_active_channel (image, active_channel) != active_channel)
1825
sub image_get_active_vectors {
1826
$blurb = "Returns the specified image's active vectors.";
1829
If there is an active path, its ID will be returned, otherwise, -1.
1835
{ name => 'image', type => 'image',
1836
desc => 'The image' }
1840
{ name => 'active_vectors', type => 'vectors',
1841
desc => 'The active vectors' }
1847
active_vectors = gimp_image_get_active_vectors (image);
1853
sub image_set_active_vectors {
1854
$blurb = "Sets the specified image's active vectors.";
1857
If the path exists, it is set as the active path in the image.
1863
{ name => 'image', type => 'image',
1864
desc => 'The image' },
1865
{ name => 'active_vectors', type => 'vectors',
1866
desc => 'The new image active vectors' }
1872
if (gimp_image_set_active_vectors (image, active_vectors) != active_vectors)
1879
sub image_get_selection {
1880
$blurb = "Returns the specified image's selection.";
1186
1882
$help = <<'HELP';
1187
1883
This will always return a valid ID for a selection -- which is represented as a
1188
1884
channel internally.
1193
my $comp_arg = <<'CODE';
1194
splice @inargs, 1, 0, ({ name => 'component',
1195
type => 'enum GimpChannelType',
1196
desc => 'The image component: { %%desc%% }' });
1198
$invoke{code} = <<'SUCCESS';
1200
if (component == GIMP_GRAY_CHANNEL)
1201
success = gimp_image_base_type (gimage) == GIMP_GRAY;
1202
else if (component == GIMP_INDEXED_CHANNEL)
1203
success = gimp_image_base_type (gimage) == GIMP_INDEXED;
1205
success = gimp_image_base_type (gimage) == GIMP_RGB;
1210
my $comp_help = <<'CODE';
1211
$help =~ s/(component)/$1 (i.e. Red, Green, Blue intensity channels
1215
or in%%type%% -- whether or not it can be %%action%%. If the specified component
1216
is not valid for the image type, an error is returned.
1221
active => 'modified',
1225
foreach (sort keys %comp_action) {
1226
my $help = $comp_help;
1228
$help =~ s/%%type%%/$_/e;
1229
$help =~ s/%%action%%/$comp_action{$_}/e;
1231
&image_accessors("component_$_", 'boolean', "image component is $_", 1,
1232
[ <<CODE1, <<CODE2 ]);
1234
\$outargs[0]->{name} = '$_';
1235
\$outargs[0]->{desc} = 'Component is $_ (%%desc%%)';
1237
chop \$outargs[0]->{alias};
1238
\$outargs[0]->{alias} .= ', component)';
1247
\$invoke{code} =~ s/}/"\$code}"/e;
1248
\$invoke{code} =~ s/ component_$_/ component, $_/;
1249
\$inargs[2]->{name} = '$_';
1250
\$inargs[2]->{desc} = 'Component is $_ (%%desc%%)';
1255
&image_accessors('filename', 'string', 'filename', 1,
1256
[ <<'CODE1', <<'CODE2' ]);
1259
in the filesystem encoding. The image has a filename only if it was loaded
1260
or has since been saved. Otherwise, this function returns %NULL.
1263
$outargs[0]->{alias} =~ s/g_strdup \((.*)\)/$1/;
1265
$help .= " The filename should be in the filesystem encoding.";
1267
$inargs[1]->{no_validate} = 1;
1269
$invoke{code} = <<CODE3;
1890
{ name => 'image', type => 'image',
1891
desc => 'The image' }
1895
{ name => 'selection', type => 'selection',
1896
desc => 'The selection channel' }
1902
selection = GIMP_SELECTION (gimp_image_get_mask (image));
1911
sub image_get_component_active {
1912
$blurb = "Returns if the specified image's image component is active.";
1915
This procedure returns if the specified image's image component
1916
(i.e. Red, Green, Blue intensity channels in an RGB image) is active
1917
or inactive -- whether or not it can be modified. If the specified
1918
component is not valid for the image type, an error is returned.
1924
{ name => 'image', type => 'image',
1925
desc => 'The image' },
1926
{ name => 'component', type => 'enum GimpChannelType',
1927
desc => 'The image component' }
1931
{ name => 'active', type => 'boolean',
1932
desc => 'Component is active' }
1938
if (component == GIMP_GRAY_CHANNEL)
1939
success = gimp_image_base_type (image) == GIMP_GRAY;
1940
else if (component == GIMP_INDEXED_CHANNEL)
1941
success = gimp_image_base_type (image) == GIMP_INDEXED;
1943
success = gimp_image_base_type (image) == GIMP_RGB;
1946
active = gimp_image_get_component_active (image, component);
1952
sub image_set_component_active {
1953
$blurb = "Sets if the specified image's image component is active.";
1956
This procedure sets if the specified image's image component
1957
(i.e. Red, Green, Blue intensity channels in an RGB image) is active
1958
or inactive -- whether or not it can be modified. If the specified
1959
component is not valid for the image type, an error is returned.
1965
{ name => 'image', type => 'image',
1966
desc => 'The image' },
1967
{ name => 'component', type => 'enum GimpChannelType',
1968
desc => 'The image component' },
1969
{ name => 'active', type => 'boolean',
1970
desc => 'Component is active' }
1976
if (component == GIMP_GRAY_CHANNEL)
1977
success = gimp_image_base_type (image) == GIMP_GRAY;
1978
else if (component == GIMP_INDEXED_CHANNEL)
1979
success = gimp_image_base_type (image) == GIMP_INDEXED;
1981
success = gimp_image_base_type (image) == GIMP_RGB;
1984
gimp_image_set_component_active (image, component, active);
1990
sub image_get_component_visible {
1991
$blurb = "Returns if the specified image's image component is visible.";
1994
This procedure returns if the specified image's image component
1995
(i.e. Red, Green, Blue intensity channels in an RGB image) is visible
1996
or invisible -- whether or not it can be seen. If the specified
1997
component is not valid for the image type, an error is returned.
2003
{ name => 'image', type => 'image',
2004
desc => 'The image' },
2005
{ name => 'component', type => 'enum GimpChannelType',
2006
desc => 'The image component' }
2010
{ name => 'visible', type => 'boolean',
2011
desc => 'Component is visible' }
2017
if (component == GIMP_GRAY_CHANNEL)
2018
success = gimp_image_base_type (image) == GIMP_GRAY;
2019
else if (component == GIMP_INDEXED_CHANNEL)
2020
success = gimp_image_base_type (image) == GIMP_INDEXED;
2022
success = gimp_image_base_type (image) == GIMP_RGB;
2025
visible = gimp_image_get_component_visible (image, component);
2031
sub image_set_component_visible {
2032
$blurb = "Sets if the specified image's image component is visible.";
2035
This procedure sets if the specified image's image component
2036
(i.e. Red, Green, Blue intensity channels in an RGB image) is visible
2037
or invisible -- whether or not it can be seen. If the specified
2038
component is not valid for the image type, an error is returned.
2044
{ name => 'image', type => 'image',
2045
desc => 'The image' },
2046
{ name => 'component', type => 'enum GimpChannelType',
2047
desc => 'The image component' },
2048
{ name => 'visible', type => 'boolean',
2049
desc => 'Component is visible' }
2055
if (component == GIMP_GRAY_CHANNEL)
2056
success = gimp_image_base_type (image) == GIMP_GRAY;
2057
else if (component == GIMP_INDEXED_CHANNEL)
2058
success = gimp_image_base_type (image) == GIMP_INDEXED;
2060
success = gimp_image_base_type (image) == GIMP_RGB;
2063
gimp_image_set_component_visible (image, component, visible);
2069
sub image_get_filename {
2070
$blurb = "Returns the specified image's filename.";
2073
This procedure returns the specified image's filename in the
2074
filesystem encoding. The image has a filename only if it was loaded or
2075
has since been saved. Otherwise, this function returns %NULL.
2081
{ name => 'image', type => 'image',
2082
desc => 'The image' }
2086
{ name => 'filename', type => 'string',
2087
desc => 'The filename' }
2093
filename = gimp_image_get_filename (image);
2099
sub image_set_filename {
2100
$blurb = "Sets the specified image's filename.";
2103
This procedure sets the specified image's filename. The filename
2104
should be in the filesystem encoding.
2110
{ name => 'image', type => 'image',
2111
desc => 'The image' },
2112
{ name => 'filename', type => 'string',
2113
desc => 'The new image filename', no_validate => 1 }
1271
2119
/* verify that the filename can be converted to UTF-8 and back */
1272
2120
gchar *utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
1286
2134
success = FALSE;
1294
&image_accessors('name', 'string', 'name', 1,
1295
[ <<'CODE1', undef ]);
1296
delete @{$outargs[0]}{qw(alias no_declare)};
1297
$outargs[0]->{init} = 1;
2137
gimp_image_set_filename (image, filename);
2143
sub image_get_name {
2144
$blurb = "Returns the specified image's name.";
2145
$help = "This procedure returns the specified image's name.";
2150
{ name => 'image', type => 'image',
2151
desc => 'The image' }
2155
{ name => 'name', type => 'string',
2156
desc => 'The name' }
1300
vars => [ 'gchar *filename' ],
1303
filename = gimp_image_get_filename (gimage);
2162
gchar *filename = gimp_image_get_filename (image);
1307
gchar *basename = g_path_get_basename (filename);
1308
name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
1312
name = g_strdup (_("(invalid UTF-8 string)"));
2165
name = g_filename_display_basename (filename);
1316
name = g_strdup (_("Untitled"));
2167
name = g_strdup (_("Untitled"));
1324
&image_accessors('resolution', 'float', 'resolution', 0,
1325
[ <<'CODE1', <<'CODE2' ]);
1328
in dots per inch. This value is independent of any of the layers in this image.
2173
sub image_get_resolution {
2174
$blurb = "Returns the specified image's resolution.";
2177
This procedure returns the specified image's resolution in dots per inch.
2178
This value is independent of any of the layers in this image.
1331
$author = $copyright = 'Austin Donnelly';
1334
push @outargs, { %{$outargs[0]} };
1335
$outargs[0]->{void_ret} = 1;
1338
foreach $coord (qw(x y)) {
1339
foreach (qw(name alias)) {
1340
$outargs[$count]->{$_} =~ s/res/"${coord}res"/e
1342
$outargs[$count++]->{desc} .= "in the $coord-axis, in dots per inch";
1347
in dots per inch. This value is independent of any of the layers in this image.
2181
&austin_pdb_misc('1998');
2184
{ name => 'image', type => 'image',
2185
desc => 'The image' }
2189
{ name => 'xresolution', type => 'float', void_ret => 1,
2190
desc => 'The resolution in the x-axis, in dots per inch' },
2191
{ name => 'yresolution', type => 'float',
2192
desc => 'The resolution in the y-axis, in dots per inch' }
2198
gimp_image_get_resolution (image, &xresolution, &yresolution);
2204
sub image_set_resolution {
2205
$blurb = "Sets the specified image's resolution.";
2208
This procedure sets the specified image's resolution in dots per inch.
2209
This value is independent of any of the layers in this image.
1348
2210
No scaling or resizing is performed.
1351
$author = $copyright = 'Austin Donnelly';
1354
push @inargs, { %{$inargs[1]} };
1356
my $count = 1; undef %invoke;
1357
foreach $coord (qw(x y)) {
1358
my $arg = $inargs[$count];
1359
$arg->{name} =~ s/res/"${coord}res"/e;
1360
$arg->{desc} .= "in the $coord-axis, in dots per inch";
1364
$invoke{code} = <<'CODE';
2213
&austin_pdb_misc('1998');
2216
{ name => 'image', type => 'image',
2217
desc => 'The image' },
2218
{ name => 'xresolution', type => 'float',
2219
desc => 'The new image resolution in the x-axis, in dots per inch' },
2220
{ name => 'yresolution', type => 'float',
2221
desc => 'The new image resolution in the y-axis, in dots per inch' }
1366
2227
if (! FINITE (xresolution) ||
1367
2228
xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
1368
2229
! FINITE (yresolution) ||
1369
2230
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
1371
g_message (_("Image resolution is out of bounds, "
1372
"using the default resolution instead."));
2232
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING,
2233
_("Image resolution is out of bounds, "
2234
"using the default resolution instead."));
1373
2235
success = FALSE;
1377
gimp_image_set_resolution (gimage, xresolution, yresolution);
2239
gimp_image_set_resolution (image, xresolution, yresolution);
1384
my $unit_help = <<'HELP';
1385
This value is independent of any of the layers in this image. See the
1386
gimp_unit_* procedure definitions for the valid range of unit IDs and a
2246
sub image_get_unit {
2247
$blurb = "Returns the specified image's unit.";
2250
This procedure returns the specified image's unit. This value is
2251
independent of any of the layers in this image. See the gimp_unit_*()
2252
procedure definitions for the valid range of unit IDs and a
1387
2253
description of the unit system.
1390
my $unit_misc = <<'CODE';
1391
$author = $copyright = 'Michael Natterer';
1395
&image_accessors('unit', 'unit (min GIMP_UNIT_INCH)', 'unit', 1,
1396
[ <<CODE1, <<CODE2 ]);
1397
\$help .= '$unit_help';
1400
\$help .= 'No scaling or resizing is performed. $unit_help';
1405
my $tattoo_state_misc = <<'CODE';
1406
$author = $copyright = 'Andy Thomas';
1409
&image_accessors('tattoo_state', 'int32', 'tattoo_state', 1,
1410
[ <<CODE1, <<CODE2 ]);
1411
\$blurb = 'Returns the tattoo state associated with the image.';
2256
&mitch_pdb_misc('1998');
2259
{ name => 'image', type => 'image',
2260
desc => 'The image' }
2264
{ name => 'unit', type => 'unit',
2265
desc => 'The unit' }
2271
unit = gimp_image_get_unit (image);
2277
sub image_set_unit {
2278
$blurb = "Sets the specified image's unit.";
2281
This procedure sets the specified image's unit. No scaling or resizing
2282
is performed. This value is independent of any of the layers in this
2283
image. See the gimp_unit_*() procedure definitions for the valid range
2284
of unit IDs and a description of the unit system.
2287
&mitch_pdb_misc('1998');
2290
{ name => 'image', type => 'image',
2291
desc => 'The image' },
2292
{ name => 'unit', type => 'unit (min GIMP_UNIT_INCH)',
2293
desc => 'The new image unit' }
2299
gimp_image_set_unit (image, unit);
2305
sub image_get_tattoo_state {
2306
$blurb = 'Returns the tattoo state associated with the image.';
1413
2309
This procedure returns the tattoo state of the image. Use only by
1414
2310
save/load plugins that wish to preserve an images tattoo state. Using this
1415
2311
function at other times will produce unexpected results.
1419
\$blurb = 'Set the tattoo state associated with the image.';
2314
&andy_pdb_misc('2000');
2317
{ name => 'image', type => 'image',
2318
desc => 'The image' }
2322
{ name => 'tattoo_state', type => 'tattoo',
2323
desc => 'The tattoo state' }
2329
tattoo_state = gimp_image_get_tattoo_state (image);
2335
sub image_set_tattoo_state {
2336
$blurb = 'Set the tattoo state associated with the image.';
1421
2339
This procedure sets the tattoo state of the image. Use only by
1422
2340
save/load plugins that wish to preserve an images tattoo state. Using
1423
2341
this function at other times will produce unexpected results. A full
1430
2348
procedure that should be called. If effectively does a status check on
1431
2349
the tattoo values that have been set to make sure that all is OK.
1437
foreach (qw(layer channel)) {
1438
push @procs, "image_get_${_}_by_tattoo";
1440
sub image_get_${_}_by_tattoo {
1441
\$blurb = 'Find a $_ with a given tattoo in an image.';
1444
This procedure returns the $_ with the given tattoo in the specified image.
1447
\$author = \$copyright = 'Jay Cox';
1452
{ name => 'tattoo', type => 'tattoo',
1453
desc => 'The tattoo of the $_ to find' }
1457
{ name => '$_', type => '$_', init => 1,
1458
desc => 'The $_ with the specified tattoo' }
1464
$_ = gimp_image_get_${_}_by_tattoo (gimage, tattoo);
1465
success = $_ != NULL;
1473
sub preview_dim_args () {
1475
foreach (qw(width height bpp)) {
1476
push @args, { name => $_,
1478
desc => "The previews $_",
2352
&andy_pdb_misc('2000');
2355
{ name => 'image', type => 'image',
2356
desc => 'The image' },
2357
{ name => 'tattoo_state', type => 'tattoo',
2358
desc => 'The new image tattoo state' }
2364
gimp_image_set_tattoo_state (image, tattoo_state);
2370
sub image_get_layer_by_tattoo {
2371
$blurb = 'Find a layer with a given tattoo in an image.';
2374
This procedure returns the layer with the given tattoo in the specified image.
2377
&jay_pdb_misc('1998');
2380
{ name => 'image', type => 'image',
2381
desc => 'The image' },
2382
{ name => 'tattoo', type => 'tattoo',
2383
desc => 'The tattoo of the layer to find' }
2387
{ name => 'layer', type => 'layer',
2388
desc => 'The layer with the specified tattoo' }
2394
layer = gimp_image_get_layer_by_tattoo (image, tattoo);
2400
sub image_get_channel_by_tattoo {
2401
$blurb = 'Find a channel with a given tattoo in an image.';
2404
This procedure returns the channel with the given tattoo in the specified image.
2407
&jay_pdb_misc('1998');
2410
{ name => 'image', type => 'image',
2411
desc => 'The image' },
2412
{ name => 'tattoo', type => 'tattoo',
2413
desc => 'The tattoo of the channel to find' }
2417
{ name => 'channel', type => 'channel',
2418
desc => 'The channel with the specified tattoo' }
2424
channel = gimp_image_get_channel_by_tattoo (image, tattoo);
2430
sub image_get_vectors_by_tattoo {
2431
$blurb = 'Find a vectors with a given tattoo in an image.';
2434
This procedure returns the vectors with the given tattoo in the specified image.
2437
&jay_pdb_misc('1998');
2440
{ name => 'image', type => 'image',
2441
desc => 'The image' },
2442
{ name => 'tattoo', type => 'tattoo',
2443
desc => 'The tattoo of the vectors to find' }
2447
{ name => 'vectors', type => 'vectors',
2448
desc => 'The vectors with the specified tattoo' }
2454
vectors = gimp_image_get_vectors_by_tattoo (image, tattoo);
1484
2460
sub image_thumbnail {
1491
2467
number of bits per pixel in the image.
1494
$author = $copyright = 'Andy Thomas';
2470
&andy_pdb_misc('1999');
1499
{ name => 'width', type => '0 < int32 <= 1024',
1500
desc => 'The thumbnail width', alias => 'req_width' },
1501
{ name => 'height', type => '0 < int32 <= 1024',
1502
desc => 'The thumbnail height', alias => 'req_height' }
2473
{ name => 'image', type => 'image',
2474
desc => 'The image' },
2475
{ name => 'width', type => '1 <= int32 <= 1024',
2476
desc => 'The requested thumbnail width' },
2477
{ name => 'height', type => '1 <= int32 <= 1024',
2478
desc => 'The requested thumbnail height' }
2482
{ name => 'actual_width', type => 'int32', void_ret => 1,
2483
desc => 'The previews width' },
2484
{ name => 'actual_height', type => 'int32',
2485
desc => 'The previews height' },
2486
{ name => 'bpp', type => 'int32',
2487
desc => 'The previews bpp' },
1507
2488
{ name => 'thumbnail_data', type => 'int8array', wrap => 1,
1508
desc => 'The thumbnail data', init => 1,
2489
desc => 'The thumbnail data',
1509
2490
array => { name => 'thumbnail_data_count',
1510
desc => 'The number of bytes in thumbnail data',
1511
alias => 'num_bytes', init => 1 } }
2491
desc => 'The number of bytes in thumbnail data' } }
1513
$outargs[0]->{void_ret} = 1;
1516
2495
code => <<'CODE'
1577
unshift @procs, qw(image_list image_new image_duplicate image_delete
1579
image_width image_height
1581
image_resize image_resize_to_layers image_scale
1582
image_crop image_flip image_rotate
1583
image_get_layers image_get_channels
1584
image_get_active_drawable
1585
image_unset_active_channel
1586
image_get_floating_sel image_floating_sel_attached_to
1587
image_pick_color image_pick_correlate_layer
1588
image_add_layer image_remove_layer
1589
image_raise_layer image_lower_layer
1590
image_raise_layer_to_top image_lower_layer_to_bottom
1591
image_add_channel image_remove_channel
1592
image_raise_channel image_lower_channel
1593
image_flatten image_merge_visible_layers image_merge_down
1594
image_add_layer_mask image_remove_layer_mask
1595
image_get_colormap image_set_colormap
1596
image_clean_all image_is_dirty
1598
%exports = (app => [@procs], lib => [@procs[0..34,37..61]]);
2551
@headers = qw("libgimpmath/gimpmath.h"
2552
"libgimpbase/gimpbase.h"
2559
@procs = qw(image_is_valid
2561
image_new image_duplicate image_delete
2563
image_width image_height
2565
image_resize image_resize_to_layers image_scale
2566
image_crop image_flip image_rotate
2567
image_get_layers image_get_channels
2569
image_get_active_drawable
2570
image_unset_active_channel
2571
image_get_floating_sel image_floating_sel_attached_to
2572
image_pick_color image_pick_correlate_layer
2573
image_add_layer image_remove_layer
2574
image_get_layer_position
2575
image_raise_layer image_lower_layer
2576
image_raise_layer_to_top image_lower_layer_to_bottom
2577
image_add_channel image_remove_channel
2578
image_get_channel_position
2579
image_raise_channel image_lower_channel
2580
image_add_vectors image_remove_vectors
2581
image_get_vectors_position
2582
image_raise_vectors image_lower_vectors
2583
image_raise_vectors_to_top image_lower_vectors_to_bottom
2584
image_flatten image_merge_visible_layers image_merge_down
2585
image_add_layer_mask image_remove_layer_mask
2586
image_get_colormap image_set_colormap
2587
image_clean_all image_is_dirty
2589
image_get_active_layer image_set_active_layer
2590
image_get_active_channel image_set_active_channel
2591
image_get_active_vectors image_set_active_vectors
2593
image_get_component_active image_set_component_active
2594
image_get_component_visible image_set_component_visible
2595
image_get_filename image_set_filename
2597
image_get_resolution image_set_resolution
2598
image_get_unit image_set_unit
2599
image_get_tattoo_state image_set_tattoo_state
2600
image_get_layer_by_tattoo
2601
image_get_channel_by_tattoo
2602
image_get_vectors_by_tattoo);
2604
%exports = (app => [@procs], lib => [@procs[0..45,48..74]]);
1600
2606
$desc = 'Image';