[core] add clone() call to Image objects

This commit is contained in:
Konstantin Käfer
2017-01-25 16:09:11 +01:00
parent be43310b6f
commit 46fe0df2a2
2 changed files with 9 additions and 6 deletions

View File

@@ -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; }