Allegro5 transparent bitamp .bmp 24 bit
Iwan91

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:

#SelectExpand
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

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).

jmasterx

Nevermind.

Iwan91

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

Thread #610766. Printed from Allegro.cc