Re: [AD] Is there a licensing reason why PNG isn't built-in to Allegro?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Peter Hull wrote:

I know that OpenLayer works on OSX, and that loads pngs. But I think it uses ldpng rather than loadpng, and I have a feeling these are two separate things.

In fact, OSX's NSImage class can load BMP, GIF, JPG, TIFF and PNG so on that platform, a BITMAP <-> NSImage bridge would work well. Likewise GdiPlus::Bitmap for windows folk.

We are using 1.4pre1 version of loadpng taken from here:
http://tjaden.strangesoft.net/loadpng/index.html

I searched for 'ldpng' but did not find anything. If it is really some
other png loader for allegro, a link would be welcome. If the same
loadpng is used in OpenLayer, I wonder how it is possible that they were
not struck by this bug in OSX.

We currently have loadpng included as part of ufo2000 sources and now
it is patched to work on ppc:
http://svn.sourceforge.net/viewcvs.cgi/ufo2000/trunk/src/loadpng/

The attached simple patch (against version 1.4pre1) seems to fix these
weird color problems. It was done after a few trial and error attempts
and is now reported to work on ppc:
http://forums.gentoo.org/viewtopic-t-448933.html

Steps to reproduce the problem (at least we use sprites with alpha
transparency loaded from png files in such a way in ufo2000):
1. set 16bpp mode
2. load 32bpp png with alpha channel
3. blit alpha blended bitmap

As I really don't have ppc hardware, it would be good if somebody could
investigate this issue and the patch in order to get it accepted
upstream if it is really a proper bugfix. So other people developing
crossplatform games will have less troubles in the future.

On 27/03/06, *Siarhei Siamashka* <siarhei.siamashka@xxxxxxxxxx <mailto:siarhei.siamashka@xxxxxxxxxx>> wrote:

    Milan Mimica wrote:

     > Kirk Black wrote:
     >
     >> I'm not very familiar with PNG.  It seems like a good format to
    use but I
     >> notice Allegro doesn't have built-in support but rather one must
    get the
     >> loadpng/libpng/zlib libraries and build them as options.  Are there
     >> licensing or technical reasons why PNG isn't built-in with Allegro?
     >
     >
     > It would add more dependencies.
     > I think we're about pulling all bitmap format stuff out of
    allegro core.

    This is somewhat related. Did anybody successfully use loadpng addon on
    MacOS X? Looks like we are having some strange problems. Alpha channel
    and some other colors appear to be swapped, see screenshot:
    http://www.xcomufo.com/forums/index.php?showtopic=8571&st=47
    <http://www.xcomufo.com/forums/index.php?showtopic=8571&st=47>

    I don't have Mac myself, so it is hard to investigate this problem for
    me. But if it is loadpng problem, having loadpng as a part of allegro
    library would certainly help to improve its portability.




    -------------------------------------------------------
    This SF.Net email is sponsored by xPML, a groundbreaking scripting
    language
    that extends applications into web and mobile media. Attend the live
    webcast
    and join the prime developer group breaking into this new coding
    territory!
    http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
    <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642>
    --
    https://lists.sourceforge.net/lists/listinfo/alleg-developers
Index: loadpng.c
===================================================================
--- loadpng.c	(revision 1000)
+++ loadpng.c	(revision 1011)
@@ -191,6 +191,9 @@
 	unsigned char *pc = (unsigned char *)&c;
 	if (pc[0] == 255)
 	    png_set_bgr(png_ptr);
+#ifdef ALLEGRO_BIG_ENDIAN	    
+	png_set_swap_alpha(png_ptr);
+#endif	    
     }
 
     /* Read the image, one line at a line (easier to debug!) */


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/