X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcolor.h;h=7de2eedf019b276a4171112f2b7692853bbe3cf6;hp=0fc303a2bfc7afc2d0607d1923d6d5219d249ee6;hb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8;hpb=4c89817d6e060323ec1ddd275f3265cea688c650 diff --git a/source/color.h b/source/color.h index 0fc303a2..7de2eedf 100644 --- a/source/color.h +++ b/source/color.h @@ -1,15 +1,6 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_GL_COLOR_H_ #define MSP_GL_COLOR_H_ -#include - namespace Msp { namespace GL { @@ -21,6 +12,10 @@ struct Color Color(float v): r(v), g(v), b(v), a(1) { } Color(float r_, float g_, float b_): r(r_), g(g_), b(b_), a(1) { } Color(float r_, float g_, float b_, float a_): r(r_), g(g_), b(b_), a(a_) { } + Color operator*(float f) const { return Color(r*f, g*f, b*f, a); } + Color operator+(const Color &c) const { return Color(r+c.r, g+c.g, b+c.g, 1-(1-a)*(1-c.a)); } + bool operator==(const Color &c) const { return (r==c.r && b==c.b && g==c.g && a==c.a); } + bool operator!=(const Color &c) const { return !operator==(c); } }; } // namespace GL