BITMAP(3)
π NAME π
BITMAP β the lil' struct that holds all the pixels of your bitmap, bestie. It lives in the Allegro game programming library, and it's genuinely the main character of everything you'll ever draw. β¨
πΈ SYNOPSIS πΈ
#include <allegro.h>
typedef struct BITMAP
π¦ DESCRIPTION π¦
okay so here's the tea, the fields you're actually allowed to touch look like this:
int w, h; - size of the bitmap in pixels
int clip; - non-zero if clipping is turned on
int cl, cr, ct, cb; - clip rectangle left, right, top,
and bottom
unsigned char *line[]; - pointers to the start of each line
ngl there is some other stuff hanging out in the structure too π but that part is liable to change, so don't you dare use anything except the fields listed above. periodt. π
The w and h fields are your besties for finding out how big an existing bitmap is, like:
bmp = load_bitmap("file.bmp", pal);
allegro_message("Bitmap size: (%dx%d)\n", bmp->w, bmp->h);
Now the clipping rectangle, and this is the part that trips people up, so pay attention bestie π β it's inclusive on the left and top (so 0 lets you draw at position 0) but exclusive on the right and bottom (so 10 lets you draw at position 9, but not at 10). And no, it is not the same format as the clipping API, which takes inclusive coordinates for all four corners. it's giving "why are they different" and honestly? no clue, just remember it. π
All the values in this structure should be treated as read-only, with exactly one exception: the line field, and the whole deep dive on how to access that lives in the "Direct access to video memory" section of the manual. iykyk. π
And if you wanna modify the clipping region? do NOT just change this structure. please, for the love of everything, refrain. Use set_clip_rect() instead. π«Ά
π SEE ALSO π
and that's the whole vibe, bestie π this page is from the Allegro manual, version 4.4.3 β slay, go make something pretty with it. πβ¨π¦
π¦ 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