Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » bitmap transparency

This thread is locked; no one can reply to it. rss feed Print
bitmap transparency
Antone333
Member #15,545
March 2014

I know its possible to make a color completely invisible. I use this already in my game. But I was wondering is there a way to draw a bitmap that is still visible but see through?

Edgar Reynaldo
Member #8,592
May 2007
avatar

#00JMP00
Member #14,740
November 2012

If you want to draw translucent bitmaps onto others, you can use draw_trans. This will exactly do what you want. Other ways may fail :-))

Dizzy Egg
Member #10,824
March 2009
avatar

Yeah, what Edgar said. You can create an image in your 'graphics software' with an alpha channel; then, if you save it as something like .png you can load it in A5 and it will use the alpha channel, 32 bits (24 for the colours RGB and 8 bits for the alpha transparency....probably).

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Antone333
Member #15,545
March 2014

could you point me to draw trans in the manual? i can't find it.

Chris Katko
Member #1,881
January 2002
avatar

Allegro 4 or 5?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Antone333
Member #15,545
March 2014

Allegro 5

Aikei_c
Member #14,871
January 2013
avatar

If you want to draw a bitmap half-transparent only sometimes, instead of editing it to include alpha channel, you could draw it tinted like that:

al_draw_tinted_bitmap(yourBitmap,al_map_rgba_f(0.5,0.5,0.5,0.5),x,y,0);

Go to: