1create_color_table(3) Allegro manual create_color_table(3)
2
3
4
6 create_color_table - Fills a color mapping table for customised
7 effects. Allegro game programming library.
8
10 #include <allegro.h>
11
12
13 void create_color_table(COLOR_MAP *table, const PALETTE pal, void
14 (*blend)(PALETTE pal, int x, int y, RGB *rgb), void (*callback)(int
15 pos));
16
18 Fills the specified color mapping table with lookup data for doing cus‐
19 tomised effects with the specified palette, calling the blend function
20 to determine the results of each color combination.
21
22 Your blend routine will be passed a pointer to the palette and the two
23 indices of the colors which are to be combined, and should fill in the
24 RGB structure with the desired result in 0-63 format. Allegro will then
25 search the palette for the closest match to the RGB color that you
26 requested, so it doesn't matter if the palette has no exact match for
27 this color.
28
29 If the callback function is not NULL, it will be called 256 times dur‐
30 ing the calculation, allowing you to display a progress indicator.
31 Example:
32
33 COLOR_MAP greyscale_table;
34 ...
35 void return_grey_color(const PALETTE pal,
36 int x, int y, RGB *rgb)
37 {
38 ...
39 }
40 ...
41 /* Build a color lookup table for greyscale effect. */
42 create_color_table(&greyscale_table, pal,
43 return_grey_color, NULL);
44
45
47 color_map(3), create_light_table(3), create_trans_table(3), cre‐
48 ate_blender_table(3), draw_trans_sprite(3), draw_lit_sprite(3),
49 draw_gouraud_sprite(3), rgb_map(3), excolmap(3)
50
51
52
53Allegro version 4.2.2 create_color_table(3)