1 /**
2  * @file color.h Color
3  *
4  * @author Copyright &copy; 2007-2013 Daniel Swanson <danij@dengine.net>
5  *
6  * @par License
7  * GPL: http://www.gnu.org/licenses/gpl.html
8  *
9  * <small>This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by the
11  * Free Software Foundation; either version 2 of the License, or (at your
12  * option) any later version. This program is distributed in the hope that it
13  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details. You should have received a copy of the GNU
16  * General Public License along with this program; if not, write to the Free
17  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18  * 02110-1301 USA</small>
19  */
20 
21 #ifndef LIBDENG_DATA_COLOR_H
22 #define LIBDENG_DATA_COLOR_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /**
29  * ColorRawf. Color Raw (f)loating point. Is intended as a handy POD
30  * structure for easy manipulation of four component, floating point
31  * color plus alpha value sets.
32  *
33  * @ingroup data
34  */
35 typedef struct ColorRawf_s {
36     union {
37         // Straight RGBA vector representation.
38         float rgba[4];
39         // Hybrid RGB plus alpha component representation.
40         struct {
41             float rgb[3];
42             float alpha;
43         };
44         // Component-wise representation.
45         struct {
46             float red;
47             float green;
48             float blue;
49             float _alpha;
50         };
51     };
52 #ifdef __cplusplus
53     ColorRawf_s(float r = 0.f, float g = 0.f, float b = 0.f, float a = 0.f)
redColorRawf_s54         : red(r), green(g), blue(b), _alpha(a) {}
55 #endif
56 } ColorRawf;
57 
58 float ColorRawf_AverageColor(ColorRawf* color);
59 float ColorRawf_AverageColorMulAlpha(ColorRawf* color);
60 
61 #ifdef __cplusplus
62 } // extern "C"
63 #endif
64 
65 #endif // LIBDENG_DATA_COLOR_H
66