create_bitmap_ex(3alleg4)
π create_bitmap_ex β NAME π
okay bestie, so create_bitmap_ex is the Allegro function that creates a memory bitmap and lets you pick the color depth yourself. yes queen, you get to choose. it's part of the Allegro game programming library, so it's giving very much "i make graphics happen" energy π¨β¨
π SYNOPSIS π
#include <allegro.h>
BITMAP *create_bitmap_ex(int color_depth, int width, int height);
β¨ DESCRIPTION β¨
so here's the tea π«: this function makes you a bitmap in a specific color depth β and the depths you can pick from are literally 8, 15, 16, 24 or 32 bits per pixel. pick your fighter, they're all valid π
here's a lil example so you can see it in the wild, no cap:
/* 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 it's giving "make a screen-sized bitmap at 32bpp, check it actually worked, use it, then clean up after yourself"? that's the whole arc π¦ main character behaviour fr fr.
πΈ RETURN VALUE πΈ
it hands you back a pointer to the created bitmap π β¦ or NULL if the bitmap just could not be created π (rude, but okay).
β οΈ and bestie, please β remember to free this bitmap later so you don't leak memory. destroy_bitmap(bmp), be responsible, we don't do leaks in this house π«Ά
π SEE ALSO π
go read these next, iykyk:
create_bitmap(3alleg4)create_sub_bitmap(3alleg4)create_video_bitmap(3alleg4)create_system_bitmap(3alleg4)destroy_bitmap(3alleg4)is_memory_bitmap(3alleg4)clear_bitmap(3alleg4)clear_to_color(3alleg4)ex12bit(3alleg4)exlights(3alleg4)exrgbhsv(3alleg4)extrans(3alleg4)
and that's the whole page, bestie π this was Allegro version 4.4.3, page create_bitmap_ex(3alleg4). go forth and allocate responsibly ππβ¨
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms