diff options
Diffstat (limited to 'include/mbgl/util')
-rw-r--r-- | include/mbgl/util/image.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp index 1d84d4824a..2de7646837 100644 --- a/include/mbgl/util/image.hpp +++ b/include/mbgl/util/image.hpp @@ -48,6 +48,13 @@ public: return size && data.get() != nullptr; } + template <typename T = Image> + T clone() const { + T copy(size); + std::copy(data.get(), data.get() + bytes(), copy.data.get()); + return copy; + } + size_t stride() const { return channels * size.width; } size_t bytes() const { return stride() * size.height; } |