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

This commit is contained in:
Sven Neumann 2010-09-06 23:58:10 +02:00
parent 378a465caa
commit bab75db54e
6 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)