al_load_bitmap(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_load_bitmap β€” Allegro 5 API πŸ’–

okay bestie, welcome to the al_load_bitmap(3alleg5) page, aka the glow-up moment where a random image file becomes a whole entire ALLEGRO_BITMAP. it's from the Allegro reference manual, it's iconic, let's get into it 🫢


✨ SYNOPSIS ✨

#include <allegro5/allegro.h>

ALLEGRO_BITMAP *al_load_bitmap(const char *filename)

🌸 DESCRIPTION 🌸

So what does it actually do? It loads an image file into a brand new ALLEGRO_BITMAP(3alleg5). that's it, that's the whole job, and it does it slayfully πŸ’…

The way it figures out what kind of file you handed it? It asks al_identify_bitmap(3alleg5) first β€” and if identification isn't possible, it falls back on the file extension like a backup plan. lowkey smart of it fr fr.

Returns NULL on error. so like… always check your return value, bestie, no cap. if it hands you NULL, something went wrong.

Also important: this function is literally the same as calling al_load_bitmap_flags(3alleg5) with a flags parameter of 0. same energy, shorter name, periodt.

Note: the core Allegro library does not support any image file formats by default. You must use the allegro_image addon, or register your own format handler.

like genuinely, do not skip that note. you will be sitting there going "why is my bitmap NULL 😭" and the answer is you didn't pull in the addon. it's giving user error, and it's giving all of us at some point, no shame, just fix it πŸ’€


πŸ‘€ SEE ALSO πŸ‘€

go read those too, they're the rest of the friend group 🌈


and that's the whole page, bestie ✨ this one came straight out of the Allegro reference manual, filed under al_load_bitmap(3alleg5). mwah, go load something pretty πŸŽ€πŸ’–πŸ¦‹

πŸ“¦ where this page comes from