1ALLEGRO_PIXEL_FORMAT(3) Library Functions Manual ALLEGRO_PIXEL_FORMAT(3)
2
3
4
6 ALLEGRO_PIXEL_FORMAT
7
9 #include <allegro5/allegro.h>
10
11 typedef enum ALLEGRO_PIXEL_FORMAT
12
14 Pixel formats. Each pixel format specifies the exact size and bit lay‐
15 out of a pixel in memory. Components are specified from high bits to
16 low bits, so for example a fully opaque red pixel in ARGB_8888 format
17 is 0xFFFF0000.
18
19 Note:
20
21 The pixel format is independent of endianness. That is, in the
22 above example you can always get the red component with
23
24 (pixel & 0x00ff0000) >> 16
25
26 But you can not rely on this code:
27
28 *(pixel + 2)
29
30 It will return the red component on little endian systems, but the
31 green component on big endian systems.
32
33 Also note that Allegro's naming is different from OpenGL naming here,
34 where a format of GL_RGBA8 merely defines the component order and the
35 exact layout including endianness treatment is specified separately.
36 Usually GL_RGBA8 will correspond to ALLEGRO_PIXEL_ABGR_8888 though on
37 little endian systems, so care must be taken (note the reversal of RGBA
38 <-> ABGR).
39
40 The only exception to this ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE which will
41 always have the components as 4 bytes corresponding to red, green, blue
42 and alpha, in this order, independent of the endianness.
43
44 · ALLEGRO_PIXEL_FORMAT_ANY - Let the driver choose a format. This is
45 the default format at program start.
46
47 · ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA - Let the driver choose a format
48 without alpha.
49
50 · ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA - Let the driver choose a format
51 with alpha.
52
53 · ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA - Let the driver choose a 15 bit
54 format without alpha.
55
56 · ALLEGRO_PIXEL_FORMAT_ANY_15_WITH_ALPHA - Let the driver choose a 15
57 bit format with alpha.
58
59 · ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA - Let the driver choose a 16 bit
60 format without alpha.
61
62 · ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA - Let the driver choose a 16
63 bit format with alpha.
64
65 · ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA - Let the driver choose a 24 bit
66 format without alpha.
67
68 · ALLEGRO_PIXEL_FORMAT_ANY_24_WITH_ALPHA - Let the driver choose a 24
69 bit format with alpha.
70
71 · ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA - Let the driver choose a 32 bit
72 format without alpha.
73
74 · ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA - Let the driver choose a 32
75 bit format with alpha.
76
77 · ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit
78
79 · ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit
80
81 · ALLEGRO_PIXEL_FORMAT_ARGB_4444 - 16 bit
82
83 · ALLEGRO_PIXEL_FORMAT_RGB_888 - 24 bit
84
85 · ALLEGRO_PIXEL_FORMAT_RGB_565 - 16 bit
86
87 · ALLEGRO_PIXEL_FORMAT_RGB_555 - 15 bit
88
89 · ALLEGRO_PIXEL_FORMAT_RGBA_5551 - 16 bit
90
91 · ALLEGRO_PIXEL_FORMAT_ARGB_1555 - 16 bit
92
93 · ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit
94
95 · ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit
96
97 · ALLEGRO_PIXEL_FORMAT_BGR_888 - 24 bit
98
99 · ALLEGRO_PIXEL_FORMAT_BGR_565 - 16 bit
100
101 · ALLEGRO_PIXEL_FORMAT_BGR_555 - 15 bit
102
103 · ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit
104
105 · ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit
106
107 · ALLEGRO_PIXEL_FORMAT_ABGR_F32 - 128 bit
108
109 · ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE - Like the version without _LE, but
110 the component order is guaranteed to be red, green, blue, alpha.
111 This only makes a difference on big endian systems, on little endian
112 it is just an alias.
113
115 al_set_new_bitmap_format(3), al_get_bitmap_format(3)
116
117
118
119Allegro reference manual ALLEGRO_PIXEL_FORMAT(3)