1 module allegro5.color;
2 
3 import allegro5.base;
4 import allegro5.internal.da5;
5 
6 nothrow @nogc extern (C)
7 {
8 	struct ALLEGRO_COLOR
9 	{
10 		float r, g, b, a;
11 	}
12 
13 	enum ALLEGRO_PIXEL_FORMAT
14 	{
15 		ALLEGRO_PIXEL_FORMAT_ANY                  = 0,
16 		ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA         = 1,
17 		ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA       = 2,
18 		ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA      = 3,
19 		ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA      = 4,
20 		ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA    = 5,
21 		ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA      = 6,
22 		ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA      = 7,
23 		ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA    = 8,
24 		ALLEGRO_PIXEL_FORMAT_ARGB_8888            = 9,
25 		ALLEGRO_PIXEL_FORMAT_RGBA_8888            = 10,
26 		ALLEGRO_PIXEL_FORMAT_ARGB_4444            = 11,
27 		ALLEGRO_PIXEL_FORMAT_RGB_888              = 12, /* 24 bit format */
28 		ALLEGRO_PIXEL_FORMAT_RGB_565              = 13,
29 		ALLEGRO_PIXEL_FORMAT_RGB_555              = 14,
30 		ALLEGRO_PIXEL_FORMAT_RGBA_5551            = 15,
31 		ALLEGRO_PIXEL_FORMAT_ARGB_1555            = 16,
32 		ALLEGRO_PIXEL_FORMAT_ABGR_8888            = 17,
33 		ALLEGRO_PIXEL_FORMAT_XBGR_8888            = 18,
34 		ALLEGRO_PIXEL_FORMAT_BGR_888              = 19, /* 24 bit format */
35 		ALLEGRO_PIXEL_FORMAT_BGR_565              = 20,
36 		ALLEGRO_PIXEL_FORMAT_BGR_555              = 21,
37 		ALLEGRO_PIXEL_FORMAT_RGBX_8888            = 22,
38 		ALLEGRO_PIXEL_FORMAT_XRGB_8888            = 23,
39 		ALLEGRO_PIXEL_FORMAT_ABGR_F32             = 24,
40 		ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE         = 25,
41 		ALLEGRO_PIXEL_FORMAT_RGBA_4444            = 26,
42 		ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8     = 27,
43 		ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 = 28,
44 		ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 = 29,
45 		ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 = 30,
46 		ALLEGRO_NUM_PIXEL_FORMATS
47 	}
48 
49 	/* Pixel unmapping */
50 	void al_unmap_rgb(ALLEGRO_COLOR color, ubyte* r, ubyte* g, ubyte* b);
51 	void al_unmap_rgba(ALLEGRO_COLOR color, ubyte* r, ubyte* g, ubyte* b, ubyte* a);
52 	void al_unmap_rgb_f(ALLEGRO_COLOR color, float* r, float* g, float* b);
53 	void al_unmap_rgba_f(ALLEGRO_COLOR color, float* r, float* g, float* b, float* a);
54 
55 	int al_get_pixel_size(int format);
56 	int al_get_pixel_format_bits(int format);
57 	int al_get_pixel_block_size(int format);
58 	int al_get_pixel_block_width(int format);
59 	int al_get_pixel_block_height(int format);
60 }
61 
62 static import allegro5.color_ret;
63 
64 mixin(ColorWrapper("allegro5.color_ret.", "al_map_rgb", "ubyte r, ubyte g, ubyte b", "r, g, b"));
65 mixin(ColorWrapper("allegro5.color_ret.", "al_map_rgba", "ubyte r, ubyte g, ubyte b, ubyte a", "r, g, b, a"));
66 mixin(ColorWrapper("allegro5.color_ret.", "al_map_rgb_f", "float r, float g, float b", "r, g, b"));
67 mixin(ColorWrapper("allegro5.color_ret.", "al_map_rgba_f", "float r, float g, float b, float a", "r, g, b, a"));
68 mixin(ColorWrapper("allegro5.color_ret.", "al_premul_rgba", "ubyte r, ubyte g, ubyte b, ubyte a", "r, g, b, a"));
69 mixin(ColorWrapper("allegro5.color_ret.", "al_premul_rgba_f", "float r, float g, float b, float a", "r, g, b, a"));