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

NAME

6       set_color_conversion - Tells Allegro how to convert images during load‐
7       ing time.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       void set_color_conversion(int mode);
14

DESCRIPTION

16       Specifies how to convert images between the various color  depths  when
17       reading graphics from external bitmap files or datafiles. The mode is a
18       bitmask specifying which types of conversion are allowed. If the appro‐
19       priate bit is set, data will be converted into the current pixel format
20       (selected by calling the set_color_depth() function), otherwise it will
21       be  left in the same format as the disk file, leaving you to convert it
22       manually before the graphic can be displayed. The default mode is total
23       conversion, so that all images will be loaded in the appropriate format
24       for the current video mode. Valid bit flags are:
25
26          COLORCONV_NONE                // disable all format
27                                        // conversions
28          COLORCONV_8_TO_15             // expand 8-bit to 15-bit
29          COLORCONV_8_TO_16             // expand 8-bit to 16-bit
30          COLORCONV_8_TO_24             // expand 8-bit to 24-bit
31          COLORCONV_8_TO_32             // expand 8-bit to 32-bit
32          COLORCONV_15_TO_8             // reduce 15-bit to 8-bit
33          COLORCONV_15_TO_16            // expand 15-bit to 16-bit
34          COLORCONV_15_TO_24            // expand 15-bit to 24-bit
35          COLORCONV_15_TO_32            // expand 15-bit to 32-bit
36          COLORCONV_16_TO_8             // reduce 16-bit to 8-bit
37          COLORCONV_16_TO_15            // reduce 16-bit to 15-bit
38          COLORCONV_16_TO_24            // expand 16-bit to 24-bit
39          COLORCONV_16_TO_32            // expand 16-bit to 32-bit
40          COLORCONV_24_TO_8             // reduce 24-bit to 8-bit
41          COLORCONV_24_TO_15            // reduce 24-bit to 15-bit
42          COLORCONV_24_TO_16            // reduce 24-bit to 16-bit
43          COLORCONV_24_TO_32            // expand 24-bit to 32-bit
44          COLORCONV_32_TO_8             // reduce 32-bit RGB to 8-bit
45          COLORCONV_32_TO_15            // reduce 32-bit RGB to 15-bit
46          COLORCONV_32_TO_16            // reduce 32-bit RGB to 16-bit
47          COLORCONV_32_TO_24            // reduce 32-bit RGB to 24-bit
48          COLORCONV_32A_TO_8            // reduce 32-bit RGBA to 8-bit
49          COLORCONV_32A_TO_15           // reduce 32-bit RGBA to 15-bit
50          COLORCONV_32A_TO_16           // reduce 32-bit RGBA to 16-bit
51          COLORCONV_32A_TO_24           // reduce 32-bit RGBA to 24-bit
52          COLORCONV_DITHER_PAL          // dither when reducing to 8-bit
53          COLORCONV_DITHER_HI           // dither when reducing to
54                                        // hicolor
55          COLORCONV_KEEP_TRANS          // keep original transparency
56
57       For convenience, the following macros can be used to select common com‐
58       binations of these flags:
59
60          COLORCONV_EXPAND_256          // expand 256-color to hi/truecolor
61          COLORCONV_REDUCE_TO_256       // reduce hi/truecolor to 256-color
62          COLORCONV_EXPAND_15_TO_16     // expand 15-bit hicolor to 16-bit
63          COLORCONV_REDUCE_16_TO_15     // reduce 16-bit hicolor to 15-bit
64          COLORCONV_EXPAND_HI_TO_TRUE   // expand 15/16-bit to 24/32-bit
65          COLORCONV_REDUCE_TRUE_TO_HI   // reduce 24/32-bit to 15/16-bit
66          COLORCONV_24_EQUALS_32        // convert between 24- and 32-bit
67          COLORCONV_TOTAL               // everything to current format
68          COLORCONV_PARTIAL             // convert 15 <-> 16-bit and
69                                        // 24 <-> 32-bit
70          COLORCONV_MOST                // all but hi/truecolor <-> 256
71          COLORCONV_DITHER              // dither during all color reductions
72          COLORCONV_KEEP_ALPHA          // convert everything to current format
73                                        // unless it would lose alpha information
74
75       If  you  enable  the COLORCONV_DITHER flag, dithering will be performed
76       whenever truecolor graphics are converted into a  hicolor  or  paletted
77       format, including by the blit() function, and any automatic conversions
78       that take place while reading graphics from disk. This can produce much
79       better  looking  results, but is obviously slower than a direct conver‐
80       sion.
81
82       If you intend using converted bitmaps with functions like masked_blit()
83       or  draw_sprite(), you should specify the COLORCONV_KEEP_TRANS flag. It
84       will ensure that the masked areas in the bitmap before  and  after  the
85       conversion stay exactly the same, by mapping transparent colors to each
86       other and adjusting colors which would be converted to the  transparent
87       color  otherwise.  It  affects  every blit() operation between distinct
88       pixel formats and every automatic conversion.
89
90

SEE ALSO

92       set_color_depth(3),          load_bitmap(3),          load_datafile(3),
93       fixup_datafile(3),  makecol15_dither(3), get_color_conversion(3), exal‐
94       pha(3), exblend(3), exdata(3), exexedat(3), exlights(3), exxfade(3)
95
96
97
98Allegro                          version 4.2.2         set_color_conversion(3)
Impressum