summaryrefslogtreecommitdiff
path: root/include/mbgl/util/image.hpp
blob: f58c2c09897c40946bb8a5880924cd789fae669d (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
#ifndef MBGL_UTIL_IMAGE
#define MBGL_UTIL_IMAGE

#include <string>
#include <memory>

namespace mbgl {
namespace util {

std::string compress_png(int width, int height, const void *rgba);


class Image {
public:
    explicit Image(const std::string &img);

    inline const char *getData() const { return img.get(); }
    inline uint32_t getWidth() const { return width; }
    inline uint32_t getHeight() const { return height; }
    inline operator bool() const { return img && width && height; }

private:
    // loaded image dimensions
    uint32_t width = 0, height = 0;

    // the raw image data
    std::unique_ptr<char[]> img;
};


}
}

#endif