|
|
| Transparency in bitmaps of Allegro 5 |
|
Lucas Adami
Member #8,528
April 2007
|
Hello. I'm unsing Allegro 5 here and I didn't find any function that makes my bitmap transparent. On the old Allegro, the functions for this were: - set_trans_blender - draw_trans_sprite Could anyone help and tell me what I have to do in the new Allegro? |
|
Matthew Leverton
Supreme Loser
January 1999
|
It works with the alpha channel. Something like: al_set_blender(ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, al_map_rgb(255,255,255)); al_draw_bitmap(bmp, 0,0);
|
|
OnlineCop
Member #7,919
October 2006
|
From here, the first thing that caught my eye was al_convert_mask_to_alpha
|
|
Lucas Adami
Member #8,528
April 2007
|
Thanks Matthew. That was what I needed! |
|
Trent Gamblin
Member #261
April 2000
|
You can do this too, to give any bitmap a degree of translucency: // load bitmap int alpha = 128; // half translucent al_set_blender(ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, al_map_rgba(255, 255, 255, alpha)); al_draw_bitmap(bmp, 0, 0, 0);
|
|
|