blob: 52a67a283027683720d9212da8ec6ed094bc09b9 (
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
|
#ifndef MBGL_UTIL_IMAGE_READER_HPP
#define MBGL_UTIL_IMAGE_READER_HPP
#include <mbgl/util/noncopyable.hpp>
// stl
#include <stdexcept>
#include <string>
#include <memory>
namespace mbgl { namespace util {
class ImageReaderException : public std::exception
{
private:
std::string message_;
public:
ImageReaderException(std::string const& message)
: message_(message) {}
~ImageReaderException() throw() {}
virtual const char* what() const throw()
{
return message_.c_str();
}
};
struct ImageReader : private noncopyable
{
virtual unsigned width() const=0;
virtual unsigned height() const=0;
virtual bool hasAlpha() const=0;
virtual bool premultipliedAlpha() const=0;
virtual void read(unsigned x,unsigned y, unsigned width, unsigned height, char* image)=0;
virtual ~ImageReader() {}
};
std::unique_ptr<ImageReader> getImageReader(char const* data, size_t size);
}}
#endif
|