summaryrefslogtreecommitdiff
path: root/include/mbgl/platform/default/offscreen_view.hpp
blob: 034aa3aaf31edc186afe46e5d4fe190278df6aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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