summaryrefslogtreecommitdiff
path: root/include/mbgl/sprite/sprite_image.hpp
blob: 4c375e58b9d7c47696b0401357ecd9d3b1c8e07b (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
#ifndef MBGL_SPRITE_IMAGE
#define MBGL_SPRITE_IMAGE

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

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

namespace mbgl {

class SpriteImage : private util::noncopyable {
public:
    SpriteImage(PremultipliedImage&&, float pixelRatio, bool sdf = false);

    PremultipliedImage image;

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

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

    float getWidth() const { return image.width / pixelRatio; }
    float getHeight() const { return image.height / pixelRatio; }
};

} // namespace mbgl

#endif