summaryrefslogtreecommitdiffstats
path: root/src/graphics/common/color.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/common/color.h')
-rw-r--r--src/graphics/common/color.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/graphics/common/color.h b/src/graphics/common/color.h
index 68421c7..907a3b9 100644
--- a/src/graphics/common/color.h
+++ b/src/graphics/common/color.h
@@ -36,12 +36,23 @@ struct Color
Color(float aR = 0.0f, float aG = 0.0f, float aB = 0.0f, float aA = 0.0f)
: r(aR), g(aG), b(aB), a(aA) {}
+ inline Gfx::Color Inverse() const
+ {
+ return Gfx::Color(1.0f - r, 1.0f - g, 1.0f - b, 1.0f - a);
+ }
+
//! Returns the struct cast to \c float* array; use with care!
inline float* Array()
{
return (float*)this;
}
+ //! Returns the struct cast to <tt>const float*</tt> array; use with care!
+ inline const float* Array() const
+ {
+ return (const float*)this;
+ }
+
//! Returns a string (r, g, b, a)
inline std::string ToString() const
{
@@ -50,6 +61,11 @@ struct Color
s << "(" << r << ", " << g << ", " << b << ", " << a << ")";
return s.str();
}
+
+ inline bool operator==(const Gfx::Color &other) const
+ {
+ return r == other.r && g == other.g && b == other.b && a == other.a;
+ }
};
/**