[Mono-list] Best way to implement image loaders?

Pokey the Penguin pokey@linuxmail.org
19 Feb 2003 20:39:11 +0000

On Wed, 2003-02-19 at 20:28, J. Perkins wrote:
> Although it is more work, I guess I am leaning toward
> the first solution. Any thoughts?

I wouldn't underestimate the work involved in reimplementing libpng.
Given its massive installed user base (stable API, included in every
Linux distribution, shipped with Mozilla and other popular Win32
programs), P/Invoking it doesn't seem too unattractive a solution to me.

For zlib, you might want to take a look at reusing code from SharpZipLib
(http://www.icsharpcode.net/OpenSource/SharpZipLib/). I think there are
currently discussions about the licensing, so don't just jump in though.

The other possibility is to reuse Gdk's Pixbuf loader, which is
pluggable and can handle not only PNG, but also renders SVG and handles
more obscure file types. It shouldn't depend on xlib or a display
system, so it would be suitable for backend/server applications. The
Pixbuf interface to return a byte array (which you'd probably need) has
been discussed on gtk-sharp-list recently.