summaryrefslogtreecommitdiff
path: root/src/mbgl/text/quads.hpp
blob: 760015340eed396111483b50e1580f0386b22240 (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
#pragma once

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

#include <vector>

namespace mbgl {

struct Anchor;
class PositionedIcon;

struct SymbolQuad {
    explicit SymbolQuad(Point<float> tl_, Point<float> tr_, Point<float> bl_, Point<float> br_,
            Rect<uint16_t> tex_, float anchorAngle_, float glyphAngle_, Point<float> anchorPoint_,
            float minScale_, float maxScale_, WritingModeType writingMode_)
        : tl(std::move(tl_)),
        tr(std::move(tr_)),
        bl(std::move(bl_)),
        br(std::move(br_)),
        tex(std::move(tex_)),
        anchorAngle(anchorAngle_),
        glyphAngle(glyphAngle_),
        anchorPoint(std::move(anchorPoint_)),
        minScale(minScale_),
        maxScale(maxScale_),
        writingMode(writingMode_) {}

    Point<float> tl, tr, bl, br;
    Rect<uint16_t> tex;
    float anchorAngle, glyphAngle;
    Point<float> anchorPoint;
    float minScale, maxScale;
    WritingModeType writingMode;
};

typedef std::vector<SymbolQuad> SymbolQuads;

SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon,
        const GeometryCoordinates& line, const style::SymbolLayoutProperties::Evaluated&,
        style::SymbolPlacementType placement, const Shaping& shapedText);

SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText,
        const float boxScale, const GeometryCoordinates& line, const style::SymbolLayoutProperties::Evaluated&,
        style::SymbolPlacementType placement, const GlyphPositions& face);

} // namespace mbgl