1load_bitmap(3)                  Allegro manual                  load_bitmap(3)
2
3
4

NAME

6       load_bitmap - Loads any supported bitmap from a file. Allegro game pro‐
7       gramming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       BITMAP *load_bitmap(const char *filename, RGB *pal);
14

DESCRIPTION

16       Loads a bitmap from a file. The palette data will be stored in the sec‐
17       ond  parameter,  which  should  be  an  array of 256 RGB structures. At
18       present this function supports BMP, LBM, PCX, and TGA files,  determin‐
19       ing the type from the file extension.
20
21       If  the file contains a truecolor image, you must set the video mode or
22       call set_color_conversion() before loading it. In  this  case,  if  the
23       destination  color  depth  is  8-bit,  the palette will be generated by
24       calling generate_optimized_palette()  on  the  bitmap;  otherwise,  the
25       returned palette will be generated by calling generate_332_palette().
26
27       The pal argument may be NULL. In this case, the palette data are simply
28       not returned. Additionally, if the file is a truecolor  image  and  the
29       destination color depth is 8-bit, the color conversion process will use
30       the current palette instead of generating an optimized one.
31
32       Example:
33
34          BITMAP *bmp;
35          PALETTE palette;
36          ...
37          bmp = load_bitmap("image.pcx", palette);
38          if (!bmp)
39             abort_on_error("Couldn't load image.pcx!");
40          ...
41          destroy_bitmap(bmp);
42

RETURN VALUE

44       Returns a pointer to the bitmap or NULL on error. Remember that you are
45       responsible  for destroying the bitmap when you are finished with it to
46       avoid memory leaks.
47
48

SEE ALSO

50       load_bmp(3), load_lbm(3), load_pcx(3), load_tga(3),  destroy_bitmap(3),
51       save_bitmap(3),    register_bitmap_file_type(3),    set_color_depth(3),
52       set_color_conversion(3),     generate_optimized_palette(3),      gener‐
53       ate_332_palette(3),  exaccel(3),  exalpha(3),  exbitmap(3), exblend(3),
54       exconfig(3), exlights(3), exshade(3), extrans(3), exxfade(3)
55
56
57
58Allegro                          version 4.2.2                  load_bitmap(3)
Impressum