[gimp-perl] Updated example scripts so they no longer use deprecated PDB procedures. NOTE: There might still be



commit 71c9007853d861728c063799081793c704a8bed1
Author: Kevin Cozens <kcozens cvs gnome org>
Date:   Tue Feb 15 01:50:04 2011 -0500

    Updated example scripts so they no longer use deprecated PDB procedures.
    NOTE: There might still be some use of deprecated procedures where the
    procedures are accessed as member functions of object based variables.

 examples/bricks            |    2 +-
 examples/example-oo        |    2 +-
 examples/gallery           |    8 ++++----
 examples/gimp-make-img-map |   27 +++++++++++++--------------
 examples/glowing_steel     |    2 +-
 examples/iland             |    2 +-
 examples/perlotine         |    2 +-
 examples/stampify          |    4 ++--
 examples/tex-to-float      |    2 +-
 9 files changed, 25 insertions(+), 26 deletions(-)
---
diff --git a/examples/bricks b/examples/bricks
index bc03274..e23bcbc 100755
--- a/examples/bricks
+++ b/examples/bricks
@@ -112,7 +112,7 @@ sub do_bricks {
     gimp_selection_all($image);
     if ($bp ne "") 
       {
-      gimp_patterns_set_pattern($bp);
+      gimp_context_set_pattern($bp);
       gimp_edit_bucket_fill($layerb,2,0,100,0,0,1,1); 
       }
     $border->edit_copy();
diff --git a/examples/example-oo b/examples/example-oo
old mode 100644
new mode 100755
index 9223ac1..751da9b
--- a/examples/example-oo
+++ b/examples/example-oo
@@ -26,7 +26,7 @@ sub plug_in_example_oo {
 # like Objtype->function, and it will be translated into 
 # gimp_objtype_function
 
-# instead of gimp_palette_set_background() you can use
+# instead of gimp_context_set_background() you can use
   Palette->set_background([200,200,100]);
 
 # Next, we have 2 examples of using the drawable or image as an object when
diff --git a/examples/gallery b/examples/gallery
index de43202..40b7f93 100755
--- a/examples/gallery
+++ b/examples/gallery
@@ -50,7 +50,7 @@ use Gimp::Util;
 sub printHeader {
 	my ($rf,$gf,$bf,$r,$g,$b, $htmlFile,$gallerytitle)= _;
 	printf $htmlFile "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">";
-   	printf $htmlFile "<body bgcolor='#%x%x%x'>\n",$r,$g,$b;
+        printf $htmlFile "<body bgcolor='#%x%x%x'>\n",$r,$g,$b;
         printf $htmlFile "<center><font face=\"verdana,arial\" size=\"5\" color=\"#%x%x%x\">",$rf,$gf,$bf;
 	printf $htmlFile "$gallerytitle\n";
         printf $htmlFile "<table><tr>\n";
@@ -67,7 +67,7 @@ sub printFooter {
 sub galleryMaker {
    my ($path, $label, $labelcolor, $labelpos, $font, $bright, $contrast, $rotate, $scalefix, $fixed, $gallerytitle, $color, $foregroundcolor, $galleryfile,$columns,$parentURL) = @_;
  
-   $oldforeground=gimp_palette_get_foreground();
+   $oldforeground=gimp_context_get_foreground();
    $path=$path.'/';
    if ($path eq ""){
         Gimp->message(__"All fields were not completed, sorry.");
@@ -116,7 +116,7 @@ sub galleryMaker {
 		   gimp_brightness_contrast($clayer, $bright, $contrast);
 		   if ( $label ne "" ){	
 			   my $newlayer=gimp_layer_new($img, 200, 100, RGB_IMAGE, "newlayer", 100, NORMAL_MODE);
-			   gimp_palette_set_foreground($labelcolor);
+			   gimp_context_set_foreground($labelcolor);
 			   my $txtlayer=gimp_text_fontname($img, -1, 1, 1, $label, 0, 0, 16, 0, $font); 
 			   if ($twidthEval == 0) {	
 			   	$txtwidth=gimp_drawable_width($txtlayer);
@@ -186,7 +186,7 @@ sub galleryMaker {
     printFooter($rf,$gf,$bf,$parentURL, *htmlFile);
     close htmlFile;
     Gimp->message(__"Your gallery ($galleryfile) has been generated through Gallery plug-in with $totalentries entries");
-    gimp_palette_set_foreground($oldforeground);
+    gimp_context_set_foreground($oldforeground);
    # return();
 
 }
diff --git a/examples/gimp-make-img-map b/examples/gimp-make-img-map
index 29a14c9..bd6bfde 100755
--- a/examples/gimp-make-img-map
+++ b/examples/gimp-make-img-map
@@ -254,18 +254,18 @@ sub decoration_drop_shadow {
     $tiled_img->add_layer_mask($tiled_shadow, $tiled_shadow_msk);
     
     # Fill all the layers with some contents
-    gimp_palette_set_background([128,128,128]); 
+    gimp_context_set_background([128,128,128]); 
     $tiled_drw->edit_fill(BACKGROUND_FILL);
     
-    gimp_palette_set_background($bgcolor);
+    gimp_context_set_background($bgcolor);
     $tiled_background->edit_fill(BACKGROUND_FILL);
     if ($bgpattern) {
 	print "Setting pattern\n";
-	gimp_patterns_set_pattern($bgpattern);
+	gimp_context_set_pattern($bgpattern);
 	$tiled_background->bucket_fill(PATTERN_BUCKET_FILL,
 				       NORMAL, 100, 0, FALSE, 0,0);
     }
-    gimp_palette_set_background([0, 0, 0]);  # Shadow color
+    gimp_context_set_background([0, 0, 0]);  # Shadow color
     $tiled_shadow->edit_fill(BACKGROUND_FILL);
     
     # Add all the layers to the image
@@ -277,7 +277,7 @@ sub decoration_drop_shadow {
     my $xpos = 0;
     
     # Set color for drawing in mask
-    gimp_palette_set_background([255, 255, 255]);
+    gimp_context_set_background([255, 255, 255]);
     for $ly_idx (0   $layout-1) {
 	my ($img, $xpos, $ypos) = @{$layout->[$ly_idx]};
 #	($layer) = @{gimp_image_get_layers($img)};
@@ -333,18 +333,18 @@ sub decoration_sunken_windows {
     $tiled_punch_layer->add_layer_mask($tiled_punch_mask);
     
     # Fill all the layers with some contents
-    gimp_palette_set_background([128,128,128]); 
+    gimp_context_set_background([128,128,128]); 
     $tiled_drw->edit_fill(BACKGROUND_FILL);
     
-    gimp_palette_set_background($bgcolor);
+    gimp_context_set_background($bgcolor);
     $tiled_punch_layer->edit_fill(BACKGROUND_FILL);
     if ($bgpattern) {
 	print "Setting pattern\n";
-	gimp_patterns_set_pattern($bgpattern);
+	gimp_context_set_pattern($bgpattern);
 	$tiled_punch_layer->bucket_fill(PATTERN_BUCKET_FILL,
 				NORMAL, 100, 0, FALSE, 0,0);
     }
-    gimp_palette_set_background([255, 255, 255]);  # Punch stencil
+    gimp_context_set_background([255, 255, 255]);  # Punch stencil
     $tiled_punch_stencil->edit_fill(BACKGROUND_FILL);
     
     # Add all the layers to the image
@@ -356,7 +356,7 @@ sub decoration_sunken_windows {
     my $xpos = 0;
     
     # Set color for drawing in mask
-    gimp_palette_set_background([0, 0, 0]);
+    gimp_context_set_background([0, 0, 0]);
     for $ly_idx (0   $layout-1) {
 	my ($img, $xpos, $ypos) = @{$layout->[$ly_idx]};
 	my $layer = Gimp::gimp_image_get_active_layer($img);
@@ -451,10 +451,9 @@ Gimp::on_net sub {
 	    my ($img, $xpos, $ypos) = @{$layout->[$idx]};
 	    my($w,$h) = ($img->width, $img->height);
 	    
-	    printf INDEX "%s %.0f %.0f %.0f %.0f %s\n",
-	        $filenames[$idx], $xpos, $ypos, $xpos+$w, $ypos+$h, $descr;
-	    printf "%s %.0f %.0f %.0f %.0f %s\n",
-	        $filenames[$idx], $xpos, $ypos, $xpos+$w, $ypos+$h, $descr;
+           printf INDEX "%s %.0f %.0f %.0f %.0f %s\n",
+                $filenames[$idx], $xpos, $ypos, $xpos+$w, $ypos+$h, $descr;
+           printf "%s %.0f %.0f %.0f %.0f %s\n",
 	}
 	close(INDEX);
     }
diff --git a/examples/glowing_steel b/examples/glowing_steel
index 91644d1..a7593ea 100755
--- a/examples/glowing_steel
+++ b/examples/glowing_steel
@@ -65,7 +65,7 @@ sub perl_fu_glowing_steel {
   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_preserve_trans($textlayer,1); }
+    { gimp_layer_set_lock_alpha($textlayer,1); }
 
   perl_fu_brushed_metal($image, $textlayer, 25, 135);
 
diff --git a/examples/iland b/examples/iland
index c481c27..472aecd 100755
--- a/examples/iland
+++ b/examples/iland
@@ -21,7 +21,7 @@ sub landscape {
 	my ($image, $drawable, $floor,$component, $delta,$elevation, $camerapos) = @_;
 	
 	#gimp_tile_cache_size(20000);
-	gimp_selection_clear($image);
+	gimp_selection_none($image);
 	plug_in_rotate(RUN_NONINTERACTIVE, $image, -1, $camerapos, 1) if ($camerapos != 0);
 	$width=gimp_image_width($image);
 	$height=gimp_image_height($image);
diff --git a/examples/perlotine b/examples/perlotine
index 0040a0a..251109f 100755
--- a/examples/perlotine
+++ b/examples/perlotine
@@ -47,7 +47,7 @@ sub get_vguides {
     my @vguides;
     while ($i=$img->find_next_guide($i)) {
         if ($img->get_guide_orientation($i) == &Gimp::ORIENTATION_VERTICAL){
-            $keyval = sprintf("%4d", $img->get_guide_position($i));
+	    $keyval = sprintf("%4d", $img->get_guide_position($i));
             $vkeys{$keyval} = $i;
             }
         }
diff --git a/examples/redeye b/examples/redeye
old mode 100644
new mode 100755
diff --git a/examples/stampify b/examples/stampify
index 5edb08d..8f40a06 100755
--- a/examples/stampify
+++ b/examples/stampify
@@ -31,7 +31,7 @@ register	"stampify",
 		my $layer1 = gimp_layer_new($img2, $nw, $nh, RGBA_IMAGE, "Layer 1", 100, NORMAL_MODE);
 		gimp_image_add_layer($img2, $layer1, 0);
 		gimp_image_set_active_layer($img2, $layer1);
-		gimp_palette_set_background($paper);
+		gimp_context_set_background($paper);
 		gimp_drawable_fill($layer1, 1);
 # create horisontal holes
 		gimp_selection_none($img2);
@@ -54,7 +54,7 @@ register	"stampify",
 				CHANNEL_OP_ADD, 1, 0, 0);
 			$pos = $pos + $diameter + $gap;
 		}
-		gimp_palette_set_background($hole);
+		gimp_context_set_background($hole);
 		gimp_edit_fill($layer1, BACKGROUND_FILL);
 		gimp_selection_none($img2);
 # here comes the clever part! :-)
diff --git a/examples/tex-to-float b/examples/tex-to-float
index 5df8f27..197509d 100755
--- a/examples/tex-to-float
+++ b/examples/tex-to-float
@@ -126,7 +126,7 @@ sub grey_file_to_float {
     if (gimp_version() gt "2.3")  # make work for 2.2 or 2.3
       { gimp_layer_set_lock_alpha($floating_layer, 1); }
     else
-      { gimp_layer_set_preserve_trans($floating_layer,1); }
+      { gimp_layer_set_lock_alpha($floating_layer,1); }
     gimp_edit_fill($floating_layer, BACKGROUND_FILL);
 
     cleanup();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]