1save_bitmap(3) Allegro manual save_bitmap(3)
2
3
4
6 save_bitmap - Saves a bitmap into any supported file format. Allegro
7 game programming library.
8
10 #include <allegro.h>
11
12
13 int save_bitmap(const char *filename, BITMAP *bmp, const RGB *pal);
14
16 Writes a bitmap into a file, using the specified palette, which should
17 be an array of 256 RGB structures. The output format is determined from
18 the filename extension: at present this function supports BMP, PCX and
19 TGA formats.
20
21 Two things to watch out for: on some video cards it may be faster to
22 copy the screen to a memory bitmap and save the latter, and if you use
23 this to dump the screen into a file you may end up with an image much
24 larger than you were expecting, because Allegro often creates virtual
25 screens larger than the visible screen. You can get around this by
26 using a sub-bitmap to specify which part of the screen to save, eg:
27
28 BITMAP *bmp;
29 PALETTE pal;
30 ...
31 get_palette(pal);
32 bmp = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H);
33 save_bitmap("dump.pcx", bmp, pal);
34 destroy_bitmap(bmp);
35
37 Returns non-zero on error.
38
39
41 save_bmp(3), save_pcx(3), save_tga(3), load_bitmap(3), register_bit‐
42 map_file_type(3)
43
44
45
46Allegro version 4.4.3 save_bitmap(3)