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
]
On 2006-04-04, Siarhei Siamashka <siarhei.siamashka@xxxxxxxxxx> wrote:
> 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.
'ldpng' is the name used when 'loadpng' won't fit into 8.3 filename
restrictions so I am guessing they are one and the same.
> If the same
> loadpng is used in OpenLayer, I wonder how it is possible that they were
> not struck by this bug in OSX.
I guess few people use Allegro with OSX, and even fewer use Allegro,
OpenLayer, OSX, and PNG images with alpha channels.
> > 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.
We can put loadpng into the Allegro SVN tree so other people can commit
patches to it, or start a new SF project. I have been wanting another
maintainer anyway.
> 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!) */
I have been testing 'recent' loadpng releases against the PngSuite and
as far as I remember all the BGR problems were sorted out on i386.
If someone could test this patch on OSX against the PngSuite then
that would be great. I will probably commit it and make a release
in a couple of weeks anyway, unless I forget, which I will (remind me).
http://www.schaik.com/pngsuite/
Peter