#ifndef MBGL_UTIL_IMAGE #define MBGL_UTIL_IMAGE #include #include namespace mbgl { enum ImageAlphaMode { Unassociated, Premultiplied }; template class Image { public: Image() {} Image(size_t w, size_t h) : width(w), height(h), data(std::make_unique(size())) {} size_t stride() const { return width * 4; } size_t size() const { return width * height * 4; } size_t width = 0; size_t height = 0; std::unique_ptr data; }; using UnassociatedImage = Image; using PremultipliedImage = Image; // TODO: don't use std::string for binary data. PremultipliedImage decodeImage(const std::string&); std::string encodePNG(const PremultipliedImage&); } #endif