summaryrefslogtreecommitdiff
path: root/src/mbgl/text/shaping.hpp
blob: b0e6ae3b1dd4f5dd8fb38e3c9ad4acb0c441c722 (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
37
38
39
40
41
42
#pragma once

#include <mbgl/text/glyph.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/util/optional.hpp>

namespace mbgl {

class SpriteAtlasElement;
class SymbolFeature;

class PositionedIcon {
public:
    PositionedIcon() = default;
    PositionedIcon(const SpriteAtlasElement& image_,
                   float top_,
                   float bottom_,
                   float left_,
                   float right_,
                   float angle_)
        : image(image_),
          top(top_),
          bottom(bottom_),
          left(left_),
          right(right_),
          angle(angle_) {}

    optional<SpriteAtlasElement> image;
    float top = 0;
    float bottom = 0;
    float left = 0;
    float right = 0;
    float angle = 0;

    explicit operator bool() const { return image && (*image).pos.hasArea(); }
};

PositionedIcon shapeIcon(const SpriteAtlasElement&,
                         const SymbolFeature&);

} // namespace mbgl