Apply text to bitmap
Travis Peterson

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


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.

Travis Peterson

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

al_set_clipping_rectangle will do what you want.

Other ways to animate include transformations over time. Had some fun with this in my TINS entry(not submitted).


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.

Thread #617109. Printed from