Re: Event loop



On 13 Nov, Havoc Pennington wrote:

Nils Rennebarth <nils ipe uni-stuttgart de> writes:
In my application I have to save a 1MB image to a file using .png which
takes a lot of time on that oldish P166. What would you suggest to use
for saving the image "in the background"?


libpng may support progressive saving. If it does, an idle handler is
easy to support; just feed some fixed small chunk of data into the
saver on every idle.

Looking at the manual page for libpng(3), it seems you don't have to write
the whole picture at once, you can write a couple of rows at a time. So you
can stick it in an idle or timeout functions. 

BTW, don't try to read the png header file, it's horrible, especially the
macro declaration of functions. :-(

If it doesn't, you are pretty much forced to use
a thread or process unless you write your own PNG encoder. I'll stay
out of the "threads vs. processes" debate. ;-)

Right on. Let everybody use what suits themselves and don't flame others
for doing otherwise. :-) Although I wonder if the issue isn't becoming moot
with the ever increasing speed and memory available.

Roland
-- 
Roland Smith                        "When life hands you a lemon,
r s m i t h @ x s 4 a l l . n l      make lemonade."
http://www.xs4all.nl/~rsmith/





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]