cgv
Loading...
Searching...
No Matches
image_view.h
1#pragma once
2
3#include "data_view.h"
4
5#include "lib_begin.h"
6
7namespace cgv {
8 namespace data {
9
10class CGV_API image_view
11{
12public:
13 data_format df;
14 data_view dv;
15 void* ref_void(size_t i, size_t j);
16 const void* get_void(size_t i, size_t j) const;
17public:
18 image_view();
19 size_t get_width() const { return df.get_width(); }
20 size_t get_height() const { return df.get_height(); }
21 data_view& ref_data_view() { return dv; }
22 void create(const std::string& fmt_dcr, std::ptrdiff_t w=-1, std::ptrdiff_t h=-1);
23 void clear(double v);
24 template <typename T>
25 T& ref(size_t i, size_t j) { return *((T*)ref_void(i,j)); }
26 template <typename T>
27 const T& get(size_t i, size_t j) const { return *((const T*)get_void(i,j)); }
28 template <typename T>
29 T* ptr(size_t i, size_t j) { return (T*)ref_void(i,j); }
30 void copy_rectangle(const image_view& src, std::ptrdiff_t X = 0, std::ptrdiff_t Y = 0, std::ptrdiff_t x = 0, std::ptrdiff_t y = 0, std::ptrdiff_t w = -1, std::ptrdiff_t h = -1);
31 void sub_sample();
32};
33
34 }
35}
36
37#include <cgv/config/lib_end.h>
A data_format describes a multidimensional data block of data entries.
Definition data_format.h:17
size_t get_width() const
return the resolution in the first dimension, or 1 if not defined
size_t get_height() const
return the resolution in the second dimension, or 1 if not defined
the data view gives access to a data array of one, two, three or four dimensions.
Definition data_view.h:153
the cgv namespace
Definition print.h:11