I asked about performance on the gimp mailing list. If all you want to do is call a bunch of pdb calls, then a tiny-fu scheme script will perform as well as a python or compiled C plugin. Where python and C will show improvement is in lower level access to the image, i.e. reading or manipulating the image data directly. So I wouldn't expect much speed improvement on the flatten.
The multifill code is at it simplest a nested loop walking the image, looking for white. When it finds the white, it does a magic wand select then fills it appropriately.
I added a few optimizations, like a select by colour (white) to get the bounds for the next iteration of the loop after finding white. If the bounds haven't changed, continue scanning the X; if it has changed start scanning from the upper left corner of the new bounds.
Another optimization was to keep a channel copy of the selection = the white space. Rreading the xy value in a channel is faster then reading the colour.
Hi Rob, I've started work on translating your Multifill script to a C plugin. The code has finally become intelligible to me, after I read a basic Scheme tutorial. It's all about lists!
Anyway, as a start I managed to convert the simpler Flatten procedure. Result was no discernible speed-up. I didn't really expect to see much speed-up on a while loop that doesn't run many times.
Oh well, now to see if I can translate the more complex Multifill procedure.
Follow this: http://wiki.gimp.org/gimp/HowToCompi...crosoftWindows
which is the easiest way to set up a gimp compile environment, and compile gimp.
This will also give you the gimptool-2.0 application and libs all set up for compiling plugins.
What do I need to be able to compile gimp plugins (written in C) on WinXP? You mentioned MinGW/MSYS. Anything else?
Superb work. Thanks very much. I will put it all together in a zip file with a readme and release it to the GIMP plugin registry, and also announce it in the Mapping Elements forum of this web site.
Here is a zip with the windows compiled plugin as well as the c code modified to register the plugin in the vector menu. You can diff it to see the required changes.
I have compiled it under windows. It would be real nice to get it under the Vectors menu so it shows up as a right click in the path panel.
I'll ask on the gimp developer list, OK?
Here's a preview (linear taper for now):
Need to add a dialog window with taper options.
heh - devil is always in the details
OK thanks. Problem is turning out much more difficult than I first thought.