Skip to content

Commit

Permalink
Added a copying function to ImageBase that can force a specific depth.
Browse files Browse the repository at this point in the history
  • Loading branch information
parnham committed Jun 17, 2024
1 parent d2212f1 commit 4f345e7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/emergent/image/ImageBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ namespace emergent
}


// Copy from an existing image but ensure the required depth is established.
// Converts type and depth where necessary and returns itself
template <typename U> ImageBase<T> &From(const ImageBase<U> &image, const byte depth)
{
this->depth = depth;
this->Copy(image);
return *this;
}


/// Operator override to support implicit and explicit typecasting
operator T*() { return this->buffer.data(); }
operator const T*() const { return this->buffer.data(); }
Expand Down

0 comments on commit 4f345e7

Please sign in to comment.