Strange problem with transparent png's.
netcat

Attached are two screenshots from two apps, one using allegro and the loadpng library and the other using the FOX GUI toolkit, and also the tileset itself (from RPG Maker XP) so you can see how it is supposed to look. I suspect it might be the semi transparent shadows from the trees and such that causes it, because other images with just transparent backgrounds work fine (and images similar to the attached are broken).

Anyone know what's wrong? Is my libpng broken? :-/

kazzmir

Whats the problem? The gigantic black box on the right side in the Allegro application? Other than that the gui and allegro look the same to me.

netcat

You'll see the problem if you look at the third attachment; the loaded image is all screwed up.

gnolam

... all screwed up how? The third attachment looks fine to me.

netcat

The third attachment is how it's supposed to look... "the loaded image" = the image as it shows up in the applications.

kazzmir

Oh, the fox gui and allegro show the sprite the same so I thought there were no problems.

Are you doing anything special to show the sprite in allegro? or is it basically

BITMAP * all = load_sprite( ... );
blit( all, screen, ... );

?

netcat

Simply doing

tileset = load_png( ..., 0)
...
blit(tileset, buffer, ... )

Also, just tested loading in SDL and it works fine there.

CGamesPlay

The PNG is being loaded without an alpha channel, apparently.

I don't know anything about loadpng or FOX GUI though, so I can't help more than that.

[append]

Here's the same image drawn with Allegro's magic pink as the background. Try using it, instead.

You will need to used masked_blit instead of blit.

masked_blit

Paul whoknows

Convert you PNG files to TGA and load it using Allegro.

CGamesPlay

Converting it to TGA isn't necessary. He could keep it as PNG like I suggested in my post, or he could use Allegro's software blending techniques:

[append]

I vote that we call this problem the Invisible Pink Unicorn Syndrome

netcat
CGamesPlay said:

set_alpha_blender

Doh, hadn't noticed that function before. Calling that makes it work perfectly, obviously.

Thanks!

Paul whoknows
Thread #593049. Printed from Allegro.cc