![]() |
|
Blending issues |
alex Ioan
Member #12,015
June 2010
|
al_set_blender(ALLEGRO_ONE, ALLEGRO_ZERO, al_map_rgba(255, 255, 255, 255)); I cant seem to get this to work... if I want to draw transparent text shouldn't I just change the last 255 value ? Anyway this line won't work.... can't pass ALLEGRO color as int... searched the manual, found another syntax for that last parameter but it made the text not show up...
|
Trent Gamblin
Member #261
April 2000
![]() |
The other parameter is the first not the last, and it's the blend mode. You want ALLEGRO_ADD there. To get transparency you change the last parameter to the alpha value then multiply the color components by it. It makes the most sense with floats: al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA,al_map_rgba_f(1.0*0.75, 1.0*0.75, 1.0*0.75, 0.75));
|
alex Ioan
Member #12,015
June 2010
|
Error 1 error C2660: 'al_set_blender' : function does not take 4 arguments
|
Slartibartfast
Member #8,789
June 2007
![]() |
Look at the code in your post, al_set_blender is a link. Click it and read the correct way to use al_set_blender. ---- |
alex Ioan
Member #12,015
June 2010
|
sorry, read that numerous times... but still can't figure out how it works tried al_draw_text(font, al_map_rgba_f(0.25, 0.25, 0.25, 0.25), 100, 100,ALLEGRO_ALIGN_LEFT,"TEXT"); this works at least...
|
Arthur Kalliokoski
Second in Command
February 2005
![]() |
I'm not sure, but I think Trent's post was supposed to have an OR '|' in place of one of the commas, which would be 3 parameters. They all watch too much MSNBC... they get ideas. |
Slartibartfast
Member #8,789
June 2007
![]() |
Yes, that is the correct way. Once the blending mode is correct, you want to draw your text, which you can indeed do with al_draw_text, and if you want the text to have a certain color you'd put in the correct values for the color as per your blending mode. ---- |
alex Ioan
Member #12,015
June 2010
|
so for text just use al_draw_text(font, al_map_rgba_f(0.25, 0.25, 0.25, 0.25), 100, 100,ALLEGRO_ALIGN_LEFT,"TEXT");
what would be the difference between this and using a blender ? PS: drawing the text with that color works well only for white.... trying to get other pure color transparent is kinda hard... Isn't there a way to only make ANY colored text an amount of % transparent ?
|
Trent Gamblin
Member #261
April 2000
![]() |
Oops, I'm thinking a year ago. The correct format is: al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA);
|
alex Ioan
Member #12,015
June 2010
|
al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); this makes images and text sorta transparent to each other... I mean when I crossover 2 bitmaps Its like they are both a bit transparent. Still that doesn't help me get faded text on black background
|
Trent Gamblin
Member #261
April 2000
![]() |
To fade text, adjust the alpha in the al_draw_text command. Like you have above... not sure I understand what you want though. To just draw it transparent, use 0.x for all 4 colour parameters, to make it gradually fade, adjust the values from 1.0 to 0.0 gradually over time. EDIT: And you want ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA not ONE, ONE.
|
alex Ioan
Member #12,015
June 2010
|
yea I got it now, it was ok in the first place But anyway
|
|