summaryrefslogtreecommitdiff
path: root/src/mbgl/text/quads.hpp
blob: f67266b1ec4fa213d59791a5e83479c34ecb5a45 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once

#include <mbgl/style/image_impl.hpp>
#include <mbgl/style/layers/symbol_layer_properties.hpp>
#include <mbgl/style/types.hpp>
#include <mbgl/text/glyph_atlas.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>

#include <vector>

namespace mbgl {

class Anchor;
class PositionedIcon;

class SymbolQuad {
public:
    SymbolQuad(Point<float> tl_,
               Point<float> tr_,
               Point<float> bl_,
               Point<float> br_,
               Rect<uint16_t> tex_,
               WritingModeType writingMode_,
               Point<float> glyphOffset_,
               size_t sectionIndex_ = 0)
        : tl(tl_),
          tr(tr_),
          bl(bl_),
          br(br_),
          tex(tex_),
          writingMode(writingMode_),
          glyphOffset(glyphOffset_),
          sectionIndex(sectionIndex_) {}

    Point<float> tl;
    Point<float> tr;
    Point<float> bl;
    Point<float> br;
    Rect<uint16_t> tex;
    WritingModeType writingMode;
    Point<float> glyphOffset;
    size_t sectionIndex;
};

using SymbolQuads = std::vector<SymbolQuad>;

SymbolQuad getIconQuad(const PositionedIcon& shapedIcon,
                       WritingModeType writingMode);

SymbolQuads getGlyphQuads(const Shaping& shapedText,
                          const std::array<float, 2> textOffset,
                          const style::SymbolLayoutProperties::Evaluated&,
                          style::SymbolPlacementType placement,
                          const ImageMap& imageMap,
                          bool allowVerticalPlacement);

} // namespace mbgl