al_hold_bitmap_drawing(3)
okay so bestie, this is al_hold_bitmap_drawing(3) straight out of the Library Functions Manual β yes, the Allegro 5 API one β¨π
π NAME π
al_hold_bitmap_drawing β Allegro 5 API. That's the function, that's the vibe, no cap.
πΈ SYNOPSIS πΈ
#include <allegro5/allegro.h>
void al_hold_bitmap_drawing(bool hold)
π¦ DESCRIPTION π¦
okay so al_hold_bitmap_drawing enables or disables deferred bitmap drawing, based on hold. This is the move when you want efficient drawing of many bitmaps that share a parent bitmap β like sub-bitmaps from a tilesheet, or just identical bitmaps. It's giving batch-drawing main character energy π₯.
Drawing bitmaps that do not share a parent is less efficient, so it's advisable to stagger bitmap drawing calls such that the parent bitmap is the same for large number of those calls. iykyk, group your faves together.
While deferred bitmap drawing is enabled, the only functions you can use are the bitmap drawing functions and font drawing functions. Changing the state β like the blending modes β will result in undefined behaviour π. One exception to this rule are the non-projection transformations. It is possible to set a new transformation while the drawing is held. slay for that one exception, honestly.
π¨ No drawing is guaranteed to take place until you disable the hold. Like, none. Do not come for the screen if it hasn't shown up yet, bestie.
Thus, the idiom of this function's usage is to enable the deferred bitmap drawing, draw as many bitmaps as possible, taking care to stagger bitmaps that share parent bitmaps, and then disable deferred drawing. That's the whole flow π«Ά.
As mentioned above, this function also works with bitmap and truetype fonts, so if multiple lines of text need to be drawn, this function can speed things up. Text girlies stay winning π.
π SEE ALSO π
al_is_bitmap_drawing_held(3)β the related one, bestie π¦
source/version: Allegro reference manual (Allegro 5 API); date: not printed in this footer, bestie π β mwah π
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms