summaryrefslogtreecommitdiff
path: root/src/mbgl/layer/background_layer.hpp
blob: 39142a3bd3d9211d35b15cea6b735e7d0a0c1954 (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
34
35
36
#pragma once

#include <mbgl/style/style_layer.hpp>
#include <mbgl/style/paint_property.hpp>

namespace mbgl {

class BackgroundPaintProperties {
public:
    PaintProperty<float> backgroundOpacity { 1.0f };
    PaintProperty<Color> backgroundColor { {{ 0, 0, 0, 1 }} };
    PaintProperty<std::string, CrossFadedFunctionEvaluator> backgroundPattern { "" };
};

class BackgroundLayer : public StyleLayer {
public:
    BackgroundLayer() : StyleLayer(Type::Background) {}
    std::unique_ptr<StyleLayer> clone() const override;

    void parseLayout(const JSValue&) override {};
    void parsePaints(const JSValue&) override;

    void cascade(const StyleCascadeParameters&) override;
    bool recalculate(const StyleCalculationParameters&) override;

    std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;

    BackgroundPaintProperties paint;
};

template <>
inline bool StyleLayer::is<BackgroundLayer>() const {
    return type == Type::Background;
}

} // namespace mbgl