- Online Community Forums » Programming Questions » al_draw_tinted_bitmap() not working as expected

Credits go to Thomas Fjellstrom for helping out!
This thread is locked; no one can reply to it. rss feed Print
al_draw_tinted_bitmap() not working as expected
Member #12,157
July 2010

The allecro manual for 5.0 RC4 says that using the following code will draw a bitmap that has 50% opacity:

al_draw_tinted_bitmap(bitmap, al_map_rgba_f(1, 1, 1, 0.5), x, y, 0);

I went ahead and tried the same thing in my project:


However, it does not draw the bitmap at 50% opacity when alpha=0.5. I also tried alpha = 0, but the bitmap is still drawing with distorted colors.

Here is what it renders when I draw when alpha = 0:

This is what it looks like with no tinting (eg, all multipliers are 1)

Hopefully you can help me out or point me in the right direction :)

Thomas Fjellstrom
Member #476
June 2000

I think this is related to the new default of using pre-multiplied alpha, you can either change the default blender back to how it was (I can't remember what that was atm), or do: al_draw_tinted_bitmap(panelBG,al_map_rgba_f(1*alpha,1*alpha,1*alpha,alpha),x,y,0);

Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" --

Member #12,157
July 2010

Thanks! Worked perfectly. :)

Someone should probably update the manual with that information too ::)

Go to: