summaryrefslogtreecommitdiff
path: root/include/mbgl/util/color.hpp
diff options
context:
space:
mode:
authorYoung Hahn <young@mapbox.com>2016-06-15 11:38:22 -0400
committerGitHub <noreply@github.com>2016-06-15 11:38:22 -0400
commit24b66bc8cdd40a52e08d198c063daa3e1f6be92a (patch)
tree6d98a5e1216a83f7d6d4c78422c8306d4a4cb157 /include/mbgl/util/color.hpp
parentfe64238b4cd5a7da403a4f29a62b14234ecba569 (diff)
downloadqtlocation-mapboxgl-24b66bc8cdd40a52e08d198c063daa3e1f6be92a.tar.gz
Color class (#5361)
* Color class * Switch to list initialization
Diffstat (limited to 'include/mbgl/util/color.hpp')
-rw-r--r--include/mbgl/util/color.hpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/mbgl/util/color.hpp b/include/mbgl/util/color.hpp
index d7fe61c640..82cd3c42e7 100644
--- a/include/mbgl/util/color.hpp
+++ b/include/mbgl/util/color.hpp
@@ -5,6 +5,20 @@
namespace mbgl {
// Stores a premultiplied color, with all four channels ranging from 0..1
-using Color = std::array<float, 4>;
+class Color {
+public:
+ float r = 0.0f;
+ float g = 0.0f;
+ float b = 0.0f;
+ float a = 0.0f;
+};
+
+inline bool operator== (const Color& colorA, const Color& colorB) {
+ return colorA.r == colorB.r && colorA.g == colorB.g && colorA.b == colorB.b && colorA.a == colorB.a;
+}
+
+inline bool operator!= (const Color& colorA, const Color& colorB) {
+ return !(colorA.r == colorB.r && colorA.g == colorB.g && colorA.b == colorB.b && colorA.a == colorB.a);
+}
} // namespace mbgl