blob: c5856ebbc7db145828ea77b9835196c6cd414219 (
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
|
#ifndef MBGL_ANNOTATIONS_SPRITE_PARSER
#define MBGL_ANNOTATIONS_SPRITE_PARSER
#include <mapbox/variant.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/geo.hpp>
#include <string>
#include <memory>
#include <map>
namespace mbgl {
namespace util {
class Image;
} // namespace util
class SpriteImage;
using SpriteImagePtr = std::shared_ptr<const SpriteImage>;
// Extracts an individual image from a spritesheet from the given location.
SpriteImagePtr createSpriteImage(const util::Image& image,
uint16_t srcX,
uint16_t srcY,
uint16_t srcWidth,
uint16_t srcHeight,
double ratio,
bool sdf);
using Sprites = std::map<std::string, SpriteImagePtr>;
using SpriteParseResult = mapbox::util::variant<
Sprites, // success
std::string>; // error
// Parses an image and an associated JSON file and returns the sprite objects.
SpriteParseResult parseSprite(const std::string& image, const std::string& json);
} // namespace mbgl
#endif
|