![]() |
|
best way for drawing tinted text |
William Labbett
Member #4,486
March 2004
![]() |
hi, needing to draw some text transparently I'm wondering whether I should draw it to a temporary bitmap first then set the blender and use al_draw_tinted_bitmap or if there's another better way. please advise...
|
Thomas Fjellstrom
Member #476
June 2000
![]() |
Make sure you use the alpha component of the color you give al_draw_text? -- |
Mark Oates
Member #1,146
March 2001
![]() |
Yes, al_draw_text(); contains a color parameter, so just pass a color with alpha. IMPORTANT: As of the newest versions of A5 (since 5.0.0 RC3), you'll need to also multiply the color components of your tint by the alpha to get correct results. ALLEGRO_FONT *font = get_font("UnionBold.ttf", -30); float alpha = 0.5f; ALLEGRO_COLOR color = al_map_rgba_f(1.0*alpha, 0.4*alpha, 0.6*alpha, alpha); // <-- correct //ALLEGRO_COLOR color = al_map_rgba_f(1.0, 0.4, 0.6, alpha); // <--no longer correct al_draw_text(font, color, 10, 10, NULL, "This is transparent text."); This is new. -- |
William Labbett
Member #4,486
March 2004
![]() |
cool. Thanks to you both. A pleasant suprise.
|
|