How to draw transparency text
I want to draw my text as an animation from total transparency to normal look text. I tried like that:
al_draw_text(font, al_map_rgba(255, 255, 255, txtTrans), 20, 20, 0, title.c_str());
and I changing txtTrans by some time, but it doesn't work. And I wrote just 0 to make sure.
Someone know how I can get this effect? Maybe through bitmap font? But this way, I think is not optimal, isn't it?
It depends on the blender in use. The default blender is the pre-multiplied alpha blender, which expects pre-multiplied alpha values to be passed to it, for example 100%translucent would be al_map_rgba(0,0,0,0) - because you need to multiply the color values by the alpha values. Ie - al_map_rgba((r*a)/255 , (g*a)/255 , (b*a)/255 , a)
It works, thank you!
By the way I ask for this about bitmap. Does exist any method to draw bitmap like that?
I can tint it, but coloring bitmap is not good idea. This is good way to get a shadow for example, if I tint with color al_map_rgba(0, 0, 0, a). Differently is with strings. They must be tinted.
Thread #615564. Printed from Allegro.cc
You're right again, thanks