summaryrefslogtreecommitdiff
path: root/include/mbgl/platform/default/offscreen_view.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/platform/default/offscreen_view.hpp')
-rw-r--r--include/mbgl/platform/default/offscreen_view.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/mbgl/platform/default/offscreen_view.hpp b/include/mbgl/platform/default/offscreen_view.hpp
new file mode 100644
index 0000000000..034aa3aaf3
--- /dev/null
+++ b/include/mbgl/platform/default/offscreen_view.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <mbgl/map/view.hpp>
+#include <mbgl/gl/framebuffer.hpp>
+#include <mbgl/gl/renderbuffer.hpp>
+#include <mbgl/util/optional.hpp>
+#include <mbgl/util/image.hpp>
+
+namespace mbgl {
+
+namespace gl {
+class Context;
+} // namespace gl
+
+class OffscreenView : public View {
+public:
+ OffscreenView(gl::Context&, std::array<uint16_t, 2> size = {{ 256, 256 }});
+
+ void bind() override;
+
+ PremultipliedImage readStillImage();
+
+ std::array<uint16_t, 2> getSize() const;
+
+private:
+ gl::Context& context;
+ std::array<uint16_t, 2> size;
+ optional<gl::Framebuffer> framebuffer;
+ optional<gl::Renderbuffer<gl::RenderbufferType::RGBA>> color;
+ optional<gl::Renderbuffer<gl::RenderbufferType::DepthStencil>> depthStencil;
+};
+
+} // namespace mbgl