- Online Community Forums » Programming Questions » Allegro5 transparent bitamp .bmp 24 bit

This thread is locked; no one can reply to it. rss feed Print
Allegro5 transparent bitamp .bmp 24 bit
Member #14,487
August 2012

I'm using allegro 5.0.7 and I have one big problem.
I was trying make a bitmap exactly .bmp (24-bit) transparent with specific color, but it didn't work. Can you give me a hint how to do this?

This is my code:

1ALLEGRO_COLOR color=al_get_pixel(picture, 0, 0); 2al_convert_mask_to_alpha(picture,al_map_rgb(color.r, color.g,color.b)); 3al_draw_bitmap(picture,hero_x, hero_y, ALLEGRO_VIDEO_BITMAP);

I was searching in Internet but I didn't find a answer.

Matthew Leverton
Supreme Loser
January 1999

color.r, .g, .b are floats. So it should be:

al_convert_mask_to_alpha(picture, al_map_rgb_f(color.r, color.g, color.b)).

However, you can simply do:

al_convert_mask_to_alpha(picture, color).

Member #11,410
October 2009


Member #14,487
August 2012

Now it's work.
Thank you very much Matthew Leverton.

Go to: