summaryrefslogtreecommitdiff
path: root/src/mbgl/sprite/sprite_parser.hpp
blob: 175ec8a883d1652a465761250a6209fe829840cf (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
#pragma once

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

#include <string>
#include <memory>
#include <unordered_map>

namespace mbgl {

namespace style {
class Image;
} // namespace style

// Extracts an individual image from a spritesheet from the given location.
std::unique_ptr<style::Image> createStyleImage(const PremultipliedImage&,
                                 uint32_t srcX,
                                 uint32_t srcY,
                                 uint32_t srcWidth,
                                 uint32_t srcHeight,
                                 double ratio,
                                 bool sdf);

using Images = std::unordered_map<std::string, std::unique_ptr<style::Image>>;

// Parses an image and an associated JSON file and returns the sprite objects.
Images parseSprite(const std::string& image, const std::string& json);

} // namespace mbgl