image: sectioning

This commit is contained in:
Danny Robson 2015-06-04 14:35:02 +10:00
parent a88bebe037
commit 8da9151df2

View File

@ -30,6 +30,7 @@ namespace util { namespace image {
struct buffer { struct buffer {
typedef T value_type; typedef T value_type;
//---------------------------------------------------------------------
buffer (util::extent2u); buffer (util::extent2u);
buffer (size_t w, size_t h); buffer (size_t w, size_t h);
buffer (size_t w, size_t h, size_t s); buffer (size_t w, size_t h, size_t s);
@ -38,16 +39,19 @@ namespace util { namespace image {
buffer (const buffer<T>&) = delete; buffer (const buffer<T>&) = delete;
buffer (buffer<T> &&) = default; buffer (buffer<T> &&) = default;
//---------------------------------------------------------------------
void fill (T); void fill (T);
template <typename U> //---------------------------------------------------------------------
buffer<U> alloc (void) const; /// allocate and return a buffer of the same dimensions. contents are undefined.
template <typename U = T> buffer<U> alloc (void) const;
template <typename U> /// allocate and return a buffer with the same contents
buffer<U> clone (void) const; template <typename U = T> buffer<U> clone (void) const;
buffer<T> downsample (float factor) const; buffer<T> downsample (float factor) const;
//---------------------------------------------------------------------
constexpr size_t area (void) const; constexpr size_t area (void) const;
constexpr bool is_packed (void) const; constexpr bool is_packed (void) const;
@ -55,12 +59,14 @@ namespace util { namespace image {
size_t h; size_t h;
size_t s; size_t s;
//---------------------------------------------------------------------
T operator[] (point<2,size_t>) const; T operator[] (point<2,size_t>) const;
T& operator[] (point<2,size_t>); T& operator[] (point<2,size_t>);
T operator[] (size_t) const; T operator[] (size_t) const;
T& operator[] (size_t); T& operator[] (size_t);
//---------------------------------------------------------------------
T* begin (void); T* begin (void);
T* end (void); T* end (void);
T* data (void); T* data (void);