From 1045934d5e62eaf85bc280ce2d75e7558f5a5104 Mon Sep 17 00:00:00 2001 From: Roman Blum Date: Tue, 6 Dec 2016 02:16:13 +0100 Subject: [core, ios, macos] Add image accessor to MGLStyle (#7096) * [core] Add interface to get image from sprite atlas * [tests] Add tests for Map::getImage * [ios, macos] WIP: get MGLImage for name from style * [ios, macos] Fixed -imageForName: Convert from sprite images to platform images using the existing encodePNG() function, which is also used for printing. Allow -imageForName: to return nil without an assertion failure. Added a basic test. --- src/mbgl/map/map.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mbgl/map') diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 68c20a3132..f6ee6a5650 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -896,6 +896,13 @@ void Map::removeImage(const std::string& name) { impl->onUpdate(Update::Repaint); } +const SpriteImage* Map::getImage(const std::string& name) { + if (impl->style) { + return impl->style->spriteAtlas->getSprite(name).get(); + } + return nullptr; +} + #pragma mark - Defaults std::string Map::getStyleName() const { -- cgit v1.2.1