[gimp] python: port plug-ins to Image.insert_layer()



commit bab75db54e07c2ea866cc3e659d95786d8fc40b3
Author: Sven Neumann <sven gimp org>
Date:   Mon Sep 6 23:58:10 2010 +0200

    python: port plug-ins to Image.insert_layer()

 .../plug-ins/benchmark-foreground-extract.py       |    2 +-
 plug-ins/pygimp/plug-ins/clothify.py               |    4 ++--
 plug-ins/pygimp/plug-ins/foggify.py                |    2 +-
 plug-ins/pygimp/plug-ins/py-slice.py               |    2 +-
 plug-ins/pygimp/plug-ins/shadow_bevel.py           |    2 +-
 plug-ins/pygimp/plug-ins/sphere.py                 |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/pygimp/plug-ins/benchmark-foreground-extract.py b/plug-ins/pygimp/plug-ins/benchmark-foreground-extract.py
index 3c4691b..74ecd51 100755
--- a/plug-ins/pygimp/plug-ins/benchmark-foreground-extract.py
+++ b/plug-ins/pygimp/plug-ins/benchmark-foreground-extract.py
@@ -160,7 +160,7 @@ def misclassified_pixels (mask, truth):
     copy.name = "Difference"
     copy.mode = DIFFERENCE_MODE
 
-    image.add_layer (copy, -1)
+    image.insert_layer (copy)
 
     # The assumption made here is that the output of
     # foreground_extract is a strict black and white mask. The truth
diff --git a/plug-ins/pygimp/plug-ins/clothify.py b/plug-ins/pygimp/plug-ins/clothify.py
index b6e8423..e286450 100755
--- a/plug-ins/pygimp/plug-ins/clothify.py
+++ b/plug-ins/pygimp/plug-ins/clothify.py
@@ -28,7 +28,7 @@ def clothify(timg, tdrawable, bx=9, by=9, azimuth=135, elevation=45, depth=3):
 
     layer_one = gimp.Layer(img, "X Dots", width, height, RGB_IMAGE,
                            100, NORMAL_MODE)
-    img.add_layer(layer_one, 0)
+    img.insert_layer(layer_one)
     pdb.gimp_edit_fill(layer_one, BACKGROUND_FILL)
 
     pdb.plug_in_noisify(img, layer_one, 0, 0.7, 0.7, 0.7, 0.7)
@@ -36,7 +36,7 @@ def clothify(timg, tdrawable, bx=9, by=9, azimuth=135, elevation=45, depth=3):
     layer_two = layer_one.copy()
     layer_two.mode = MULTIPLY_MODE
     layer_two.name = "Y Dots"
-    img.add_layer(layer_two, 0)
+    img.insert_layer(layer_two)
 
     pdb.plug_in_gauss_rle(img, layer_one, bx, 1, 0)
     pdb.plug_in_gauss_rle(img, layer_two, by, 0, 1)
diff --git a/plug-ins/pygimp/plug-ins/foggify.py b/plug-ins/pygimp/plug-ins/foggify.py
index 03f705d..9e691c4 100755
--- a/plug-ins/pygimp/plug-ins/foggify.py
+++ b/plug-ins/pygimp/plug-ins/foggify.py
@@ -33,7 +33,7 @@ def foggify(img, layer, name, colour, turbulence, opacity):
     fog = gimp.Layer(img, name,
                      layer.width, layer.height, type, opacity, NORMAL_MODE)
     fog.fill(TRANSPARENT_FILL)
-    img.add_layer(fog, 0)
+    img.insert_layer(fog)
 
     gimp.set_background(colour)
     pdb.gimp_edit_fill(fog, BACKGROUND_FILL)
diff --git a/plug-ins/pygimp/plug-ins/py-slice.py b/plug-ins/pygimp/plug-ins/py-slice.py
index 2dcd58f..f5b80bd 100755
--- a/plug-ins/pygimp/plug-ins/py-slice.py
+++ b/plug-ins/pygimp/plug-ins/py-slice.py
@@ -165,7 +165,7 @@ def slice(image, drawable, image_path, image_basename, image_extension,
             temp_image = pdb.gimp_image_new (drawable.width, drawable.height,
                                          image.base_type)
             temp_drawable = pdb.gimp_layer_new_from_drawable (drawable, temp_image)
-            temp_image.add_layer (temp_drawable, -1)
+            temp_image.insert_layer (temp_drawable)
 
     temp_image.disable_undo()
     temp_image.crop(right - left, bottom - top, left, top)
diff --git a/plug-ins/pygimp/plug-ins/shadow_bevel.py b/plug-ins/pygimp/plug-ins/shadow_bevel.py
index c57e590..3bd40dd 100755
--- a/plug-ins/pygimp/plug-ins/shadow_bevel.py
+++ b/plug-ins/pygimp/plug-ins/shadow_bevel.py
@@ -26,7 +26,7 @@ def shadow_bevel(img, drawable, blur, bevel, do_shadow, drop_x, drop_y):
 
     # copy the layer
     shadow = drawable.copy(True)
-    img.add_layer(shadow, img.layers.index(drawable)+1)
+    img.insert_layer(shadow, position=img.layers.index(drawable) + 1)
     shadow.name = drawable.name + " shadow"
     shadow.lock_alpha = False
 
diff --git a/plug-ins/pygimp/plug-ins/sphere.py b/plug-ins/pygimp/plug-ins/sphere.py
index 8ac668e..b947fec 100755
--- a/plug-ins/pygimp/plug-ins/sphere.py
+++ b/plug-ins/pygimp/plug-ins/sphere.py
@@ -47,7 +47,7 @@ def sphere(radius, light, shadow, foo, bg_colour, sphere_colour):
     offset = radius * 0.1
 
     img.disable_undo()
-    img.add_layer(drawable, 0)
+    img.insert_layer(drawable)
 
     gimp.set_foreground(sphere_colour)
 



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