1 #pragma once
2 
3 #include <mbgl/util/image.hpp>
4 
5 namespace mbgl {
6 
7 namespace gl {
8 class Context;
9 class Texture;
10 } // namespace gl
11 
12 class OffscreenTexture {
13 public:
14     OffscreenTexture(gl::Context&,
15                      Size size = { 256, 256 },
16                      gl::TextureType type = gl::TextureType::UnsignedByte);
17     OffscreenTexture(gl::Context&,
18                      Size size,
19                      gl::Renderbuffer<gl::RenderbufferType::DepthComponent>&,
20                      gl::TextureType type = gl::TextureType::UnsignedByte);
21     ~OffscreenTexture();
22     OffscreenTexture(OffscreenTexture&&);
23     OffscreenTexture& operator=(OffscreenTexture&&);
24 
25     void bind();
26 
27     PremultipliedImage readStillImage();
28 
29     gl::Texture& getTexture();
30 
31     const Size& getSize() const;
32 
33 private:
34     class Impl;
35     std::unique_ptr<Impl> impl;
36 };
37 
38 } // namespace mbgl
39