Re: [Gimp-developer] Bucket-fill the selection in a python plugin
On 06/09/2010 21:34, Sven Neumann wrote: > > On Mon, 2010-09-06 at 20:59 +0200, Ofnuts wrote: > >> I'm working on my first Gimp plugin in python, and most things work, but >> I can't seem to make a bucket-fill into the selection. >> >> My code currently does: >> >> >> res=pdb.gimp_edit_bucket_fill_full(drawable,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_COMPOSITE,0,0) > > You are using opacity=0. The fill does of course not have any effect > then. > > Are you certain that you actually want to bucket-fill at all? Since you > are using a selection, it seems likely that you actually want to fill > that selection. Then you can use layer.fill() instead. > layer.fill() fills the whole layer. But you got me thinking and I found gimp_edit_fill(drawable,fill_type) that covers it. So the script works now. For the record, it "wraps" a bit map around the selection: http://i26.servimg.com/u/f26/12/46/16/36/wrapbi10.png Besides the obvious double rainbow generation, I intend to use it to generate complex ridges around arbitrary object shapes for bump-mapping. Anyone knows if something like this been done before (in other words, am I reinventing the wheel)? I couldn't find anything like it in the plugin registry. If not, although it works, I'm not too pleased with its performance. would it be ok for me to post the code here so that the gurus can lead me towards better ways to achieve the same result? Many thanks for the help so far -- Ofnuts ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Bucket-fill the selection in a python plugin
On Mon, 2010-09-06 at 20:59 +0200, Ofnuts wrote: > I'm working on my first Gimp plugin in python, and most things work, but > I can't seem to make a bucket-fill into the selection. > > My code currently does: > > > res=pdb.gimp_edit_bucket_fill_full(drawable,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_COMPOSITE,0,0) You are using opacity=0. The fill does of course not have any effect then. Are you certain that you actually want to bucket-fill at all? Since you are using a selection, it seems likely that you actually want to fill that selection. Then you can use layer.fill() instead. Sven ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] Bucket-fill the selection in a python plugin
Hello from the noob... I'm working on my first Gimp plugin in python, and most things work, but I can't seem to make a bucket-fill into the selection. My code currently does: res=pdb.gimp_edit_bucket_fill_full(drawable,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_COMPOSITE,0,0) ... but this returns "None", so I suspect something is not correct in the call. As far as I can tell: - "drawable" is indeed an existing layer of the image. - there is a selection. I have tried various other values to no avail. I've also tried the python-fu console, after creating a selection by hand on a plain new image: >>> print gimp.image_list()[0] >>> img=gimp.image_list()[0] >>> layer=img.active_layer >>> print layer >>> print pdb.gimp_edit_bucket_fill_full(layer,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_COMPOSITE,0,0) None >>> print pdb.gimp_edit_bucket_fill_full(layer,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_V,0,0) None >>> Running Gimp Windows 2.6.10 Any ideas? That must be something fairly obvious for anyone else... Ofnuts PS: I take the opportunity to thank all the contributors to that fine piece of software. ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer