0.8.2 API documentation
image.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "./core/storage_linear.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_linear::extent_type extent_type;
22  typedef storage_linear::data_type data_type;
23 
25  image();
26 
28  explicit image(format_type Format, extent_type const& Extent);
29 
34  explicit image(image const& Image, format_type Format);
35 
37  bool empty() const;
38 
40  format_type format() const;
41 
43  extent_type extent() const;
44 
46  size_type size() const;
47 
50  template <typename genType>
51  size_type size() const;
52 
54  void* data();
55 
57  void const* data() const;
58 
60  template <typename genType>
61  genType* data();
62 
64  template <typename genType>
65  genType const* data() const;
66 
68  void clear();
69 
72  template <typename genType>
73  void clear(genType const& Texel);
74 
78  template <typename genType>
79  genType load(extent_type const& TexelCoord);
80 
84  template <typename genType>
85  void store(extent_type const& TexelCoord, genType const& Data);
86 
87  private:
93  explicit image(
94  std::shared_ptr<storage_linear> Storage,
95  format_type Format,
96  size_type BaseLayer,
97  size_type BaseFace,
98  size_type BaseLevel);
99 
100  std::shared_ptr<storage_linear> Storage;
101  format_type const Format;
102  size_type const BaseLevel;
103  data_type* Data;
104  size_type const Size;
105 
106  data_type* compute_data(size_type BaseLayer, size_type BaseFace, size_type BaseLevel);
107  size_type compute_size(size_type Level) const;
108  };
109 }//namespace gli
110 
111 #include "./core/image.inl"
image()
Create an empty image instance.
format_type format() const
Return the image instance format.
format
Texture data format.
Definition: format.hpp:12
2d texture
Definition: texture2d.hpp:12
Image, representation for a single texture level.
Definition: image.hpp:11
void store(extent_type const &TexelCoord, genType const &Data)
Store the texel located at TexelCoord coordinates.
genType load(extent_type const &TexelCoord)
Load the texel located at TexelCoord coordinates.
3d texture
Definition: texture3d.hpp:12
void clear()
Clear the entire image storage_linear with zeros.
size_type size() const
Return the memory size of an image instance storage_linear in bytes.
1d texture
Definition: texture1d.hpp:12
void * data()
Return a pointer to the beginning of the image instance data.
Namespace where all the classes and functions provided by GLI are exposed.
Definition: clear.hpp:6
extent_type extent() const
Return the dimensions of an image instance: width, height and depth.
bool empty() const
Return whether the image instance is empty, no storage_linear or description have been assigned to th...