"balachandran c" <[EMAIL PROTECTED]> writes:

>    Q.1)
>    I am writing a plugin which requires comparing one row of pixels with
>    the one following it. Here is what I could think of,
>    iterate over pixel regions (width = image width, height = tile
>    height):
>          iterate over rows in current pixel region:
>                do comparison;
>          cp the last row into buff for cmp with first row of next rgn
>    is that advisable? how should it be done?

Why don't you just iterate over the image row by row? If you set the
plug-in tile cache large enough, libgimp will take care of minimizing
the amount of data that is being sent over the wire. Of course you can
try to optimize this further but it will most probably not be worth it
unless you are working on very large images and are low on memory.

>    Q.2)
>    Could someone please point me to resources for making my plugin
>    multithreaded?

You can do that using gthread (part of GLib) but it is questionable if
it's worth the effort. You would have to synchronize access to libgimp
since libgimp isn't MT-safe.

>    One part of the algorithm involves quantizing the image, and the other
>    involves user input. They are independent steps. Is it advisable to
>    use one thread to launch the quantizing step, while the other waits
>    for user input?

You could run the quanitization as an idle handler in the plug-in's
main loop. You just need to split it into reasonably small chunks.
That will probably be easier than a multi-threaded approach and it
avoids the problems you would get with threads.

Gimp-developer mailing list

Reply via email to