3
# Gimp-Python - allows the writing of Gimp plugins in Python.
4
# Copyright (C) 1997 James Henstridge <james@daa.com.au>
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
def python_foggify(img, layer, name, colour, turbulence, opacity):
24
img.undo_group_start()
26
fog = gimp.Layer(img, name, layer.width, layer.height, RGBA_IMAGE,
29
oldbg = gimp.get_background()
30
gimp.set_background(colour)
31
pdb.gimp_edit_fill(fog, BACKGROUND_FILL)
32
gimp.set_background(oldbg)
34
# create a layer mask for the new layer
35
mask = fog.create_mask(0)
38
# add some clouds to the layer
39
pdb.plug_in_plasma(img, mask, int(time.time()), turbulence)
41
# apply the clouds to the layer
42
fog.remove_mask(MASK_APPLY)
48
"Add a layer of fog to the image",
49
"Add a layer of fog to the image",
53
"<Image>/Python-Fu/Effects/Add _fog",
56
(PF_STRING, "name", "The new layer name", "Clouds"),
57
(PF_COLOUR, "colour", "The colour of the fog", (240,180,70)),
58
(PF_SLIDER, "turbulence", "The turbulence", 1.0, (0, 10, 0.1)),
59
(PF_SLIDER, "opacity", "The opacity", 100, (0, 100, 1)),