create_bitmap_ex(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ create_bitmap_ex ✨

okay bestie, welcome to the Allegro manual πŸ’– β€” this is the page for create_bitmap_ex, and it's gonna be so good, I promise.


🌸 NAME 🌸

create_bitmap_ex β€” it makes you a memory bitmap, but with a color depth you pick yourself πŸ’… Part of the Allegro game programming library.


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

BITMAP *create_bitmap_ex(int color_depth, int width, int height);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. this function creates a bitmap in a specific color depth. the depths you can ask for are 8, 15, 16, 24 or 32 bits per pixel. that's it, that's the whole vibe. 🫢

here's the example, and it literally eats every time:

/* Create screen sized bitmap in 32 bits per pixel. */
BITMAP *bmp = create_bitmap_ex(32, SCREEN_W, SCREEN_H);
if (!bmp)
   abort_on_error("Couldn't create bitmap!");
/* Use the bitmap. */
...
/* Destroy it when we don't need it any more. */
destroy_bitmap(bmp);

see how she does it? make it, check it actually happened, use it, then clean it up. that's main character energy ✨


πŸ’œ RETURN VALUE πŸ’œ

she hands you back a pointer to the bitmap she made πŸŽ‰ β€” or NULL if the bitmap could not be created (yes, that happens, it's giving πŸ’€).

IMPORTANT: remember to free this bitmap later, bestie. not freeing it = memory leaks, and memory leaks are not the vibe. πŸ™ˆ

⭐ SEE ALSO ⭐


and that's the whole page, no cap 🌈 go make some bitmaps, bestie, you've got this. mwah πŸ’…πŸ’–

this was brought to you by Allegro, version 4.4.3, and this very page, create_bitmap_ex(3) πŸŽ€ bye bestie!! πŸ‘‘

πŸ“¦ where this page comes from