summaryrefslogtreecommitdiff
path: root/src/mbgl/util
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-25 12:29:04 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-26 18:15:23 +0200
commite55a46e5d19178a04b8244f7077ac71f12df639d (patch)
tree5a46ccacccfbb2b42f0dd82cb1fc54bebb0d50c1 /src/mbgl/util
parent8785f77cd633be92123464310f85ea671689473c (diff)
downloadqtlocation-mapboxgl-e55a46e5d19178a04b8244f7077ac71f12df639d.tar.gz
[core] Fix Color serialization
Diffstat (limited to 'src/mbgl/util')
-rw-r--r--src/mbgl/util/color.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mbgl/util/color.cpp b/src/mbgl/util/color.cpp
index 44f815e8b8..5d30d25244 100644
--- a/src/mbgl/util/color.cpp
+++ b/src/mbgl/util/color.cpp
@@ -48,4 +48,15 @@ mbgl::Value Color::toObject() const {
return mapbox::base::ValueObject{{"r", double(r)}, {"g", double(g)}, {"b", double(b)}, {"a", double(a)}};
}
+mbgl::Value Color::serialize() const {
+ std::array<double, 4> array = toArray();
+ return std::vector<mbgl::Value>{
+ std::string("rgba"),
+ array[0],
+ array[1],
+ array[2],
+ array[3],
+ };
+}
+
} // namespace mbgl