Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » What's the blending mode settings for write alpha?

This thread is locked; no one can reply to it. rss feed Print
What's the blending mode settings for write alpha?
roger levy
Member #2,513
July 2002

I want to write RGBA to the target bitmap with no blending. Specifically I want to erase part of my bitmap with al_draw_filled_rectangle.

Edgar Reynaldo
Member #8,592
May 2007
avatar

See al_set_separate_blender

You should be able to use this to overwrite only the alpha portion of the target bitmap :

al_set_separate_blender(ALLEGRO_ADD , ALLEGRO_ZERO , ALLEGRO_ONE ,
                        ALLEGRO_ADD , ALLEGRO_ONE , ALLEGRO_ZERO);

I missed that you want to write the RGB as well. Switch the 2nd and 3rd parameters to overwrite the RGB as well.

roger levy
Member #2,513
July 2002

thanks, this works for erasing part of the bitmap, but, not sure if i'm doing something wrong, it doesn't seem to work when drawing bitmaps, i'd expect it to be the same as turning off alpha transparency, but nothing shows up, except for, strangely, al_draw_text commands.

EDIT: NEVERMIND! i forgot i'm blitting my bitmap over the entire screen. i need to restore normal blending before doing that to see anything, obviously.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: