From 5dd98df50ba1210b1eef0d8d6655713a725f2995 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 21 Apr 2017 14:52:19 -0700 Subject: [all] Rationalize style::Image A style has a collection of images, just as it has collections of sources and layers. * Name things appropriately * Use std::unique_ptr --- include/mbgl/style/image.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 include/mbgl/style/image.hpp (limited to 'include/mbgl/style') diff --git a/include/mbgl/style/image.hpp b/include/mbgl/style/image.hpp new file mode 100644 index 0000000000..499377467e --- /dev/null +++ b/include/mbgl/style/image.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +namespace mbgl { +namespace style { + +class Image { +public: + Image(PremultipliedImage&&, float pixelRatio, bool sdf = false); + + PremultipliedImage image; + + // Pixel ratio of the sprite image. + const float pixelRatio; + + // Whether this image should be interpreted as a signed distance field icon. + const bool sdf; + + float getWidth() const { return image.size.width / pixelRatio; } + float getHeight() const { return image.size.height / pixelRatio; } +}; + +} // namespace style +} // namespace mbgl -- cgit v1.2.1