Commit bab75db5 authored by Sven Neumann's avatar Sven Neumann

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

parent 378a465c
...@@ -160,7 +160,7 @@ def misclassified_pixels (mask, truth): ...@@ -160,7 +160,7 @@ def misclassified_pixels (mask, truth):
copy.name = "Difference" copy.name = "Difference"
copy.mode = DIFFERENCE_MODE copy.mode = DIFFERENCE_MODE
image.add_layer (copy, -1) image.insert_layer (copy)
# The assumption made here is that the output of # The assumption made here is that the output of
# foreground_extract is a strict black and white mask. The truth # foreground_extract is a strict black and white mask. The truth
......
...@@ -28,7 +28,7 @@ def clothify(timg, tdrawable, bx=9, by=9, azimuth=135, elevation=45, depth=3): ...@@ -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, layer_one = gimp.Layer(img, "X Dots", width, height, RGB_IMAGE,
100, NORMAL_MODE) 100, NORMAL_MODE)
img.add_layer(layer_one, 0) img.insert_layer(layer_one)
pdb.gimp_edit_fill(layer_one, BACKGROUND_FILL) pdb.gimp_edit_fill(layer_one, BACKGROUND_FILL)
pdb.plug_in_noisify(img, layer_one, 0, 0.7, 0.7, 0.7, 0.7) 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): ...@@ -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 = layer_one.copy()
layer_two.mode = MULTIPLY_MODE layer_two.mode = MULTIPLY_MODE
layer_two.name = "Y Dots" 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_one, bx, 1, 0)
pdb.plug_in_gauss_rle(img, layer_two, by, 0, 1) pdb.plug_in_gauss_rle(img, layer_two, by, 0, 1)
......
...@@ -33,7 +33,7 @@ def foggify(img, layer, name, colour, turbulence, opacity): ...@@ -33,7 +33,7 @@ def foggify(img, layer, name, colour, turbulence, opacity):
fog = gimp.Layer(img, name, fog = gimp.Layer(img, name,
layer.width, layer.height, type, opacity, NORMAL_MODE) layer.width, layer.height, type, opacity, NORMAL_MODE)
fog.fill(TRANSPARENT_FILL) fog.fill(TRANSPARENT_FILL)
img.add_layer(fog, 0) img.insert_layer(fog)
gimp.set_background(colour) gimp.set_background(colour)
pdb.gimp_edit_fill(fog, BACKGROUND_FILL) pdb.gimp_edit_fill(fog, BACKGROUND_FILL)
......
...@@ -165,7 +165,7 @@ def slice(image, drawable, image_path, image_basename, image_extension, ...@@ -165,7 +165,7 @@ def slice(image, drawable, image_path, image_basename, image_extension,
temp_image = pdb.gimp_image_new (drawable.width, drawable.height, temp_image = pdb.gimp_image_new (drawable.width, drawable.height,
image.base_type) image.base_type)
temp_drawable = pdb.gimp_layer_new_from_drawable (drawable, temp_image) 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.disable_undo()
temp_image.crop(right - left, bottom - top, left, top) temp_image.crop(right - left, bottom - top, left, top)
......
...@@ -26,7 +26,7 @@ def shadow_bevel(img, drawable, blur, bevel, do_shadow, drop_x, drop_y): ...@@ -26,7 +26,7 @@ def shadow_bevel(img, drawable, blur, bevel, do_shadow, drop_x, drop_y):
# copy the layer # copy the layer
shadow = drawable.copy(True) 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.name = drawable.name + " shadow"
shadow.lock_alpha = False shadow.lock_alpha = False
......
...@@ -47,7 +47,7 @@ def sphere(radius, light, shadow, foo, bg_colour, sphere_colour): ...@@ -47,7 +47,7 @@ def sphere(radius, light, shadow, foo, bg_colour, sphere_colour):
offset = radius * 0.1 offset = radius * 0.1
img.disable_undo() img.disable_undo()
img.add_layer(drawable, 0) img.insert_layer(drawable)
gimp.set_foreground(sphere_colour) gimp.set_foreground(sphere_colour)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment