简体   繁体   English

如何在完整地图的mapbox ios sdk中拍摄快照

[英]how to take snapshot in mapbox ios sdk of full map

/** @name Capturing Snapshots of the Map View */ / ** @name捕获地图视图的快照* /

/** Take a snapshot of the map view. / **拍摄地图视图的快照。 By default, the overlay containing any visible annotations is also captured. 默认情况下,还将捕获包含任何可见注释的叠加层。 @return An image depicting the map view. @return描述地图视图的图像。 */ * /

- (UIImage *)takeSnapshot;

/** Take a snapshot of the map view. / **拍摄地图视图的快照。

@param includeOverlay Whether to include the overlay containing any visible annotations. @param includeOverlay是否包括包含任何可见注释的叠加层。

@return An image depicting the map view. @return描述地图视图的图像。 */ * /

- (UIImage *)takeSnapshotAndIncludeOverlay:(BOOL)includeOverlay;

Actually You can use a method called takeSnapshot in a RMMapView it returns an UIImage so you can use it for whatever you want, here is an example blurring my snapshot 其实你可以使用一个名为takeSnapshot方法返回一个UIImage的 ,所以你可以用它为任何你想要一个RMMapView,这里有一个例子模糊了我的快照

-(UIImage*) performScreenshotAndBlur
{
    UIImage *blurImage = self.mapView.takeSnapshot;
    blurImage = [blurImage applyBlurWithRadius:10 tintColor:[UIColor colorWithRed:0.067 green:0.067 blue:0.067 alpha:0.2] saturationDeltaFactor:1.8 maskImage:nil];
    return blurImage;
}

This depends on which zoom level you are at. 这取决于您所处的缩放级别。 If it is the furthest zoomed out possibly (somewhere from z0-2 , depending on device size), the world will be 256 , 512 , or 1024px on a side. 如果它是可能缩小最远(从某处z0-2 ,这取决于设备的尺寸),全球将有256512 ,或1024px上的一侧。 If it's zoomed in much further, say to street level at z17 , you are talking about 2 ^ 17 * 256 or 33,554,432px on each side of the image. 如果将其进一步放大,以z17处的街道水平z17 ,则您正在谈论的是图像两边的2 ^ 17 * 25633,554,432px This is why maps are drawn tiled and why this functionality isn't built in by default. 这就是为什么将地图绘制为平铺的原因,并且默认情况下未内置此功能的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM