Gary Mart (GAM22) admin0 wrote:
>
> On Thu, 2 Jul 1998, Paul Reavis wrote:
>
> > Reinhard Simon wrote:
> > >
> > > I want to print a Canvas with a picture (gif) directly from a frame.
> <--snip
> >
> > Now, we take snapshots, dump them as PNG images (better JDK native
> > support through zlib than gif), spit out some HTML that references them,
> <--snip-->
>
> Cold you spare a few more details on how you are producing PNG images?
> PNG image export is high on Sun's bug list and I have tried the 3rd
> party Gif encoders but they were VERY SLOW (I though my program had
> crashed).
GIF encoding is VERY SLOW; we wrote our own and it was pretty stinky.
(My coworker, Brad Gray, actually did all this; I don't like to get my
hands dirty with bits these days :-)).
The problem seems to be that GIF encoding hits Java where it's slowest.
Without native support it's hard to get it very fast. Not to mention the
illegalities :-)
So we dumped it and switched to PNG, since Netscape 4.05 supported it
(we just bundle Netscape with our product now that it's free; this keeps
us from worrying about formatting for different weird browsers).
PNG is much better suited to awt-style images; the color model is very
similar (4 byte RGBA is one option), you don't have to reduce the colors
to 256 (yuck!), etc. But the real bonus is that it uses zlib
compression, which is provided (presumably with native implementation)
in java.util.zip or whatever. Compressing those babies is very very fast
(as in ~5 mins for GIF, ~5 seconds for PNG compression) and we are real
happy with Brad's encoder.
I think there are some free PNG compressors out there for Java; if not
writing your own is not too hard (assuming some experience with binary
formats). The hardest part of these things is the compression, and all
that's handled for you - you basically just have to name the chunks
right, put things in the right order and feed the compression method.
Our encoder isn't on my pile of things to clean up and LGPL, I'm afraid,
so I can't give it to you :-< But really, finding one or even writing
one shouldn't be too hard. One thing that made it easy for us (and
therefore not as suitable for public release) is that we only
implemented what we absolutely had to - no special features or anything,
just a quick image dump.
--
Paul Reavis [EMAIL PROTECTED]
Design Lead
Partner Software, Inc. http://www.partnersoft.com