Blit transparent images with Allegro

1.5k Views Asked by At

I'm wondering if there is any possibility to draw png with transparent colors, so I can make something half-transparent. I've read this but I can't get anything to work. I also heard about alpng library but I don't know if it's able to load transparency too. I'm using allegro 4.2.1 with the newest Dev-C++.

1

There are 1 best solutions below

5
On BEST ANSWER

You need to load a 32-bit image, call set_alpha_blender() and then draw_trans_sprite(). See this discussion. TGA is the only format that Allegro 4 supports natively that is sufficient for this task. Otherwise, you'll need to look into a PNG loader add-on.

You may also want to consider switching to Allegro 5 if you are just getting started. It has a much more modern API for this type of thing.