al_draw_tinted_bitmap() not working as expected

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

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


Thanks! Worked perfectly. :)

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

Thread #606236. Printed from