0.8.0 API documentation
image.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "./core/storage.hpp"
7 
8 namespace gli
9 {
11  class image
12  {
13  private:
14  friend class texture1d;
15  friend class texture2d;
16  friend class texture3d;
17 
18  public:
19  typedef size_t size_type;
20  typedef gli::format format_type;
21  typedef storage::extent_type extent_type;
22  typedef storage::data_type data_type;
23 
25  image();
26 
28  explicit image(
29  format_type Format,
30  extent_type const& Extent);
31 
36  explicit image(
37  image const& Image,
38  format_type Format);
39 
41  bool empty() const;
42 
44  format_type format() const;
45 
47  extent_type extent() const;
48 
50  size_type size() const;
51 
54  template <typename genType>
55  size_type size() const;
56 
58  void* data();
59 
61  void const* data() const;
62 
64  template <typename genType>
65  genType* data();
66 
68  template <typename genType>
69  genType const* data() const;
70 
72  void clear();
73 
76  template <typename genType>
77  void clear(genType const& Texel);
78 
82  template <typename genType>
83  genType load(extent_type const& TexelCoord);
84 
88  template <typename genType>
89  void store(extent_type const& TexelCoord, genType const& Data);
90 
91  private:
97  explicit image(
98  std::shared_ptr<storage> Storage,
99  format_type Format,
100  size_type BaseLayer,
101  size_type BaseFace,
102  size_type BaseLevel);
103 
104  std::shared_ptr<storage> Storage;
105  format_type const Format;
106  size_type const BaseLevel;
107  data_type* Data;
108  size_type const Size;
109 
110  data_type* compute_data(size_type BaseLayer, size_type BaseFace, size_type BaseLevel);
111  size_type compute_size(size_type Level) const;
112  };
113 }//namespace gli
114 
115 #include "./core/image.inl"
3d texture
Definition: texture3d.hpp:13
Namespace where all the classes and functions provided by GLI are exposed.
Definition: comparison.hpp:15
1d texture
Definition: texture1d.hpp:13
bool empty() const
Return whether the image instance is empty, no storage or description have been assigned to the insta...
format
Texture data format.
Definition: format.hpp:12
extent_type extent() const
Return the dimensions of an image instance: width, height and depth.
2d texture
Definition: texture2d.hpp:13
Image, representation for a single texture level.
Definition: image.hpp:11
image()
Create an empty image instance.
genType load(extent_type const &TexelCoord)
Load the texel located at TexelCoord coordinates.
format_type format() const
Return the image instance format.
void store(extent_type const &TexelCoord, genType const &Data)
Store the texel located at TexelCoord coordinates.
size_type size() const
Return the memory size of an image instance storage in bytes.
void clear()
Clear the entire image storage with zeros.
void * data()
Return a pointer to the beginning of the image instance data.