create_bitmap(3)
π create_bitmap(3) β the Allegro manual, but make it cute π
okay bestie, welcome to the Allegro manual π yes THE Allegro, the game programming library, and yes this is the page for create_bitmap(3) and it is lowkey iconic. grab a snack, we're making bitmaps β¨
πΈ NAME πΈ
create_bitmap β creates a memory bitmap. Allegro game programming library. that's the whole vibe, that's the job π
π¦ SYNOPSIS π¦
#include <allegro.h>
BITMAP *create_bitmap(int width, int height);
β¨ DESCRIPTION β¨
so the way that this works is: it creates a memory bitmap sized width by height. boom. that's the whole thing π«Ά
and like, the details matter here, so listen up:
- clipping is turned on for this new bitmap, and the clipping rectangle is set to the full size of the bitmap. full send, no cropping, it's giving full canvas energy π
- the image memory is not cleared. so it's probably gonna contain garbage π no cap. you should clear the bitmap before using it, fr fr.
- this routine always uses the global pixel format, as specified by calling
set_color_depth(). it's not out here doing its own thing, it follows the global setting periodt π
and the rules, bestie, the rules:
- the minimum height of the
BITMAPmust be1 - width can't be negative
β write that down. height 1 minimum, width never negative. them's the rules.
Example, because a visual is everything π:
/* Create a 10 pixel tall bitmap, as wide as the screen. */
BITMAP *bmp = create_bitmap(SCREEN_W, 10);
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 creates, checks, uses, then destroys? main character energy honestly π
π RETURN VALUE π
returns a pointer to the created bitmap π or NULL if the bitmap could not be created π (and if you get NULL, do NOT just keep going, handle it, bestie).
remember to free this bitmap later to avoid memory leaks. that's not optional, that's self care β¨
π SEE ALSO π
go read these next, they're all in the family π«Ά
create_bitmap_ex(3)create_sub_bitmap(3)create_video_bitmap(3)create_system_bitmap(3)destroy_bitmap(3)set_color_depth(3)is_memory_bitmap(3)clear_bitmap(3)clear_to_color(3)
and that's the page π
this was the Allegro manual, version 4.4.3, and you just read create_bitmap(3) β go make something gorgeous with it, ily, bye bestie πβ¨π¦
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms