summaryrefslogtreecommitdiff
path: root/include/mbgl/annotation/sprite_image.hpp
blob: 7d8ea0501c8bd572997ffae5f88e607e82280a46 (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
#ifndef MBGL_ANNOTATIONS_SPRITE_IMAGE
#define MBGL_ANNOTATIONS_SPRITE_IMAGE

#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/geo.hpp>

#include <string>
#include <memory>
#include <cstdint>

namespace mbgl {

class SpriteImage : private util::noncopyable {
public:
    SpriteImage(
        uint16_t width, uint16_t height, float pixelRatio, std::string&& data, bool sdf = false);

    // Logical dimensions of the sprite image.
    const uint16_t width;
    const uint16_t height;

    // Pixel ratio of the sprite image.
    const float pixelRatio;

    // Physical dimensions of the sprite image.
    const uint16_t pixelWidth;
    const uint16_t pixelHeight;

    // A string of an RGBA8 representation of the sprite. It must have exactly
    // (width * ratio) * (height * ratio) * 4 (RGBA) bytes. The scan lines may
    // not have gaps between them (i.e. stride == 0).
    const std::string data;

    // Whether this image should be interpreted as a signed distance field icon.
    const bool sdf;
};

}

#endif