summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLStyle.h
diff options
context:
space:
mode:
authorRoman Blum <rmnblm@gmail.com>2016-12-06 02:16:13 +0100
committerMinh Nguyễn <mxn@1ec5.org>2016-12-05 17:16:13 -0800
commit1045934d5e62eaf85bc280ce2d75e7558f5a5104 (patch)
treecf299675768bb6ba1996d3a312823b60737bc109 /platform/darwin/src/MGLStyle.h
parent5579e67804369777819babba5cf6e25eb91ee77e (diff)
downloadqtlocation-mapboxgl-1045934d5e62eaf85bc280ce2d75e7558f5a5104.tar.gz
[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.
Diffstat (limited to 'platform/darwin/src/MGLStyle.h')
-rw-r--r--platform/darwin/src/MGLStyle.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 54ca267bab..3fe8fb9492 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -372,6 +372,23 @@ static const NSInteger MGLStyleDefaultVersion = 9;
#pragma mark Managing a Style’s Images
/**
+ Returns the image associated with the given name in the style.
+
+ @note Names and their associated images are not guaranteed to exist across
+ styles or different versions of the same style. Applications that use this
+ API must first set the style URL to an explicitly versioned style using a
+ convenience method like `+[MGLStyle outdoorsStyleURLWithVersion:]`,
+ `MGLMapView`'s “Style URL” inspectable in Interface Builder, or a manually
+ constructed `NSURL`. This approach also avoids image name changes that will
+ occur in the default style over time.
+
+ @param name The name associated with the image you want to obtain.
+ @return The image associated with the given name, or `nil` if no image is
+ associated with that name.
+ */
+- (nullable MGLImage *)imageForName:(NSString *)name;
+
+/**
Adds or overrides an image used by the style’s layers.
To use an image in a style layer, give it a unique name using this method, then