1 /** @file color.cpp Color
2  *
3  * @authors Copyright &copy; 2007-2013 Daniel Swanson <danij@dengine.net>
4  *
5  * @par License
6  * GPL: http://www.gnu.org/licenses/gpl.html
7  *
8  * <small>This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version. This program is distributed in the hope that it
12  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details. You should have received a copy of the GNU
15  * General Public License along with this program; if not, write to the Free
16  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17  * 02110-1301 USA</small>
18  */
19 
20 #include "de_platform.h"
21 #include "misc/color.h"
22 
ColorRawf_AverageColor(ColorRawf * c)23 float ColorRawf_AverageColor(ColorRawf* c)
24 {
25     DENG_ASSERT(c);
26     return (c->red + c->green + c->blue) / 3;
27 }
28 
ColorRawf_AverageColorMulAlpha(ColorRawf * c)29 float ColorRawf_AverageColorMulAlpha(ColorRawf* c)
30 {
31     DENG_ASSERT(c);
32     return (c->red + c->green + c->blue) / 3 * c->alpha;
33 }
34