[gimp-perl] Tools to find deprecated GIMP procs, changes of those. Bug 727127
- From: Ed J <edj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-perl] Tools to find deprecated GIMP procs, changes of those. Bug 727127
- Date: Wed, 23 Apr 2014 05:11:15 +0000 (UTC)
commit 74366d6ff8fe7f6f4448683b0cda2826bfa08add
Author: Ed J <m8r-35s8eo mailinator com>
Date: Sat Mar 29 02:25:38 2014 +0000
Tools to find deprecated GIMP procs, changes of those. Bug 727127
examples/animate_cells | 6 +-
examples/billboard | 12 +-
examples/blended2 | 17 ++-
examples/blowinout | 10 +-
examples/bricks | 10 +-
examples/ditherize | 4 +-
examples/dots | 12 +-
examples/example-fu | 2 +-
examples/example-net | 2 +-
examples/example-oo | 4 +-
examples/feedback | 2 +-
examples/frame_reshuffle | 2 +-
examples/gimp-make-img-map | 38 +++---
examples/glowing_steel | 37 +++---
examples/goldenmean | 2 +-
examples/guides_to_selection | 4 +-
examples/iland | 4 +-
examples/image_tile | 6 +-
examples/innerbevel | 4 +-
examples/mirrorsplit | 10 +-
examples/pixelmap | 2 +-
examples/prep4gif | 6 +-
examples/randomart1 | 5 +-
examples/redeye | 4 +-
examples/repdup | 2 +-
examples/roundsel | 2 +-
examples/scratches | 2 +-
examples/selective_sharpen | 4 +-
examples/sethspin | 14 +-
examples/stampify | 14 +-
examples/stamps | 14 +-
examples/testall | 4 +-
examples/translogo | 10 +-
examples/triangle | 10 +-
examples/warp-sharp | 8 +-
examples/webify | 3 +-
examples/xachlego | 4 +-
examples/xachshadow | 6 +-
examples/xachvision | 4 +-
examples/yinyang | 17 ++--
utils/find-deprecated-procs.pl | 66 ++++++++++
utils/list-pdb-deprecations.pl | 264 ++++++++++++++++++++++++++++++++++++++++
42 files changed, 495 insertions(+), 158 deletions(-)
---
diff --git a/examples/animate_cells b/examples/animate_cells
index 3021252..0ae8072 100755
--- a/examples/animate_cells
+++ b/examples/animate_cells
@@ -41,7 +41,7 @@ sub perl_fu_animate_cells {
return;
}
- gimp_selection_layer_alpha($ids[0]);
+ gimp_image_select_item($image,CHANNEL_OP_REPLACE,$ids[0]);
for($i=1;$i<@ids;$i++) {
gimp_progress_update(1/(@ids-1)/2*$i);
$lnum = $#ids+1-$i;
@@ -69,13 +69,13 @@ sub fix_cell_layer {
my $lnum = shift; # The new layer's number
my $dup = gimp_layer_copy($prev,0);
# Tried to do a gimp_layer_get_position($target), here, but it failed...
- gimp_image_add_layer($img, $dup, $lnum);
+ gimp_image_insert_layer($img, $dup, 0, $lnum);
gimp_selection_sharpen($img); # No feathered or fuzzy selection areas
gimp_selection_grow($img,1); # XXX - Gets around gimp 1-pixel bug
gimp_edit_copy($back);
my $float = gimp_edit_paste($dup,0);
gimp_floating_sel_anchor($float);
- gimp_selection_layer_alpha($target);
+ gimp_image_select_item($img,CHANNEL_OP_REPLACE,$target);
}
# Gimp::Fu registration routine for placing this function into gimp's PDB
diff --git a/examples/billboard b/examples/billboard
index 3d2c273..0d7b70a 100755
--- a/examples/billboard
+++ b/examples/billboard
@@ -45,13 +45,13 @@ sub spin_layer { # the function for actually spinning the layer
Gimp->progress_update ($i/3.14159);
# create a new layer for spinning
$framelay = ($i < 3.14159/2.0) ? $spin->copy(1) : $dest->copy(1);
- $img->add_layer($framelay, 0);
+ $img->insert_layer($framelay, 0, 0);
# spin it a step
# Here I need to make the proper selection, repeatedly if necessary
$blindheight = $img->height/$blinds;
for ($j=0; $j<$blinds; $j++) {
# select a section
- $img->rect_select(0, $j*$blindheight, $img->width, $blindheight, 2, 0, 0.13);
+ $img->select_rectangle(2, 0, $j*$blindheight, $img->width, $blindheight);
@x = $img->selection_bounds();
# x[1],x[2] x[3],x[2]
# x[1],x[4] x[3],x[4]
@@ -70,9 +70,9 @@ sub spin_layer { # the function for actually spinning the layer
} # end for ($j=0;...
- # I need to create another layer beind this spun one now
+ # I need to create another layer behind this spun one now
$backlayer = $framelay->layer_copy(0);
- $img->add_layer($backlayer, 1);
+ $img->insert_layer($backlayer, 0, 1);
$backlayer->fill(1); # BG-IMAGE-FILL
}
for ($i=0; $i<$numframes; $i++) {
@@ -82,7 +82,7 @@ sub spin_layer { # the function for actually spinning the layer
}
@all_layers = $img->get_layers();
$destfram = $all_layers[$numframes]->copy(0);
- $img->add_layer($destfram,0);
+ $img->insert_layer($destfram,0,0);
# clean up my temporary layers
$img->remove_layer($all_layers[$numframes]);
@@ -148,7 +148,7 @@ register "billboard",
if ($spinback) {
@layerlist = $img->get_layers();
- $img->add_layer($layerlist[$frames/2]->copy(0),0);
+ $img->insert_layer($layerlist[$frames/2]->copy(0),0,0);
@layerlist = $img->get_layers();
spin_layer($img, $layerlist[1], $layerlist[0], $frames/2, $psp, $shadenum);
$img->remove_layer(($img->get_layers)[0]);
diff --git a/examples/blended2 b/examples/blended2
index 502193c..2890300 100755
--- a/examples/blended2
+++ b/examples/blended2
@@ -34,12 +34,12 @@ sub my_innerbevel {
$bg_layer=$img->layer_new($drawable->width,$drawable->height,$image->layertype(1),
"Background", 100, NORMAL_MODE);
Context->set_background ($bg_col);
$bg_layer->drawable_fill(BACKGROUND_FILL);
- $img->add_layer($bg_layer,0);
+ $img->insert_layer($bg_layer,0,0);
}
$img->resize($drawable->width,$drawable->height, 0, 0);
my $text1_lay;
$text1_lay=$img->layer_new($drawable->width,$drawable->height,$image->layertype(1), "Text -1-", 100,
NORMAL_MODE);
- $img->add_layer($text1_lay,-1);
+ $img->insert_layer($text1_lay,0,-1);
gimp_edit_clear ($text1_lay);
$text1_lay->edit_paste(0)->floating_sel_anchor;
if ($api22) {
@@ -68,7 +68,7 @@ sub my_innerbevel {
my $text2_lay;
$text2_lay=$text1_lay->copy(1);
$text2_lay->add_alpha;
- $img->add_layer($text2_lay, -1);
+ $img->insert_layer($text2_lay, 0, -1);
Context->set_background ([255, 255, 255]);
$text2_lay->edit_fill(BACKGROUND_FILL);
if ($api22) {
@@ -82,15 +82,20 @@ sub my_innerbevel {
plug_in_gauss_rle ($text2_lay, 6, 1, 1);
plug_in_bump_map ($img, $text1_lay, $text2_lay, 110.0, $elev, $depth, 0, 0, 0, 0, 0, 0, 0);
$text2_lay->invert;
- $img->lower_layer($text2_lay);
+ $img->lower_item($text2_lay);
$text2_lay->translate(2, 3);
$text2_lay->set_opacity(75);
if ($rad_tog == 1) {
$img->flatten;
gimp_image_convert_indexed ($img, 0, MAKE_PALETTE, 256, 0, 0, "");
- my $new = gimp_image_active_drawable ($img);
+ my $new = gimp_image_get_active_drawable ($img);
gimp_layer_add_alpha ($new);
- gimp_by_color_select ($new, [255, 255, 255], 55, CHANNEL_OP_ADD, 0, 0, 0.0, 0);
+ gimp_context_set_sample_threshold(55);
+ gimp_context_set_antialias(0);
+ gimp_context_set_feather(0);
+ gimp_context_set_feather_radius(0);
+ gimp_context_set_sample_merged(0);
+ gimp_image_select_color ($img, CHANNEL_OP_ADD, $new, [255, 255, 255]);
gimp_edit_clear ($new);
gimp_selection_none ($img);
} else {
diff --git a/examples/blowinout b/examples/blowinout
index 0ff2bf0..b93812c 100755
--- a/examples/blowinout
+++ b/examples/blowinout
@@ -36,7 +36,7 @@ sub blowinout {
# It needs to have 2 layers
my $dmlayer = gimp_layer_new($dm, $xsize, $ysize, GRAY_IMAGE, "newlayer",
100, NORMAL_MODE);
- gimp_image_add_layer($dm, $dmlayer, 0);
+ gimp_image_insert_layer($dm, $dmlayer, 0, 0);
# Create the layers, one-by-one
my $i = 1;
@@ -50,12 +50,12 @@ sub blowinout {
plug_in_noisify($dm, $dmlayer, 0, 255, 255, 255, 0);
gimp_levels($dmlayer, 0, 0, 255, 1.0, 128, 255);
$drawable = gimp_layer_copy($drawable, 0);
- gimp_image_add_layer($img, $drawable, -1);
+ gimp_image_insert_layer($img, $drawable, 0, -1);
plug_in_displace($img, $drawable, $xdist, $ydist, 1, 1, $dmlayer,
$dmlayer, 1);
if ( $inmode == 1 )
{
- gimp_image_lower_layer($img, $drawable);
+ gimp_image_lower_item($img, $drawable);
};
for ( $i = 2; $i <= $nsteps; $i++ ) {
$xdist = ($arithmode) ?
@@ -68,12 +68,12 @@ sub blowinout {
plug_in_noisify($dm, $dmlayer, 0, 255, 255, 255, 0);
gimp_levels($dmlayer, 0, 0, 255, 1.0, 128, 255);
$drawable = gimp_layer_copy($drawable, 0);
- gimp_image_add_layer($img, $drawable, -1);
+ gimp_image_insert_layer($img, $drawable, 0, -1);
plug_in_displace($img, $drawable, $xdist, $ydist, 1, 1, $dmlayer,
$dmlayer, 1);
if ( $inmode == 1 )
{
- gimp_image_lower_layer($img, $drawable);
+ gimp_image_lower_item($img, $drawable);
};
}
diff --git a/examples/bricks b/examples/bricks
index d5bbcb4..d3f232a 100755
--- a/examples/bricks
+++ b/examples/bricks
@@ -11,7 +11,7 @@
# 12/5/03: <sjburges gimp org> updated to use gimp_image_get_floating_sel,
# rather than gimp_image_floating_sel, gimp_undo_push/gimp_image_undo_push
#
-# 25/2/04: <sjbkurges gimp org> changed color specifiers. Reordered so that
+# 25/2/04: <sjburges gimp org> changed color specifiers. Reordered so that
# pasting happens after layer mask is attached to image. Removed harmful
# gimp_layer_delete() calls. s/gimp_channel_ops_offset/gimp_drawable_offset/.
#
@@ -47,13 +47,13 @@ sub do_bricks {
gimp_image_undo_group_start($image);
while ($h < $imgh)
{
- gimp_rect_select($image,0,$h,$imgw,$bw,2,0,0);
+ gimp_image_select_rectangle($image,2,0,$h,$imgw,$bw);
gimp_edit_bucket_fill($layer,0,0,100,0,0,0,0);
$w = 1;
$wo = 0; $wo = ($brickw / 2) if ($j == 1);
while ($w < $imgw)
{
- gimp_rect_select($image,$w+$wo,$h,$bw,$brickh+1,2,0,0);
+ gimp_image_select_rectangle($image,2,$w+$wo,$h,$bw,$brickh+1);
gimp_edit_bucket_fill($layer,0,0,100,0,0,1,1);
# print "$h $w\n";
$w += $brickw;
@@ -92,12 +92,12 @@ sub do_bricks {
{
gimp_context_set_foreground ("#ffffff") if ($r > 0);
gimp_context_set_foreground ("#000000") if ($r < 0);
- gimp_rect_select($image,$w+$wo+$bp,$h+$bp,$brickw,$brickh,2,0,0);
+ gimp_image_select_rectangle($image,2,$w+$wo+$bp,$h+$bp,$brickw,$brickh);
gimp_edit_bucket_fill($layerpat,0,0,4*abs($r),0,0,1,1);
# halves
if (($j == 1) && ($w+$wo+$brickw > $imgw))
{
- gimp_rect_select($image,0,$h+$bp,$brickw/2,$brickh,2,0,0);
+ gimp_image_select_rectangle($image,2,0,$h+$bp,$brickw/2,$brickh);
gimp_edit_bucket_fill($layerpat,0,0,4*abs($r),0,0,1,1);
}
}
diff --git a/examples/ditherize b/examples/ditherize
index 0e16103..8b32115 100755
--- a/examples/ditherize
+++ b/examples/ditherize
@@ -50,7 +50,7 @@ register "plug_in_ditherize",
my ($w,$h)=($x2-$x1,$y2-$y1);
my $sel = $image->selection_save;
- $image->rect_select($x1,$y1,$w,$h,CHANNEL_OP_REPLACE,0,0);
+ $image->select_rectangle(CHANNEL_OP_REPLACE,$x1,$y1,$w,$h);
$drawable->edit_copy;
$sel->selection_load;
$sel->remove_channel;
@@ -60,7 +60,7 @@ register "plug_in_ditherize",
my $draw = new Gimp::Layer($copy, $w, $h,
$imagetype2layertype{$image->base_type},
"temporary layer", 100, NORMAL_MODE);
- $copy->add_layer ($draw, 1);
+ $copy->insert_layer ($draw, 0, 1);
$draw->edit_paste(0)->anchor;
$copy->convert_indexed ($dither, MAKE_PALETTE, $colours, 1, 1, "");
diff --git a/examples/dots b/examples/dots
index 55e9615..44e2f75 100755
--- a/examples/dots
+++ b/examples/dots
@@ -57,8 +57,8 @@ register "dots",
$y<$img->height+$size+$yspacing;
$y+=$yspacing)
{
- $img->ellipse_select($x-0.5*$size,$y-0.5*$size,
- $size,$size,CHANNEL_OP_ADD,1,0,0.0);
+ $img->select_ellipse(CHANNEL_OP_ADD,$x-0.5*$size,$y-0.5*$size,
+ $size,$size);
}
}
@@ -66,13 +66,13 @@ register "dots",
Context->push();
$opc = gimp_channel_new($img,$img->width,$img->height,"OPC", 50, [0,0,0]);
- $img->add_channel($opc,0);
+ $img->insert_channel($opc,0,0);
Context->set_foreground([($opacity/100.0)x3]);
$opc->fill(FOREGROUND_FILL);
- $opc->selection_combine(CHANNEL_OP_INTERSECT);
+ $img->select_item(CHANNEL_OP_INTERSECT, $opc);
# And mask off with original selection
- $selchannel->selection_combine(CHANNEL_OP_INTERSECT);
+ $img->select_item(CHANNEL_OP_INTERSECT, $selchannel);
# Make the dots
Context->set_foreground($dotcolor);
@@ -85,7 +85,7 @@ register "dots",
}
else
{
- $selchannel->selection_combine(CHANNEL_OP_REPLACE);
+ $img->select_item(CHANNEL_OP_REPLACE, $selchannel);
}
$img->remove_channel($selchannel);
diff --git a/examples/example-fu b/examples/example-fu
index 11dad1b..f1f8671 100755
--- a/examples/example-fu
+++ b/examples/example-fu
@@ -52,7 +52,7 @@ register "gimp_fu_example_script", # fill in a function name
# the __ before the string in the next line indicates text that must be translated
my $l = new Gimp::Layer ($img, $width, $height, RGB, __"Background", 100, NORMAL_MODE);
- $l->add_layer(0);
+ $l->insert_layer(0,0);
# now a few syntax examples
diff --git a/examples/example-net b/examples/example-net
index 2dbd6e6..29d9c38 100755
--- a/examples/example-net
+++ b/examples/example-net
@@ -19,7 +19,7 @@ Gimp::on_net {
# the is the same as $img = new Gimp::Image(600,300,RGB)
$bg=$img->layer_new(30,20,RGB_IMAGE,"Background",100,NORMAL_MODE);
# you have to add a layer after you create it
- $bg->add_layer(1);
+ $bg->insert_layer(0,1);
# Show it (this slows things down)
new Gimp::Display($img);
diff --git a/examples/example-oo b/examples/example-oo
index 1d1ec3a..ea89fa5 100755
--- a/examples/example-oo
+++ b/examples/example-oo
@@ -32,8 +32,8 @@ sub plug_in_example_oo {
# Next, we have 2 examples of using the drawable or image as an object when
# its the first parameter to the PDB call.
-# image_add_layer($img,$bg,1);
- $img->add_layer($bg,1);
+# image_insert_layer($img,$bg,0,1);
+ $bg->insert_layer(0,1);
# gimp_drawable_fill ($bg,BACKGROUND_FILL);
$bg->fill(BACKGROUND_FILL);
diff --git a/examples/feedback b/examples/feedback
index 8bf3025..ee4eb8d 100755
--- a/examples/feedback
+++ b/examples/feedback
@@ -30,7 +30,7 @@ register "feedback",
for (; $repeat>0; $repeat--) {
$drawable = $img->flatten;
$copylayer = $drawable->copy(1);
- $img->add_layer($copylayer,0);
+ $img->insert_layer($copylayer,0,0);
$copylayer->scale($img->width - $offset, $img->height - $offset, 0);
}
$img->flatten;
diff --git a/examples/frame_reshuffle b/examples/frame_reshuffle
index ff73f2d..ef9e95a 100755
--- a/examples/frame_reshuffle
+++ b/examples/frame_reshuffle
@@ -51,7 +51,7 @@ register "layer_reorder",
# now re-order the layers
$img->undo_group_start;
for(@layers) {
- $img->raise_layer_to_top($_) unless $$_ == ${($img->get_layers)[0]};
+ $img->raise_item_to_top($_) unless $$_ == ${($img->get_layers)[0]};
}
Gimp->displays_flush;
$img->undo_group_end;
diff --git a/examples/gimp-make-img-map b/examples/gimp-make-img-map
index bf42c5e..b6a0009 100755
--- a/examples/gimp-make-img-map
+++ b/examples/gimp-make-img-map
@@ -250,8 +250,8 @@ sub decoration_drop_shadow {
$tiled_shadow->layer_add_alpha();
# Connect masks to respective layers
- $tiled_img->add_layer_mask($tiled_drw, $tiled_drw_msk);
- $tiled_img->add_layer_mask($tiled_shadow, $tiled_shadow_msk);
+ $tiled_drw->add_mask($tiled_drw_msk);
+ $tiled_shadow->add_mask($tiled_shadow_msk);
# Fill all the layers with some contents
gimp_context_set_background([128,128,128]);
@@ -262,16 +262,16 @@ sub decoration_drop_shadow {
if ($bgpattern) {
print "Setting pattern\n";
gimp_context_set_pattern($bgpattern);
- $tiled_background->bucket_fill(PATTERN_BUCKET_FILL,
+ $tiled_background->edit_bucket_fill(PATTERN_BUCKET_FILL,
NORMAL, 100, 0, FALSE, 0,0);
}
gimp_context_set_background([0, 0, 0]); # Shadow color
$tiled_shadow->edit_fill(BACKGROUND_FILL);
# Add all the layers to the image
- $tiled_img->add_layer($tiled_background,-1);
- $tiled_img->add_layer($tiled_shadow,-1);
- $tiled_img->add_layer($tiled_drw,-1);
+ $tiled_img->insert_layer($tiled_background,0,-1);
+ $tiled_img->insert_layer($tiled_shadow,0,-1);
+ $tiled_img->insert_layer($tiled_drw,0,-1);
gimp_display_new($tiled_img);
my $xpos = 0;
@@ -285,17 +285,17 @@ sub decoration_drop_shadow {
my($w,$h) = ($img->width, $img->height);
$img->selection_all();
$layer->edit_copy();
- $tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
+ $tiled_img->select_rectangle(0, $xpos, $ypos, $w, $h);
$tiled_drw->edit_paste(0)
->floating_sel_anchor;
# why is the selection cleared?
- $tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
+ $tiled_img->select_rectangle(0, $xpos, $ypos, $w, $h);
$tiled_drw_msk->edit_fill(BACKGROUND_FILL);
# why is the selection cleared?
- $tiled_img->rect_select($xpos+$shadow_xoffs,
- $ypos+$shadow_yoffs, $w, $h, 0, 0, 0);
+ $tiled_img->select_rectangle(0, $xpos+$shadow_xoffs,
+ $ypos+$shadow_yoffs, $w, $h);
$tiled_shadow_msk->edit_fill(BACKGROUND_FILL);
$tiled_img->selection_none();
@@ -330,7 +330,7 @@ sub decoration_sunken_windows {
$tiled_punch_layer->layer_add_alpha();
# Connect masks to respective layers
- $tiled_punch_layer->add_layer_mask($tiled_punch_mask);
+ $tiled_punch_layer->add_mask($tiled_punch_mask);
# Fill all the layers with some contents
gimp_context_set_background([128,128,128]);
@@ -341,16 +341,16 @@ sub decoration_sunken_windows {
if ($bgpattern) {
print "Setting pattern\n";
gimp_context_set_pattern($bgpattern);
- $tiled_punch_layer->bucket_fill(PATTERN_BUCKET_FILL,
+ $tiled_punch_layer->edit_bucket_fill(PATTERN_BUCKET_FILL,
NORMAL, 100, 0, FALSE, 0,0);
}
gimp_context_set_background([255, 255, 255]); # Punch stencil
$tiled_punch_stencil->edit_fill(BACKGROUND_FILL);
# Add all the layers to the image
- $tiled_img->add_layer($tiled_punch_stencil,-1);
- $tiled_img->add_layer($tiled_drw,-1);
- $tiled_img->add_layer($tiled_punch_layer,-1);
+ $tiled_img->insert_layer($tiled_punch_stencil,0,-1);
+ $tiled_img->insert_layer($tiled_drw,0,-1);
+ $tiled_img->insert_layer($tiled_punch_layer,0,-1);
gimp_display_new($tiled_img);
my $xpos = 0;
@@ -364,19 +364,19 @@ sub decoration_sunken_windows {
my($w,$h) = ($img->width, $img->height);
$img->selection_all();
$layer->edit_copy();
- $tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
+ $tiled_img->select_rectangle(0, $xpos, $ypos, $w, $h);
$tiled_drw->edit_paste(0)
->floating_sel_anchor;
# why is the selection cleared?
$bw = 3;
- $tiled_img->rect_select($xpos-$bw,
- $ypos-$bw, $w+2*$bw, $h+2*$bw, 0, 0, 0);
+ $tiled_img->select_rectangle(0, $xpos-$bw,
+ $ypos-$bw, $w+2*$bw, $h+2*$bw);
$tiled_punch_stencil->edit_fill(BACKGROUND_FILL);
# why is the selection cleared?
$tiled_img->selection_none();
- $tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
+ $tiled_img->select_rectangle(0, $xpos, $ypos, $w, $h);
$tiled_punch_layer->edit_cut();
$tiled_img->selection_none();
diff --git a/examples/glowing_steel b/examples/glowing_steel
index b0ae3b8..d060f1a 100755
--- a/examples/glowing_steel
+++ b/examples/glowing_steel
@@ -60,12 +60,9 @@ sub perl_fu_glowing_steel {
gimp_image_resize($image, $width, $height, 0, 0);
my $backlayer = gimp_layer_new($image, $width, $height, RGBA_IMAGE,
"Background", 100, NORMAL_MODE);
- gimp_image_add_layer($image, $backlayer, 1);
+ gimp_image_insert_layer($image, $backlayer, 0, 1);
- if (gimp_version() gt "2.3") # make work for 2.2 or 2.3
- { gimp_layer_set_lock_alpha($textlayer, 1); }
- else
- { gimp_layer_set_lock_alpha($textlayer,1); }
+ gimp_layer_set_lock_alpha($textlayer,1);
perl_fu_brushed_metal($image, $textlayer, 25, 135);
@@ -76,7 +73,7 @@ sub perl_fu_glowing_steel {
my $hl_layer = (gimp_image_get_layers($image))[0];
$textlayer = gimp_image_merge_down($image, $hl_layer, EXPAND_AS_NECESSARY);
}
- gimp_drawable_set_name($textlayer, "Text");
+ gimp_item_set_name($textlayer, "Text");
# Fill the background
gimp_selection_all($image);
@@ -106,7 +103,7 @@ sub perl_fu_add_glow {
gimp_image_undo_group_start($image);
- if (!gimp_drawable_is_layer($drawable)) {
+ if (!gimp_item_is_layer($drawable)) {
die("add_glow: Only layers can have glow added");
}
@@ -130,7 +127,7 @@ sub perl_fu_add_glow {
warn("add_glow: gimp_layer_get_position failed");
$lnum = 0;
}
- gimp_image_add_layer($image, $glow, $lnum);
+ gimp_image_insert_layer($image, $glow, 0, $lnum);
# Clear out the new layer
gimp_selection_all($image);
@@ -140,11 +137,11 @@ sub perl_fu_add_glow {
gimp_context_push();
gimp_context_set_foreground($color);
- gimp_selection_layer_alpha($drawable);
+ gimp_image_select_item($image, CHANNEL_OP_REPLACE, $drawable);
gimp_selection_grow($image, $radius);
gimp_selection_feather($image, $radius*1.5);
gimp_edit_bucket_fill($glow,FG_BUCKET_FILL,NORMAL_MODE,100,255,0,0,0);
- gimp_selection_layer_alpha($drawable);
+ gimp_image_select_item($image, CHANNEL_OP_REPLACE, $drawable);
gimp_edit_clear($glow);
gimp_selection_load($old_sel);
@@ -171,7 +168,7 @@ sub perl_fu_brushed_metal {
my($bset, $x1, $y1, $x2, $y2) = gimp_selection_bounds($image);
if (!$bset) {
if(gimp_drawable_has_alpha($drawable)) {
- gimp_selection_layer_alpha($drawable);
+ gimp_image_select_item($image, CHANNEL_OP_REPLACE, $drawable);
} else {
gimp_selection_all($image);
}
@@ -186,7 +183,7 @@ sub perl_fu_brushed_metal {
my $height = abs($y2-$y1);
my $templ = gimp_layer_new($image, $width, $height, RGBA_IMAGE, "Temp",
100, NORMAL_MODE);
- gimp_image_add_layer($image, $templ, 0);
+ gimp_image_insert_layer($image, $templ, 0, 0);
gimp_layer_set_offsets($templ, $x1+$length, $y1+$length);
my $target_select = gimp_selection_save($image);
gimp_selection_none($image);
@@ -212,7 +209,7 @@ sub perl_fu_brushed_metal {
gimp_layer_set_offsets($float, $x1+$length, $y1+$length);
gimp_floating_sel_anchor($float);
gimp_image_remove_layer($image,$templ);
- # gimp_layer_delete($templ);
+ # gimp_item_delete($templ);
gimp_image_undo_group_end($image);
@@ -229,12 +226,12 @@ sub perl_fu_highlight_edges {
gimp_image_undo_group_start($image);
- if (!gimp_drawable_is_layer($drawable)) {
+ if (!gimp_item_is_layer($drawable)) {
gimp_message("highlight_edges: Only layers can be highlighted!");
return;
}
- if (!gimp_drawable_get_visible($drawable)) {
+ if (!gimp_item_get_visible($drawable)) {
gimp_message("highlight_edges: The active layer must be visible!");
return;
}
@@ -249,7 +246,7 @@ sub perl_fu_highlight_edges {
}
}
- gimp_selection_layer_alpha($drawable);
+ gimp_image_select_item($image, CHANNEL_OP_REPLACE, $drawable);
my $white = gimp_layer_copy($drawable,0);
my $black = gimp_layer_copy($drawable,0);
my $lnum;
@@ -258,8 +255,8 @@ sub perl_fu_highlight_edges {
warn("highlight_edges: gimp_layer_get_position failed");
$lnum = 0;
}
- gimp_image_add_layer($image, $black, $lnum);
- gimp_image_add_layer($image, $white, $lnum);
+ gimp_image_insert_layer($image, $black, 0, $lnum);
+ gimp_image_insert_layer($image, $white, 0, $lnum);
gimp_context_push();
@@ -270,8 +267,8 @@ sub perl_fu_highlight_edges {
gimp_layer_translate($white, -1*$pixels, -1*$pixels);
gimp_layer_translate($black, 1*$pixels, 1*$pixels);
$white = gimp_image_merge_down($image, $white, EXPAND_AS_NECESSARY);
- gimp_drawable_set_name($white, "Edge Highlight");
- gimp_selection_layer_alpha($drawable);
+ gimp_item_set_name($white, "Edge Highlight");
+ gimp_image_select_item($image, CHANNEL_OP_REPLACE, $drawable);
gimp_edit_clear($white);
gimp_selection_load($old_sel);
diff --git a/examples/goldenmean b/examples/goldenmean
index 0cb18e2..358985b 100755
--- a/examples/goldenmean
+++ b/examples/goldenmean
@@ -22,7 +22,7 @@ sub goldenmean {
$img = gimp_image_new($width, $height, RGB);
$layer = gimp_layer_new($img, $width, $height, RGB_IMAGE, "Layer 1", 100, NORMAL_MODE);
- gimp_image_add_layer($layer, -1);
+ gimp_image_insert_layer($layer, 0, -1);
Context->push();
$layer->gimp_edit_fill(BACKGROUND_FILL);
diff --git a/examples/guides_to_selection b/examples/guides_to_selection
index 0435868..f7b20a9 100755
--- a/examples/guides_to_selection
+++ b/examples/guides_to_selection
@@ -40,7 +40,9 @@ register "guide_to_selection",
} else {
($x,$y,$w,$h) = ($x,0,1,$H);
}
- $img->rect_select($x,$y,$w,$h,$operation,$feather,$radius);
+ gimp_context_set_feather($feather);
+ gimp_context_set_feather_radius($radius);
+ $img->select_rectangle($operation,$x,$y,$w,$h);
$operation = CHANNEL_OP_ADD if $operation == CHANNEL_OP_REPLACE;
$i = $img->find_next_guide($i);
diff --git a/examples/iland b/examples/iland
index 2d3051d..e5f74cc 100755
--- a/examples/iland
+++ b/examples/iland
@@ -31,8 +31,8 @@ sub landscape {
my $src= new Gimp::PixelRgn ($drawable, 0,0,$width, $height, 0, 0);
my $newimage=gimp_image_new($src->w, $src->h, 0);
$layer=gimp_layer_new($newimage,$src->w, $src->h, RGB_IMAGE, "L1", 100, NORMAL_MODE);
- gimp_image_add_layer($layer, -1);
- $newdrawable=gimp_image_active_drawable($newimage);
+ gimp_image_insert_layer($layer, 0, -1);
+ $newdrawable=gimp_get_image_active_drawable($newimage);
my $dest = new Gimp::PixelRgn ($newdrawable, 0,0,$width, $height,1,1);
Gimp->progress_init("Rendering...");
my $relord=$src->w/255;
diff --git a/examples/image_tile b/examples/image_tile
index 54236e9..380a45e 100755
--- a/examples/image_tile
+++ b/examples/image_tile
@@ -178,7 +178,7 @@ sub perl_fu_image_tile {
gimp_edit_copy($drawable); # gimp 1.1 -deleted $image
my $back =
gimp_layer_new($dup,$imgwidth,$imgheight,RGB_IMAGE,"Target",100,NORMAL_MODE);
- gimp_image_add_layer($dup,$back,0);
+ gimp_image_insert_layer($dup,$back,0,0);
my $sel = gimp_edit_paste($back,0); # gimp 1.1 -deleted $dup
gimp_floating_sel_anchor($sel);
my $oimage = get_image_cells($dup,$xtiles*$xcells,$ytiles*$ycells,
@@ -377,8 +377,8 @@ sub overlay_image {
match_aspect($img,$width/$height,$subwidth,$subheight);
gimp_image_scale($img,$width,$height);
gimp_edit_copy(gimp_image_get_active_drawable($img)); #gimp 1.1 -deleted $img
- my $baseimg = gimp_drawable_get_image($draw);
- gimp_rect_select($baseimg,$x,$y,$width,$height,CHANNEL_OP_REPLACE,0,0);
+ my $baseimg = gimp_item_get_image($draw);
+ gimp_image_select_rectangle(CHANNEL_OP_REPLACE,$baseimg,$x,$y,$width,$height);
my $sel = gimp_edit_paste($draw,0); # gimp 1.1 -deleted $baseimg
gimp_floating_sel_anchor($sel);
gimp_image_delete($img);
diff --git a/examples/innerbevel b/examples/innerbevel
index a482436..e07a5e2 100755
--- a/examples/innerbevel
+++ b/examples/innerbevel
@@ -87,7 +87,7 @@ elsif ($api23) { $layer->set_lock_alpha(1); }
$layer->edit_blend(FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, REPEAT_NONE, 0, 0, 0, 3, 0.20,
@pt1, @pt2);
# -- step 4 --
$layer2 = $layer->copy(0); # Can you override these to have a default? (would be nice)
-$img->add_layer($layer2, 0);
+$img->insert_layer($layer2, 0, 0);
# -- step 5 --
if ($api22) { $layer2->set_preserve_trans(1); }
elsif ($api23) { $layer2->set_lock_alpha(1); }
@@ -102,7 +102,7 @@ $layer2->gauss_rle(6,1,1);
$layer->plug_in_bump_map($layer2, $azimuth, $elevation, $depth, 0,0,0,0,1,0,$maptype);
# -- step 8 --
$layer2->invert;
-$img->lower_layer($layer2);
+$img->lower_item($layer2);
# -- step 9 --
$layer2->translate(2, 3);
diff --git a/examples/mirrorsplit b/examples/mirrorsplit
index dcbc030..8294576 100755
--- a/examples/mirrorsplit
+++ b/examples/mirrorsplit
@@ -35,22 +35,22 @@ register "mirror_split",
eval { $img->undo_group_start };
my $temp1 = gimp_layer_copy($layer, 1);
- $img->add_layer($temp1,-1);
+ $img->insert_layer($temp1,0,-1);
if ($mirror == 0) { # upper half
$temp1 = $temp1->transform_flip_simple(&Gimp::ORIENTATION_VERTICAL, 1, 0.0, 1);
- gimp_rect_select($img, 0, $hspan, $w, $h - $hspan, &Gimp::CHANNEL_OP_REPLACE, 0, 0);
+ gimp_image_select_rectangle(&Gimp::CHANNEL_OP_REPLACE, $img, 0, $hspan, $w, $h -
$hspan);
};
if ($mirror == 1) { # lower half
$temp1 = $temp1->transform_flip_simple(&Gimp::ORIENTATION_VERTICAL, 1, 0.0, 1);
- gimp_rect_select($img, 0, 0, $w, $hspan, &Gimp::CHANNEL_OP_REPLACE, 0, 0);
+ gimp_image_select_rectangle(&Gimp::CHANNEL_OP_REPLACE, $img, 0, 0, $w, $hspan);
};
if ($mirror == 2) { # left half
$temp1 = $temp1->transform_flip_simple(&Gimp::ORIENTATION_HORIZONTAL, 1, 0.0, 1);
- gimp_rect_select($img, $wspan, 0, $w - $wspan, $h, &Gimp::CHANNEL_OP_REPLACE, 0, 0);
+ gimp_image_select_rectangle(&Gimp::CHANNEL_OP_REPLACE, $img, $wspan, 0, $w - $wspan,
$h);
};
if ($mirror == 3) { # right half
$temp1 = $temp1->transform_flip_simple(&Gimp::ORIENTATION_HORIZONTAL, 1, 0.0, 1);
- gimp_rect_select($img, 0, 0, $wspan, $h, &Gimp::CHANNEL_OP_REPLACE, 0, 0);
+ gimp_image_select_rectangle(&Gimp::CHANNEL_OP_REPLACE, $img, 0, 0, $wspan, $h);
};
gimp_edit_copy($temp1);
diff --git a/examples/pixelmap b/examples/pixelmap
index 4161ec9..8fcadaa 100755
--- a/examples/pixelmap
+++ b/examples/pixelmap
@@ -87,7 +87,7 @@ register "pixelgen",
my $layername = $expr;
$layername =~ s/\n//g;
my $layer = new Gimp::Layer $image, $w, $h, $type, $layername, 100, NORMAL_MODE;
- $image->add_layer($layer, 0);
+ $image->insert_layer($layer, 0, 0);
eval { pixelmap($image, $layer, $expr) };
if ($@) {
my $error = $@;
diff --git a/examples/prep4gif b/examples/prep4gif
index 7669008..29509c6 100755
--- a/examples/prep4gif
+++ b/examples/prep4gif
@@ -49,7 +49,7 @@ sub prep {
# Hide the bottom layer, so it doesn't get into the merge visible later.
my $bottomlayer = $layers[$#layers];
- gimp_drawable_set_visible($bottomlayer, 0);
+ gimp_item_set_visible($bottomlayer, 0);
gimp_layer_add_alpha($bottomlayer);
# NOTE TO PERL NEWBIES - 'my' variables should be declared in their outermost
@@ -69,11 +69,11 @@ sub prep {
gimp_threshold($layer_mask,$threshold,255);
# Transfer layer mask to selection, and grow the selection
- gimp_selection_layer_alpha($foreground);
+ gimp_image_select_item($out, CHANNEL_OP_REPLACE, $foreground);
gimp_selection_grow($out,$growth);
# Apply this selection to the background
- gimp_drawable_set_visible($bottomlayer, 1);
+ gimp_item_set_visible($bottomlayer, 1);
gimp_image_set_active_layer($out, $bottomlayer);
gimp_selection_invert($out);
gimp_edit_cut($bottomlayer);
diff --git a/examples/randomart1 b/examples/randomart1
index d06aac8..387b4d5 100755
--- a/examples/randomart1
+++ b/examples/randomart1
@@ -48,7 +48,7 @@ register "random_art_1", # Funktionsname
"Random Art #1",100,NORMAL_MODE);
# F�ge sie in das Bild ein
- $image->add_layer($layer,0);
+ $image->insert_layer($layer,0,0);
# Setze die Hintergrundfarben
Context->set_background('white');
@@ -71,7 +71,8 @@ register "random_art_1", # Funktionsname
}
# Selektiere die Region
- $image->free_select (\ ecken, CHANNEL_OP_REPLACE, 1, 1, $feather);
+ gimp_context_set_feather($feather);
+ $image->select_polygon(CHANNEL_OP_REPLACE, \ ecken);
# W�hle zuf�llig zwei Farben aus
Context->set_foreground([rand(256)/256.0,rand(256)/256.0,rand(256)/256.0]);
diff --git a/examples/redeye b/examples/redeye
index 1c54ba9..1a567ad 100755
--- a/examples/redeye
+++ b/examples/redeye
@@ -17,8 +17,8 @@ sub dynamic_redeye
my($image, $drawable, $threshold) = @_;
# Stuff we might need in the future.
- # $image->undo_push_group_start;
- # $image->undo_push_group_end;
+ # $image->undo_group_start;
+ # $image->undo_group_end;
Gimp->progress_init("Clearing red-eye", -1);
my $a = pdl [1..10];
diff --git a/examples/repdup b/examples/repdup
index d8f5664..ca33a60 100755
--- a/examples/repdup
+++ b/examples/repdup
@@ -36,7 +36,7 @@ register "repdup",
for ($i = 0; $i < $repeats; $i++) {
$b[1] = $b[1] + $xoffset;
$b[2] = $b[2] + $yoffset;
- gimp_rect_select($img, $b[1], $b[2], $w, $h, CHANNEL_OP_REPLACE, 0, 0);
+ gimp_image_select_rectangle(CHANNEL_OP_REPLACE, $img, $b[1], $b[2], $w, $h);
$bit_bucket = gimp_edit_paste($layer, 0);
gimp_floating_sel_anchor($bit_bucket);
gimp_selection_none($img);
diff --git a/examples/roundsel b/examples/roundsel
index 1139fc1..278a0a8 100755
--- a/examples/roundsel
+++ b/examples/roundsel
@@ -29,7 +29,7 @@ register "round_sel",
gimp_levels($channel, 0, 123, 133, 1.0, 0, 255);
gimp_selection_load($channel);
gimp_image_remove_channel($img, $channel);
- # gimp_channel_delete($channel);
+ # gimp_item_delete($channel);
eval { $img->undo_group_end };
diff --git a/examples/scratches b/examples/scratches
index e4e650a..ed57c0e 100755
--- a/examples/scratches
+++ b/examples/scratches
@@ -13,7 +13,7 @@ sub new_scratchlayer {
my $type = $image->layertype(0);
my $layer = $image->layer_new ($drawable->width, $drawable->height, $image->layertype(0),
"displace layer ($angle)", 100, NORMAL_MODE);
- $layer->add_layer(-1);
+ $layer->insert_layer(0, -1);
$layer->fill (WHITE_FILL);
$layer->noisify (0, 1, 1, 1, 0);
$layer->mblur (0, $length, $angle, 0, 0, 0);
diff --git a/examples/selective_sharpen b/examples/selective_sharpen
index 51712ed..d9685c2 100755
--- a/examples/selective_sharpen
+++ b/examples/selective_sharpen
@@ -33,7 +33,7 @@ sub my_code {
# 1) take the original photo, duplicate the layer
$edge_layer = $original_layer->copy(1);
- $img->add_layer($edge_layer,-1);
+ $img->insert_layer($edge_layer,0,-1);
# 2) convert the copy to grayscale
$edge_layer->desaturate;
@@ -56,7 +56,7 @@ sub my_code {
my $selchan = $img->channel_new($img->width, $img->height, "sharpen_mask",
100.0, [1.0,0,0]);
- $img->add_channel($selchan, -1);
+ $img->insert_channel($selchan, 0, -1);
$edge_layer->edit_copy;
$selchan->edit_paste(1);
$img->get_floating_sel->anchor;
diff --git a/examples/sethspin b/examples/sethspin
index de08d9c..5a865e2 100755
--- a/examples/sethspin
+++ b/examples/sethspin
@@ -90,9 +90,9 @@ sub spin_layer { # the function for actually spinning the layer
# create a new layer for spinning
$framelay = ($i < 3.14159/2.0) ? $spin->copy(1) : $dest->copy(1);
- $img->add_layer($framelay, 0);
+ $img->insert_layer($framelay, 0, 0);
$floater = $framelay->copy(1);
- $img->add_layer($floater, 0);
+ $img->insert_layer($floater, 0, 0);
# spin it a step
$img->selection_all();
@@ -108,12 +108,12 @@ sub spin_layer { # the function for actually spinning the layer
# height must be != 0
$y3++ if ($y1 == $y3);
- $floater = Gimp->gimp_drawable_transform_perspective_default($floater,
+ $floater = $floater->transform_perspective(
$x[1]+saw($i)*$prp*$framelay->width,$y1,
$x[3]-saw($i)*$prp*$framelay->width,$y1,
$x[1]-saw($i)*$prp*$framelay->width,$y3,
$x[3]+saw($i)*$prp*$framelay->width,$y3,
- 0,1);
+ );
$framelay->fill(1); # BG-IMAGE-FILL
# merge the two layers together before we continue
@@ -121,7 +121,7 @@ sub spin_layer { # the function for actually spinning the layer
$framelay = $img->merge_visible_layers(0);
$frameno++;
- $framelay->drawable_set_name("Spin Layer $frameno (50ms)");
+ $framelay->set_name("Spin Layer $frameno (50ms)");
}
}
@@ -201,9 +201,9 @@ register "seth_spin",
$img->set_visible(@all_layers);
if ($spinback) {
- $all_layers[$frames/2-1]->drawable_set_name(__"Spin Layer DEST (250ms)");
+ $all_layers[$frames/2-1]->set_name(__"Spin Layer DEST (250ms)");
}
- $all_layers[$frames-1]->drawable_set_name(__"Spin Layer SRC (250ms)");
+ $all_layers[$frames-1]->set_name(__"Spin Layer SRC (250ms)");
# indexed conversion wants a display for some reason
if ($indexed) {
diff --git a/examples/stampify b/examples/stampify
index a6bf743..8a3011f 100755
--- a/examples/stampify
+++ b/examples/stampify
@@ -29,7 +29,7 @@ register "stampify",
$nh = int(gimp_image_height($img) + 2 * $marg + $diameter);
my $img2 = gimp_image_new($nw, $nh, RGB);
my $layer1 = gimp_layer_new($img2, $nw, $nh, RGBA_IMAGE, "Layer 1", 100, NORMAL_MODE);
- gimp_image_add_layer($img2, $layer1, 0);
+ gimp_image_insert_layer($img2, $layer1, 0, 0);
gimp_image_set_active_layer($img2, $layer1);
gimp_context_set_background($paper);
gimp_drawable_fill($layer1, 1);
@@ -38,19 +38,19 @@ register "stampify",
my $nholes = int (($nw + $gap) / ($diameter + $gap) + 0.5);
$pos = 0;
for ($i = 0; $i<$nholes; $i++) {
- gimp_ellipse_select($img2,
- $pos, 0,
+ gimp_image_select_ellipse($img2,
+ CHANNEL_OP_ADD, $pos, 0,
$diameter, $diameter,
- CHANNEL_OP_ADD, 1, 0, 0);
+ );
$pos = $pos + $diameter + $gap;
}
# create vertical holes
$pos = 0;
for ($i = 0; $i<$nholes; $i++) {
- gimp_ellipse_select($img2,
- 0, $pos,
+ gimp_image_select_ellipse($img2,
+ CHANNEL_OP_ADD, 0, $pos,
$diameter, $diameter,
- CHANNEL_OP_ADD, 1, 0, 0);
+ );
$pos = $pos + $diameter + $gap;
}
gimp_context_set_background($hole);
diff --git a/examples/stamps b/examples/stamps
index 34a853e..99f3649 100755
--- a/examples/stamps
+++ b/examples/stamps
@@ -14,7 +14,7 @@ sub stamps {
gimp_context_set_background($paper);
$img = gimp_image_new($size, $size, RGB);
$layer = gimp_layer_new($img, $size, $size, RGB_IMAGE, "Layer 1", 100, NORMAL_MODE);
- gimp_image_add_layer($layer, -1);
+ gimp_image_insert_layer($layer, 0, -1);
gimp_context_set_background($hole);
$layer->gimp_edit_fill(BACKGROUND_FILL);
gimp_selection_none($img);
@@ -22,14 +22,14 @@ sub stamps {
my $ncircles = int(($size + $gap) / ($diameter + $gap));
$x = 0;
for ($i=0; $i<$ncircles; $i++) {
- gimp_ellipse_select($img,
- $x, 0,
+ gimp_image_select_ellipse($img,
+ CHANNEL_OP_ADD, $x, 0,
$diameter, $diameter,
- CHANNEL_OP_ADD, 1, 0, 0);
- gimp_ellipse_select($img,
- 0, $x,
+ );
+ gimp_image_select_ellipse($img,
+ CHANNEL_OP_ADD, 0, $x,
$diameter, $diameter,
- CHANNEL_OP_ADD, 1, 0, 0);
+ );
$x = $x + $diameter + $gap;
}
gimp_context_set_background($paper);
diff --git a/examples/testall b/examples/testall
index a5ba6e0..c388ab5 100755
--- a/examples/testall
+++ b/examples/testall
@@ -116,14 +116,14 @@ foreach $test (@testbench)
if ($test->[2] & $REQ_ALPHA)
{
$drw->add_alpha;
- Gimp::gimp_rect_select($img, 0.1*$height,0.1*$width,0.8*$height,0.8*$width,CHANNEL_OP_REPLACE,0,0);
+ $img->select_rectangle(CHANNEL_OP_REPLACE,0.1*$height,0.1*$width,0.8*$height,0.8*$width);
Gimp::gimp_selection_invert($img);
Gimp::gimp_edit_cut($drw);
Gimp::gimp_selection_none($img);
}
if ($test->[2] & $REQ_SEL)
{
- Gimp::gimp_rect_select($img, 0.2*$height,0.2*$width,0.6*$height,0.6*$width,CHANNEL_OP_REPLACE,0,0);
+ $img->select_rectangle(CHANNEL_OP_REPLACE,0.2*$height,0.2*$width,0.6*$height,0.6*$width);
}
if ($test->[2] & $REQ_GUIDE)
{
diff --git a/examples/translogo b/examples/translogo
index 9eb7a8c..cc15c81 100755
--- a/examples/translogo
+++ b/examples/translogo
@@ -26,10 +26,10 @@ sub my_code {
my $layer;
$layer=$img->layer_new($drawable->width,$drawable->height,$image->layertype(1), __"Text", 100,
NORMAL_MODE);
$layer->drawable_fill(TRANSPARENT_FILL);
- $img->add_layer($layer,0);
+ $img->insert_layer($layer,0,0);
$layer->edit_paste(0)->floating_sel_anchor;
$img->resize($drawable->width,$drawable->height, 0, 0);
- gimp_selection_layer_alpha ($layer);
+ gimp_image_select_item($img, CHANNEL_OP_REPLACE, $layer);
gimp_selection_invert ($img);
Context->set_background ([255, 255, 255]);
gimp_edit_fill ($layer, BACKGROUND_FILL);
@@ -39,10 +39,10 @@ sub my_code {
my $bump_lay;
$bump_lay = $img->layer_new($img->width,$img->height, RGBA_IMAGE, __"Bumpmap", 100, NORMAL_MODE);
$bump_lay->drawable_fill(BACKGROUND_FILL);
- $img->add_layer($bump_lay,0);
+ $img->insert_layer($bump_lay,0,0);
if ($rad_tog == 1) {
Context->set_pattern ($pattern);
- gimp_bucket_fill ($bump_lay, PATTERN_BUCKET_FILL, NORMAL_MODE, 100, 0, 0, 0, 0);
+ gimp_edit_bucket_fill ($bump_lay, PATTERN_BUCKET_FILL, NORMAL_MODE, 100, 0, 0, 0, 0);
} else {
Context->set_background ($txt_col);
gimp_edit_fill ($bump_lay, BACKGROUND_FILL);
@@ -61,7 +61,7 @@ sub my_code {
gimp_image_convert_indexed ($img, 0, MAKE_PALETTE, 256, 0, 0, "");
my $new = gimp_image_get_active_drawable ($img);
gimp_layer_add_alpha ($new);
- gimp_by_color_select ($new, [255, 255, 255], 55, CHANNEL_OP_ADD, 0, 0, 0.0, 0);
+ gimp_image_select_color ($img, CHANNEL_OP_ADD, $new, [255, 255, 255]);
gimp_edit_clear ($new);
gimp_selection_none ($img);
return ($img);
diff --git a/examples/triangle b/examples/triangle
index 2445f1c..d1610e4 100755
--- a/examples/triangle
+++ b/examples/triangle
@@ -29,18 +29,18 @@ register "triangle",
$h = $img->height();
if ($type == 0) {
- @lista= [0, 0, $w, 0, 0, $h, 0, 0];
+ $lista= [0, 0, $w, 0, 0, $h, 0, 0];
};
if ($type == 1) {
- @lista= [0, 0, 0, $h, $w, $h, 0, 0];
+ $lista= [0, 0, 0, $h, $w, $h, 0, 0];
};
if ($type == 2) {
- @lista= [0, 0, $w, 0, $w, $h, 0, 0];
+ $lista= [0, 0, $w, 0, $w, $h, 0, 0];
};
if ($type == 3) {
- @lista= [$w, 0, $w, $h, 0, $h, $w, 0];
+ $lista= [$w, 0, $w, $h, 0, $h, $w, 0];
};
- $img->free_select(8, @lista, $mode, 0, 0, 0);
+ $img->select_polygon($mode, $lista);
};
exit main;
diff --git a/examples/warp-sharp b/examples/warp-sharp
index 727871f..39f4a45 100755
--- a/examples/warp-sharp
+++ b/examples/warp-sharp
@@ -35,9 +35,9 @@ sub warp_sharp {
}
$x_displace_layer->fill(1 + $version);
$y_displace_layer->fill(1 + $version);
- $img->add_layer($edge_layer,-1);
- $img->add_layer($x_displace_layer,-1);
- $img->add_layer($y_displace_layer,-1);
+ $img->insert_layer($edge_layer,0,-1);
+ $img->insert_layer($x_displace_layer,0,-1);
+ $img->insert_layer($y_displace_layer,0,-1);
# added another parameter in edge detect plugin... I'm assuming it was
# previously differential?
@@ -58,7 +58,7 @@ sub warp_sharp {
$old_selection->gimp_selection_load;
$old_selection->remove_channel;
# will cause a crash:
- # $old_selection->gimp_channel_delete;
+ # $old_selection->gimp_item_delete;
}
plug_in_displace($img,$drw, $displace_amount, $displace_amount, 1,1,
diff --git a/examples/webify b/examples/webify
index 2596625..604d751 100755
--- a/examples/webify
+++ b/examples/webify
@@ -35,7 +35,8 @@ register "webify",
if ($alpha) {
$drawable->add_alpha;
- $drawable->by_color_select($bg,$thresh,CHANNEL_OP_REPLACE,1,0,0,0);
+ gimp_context_set_sample_threshold($thresh);
+ $img->select_color(CHANNEL_OP_REPLACE,$drawable,$bg);
$drawable->edit_cut if $img->selection_bounds;
}
Plugin->autocrop($drawable) if $autocrop;
diff --git a/examples/xachlego b/examples/xachlego
index dd3ff9b..568b316 100755
--- a/examples/xachlego
+++ b/examples/xachlego
@@ -68,7 +68,7 @@ register "xach_blocks",
# 2. in a new white layer, render a grid
# at the same resolution as the pixelize, then blur it.
$gridlayer = $img->layer_new($img->width, $img->height, RGBA_IMAGE, "Grid 1", 100, 0);
- $img->add_layer($gridlayer,0);
+ $img->insert_layer($gridlayer,0,0);
$img->selection_all;
gimp_edit_clear($gridlayer);
gimp_context_set_background([255,255,255]);
@@ -93,7 +93,7 @@ register "xach_blocks",
$img->selection_all;
$cleangrid = $img->layer_new($img->width, $img->height,
RGBA_IMAGE, "Grid 2", 100, 0);
- $img->add_layer($cleangrid,0);
+ $img->insert_layer($cleangrid,0,0);
gimp_edit_fill($cleangrid, BACKGROUND_FILL);
$cleangrid->plug_in_grid(1, $blocksize, 0, [0,0,0], 255, 1, $blocksize, 0, [0,0,0], 255, 0, 0, 0,
[0,0,0], 0);
gimp_selection_load($selection);
diff --git a/examples/xachshadow b/examples/xachshadow
index 6c0bdba..f0fa753 100755
--- a/examples/xachshadow
+++ b/examples/xachshadow
@@ -54,13 +54,13 @@ register "xach_shadows",
# Now the fun begins :)
$drawable->plug_in_pixelize($blocksize);
$shadowlayer = $drawable->layer_copy(0);
- $img->add_layer($shadowlayer,0);
+ $img->insert_layer($shadowlayer,0,0);
$checkmask = $shadowlayer->create_mask(ADD_WHITE_MASK);
$shadowlayer->add_mask($checkmask);
plug_in_checkerboard ($img, $checkmask, 0, $blocksize);
$frontlayer = $shadowlayer->layer_copy(0);
- $img->add_layer($frontlayer,0);
+ $img->insert_layer($frontlayer,0,0);
Context->set_background([0,0,0]);
$shadowlayer->fill(BACKGROUND_FILL);
$checkmask->plug_in_gauss_iir(0.3*$blocksize, 1, 1);
@@ -68,7 +68,7 @@ register "xach_shadows",
$gridlayer = $img->layer_new($img->width, $img->height, RGBA_IMAGE, "Grid 1", 100, 0);
- $img->add_layer($gridlayer,0);
+ $img->insert_layer($gridlayer,0,0);
$img->selection_all;
gimp_edit_clear($gridlayer);
Context->set_background([255,255,255]);
diff --git a/examples/xachvision b/examples/xachvision
index c68a493..aff53b0 100755
--- a/examples/xachvision
+++ b/examples/xachvision
@@ -25,10 +25,10 @@ register "xachvision",
Context->push();
$midlayer = $drawable->gimp_layer_copy(1);
- $img->add_layer($midlayer, 0);
+ $img->insert_layer($midlayer, 0, 0);
$toplayer = $drawable->gimp_layer_copy(1);
- $img->add_layer($toplayer, 0);
+ $img->insert_layer($toplayer, 0, 0);
Context->set_background($color);
$toplayer->edit_fill(BACKGROUND_FILL);
diff --git a/examples/yinyang b/examples/yinyang
index ee70499..99f009e 100755
--- a/examples/yinyang
+++ b/examples/yinyang
@@ -27,7 +27,7 @@ sub yinyang {
# Create new image
my $img = gimp_image_new($width,$height,0);
my $layer = gimp_layer_new($img,$width,$height,1,"Yin/Yang",100,0);
- gimp_image_add_layer($img,$layer,0);
+ gimp_image_insert_layer($img,$layer,0,0);
gimp_image_set_active_layer($img,$layer);
my $draw = gimp_image_get_active_drawable($img);
gimp_context_push();
@@ -38,16 +38,17 @@ sub yinyang {
# Create the yin-yang shape
#gimp_selection_invert($img);
gimp_selection_none($img);
- gimp_rect_select($img,0,0,$width/2,$height,0,0,0);
- gimp_ellipse_select($img,$width/2-$width/4,0,$width/2,
- int($height/2),0,$aa,0,0);
- gimp_ellipse_select($img,$width/2-$width/4,$height/2,
- $width/2, $height/2, 1, $aa, 0, 0);
+ gimp_image_select_rectangle($img,0,0,0,$width/2,$height);
+ gimp_context_set_antialias($aa);
+ gimp_image_select_ellipse($img,0,$width/2-$width/4,0,$width/2,
+ int($height/2));
+ gimp_image_select_ellipse($img,0,$width/2-$width/4,$height/2,
+ $width/2, $height/2);
gimp_context_set_foreground([255,255,255]);
gimp_edit_bucket_fill($draw,0,0,100,0,0,0,0);
# Cut away all but the central circle
- gimp_ellipse_select($img,0,0,$width,$height,2,$aa,0,0);
+ gimp_image_select_ellipse($img,2,0,0,$width,$height);
gimp_selection_invert($img);
gimp_edit_clear($draw);
@@ -88,7 +89,7 @@ sub insert_eye {
my $draw = shift;
my $aa = shift;
- gimp_ellipse_select($img,$x,$y,$width,$height,2,$aa,0,0);
+ gimp_image_select_ellipse($img,2,$x,$y,$width,$height);
gimp_context_set_foreground($color);
if ($do_image) {
my $eye = gimp_file_load($file,$file);
diff --git a/utils/find-deprecated-procs.pl b/utils/find-deprecated-procs.pl
new file mode 100755
index 0000000..22f6203
--- /dev/null
+++ b/utils/find-deprecated-procs.pl
@@ -0,0 +1,66 @@
+#!/usr/local/bin/perl -w
+
+# usage: $0 <deprecated-file> <pluginfile...>
+# typically: ./utils/list-pdb-deprecations.pl <dumpfile> | $0 - examples/*
+
+use strict;
+use IO::All;
+
+my $proc2replace = read_dep(io(shift @ARGV)->all);
+$proc2replace = convert_gp($proc2replace);
+#use Data::Dumper; print Dumper($proc2replace);
+
+for my $plugin (@ARGV) {
+ my $text = io($plugin)->all;
+ map {
+ print "$plugin: found '$_', try '$proc2replace->{$_}' instead\n";
+ } grep { $text =~ /[^a-z_'"\$\/]$_[^a-z_'"]/ } keys %$proc2replace;
+}
+
+sub convert_gp {
+ my $hash = shift;
+ my %new;
+ while (my ($k, $v) = each %$hash) {
+ map { s#-#_#g } $k, $v; $new{$k} = $v;
+ map { s#gimp_## } $k, $v; $new{$k} = $v unless $k eq $v or $k !~ /_/;
+ map { s#script_fu_## } $k, $v; $new{$k} = $v unless $k eq $v or $k !~ /_/;
+ map { s#plugin_## } $k, $v; $new{$k} = $v unless $k eq $v or $k !~ /_/;
+ map { s#image_## } $k, $v; $new{$k} = $v unless $k eq $v or $k !~ /_/;
+ }
+ \%new;
+}
+
+sub read_dep {
+ my $text = shift;
+ my (
+ $noexist,
+ $noreplacement,
+ @replacements
+ ) = split /\n{2,}/, $text;
+ +{
+ map { %$_ } (
+ parsenoreplace($noreplacement),
+ map { parseblock($_) } @replacements
+ )
+ };
+}
+
+sub parsenoreplace {
+ my ($head, @others) = split /\n/, shift;
+ my %proc2replace;
+ map {
+ $proc2replace{$1} = 'NONE' if /(\S+)/;
+ } @others;
+ \%proc2replace;
+}
+
+sub parseblock {
+ my ($head, @others) = split /\n/, shift;
+ my $add = '';
+ $add = " ($1)" if $head =~ /where the replacement has ([^:]+)/;
+ my %proc2replace;
+ map {
+ $proc2replace{$1} = $2.$add if /"(.*?)", "(.*?)"/;
+ } @others;
+ \%proc2replace;
+}
diff --git a/utils/list-pdb-deprecations.pl b/utils/list-pdb-deprecations.pl
new file mode 100755
index 0000000..18c85f1
--- /dev/null
+++ b/utils/list-pdb-deprecations.pl
@@ -0,0 +1,264 @@
+#!/usr/bin/perl -w
+
+# made by Kevin Cozens, current version:
+# http://www.ve3syb.ca/software/gimp/list-pdb-deprecations.pl
+
+#This script reads in output generated by executing gimp-procedural-db-dump
+#in GIMP and outputs a summary with a list of replacement procedures where
+#the replacement does not exist, a list of obsolete procedures (ones with no
+#replacement), and the names of deprecated procedures (both with and without
+#changes in the number of expected arguments).
+#
+# Usage:
+# ./list-pdb-deprecations.pl < pdb.dump
+#
+#Kevin Cozens
+#April 10, 2006
+#
+#Updated October 23, 2006 Kevin Cozens
+#Changed output_procedure_name to split on " character. This fixes the
+#parsing of the PDB dump created by a patched version 2.2 of GIMP.
+#
+#Updated December 10, 2010 Kevin Cozens
+#Changed string used to detect if a procedure has been deprecated.
+#
+#Updated February 8, 2011 Kevin Cozens
+#All deprecation messages are now recognized by output_new_procedure_name.
+#
+#Updated February 13, 2011 Kevin Cozens
+#Added checks to make sure the replacements for deprecated functions exist.
+#
+#Updated March 1, 2011 Kevin Cozens
+#Enhanced the report generated by this script. The deprecated procedures
+#reported in one of four categories as mentioned in the description at
+#the top of this file.
+
+$show_arg_counts = 0;
+
+if (@ARGV)
+{
+ if ($ARGV[0] eq "-h" || $ARGV[0] eq "--help")
+ {
+ print "Usage: $0 [-c|-h|--help]\n";
+ print " -h, --help Show this usage information\n";
+ print " -c Show procedure argument counts in output\n";
+ print "\n";
+ exit;
+ }
+
+ if ($ARGV[0] eq "-c")
+ {
+ $show_arg_counts = 1;
+ shift(@ARGV);
+ }
+}
+
+$obsolete = ();
+
+while (<>)
+{
+ #We can't do anything until we locate the start of a register block
+ if ($_ =~ /^.register-procedure/)
+ {
+ #Extract and save a procedure name and its argument count
+ $old_procedure_name = &get_old_procedure_name($_);
+
+ &check_if_procedure_is_deprecated($old_procedure_name);
+ &find_procedure_input_arguments;
+ $procedures{$old_procedure_name} = &get_argument_count;
+ }
+}
+
+
+#Now that we have a list of all known PDB procedures and their argument counts
+#in addition to a list of deprecated procedures and their replacements, output
+#a summary of the information.
+
+#Print a list of any replacement procedure that has not been defined in PDB
+print "The following is a list of replacement procedures that do not exist:\n";
+foreach $new_procedure_name (sort(values(%deprecated)))
+{
+ if (!exists($procedures{$new_procedure_name}))
+ {
+ print " $new_procedure_name\n";
+ }
+}
+print "\n";
+
+#List deprecated functions that have no replacement
+print "The following deprecated functions have no replacement:\n";
+foreach $old_procedure_name (@obsolete)
+{
+ print " $old_procedure_name\n";
+}
+print "\n";
+
+#List functions where the number of arguments didn't change between old and new
+print "Deprecated procedures with a one-to-one replacement:\n";
+foreach $old_procedure_name (sort(keys(%deprecated)))
+{
+ $new_procedure_name = $deprecated{$old_procedure_name};
+
+ if (exists($procedures{$new_procedure_name}) &&
+ $procedures{$old_procedure_name} == $procedures{$new_procedure_name})
+ {
+ print " \"$old_procedure_name\", \"$new_procedure_name\"\n";
+ }
+}
+print "\n";
+
+#List functions where the number of arguments has changed between old and new
+print "Deprecated procedures where the replacement has more arguments:\n";
+foreach $old_procedure_name (sort(keys(%deprecated)))
+{
+ $new_procedure_name = $deprecated{$old_procedure_name};
+
+ if (exists($procedures{$new_procedure_name}) &&
+ $procedures{$new_procedure_name} > $procedures{$old_procedure_name})
+ {
+ if ($show_arg_counts == 0)
+ { print " \"$old_procedure_name\", \"$new_procedure_name\"\n"; }
+ else
+ { print " \"$old_procedure_name\" (", $procedures{$old_procedure_name}, "),
\"$new_procedure_name\" (", $procedures{$new_procedure_name}, ")\n"; }
+ }
+}
+print "\n";
+
+#List functions where the number of arguments has changed between old and new
+print "Deprecated procedures where the replacement has fewer arguments\nand is not one of the item API
procedures:\n";
+foreach $old_procedure_name (sort(keys(%deprecated)))
+{
+ $new_procedure_name = $deprecated{$old_procedure_name};
+
+ if (exists($procedures{$new_procedure_name}) &&
+ $procedures{$new_procedure_name} < $procedures{$old_procedure_name} &&
+ $new_procedure_name !~ /-item/)
+ {
+ if ($show_arg_counts == 0)
+ { print " \"$old_procedure_name\", \"$new_procedure_name\"\n"; }
+ else
+ { print " \"$old_procedure_name\" (", $procedures{$old_procedure_name}, "),
\"$new_procedure_name\" (", $procedures{$new_procedure_name}, ")\n"; }
+ }
+}
+print "\n";
+
+#List functions where the number of arguments has changed between old and new
+print "Deprecated procedures where the replacement has fewer arguments\nand is one of the item API
procedures:\n";
+foreach $old_procedure_name (sort(keys(%deprecated)))
+{
+ $new_procedure_name = $deprecated{$old_procedure_name};
+
+ if (exists($procedures{$new_procedure_name}) &&
+ $procedures{$new_procedure_name} < $procedures{$old_procedure_name} &&
+ $new_procedure_name =~ /-item/)
+ {
+ if ($show_arg_counts == 0)
+ { print " \"$old_procedure_name\", \"$new_procedure_name\"\n"; }
+ else
+ { print " \"$old_procedure_name\" (", $procedures{$old_procedure_name}, "),
\"$new_procedure_name\" (", $procedures{$new_procedure_name}, ")\n"; }
+ }
+}
+exit;
+
+
+sub get_old_procedure_name
+{
+ local (@words);
+
+ @words = split(/\"/, "@_");
+ $words[1] =~ s/_/-/g;
+ $words[1] =~ s/ [<]1[>]//;
+ return $words[1];
+}
+
+
+#This function handles four main types of deprecated messages:
+# "Deprecated: There is no replacement for this procedure."
+# "Deprecated: Use 'xxx' instead."
+# "This procedure is deprecated! Use 'xxx' instead."
+# "This procedure is deprecated! use 'xxx' instead."
+#There is no replacement function if line doesn't contain "use".
+sub check_if_procedure_is_deprecated
+{
+ local ($old_procedure_name) = @_;
+ local ($line, @words);
+
+ $line = <>;
+
+ #Is this procedure deprecated?
+ if ($line !~ /[Dd]eprecated/)
+ {
+ return 0; #No, it isn't
+ }
+
+ #Default to there being no replacement procedure
+ $new_procedure_name = "";
+
+ $line =~ s/^\s+//;
+ @words = split(/ /, $line);
+
+ #If no "use" word, there is no replacement procedure
+ if ($line =~ /[Uu]se /)
+ {
+ if ($line =~ /Deprecated:/)
+ {
+ $words[2] =~ s/\'//g;
+ $words[2] =~ s/_/-/g;
+ $new_procedure_name = $words[2];
+ }
+ else #Assume line has "deprecated!"
+ {
+ $words[5] =~ s/\'//g;
+ $words[5] =~ s/_/-/g;
+ $new_procedure_name = $words[5];
+ }
+ }
+
+ if ($new_procedure_name eq "")
+ {
+ push (@obsolete, $old_procedure_name);
+ }
+ else
+ {
+ $deprecated{$old_procedure_name} = $new_procedure_name;
+ }
+ return 1; #This procedure is deprecated
+}
+
+
+#Search for the start of the procedures input argument list
+sub find_procedure_input_arguments
+{
+ while (<> !~ /^ \(/)
+ {
+ }
+}
+
+
+#The first line read in this function will either be the opening parenthesis
+#to mark the start of data for an argument or a close parenthesis to mark
+#the end of the argument list (if there are no arguments for the procedure).
+sub get_argument_count
+{
+ local ($arg_count, $line);
+
+ $arg_count = 0;
+
+ do
+ {
+ $line = <>; #Expecting ( to mark start of an argument
+ if ($line =~ /^ \)/) #End of argument list?
+ {
+ return $arg_count;
+ }
+
+ ++$arg_count;
+
+ #Search for end of argument data
+ do {
+ $line = <>;
+ } while ($line !~ /^ \)/);
+ } while ($line !~ /^ \)/);
+
+ return $arg_count;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]