cgv
image_view.h
1 #pragma once
2 
3 #include "data_view.h"
4 
5 #include "lib_begin.h"
6 
7 namespace cgv {
8  namespace data {
9 
10 class CGV_API image_view
11 {
12 public:
13  data_format df;
14  data_view dv;
15  void* ref_void(int i, int j);
16  const void* get_void(int i, int j) const;
17 public:
18  image_view();
19  int get_width() const { return df.get_width(); }
20  int get_height() const { return df.get_height(); }
21  data_view& ref_data_view() { return dv; }
22  void create(const std::string& fmt_dcr, int w=-1, int h=-1);
23  void clear(double v);
24 
25  /*
26  bool read(const std::string& fn);
27  bool write(const std::string& fn) const;
28  */
29 
30  template <typename T>
31  T& ref(int i, int j) { return *((T*)ref_void(i,j)); }
32  template <typename T>
33  const T& get(int i, int j) const { return *((const T*)get_void(i,j)); }
34  template <typename T>
35  T* ptr(int i, int j) { return (T*)ref_void(i,j); }
36  void copy_rectangle(const image_view& src, int X = 0, int Y = 0, int x = 0, int y = 0, int w = -1, int h = -1);
37  void sub_sample();
38 };
39 
40  }
41 }
42 
43 #include <cgv/config/lib_end.h>
cgv
the cgv namespace
Definition: vr_calib.cxx:9