save_bitmap(3)
β¨ save_bitmap(3) β¨
okay bestie, welcome to the Allegro manual π this one's called save_bitmap, and fr fr it's the glow-up moment where your bitmap leaves the computer and becomes an actual file π
πΈ NAME πΈ
save_bitmap β Saves a bitmap into any supported file format. Allegro game programming library. periodt π
π¦ SYNOPSIS π¦
#include <allegro.h>
int save_bitmap(const char *filename, BITMAP *bmp, const RGB *pal);
π DESCRIPTION π
So like, the whole vibe here is: this function writes a bitmap into a file, using the palette you hand it, and that palette should be an array of 256 RGB structures. no cap. π«Ά
The output format? it's giving detective work, because it gets determined from the filename extension. at present this function supports BMP, PCX and TGA formats. slay β¨
okay now the part where I gotta be your responsible bestie, because there are two things to watch out for:
- on some video cards it may be faster to copy the screen to a memory bitmap and save the latter π§
- and if you use this to dump the screen into a file, you may end up with an image much larger than you were expecting π because Allegro often creates virtual screens larger than the visible screen. ikyky
the way you get around that? use a sub-bitmap to specify which part of the screen to save, eg:
BITMAP *bmp;
PALETTE pal;
...
get_palette(pal);
bmp = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H);
save_bitmap("dump.pcx", bmp, pal);
destroy_bitmap(bmp);
look at her go, main character energy π
β RETURN VALUE β
Returns non-zero on error. (yes queen, zero means you ate, non-zero means the vibe check failed π)
π SEE ALSO π
and that's the whole page, bestie π this came to you from the Allegro manual, version 4.4.3, and the page itself is save_bitmap(3) β go save something iconic π¦β¨π
π¦ 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