Allegro.cc - Online Community

Allegro.cc Forums » Allegro.cc Comments » Apply text to bitmap

This thread is locked; no one can reply to it. rss feed Print
Apply text to bitmap
Travis Peterson
Member #16,756
October 2017

Howdy
How do you apply Allegro_Font to Allegro_Bitmap (if possible)? Looking to have text directly above a textbox bitmap become part of that bitmap
Preciate it

beoran
Member #12,636
March 2011

You can use al_set_target_bitmap to set your bitmap as the target of Allegro5's rendering functions, included al_draw(_multiline)_text.

Note that this should not be done for live drawing. Such modifications to bitmaps are best done at load or setup time.

https://www.allegro.cc/manual/5/al_set_target_bitmap

Travis Peterson
Member #16,756
October 2017

The idea would be to do something similar near time of drawing.. reason for wanting this would be for the purpose of animating a textbox closing feature where the text and textbox get clipped x and y coordinates as the drawing range in al_draw_bitmap is reduced (the paramaters after sourcex and sourcey)
Do you know an alternative method?

Edgar Reynaldo
Member #8,592
May 2007
avatar

beoran
Member #12,636
March 2011

for live drawing setting the clpping rectangle is a better, more performant approach. You should normally prefer drawing directly to the display if at all possible.

Go to: