Announcing a PNG loader

Hi all,

I’ve done a PNG loader for SDL. It uses libpng. The advantage of png
over bmp is that it understands alpha chanels.

I tried loading/saving a palette image, a gray image, a 24bpp image
and a 32bpp image with or without alpha values. And it seems to work.

Drop the file below in the test directory and add this line to the
Makefile

SDL_png SDL_png.exe: SDL_png.o

You should also add the -lpng to the compilation (personnaly I run
make and do a copy paste on the gcc -o SDL_png … line.

To test it, generate a png image and name it sample.png.

If you want to include this in SDL, you’ll have to move the file to
the src directory and remove the example code at the end of the
file. Of course you’ll have to include the definition in a header file
too.

Have fun and let me know if there are some problems or if you can
optimize it.

Phil

PS I think the file is small enough and usefull enough to be included
in the main library, but that’s not my call.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_png.c.gz
Type: application/octet-stream
Size: 6679 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/19981102/58f1e5a5/attachment.obj
-------------- next part --------------

Hi all,

I’ve done a PNG loader for SDL. It uses libpng. The advantage of png
over bmp is that it understands alpha chanels.

I tried loading/saving a palette image, a gray image, a 24bpp image
and a 32bpp image with or without alpha values. And it seems to work.

Drop the file below in the test directory and add this line to the
Makefile

SDL_png SDL_png.exe: SDL_png.o

You should also add the -lpng to the compilation (personnaly I run
make and do a copy paste on the gcc -o SDL_png … line.

To test it, generate a png image and name it sample.png.

If you want to include this in SDL, you’ll have to move the file to
the src directory and remove the example code at the end of the
file. Of course you’ll have to include the definition in a header file
too.

Have fun and let me know if there are some problems or if you can
optimize it.

Phil

PS I think the file is small enough and usefull enough to be included
in the main library, but that’s not my call.

Where’s the source code? I don’t use Microsoft Filth, so it’s useless to
me as a Win32 object file. Please post a unified diff against the
original SDL source.On Mon, 2 Nov 1998, Lavoie Philippe wrote:


Scott M. Stone <sstone at pht.com, sstone at pht.co.jp>
Head of TurboLinux Development/Systems Administrator
Pacific HiTech, Inc (USA) / Pacific HiTech, KK (Japan)

Scott Stone writes:

Where’s the source code? I don’t use Microsoft Filth, so it’s useless to
me as a Win32 object file. Please post a unified diff against the
original SDL source.

What do you mean MS filth? I used a mime-encaspulated message of a
.gz file using my trusted old xemacs to do it.

Phil